|
@ -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 |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|