Browse Source

Merge branch 'dev-jichu' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev-jichu

shibei_master
jiangyy 4 years ago
parent
commit
d986e5f2c4
  1. 159
      src/views/modules/workSys/demandCate.vue
  2. 11
      src/views/modules/workSys/resiCate.vue

159
src/views/modules/workSys/demandCate.vue

@ -12,12 +12,12 @@
</el-form> </el-form>
</div> </div>
<div class="resi-row-btn"> <div class="resi-row-btn">
<el-button type="success" @click="handleSearch">新增分类</el-button> <el-button type="success" @click="handleAdd('1', 'add')">新增分类</el-button>
</div> </div>
<el-table <el-table
:data="tableData" :data="tableData"
row-key="id" row-key="categoryId"
v-loading="tableLoading" v-loading="tableLoading"
border border
max-height="800" max-height="800"
@ -31,7 +31,7 @@
:key="item.columnName" :key="item.columnName"
:prop="item.columnName" :prop="item.columnName"
:label="item.label" :label="item.label"
align="center" :align="item.align"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ handleFilterSpan(scope.row, item) }}</span> <span>{{ handleFilterSpan(scope.row, item) }}</span>
@ -40,6 +40,7 @@
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if="scope.row.hasBtn"
@click="handleLook(scope.row)" @click="handleLook(scope.row)"
type="text" type="text"
size="small" size="small"
@ -47,7 +48,15 @@
>{{(scope.row.usableFlag&&'禁用') || '启用'}}</el-button >{{(scope.row.usableFlag&&'禁用') || '启用'}}</el-button
> >
<el-button <el-button
@click="handleEdit(scope.row)" v-if="scope.row.level == 1"
@click="handleAdd('2', 'add', scope.row)"
type="text"
size="small"
class="btn-color-del"
>添加二级分类</el-button
>
<el-button
@click="handleEdit(scope.row, 'edit')"
type="text" type="text"
size="small" size="small"
class="btn-color-edit" class="btn-color-edit"
@ -80,13 +89,13 @@
> >
<el-form label-width="100px" :model="form" :rules="rules" ref="ruleForm"> <el-form label-width="100px" :model="form" :rules="rules" ref="ruleForm">
<el-form-item label="分类名称" prop="categoryName"> <el-form-item label="分类名称" prop="categoryName">
<el-input v-model="form.categoryName" size="small" style="width: 180px;" disabled></el-input> <el-input v-model="form.categoryName" size="small" style="width: 180px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态"> <!-- <el-form-item label="状态">
<el-switch v-model="form.usableFlag"></el-switch> <el-switch v-model="form.usableFlag"></el-switch>
</el-form-item> </el-form-item> -->
<el-form-item label="奖励积分"> <el-form-item v-if="addLevel == '2'" label="奖励积分">
<el-input-number v-model="form.awardPoint" :min="0" size="small" label="描述文字"></el-input-number> <el-input-number v-model="form.awardPoint" :min="0" size="small" label="描述文字"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -121,6 +130,8 @@ export default {
total: null, total: null,
conditions: [], conditions: [],
tableData: [], tableData: [],
addLevel: '1',
addType: 'add',
value: '', value: '',
options: [ options: [
{ {
@ -134,10 +145,12 @@ export default {
tableHeader: [ tableHeader: [
{ {
label: '分类名称', label: '分类名称',
align: 'left',
columnName: 'categoryName' columnName: 'categoryName'
}, { }, {
label: '状态', label: '状态',
columnName: 'usableFlag', columnName: 'usableFlag',
align: 'center',
options: [{ options: [{
value: true, value: true,
label: '启用' label: '启用'
@ -191,21 +204,22 @@ export default {
this.conditions = val this.conditions = val
this.getTableData() this.getTableData()
}, },
handleAdd(type, addType, row) {
this.addLevel = type
this.addType = addType
if (type == '2') this.form = { ...row, categoryName: '' }
this.dialogVisible = true
},
handlerCancle() { handlerCancle() {
this.dialogVisible = false this.dialogVisible = false
}, },
async handleLook(row) { async handleLook(row) {
const _show = {
show: 'hidden',
hidden: 'show'
}
const params = { const params = {
id: row.id, categoryId: row.categoryId,
status: _show[row.status] usableFlag: !row.usableFlag
} }
this.$http this.$http
.post('/oper/customize/resicategorystatsconfig/updatestatus', params) .post('/heart/icresidemanddict/updatestatus', params)
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
@ -217,33 +231,87 @@ export default {
return this.$message.error('网络错误') return this.$message.error('网络错误')
}) })
}, },
async handleEdit(row) { async handleEdit(row, addType) {
this.form = { ...row } this.form = { ...row }
this.addLevel = row.level
this.addType = addType
this.dialogVisible = true this.dialogVisible = true
}, },
async handleSUbmit() { async addLevelFirst() {
const _form = {
customerId: localStorage.getItem('customerId'),
categoryName: this.form.categoryName
}
await this.$http
.post('/heart/icresidemanddict/addfirst', _form)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.dialogVisible = false
this.getTableData()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
},
async addLevelChild () {
const _form = {
customerId: localStorage.getItem('customerId'),
categoryName: this.form.categoryName,
parentCategoryCode: this.form.categoryCode,
awardPoint: this.form.awardPoint
}
await this.$http
.post('/heart/icresidemanddict/addchild', _form)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.dialogVisible = false
this.getTableData()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
},
async editCate() {
const _form = {
customerId: localStorage.getItem('customerId'),
categoryName: this.form.categoryName,
categoryId: this.form.categoryId,
level: this.form.level,
awardPoint: this.form.awardPoint
}
await this.$http
.post('/heart/icresidemanddict/update', _form)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.dialogVisible = false
this.getTableData()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
},
handleSUbmit() {
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true
const _form = { if (this.addType == 'add') {
...this.form, if (this.addLevel == '1') this.addLevelFirst()
warn: (this.form.warn && 1) || 0 else this.addLevelChild()
} } else this.editCate()
await this.$http
.post('/oper/customize/resicategorystatsconfig/update', _form)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
this.dialogVisible = false
this.getTableData()
}
})
.catch(() => {
return this.$message.error('网络错误')
})
this.btnLoading = false
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
return false; return false;
@ -299,16 +367,29 @@ export default {
this.tableLoading = true this.tableLoading = true
let params = { let params = {
// formCode: 'resi_base_info', // formCode: 'resi_base_info',
customerId: localStorage.getItem('customerId'),
pageNo: this.currentPage, pageNo: this.currentPage,
pageSize: this.pageSize pageSize: this.pageSize,
firstCategoryCode: ''
} }
await this.$http await this.$http
.post('/epmetuser/icresidemanddict/pagelist', params) .post('/heart/icresidemanddict/pagelist', params)
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} else { } else {
this.tableData = res.data.list this.tableData = res.data.list.map(item => {
return {
...item,
hasBtn: true,
children: item.children.map(n => {
return {
...n,
hasBtn: item.usableFlag
}
})
}
})
this.total = res.data.total this.total = res.data.total
} }
}) })

11
src/views/modules/workSys/resiCate.vue

@ -1,8 +1,7 @@
<template> <template>
<div v-if="pageLoading" class="resi-container"> <div v-if="pageLoading" class="resi-container">
<el-card class="resi-card-table"> <el-card class="resi-card-table">
<!-- <div class="resi-row-btn"> <div class="resi-row-btn">
<div class="btn-label">是否预警</div>
<el-select <el-select
v-model="value" v-model="value"
placeholder="请选择" placeholder="请选择"
@ -17,7 +16,6 @@
> >
</el-option> </el-option>
</el-select> </el-select>
<div class="btn-label">预警类型</div>
<el-select <el-select
v-model="value" v-model="value"
placeholder="请选择" placeholder="请选择"
@ -33,13 +31,12 @@
</el-option> </el-option>
</el-select> </el-select>
<el-button type="primary" size="mini" @click="handleSearch">查询</el-button> <el-button type="primary" size="mini" @click="handleSearch">查询</el-button>
</div> --> </div>
<el-table <el-table
:data="tableData" :data="tableData"
row-key="id" row-key="id"
v-loading="tableLoading" v-loading="tableLoading"
border border
max-height="800"
style="width: 100%" style="width: 100%"
class="resi-table" class="resi-table"
> >
@ -509,11 +506,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.resi-row-btn { .resi-row-btn {
display: flex; display: flex;
align-items: center;
margin-bottom: 13px; margin-bottom: 13px;
.btn-label {
margin-right: 10px;
}
::v-deep .el-button { ::v-deep .el-button {
// margin-left: 10px; // margin-left: 10px;
border: 0; border: 0;

Loading…
Cancel
Save