From 2df0157f3b9989adc51c19dcf05fb6853cb5550d Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Fri, 17 Jun 2022 17:39:07 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/workSys/pointAditive/rule.vue | 476 ++++++++++++++++++ 1 file changed, 476 insertions(+) create mode 100644 src/views/modules/workSys/pointAditive/rule.vue diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue new file mode 100644 index 00000000..54ce3db6 --- /dev/null +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -0,0 +1,476 @@ + + + + + + + From 5cbe4bc88fad5ec73994a19936b4f14d2bb51123 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Mon, 20 Jun 2022 09:19:24 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/workSys/pointAditive/rule.vue | 207 +++++++++--------- 1 file changed, 105 insertions(+), 102 deletions(-) diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue index 54ce3db6..5cbc4c83 100644 --- a/src/views/modules/workSys/pointAditive/rule.vue +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -20,9 +20,6 @@ :prop="item.columnName" :label="item.label" :align="item.align"> - 添加二级分类 + class="btn-color-1j">添加二级分类 添加积分规则 - 添加积分规则 + 修改 - 修改 + 删除 + class="btn-color-del">删除 @@ -67,7 +67,7 @@ placeholder="请选择" size="small" style="width: 180px;" - :disabled="addLevel == '2' || addLevel == '3' ? true : false" + :disabled="addLevel == '2' || addLevel == '3' || addLevel == '4' ? true : false" clearable> - - - (减分请输入负数) - + prop="applyFlag" + label-width="200px"> 允许申请 不允许申请 @@ -124,23 +125,12 @@ export default { return { tableLoading: false, btnLoading: false, - disabled: false, pageLoading: false, dialogVisible: false, tableData: [], sHeight: 0, addLevel: '1', addType: 'add', - value: '', - options: [ - { - label: '是', - value: 1 - }, { - label: '否', - value: 2 - } - ], tableHeader: [ { label: '积分类别', @@ -152,12 +142,13 @@ export default { align: 'center' } ], - customerId: '', - form: { + typeList: [], //类别 + form: { // 新增修改相关 categoryName: '', // 类别名称 pid: '', // 上级类别ID + newPid: '', // 添加积分规则用到的pid ruleName: '', // 积分规则名称 - pointValue: '', + pointValue: '', // 加减积分 applyFlag: '0' // 允许申请0,不允许申请1 }, rules: { @@ -166,14 +157,7 @@ export default { ruleName: [{ required: true, message: '规则名称不能为空', trigger: 'blur' }], pointValue: [{ required: true, message: '加减分值不能为空', trigger: 'blur' }], applyFlag: [{ required: true, message: '请选择积分申请', trigger: 'blur' }] - }, - typeList: [{ - value: '03dedaa5dbb822550e7b25e75aa9fdde', - label: '德育积分' - },{ - value: '7a487c4c23243cbf23afb4bc8c35a3d8', - label: '党建积分' - }],//类别 + } } }, computed: { @@ -186,27 +170,16 @@ export default { ...mapGetters(['clientHeight', 'iframeHeight']) }, async created () { - this.customerId = localStorage.getItem('customerId') this.getTableData() this.pageLoading = true }, mounted () { this.$nextTick(() => { - this.sHeight = 250 - console.log('tableHeight', this.tableHeight) + this.sHeight = 210 }) }, methods: { - - handleFilterSpan (row, item) { - let _val = '' - if (item.options && item.options.length > 0) { - item.options.forEach((n) => { - if (n.value === row[item.columnName]) _val = n.label - }) - } - return _val || row[item.columnName] - }, + // 列表添加相关 handleAdd (type, addType, id, pid, categoryName) { this.addLevel = type this.addType = addType @@ -216,6 +189,7 @@ export default { if (type == '3') { this.form.pid = pid + this.form.newPid = id this.form.categoryName = categoryName } this.dialogVisible = true @@ -223,14 +197,27 @@ export default { handlerCancle () { this.dialogVisible = false }, - async handleEdit (row, addType) { - - this.form = { ...row } - this.addLevel = row.level + // 列表修改点击事件 + async handleEdit (row, addType, level) { + let url = '' + if (level === '4') { + url = `/point/additiverule/categorydetail/${row.id}` + } else if(level === '5') { + url = `/point/additiverule/ruledetail/${row.id}` + } + this.addLevel = level this.addType = addType this.dialogVisible = true + await this.$http.post(url).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + this.form = { ...res.data } + } + }) }, - async addLevelFirst () { // 从添加 按钮点击进来的 + // 添加积分类别 + async addLevelFirst () { const _form = { pid: this.form.pid, // 上级类别ID categoryName: this.form.categoryName // 类别名称 @@ -254,7 +241,7 @@ export default { async addLevelChild () { const _form = { ruleName: this.form.ruleName, - pid: this.form.pid, + pid: this.form.newPid, pointValue: this.form.pointValue, applyFlag: this.form.applyFlag } @@ -273,28 +260,7 @@ export default { }) this.btnLoading = false }, - async editCate () { - const _form = { - customerId: localStorage.getItem('customerId'), - categoryName: this.form.categoryName, - level: this.form.level, - pointValue: this.form.pointValue - } - 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) { @@ -309,30 +275,55 @@ export default { return false; } }); - }, - handleDel (row) { - let params = { - formCode: 'resi_base_info', - icResiUserId: row.icResiUserId + // 修改提交 ---------------这里还没做 + async editCate () { + const _form = { + categoryName: this.form.categoryName, + level: this.form.level, + pointValue: this.form.pointValue } - console.log('row1', row) - this.$http - .post('/epmetuser/icresiuser/delete', params) + await this.$http + .post('/heart/icresidemanddict/update', _form) .then(({ data: res }) => { - console.log('row2', row) if (res.code !== 0) { return this.$message.error(res.msg) } else { - console.log('row3', row) - this.$message.success('删除成功') + this.dialogVisible = false this.getTableData() } }) - .catch((err) => { - console.log('row4', err) + .catch(() => { return this.$message.error('网络错误') }) + this.btnLoading = false + }, + // 删除 + handleDel (row) { + this.$confirm("确认删除?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + let params = [row.id] + console.log('row1', row) + this.$http.post('/point/additiverule/delete', params) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('row3', row) + this.$message.success('删除成功') + this.getTableData() + } + }) + .catch((err) => { + console.log('row4', err) + return this.$message.error('网络错误') + }) + }).catch(err => { + console.log(err) + }); }, // 查询积分类别规则列表 async getTableData () { @@ -343,13 +334,19 @@ export default { return this.$message.error(res.msg) } else { let list = [] - res.data.forEach(element => { - if (element.pid === '0') { // 一级组织 - element.children = [] - list.push(element) - } - }); - if (list.length > 0) { + if (res.data.length > 0) { + res.data.forEach(element => { // 一级循环 + if (element.pid === '0') { + element.children = [] + list.push(element) + this.typeList.push({ //类别 + value: element.id, + label: element.categoryName + }) + } + }); + } + if (list.length > 0) { // 二级循环 res.data.forEach(element => { if (element.pid) { list.forEach((item, index) => { @@ -361,8 +358,7 @@ export default { } }); } - - if (list.length > 0) { + if (list.length > 0) { // 三级循环 res.data.forEach(element => { if (element.pid) { list.forEach((item, index) => { @@ -392,7 +388,6 @@ export default { }) this.tableLoading = false } - } } @@ -422,6 +417,14 @@ export default { margin-left: 10px; color: rgba(213, 16, 16, 1); } + ::v-deep .btn-color-2j { + margin-left: 10px; + color: #fdaf30; + } + ::v-deep .btn-color-1j { + margin-left: 10px; + color: #3cb357; + } ::v-deep .btn-color-edit { color: rgba(0, 167, 169, 1); } From 18d5953312180c063b779e61be44511fcf920d76 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Mon, 20 Jun 2022 10:35:45 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/workSys/pointAditive/rule.vue | 52 +++++++++++++++---- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue index 5cbc4c83..68401b72 100644 --- a/src/views/modules/workSys/pointAditive/rule.vue +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -50,7 +50,7 @@ - + label-width="140px"> 允许申请 不允许申请 @@ -151,6 +150,8 @@ export default { pointValue: '', // 加减积分 applyFlag: '0' // 允许申请0,不允许申请1 }, + ruleform:{}, // 积分规则查询相关数据,由于只是修改名称/分值/是否申请 所以之前的数据不做改变只做展示用 全部放在form里面 + typeform: {}, // 积分二级分类 rules: { pid: [{ required: true, message: '请选择分类', trigger: 'blur' }], categoryName: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }], @@ -199,11 +200,22 @@ export default { }, // 列表修改点击事件 async handleEdit (row, addType, level) { + console.log(addType, level) let url = '' if (level === '4') { url = `/point/additiverule/categorydetail/${row.id}` } else if(level === '5') { url = `/point/additiverule/ruledetail/${row.id}` + + await this.$http.post(`/point/additiverule/categorydetail/${row.pid}`).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + this.form.pid = res.data.pid // 分类 + this.form.categoryName = res.data.categoryName // 类别名称 + this.form.newPid = res.data.id // 类别 id + } + }) } this.addLevel = level this.addType = addType @@ -212,7 +224,18 @@ export default { if (res.code !== 0) { return this.$message.error(res.msg) } else { - this.form = { ...res.data } + if (this.addLevel === '4' ) { + this.form.pid = res.data.pid // 分类 + this.form.categoryName = res.data.categoryName // 类别名称 + this.form.newPid = res.data.id // 类别 id + this.typeform = { ...res.data } + } else { + this.form.applyFlag = res.data.applyFlag // 积分规则 只有这三块内容可以修改 + this.form.ruleName = res.data.ruleName + this.form.pointValue = res.data.pointValue + this.ruleform = { ...res.data } + } + } }) }, @@ -276,21 +299,27 @@ export default { } }); }, - // 修改提交 ---------------这里还没做 + // 修改提交 async editCate () { - const _form = { - categoryName: this.form.categoryName, - level: this.form.level, - pointValue: this.form.pointValue + if (this.addLevel === '4' ) { // 分类修改 + this.typeform.categoryName = this.form.categoryName + this.typeform.type = 'category' + } else { + this.ruleform.categoryName = this.form.categoryName + this.ruleform.pointValue = this.form.pointValue + this.ruleform.applyFlag = this.form.applyFlag + this.ruleform.type = 'rule' } + console.log(JSON.stringify(this.ruleform)) await this.$http - .post('/heart/icresidemanddict/update', _form) + .post('/point/additiverule/modify', this.addLevel==='4' ? this.typeform : this.ruleform) .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } else { this.dialogVisible = false this.getTableData() + this.$message.success('保存成功') } }) .catch(() => { @@ -327,6 +356,7 @@ export default { }, // 查询积分类别规则列表 async getTableData () { + this.tableData = [] this.tableLoading = true let params = {} await this.$http.post('/point/additiverule/list4tree', params).then(({ data: res }) => { From 980e3f37e0dfa547365b17ce0dde65be1f3b57b1 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Mon, 20 Jun 2022 10:40:46 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/workSys/pointAditive/rule.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue index 68401b72..048e9b8d 100644 --- a/src/views/modules/workSys/pointAditive/rule.vue +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -305,7 +305,7 @@ export default { this.typeform.categoryName = this.form.categoryName this.typeform.type = 'category' } else { - this.ruleform.categoryName = this.form.categoryName + this.ruleform.ruleName = this.form.ruleName this.ruleform.pointValue = this.form.pointValue this.ruleform.applyFlag = this.form.applyFlag this.ruleform.type = 'rule' From bf82b11c1fd6986251695710f3069cf28349cdd2 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Mon, 20 Jun 2022 10:50:02 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/workSys/pointAditive/rule.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue index 048e9b8d..a2fb29ee 100644 --- a/src/views/modules/workSys/pointAditive/rule.vue +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -11,10 +11,10 @@ + class="resi-table" + border> Date: Tue, 21 Jun 2022 16:37:20 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=BC=93=E5=AD=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/workSys/pointAditive/rule.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/modules/workSys/pointAditive/rule.vue b/src/views/modules/workSys/pointAditive/rule.vue index a2fb29ee..846438c9 100644 --- a/src/views/modules/workSys/pointAditive/rule.vue +++ b/src/views/modules/workSys/pointAditive/rule.vue @@ -60,7 +60,7 @@ :model="form" :rules="rules" ref="ruleForm"> - { return this.$message.error('网络错误') }) + this.form.ruleName = '' + this.form.pointValue = '' this.btnLoading = false }, // 提交按钮