Browse Source

服务

feature
tianq 3 years ago
parent
commit
d4cbc685da
  1. 200
      src/views/modules/workSys/serviceMatters.vue
  2. 195
      src/views/modules/workSys/serviceMattersComponents/addForm.vue

200
src/views/modules/workSys/serviceMatters.vue

@ -1,8 +1,204 @@
<template>
<div class="g-main">
<div v-show="pageType == 'list'">
<div class="m-table">
<div class="div_btn"><el-button size="small" type="primary " @click="handleAdd({}, 'add')">新增</el-button></div>
<el-table :data="tableData" border class="m-table-item" style="width: 100%" :height="maxTableHeight">
<!-- <el-table-column label="" fixed="left" type="selection" align="center" width="50" /> -->
<el-table-column label="序号" fixed="left" type="index" align="center" width="50" />
<el-table-column prop="categoryName" align="center" label="分类名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="awardPoint" align="center" label="积分" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="usableFlag" label="状态" min-width="140" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.usableFlag == '0'">禁用</span>
<span v-if="scope.row.usableFlag == '1'">启用</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="130">
<template slot-scope="scope">
<el-button @click="handleHid(scope.row)" type="text" size="small" v-if="scope.row.usableFlag == '1'" class="">禁用</el-button>
<el-button @click="handleHid(scope.row)" type="text" size="small" v-if="scope.row.usableFlag == '0'" class="">启用</el-button>
<el-button style="margin-right: 10px" @click="handleAdd(scope.row, 'edit')" size="small" type="text">修改</el-button>
<el-button style="margin-right: 10px" @click="handleDel(scope.row)" size="small" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
<div>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
:page-sizes="[20, 50, 100, 200]"
:page-size="parseInt(pageSize)"
layout="sizes, prev, pager, next, total"
:total="total"
></el-pagination>
</div>
</div>
</div>
<addForm :detailId="detailId" :pageType="pageType" v-if="dialogVisible" :dialogVisible="dialogVisible" @handleClose="handleClose" />
</div>
</template>
<script>
import { requestPost } from '@/js/dai/request';
import nextTick from 'dai-js/tools/nextTick';
import { mapGetters } from 'vuex';
import addForm from './residentCategoryComponents/addForm.vue';
import axios from 'axios';
export default {
data() {
return {
dialogVisible: false,
warnFlagList: [{ value: '0', label: '否' }, { value: '1', label: '是' }],
intelligentFlagList: [{ value: '0', label: '不开启' }, { value: '1', label: '开启' }],
disabled: false,
user: '',
agencyId: '',
formData: {},
customerId: '',
pageType: 'list', // list add dispose info
gridList: [], //list--
placeTypeList: [], //
tableData: [],
pageNo: 1,
pageSize: window.localStorage.getItem('pageSize') || 20,
total: 1,
detailId: '',
detailData: {},
multipleSelection: [],
rowObj: {},
importLoading: false
};
},
components: { addForm },
created() {},
computed: {
maxTableHeight() {
return this.$store.state.inIframe ? this.clientHeight - 410 + this.iframeHeigh : this.clientHeight - 410;
},
...mapGetters(['clientHeight', 'iframeHeight'])
},
watch: {},
mounted() {
this.user = this.$store.state.user;
this.agencyId = this.user.agencyId;
this.customerId = this.user.customerId;
console.log('this.customerId ', this.customerId);
this.getTableData();
},
methods: {
async handleDel(rowData) {
let message = '确认删除?';
this.$confirm(message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.del(rowData.categoryId);
})
.catch(err => {});
},
async del(id) {
const url = `/actual/base/serviceitem/delete/${id}`;
const { data, code, msg } = await requestPost(url);
if (code === 0) {
this.$message.success('删除成功!');
this.getTableData();
} else {
this.$message.error('操作失败!');
}
},
handleAdd(row, type) {
if (row.categoryId) {
this.detailId = row.categoryId;
}
this.pageType=type;
this.dialogVisible = true;
},
async handleHid(row) {
let usableFlag = '';
if (row.usableFlag == '1') {
usableFlag = false;
} else {
usableFlag = true;
}
const url = '/actual/base/serviceitem/updatestatus';
const param = {
categoryId: row.categoryId,
usableFlag: usableFlag
};
// const url = 'http://yapi.elinkservice.cn/mock/330/actual/base/enterprise/list';
const { pageSize, pageNo, formData } = this;
const { data, code, msg } = await requestPost(url, param);
if (code === 0) {
this.$message.success('操作成功');
this.getTableData();
} else {
this.$message.error(msg);
}
},
handleSearch(val) {
console.log(this.formData);
this.pageNo = 1;
this.getTableData();
},
handleClose() {
this.dialogVisible = false;
this.detailId = '';
this.getTableData();
},
async getTableData() {
const url = '/actual/base/serviceitem/list';
// const url = 'http://yapi.elinkservice.cn/mock/330/actual/base/enterprise/list';
const { pageSize, pageNo, customerId } = this;
const { data, code, msg } = await requestPost(url, {
pageSize,
pageNo,
customerId
});
if (code === 0) {
this.total = data.total || 0;
this.tableData = data.list
? data.list.map(item => {
return item;
})
: [];
} else {
this.$message.error(msg);
}
},
handleSizeChange(val) {
this.pageSize = val;
window.localStorage.setItem('pageSize', val);
this.getTableData();
},
handleCurrentChange(val) {
this.pageNo = val;
this.getTableData();
},
resetSearch() {
this.formData = {
customerId
};
this.pageNo = 1;
this.getTableData();
}
}
};
</script>
<style>
</style>
<style lang="scss" scoped>
@import '@/assets/scss/modules/management/list-main.scss';
.m-search {
.u-item-width-normal {
width: 200px;
}
}
</style>

