diff --git a/src/views/modules/workSys/demandCate.vue b/src/views/modules/workSys/demandCate.vue
index 62357f83..3859c544 100644
--- a/src/views/modules/workSys/demandCate.vue
+++ b/src/views/modules/workSys/demandCate.vue
@@ -12,12 +12,12 @@
- 新增分类
+ 新增分类
{{ handleFilterSpan(scope.row, item) }}
@@ -40,6 +40,7 @@
{{(scope.row.usableFlag&&'禁用') || '启用'}}
添加二级分类
+
-
+
-
+
+
@@ -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,33 +231,87 @@ 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() {
+ 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) => {
if (valid) {
this.btnLoading = true
- const _form = {
- ...this.form,
- warn: (this.form.warn && 1) || 0
- }
- 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
+ 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
}
})
diff --git a/src/views/modules/workSys/resiCate.vue b/src/views/modules/workSys/resiCate.vue
index 9c83dea4..4eb670df 100644
--- a/src/views/modules/workSys/resiCate.vue
+++ b/src/views/modules/workSys/resiCate.vue
@@ -1,8 +1,7 @@
-
+
@@ -509,11 +506,7 @@ export default {