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. 135
      src/views/modules/workSys/demandCate.vue
  2. 11
      src/views/modules/workSys/resiCate.vue

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

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

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

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

Loading…
Cancel
Save