195
src/views/modules/workSys/serviceMattersComponents/addForm.vue

@ -0,0 +1,195 @@
<template>
<el-dialog title="提示" :visible.sync="dialogVisible" width="800px" :before-close="handleCancle">
<div>
<el-form :model="formData" ref="form" :rules="dataRule" :label-width="'120px'">
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="formData.categoryName" disabled class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="奖励积分" prop="yellowThreshold">
<el-input-number v-model="formData.yellowThreshold" class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input-number>
</el-form-item>
<el-form-item label="对应个性需求" prop="maritalStatus" v-if="index == 0">
<el-select class="u-item-width-normal" v-model="formData.maritalStatus" placeholder="全部" size="small" clearable>
<el-option v-for="item in marryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="对应公共服务" prop="maritalStatus" v-if="index == 0">
<el-select class="u-item-width-normal" v-model="formData.maritalStatus" placeholder="全部" size="small" clearable>
<el-option v-for="item in marryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleCancle"> </el-button>
<el-button type="primary" @click="handleComfirm"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { isMobile } from '@/utils/validate';
import { mapGetters } from 'vuex';
import { Loading } from 'element-ui'; // Loading
import { requestPost, requestGet } from '@/js/dai/request';
import daiMap from '@/utils/dai-map';
import nextTick from 'dai-js/tools/nextTick';
let loading; //
let map;
var search;
var markers;
var infoWindowList;
var geocoder; //
export default {
props: {
detailId: {
type: String,
default: ''
},
dialogVisible: {
type: Boolean,
default: ''
},
pageType: {
type: String,
default: ''
}
},
data() {
return {
index: -1, //arr
arr: ['育龄妇女', '老年人', '空巢老人', '独居老人', '租户', '残疾', '大病', '慢病'],
btnDisable: false,
user: '',
agencyId: '',
marryList: [{ value: '-1', label: '不限制' }, { value: '0', label: '未婚' }, { value: '1', label: '已婚' }],
list: {},
formData: {
equipmentName: '',
scaleTotal: '',
gridId: '',
equipmentCategoryCode: '',
placeType: '',
principalName: '',
location: '',
contactNum: '',
// result: '',
remark: ''
},
dataRule: {
// name: [{ required: true, message: '', trigger: 'bulr' }],
// category: [{ required: true, message: '', trigger: 'bulr' }],
// location: [{ required: true, message: '', trigger: 'blur' }]
// content: [{ required: true, message: '', trigger: 'bulr' }, { max: 1000, message: '1000', trigger: 'blur' }]
}
};
},
watch: {},
created() {},
async mounted() {
this.user = this.$store.state.user;
this.agencyId = this.user.agencyId;
this.startLoading();
this.getDetail();
await this.endLoading();
this.endLoading();
},
methods: {
async getDetail() {
const url = `/actual/base/residentCategoryConfig/detail/${this.detailId}`;
const { data, code, msg } = await requestPost(url);
if (code === 0) {
console.log('详情数据', data);
this.formData = { ...data };
this.index = this.arr.indexOf(this.formData.categoryName);
} else {
this.$message.error(msg);
}
},
handleComfirm() {
this.save();
},
async save() {
console.log('this.formData', this.formData);
const url = '/actual/base/serviceitem/saveorupdate';
var params = {};
params = { ...this.formData };
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$message.success('操作成功');
this.handleCancle();
} else if (code >= 8000) {
this.$message.error(msg);
}
},
handleCancle() {
this.resetData();
this.$emit('handleClose');
},
resetData() {
this.$refs.form.resetFields();
},
//
startLoading() {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
});
},
//
endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
}
} // init
}
};
</script>
<style lang="scss" scoped>
@import '@/assets/scss/modules/management/form-main.scss';
@import '@/assets/scss/modules/visual/a_customize.scss';
/deep/ .el-input.is-disabled .el-input__inner,
/deep/ .el-textarea.is-disabled textarea.el-textarea__inner {
// border:none;background-color: transparent;
}
.div_map {
width: 100%;
}
.form-item::v-deep .el-form-item__label {
color: #fff;
}
.form-item {
.el-radio {
color: #fff;
}
.el-checkbox {
color: #fff;
}
}
.verifyRed::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
.form_label_box {
width: 150px;
display: inline-block;
text-align: right;
padding-right: 12px;
}
</style>
Loading…
Cancel
Save