From f9319ef4fbebfb24b5004ef45b690cf808120281 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 29 Dec 2023 10:36:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 11 + src/layouts/navbar/index.vue | 39 ++-- src/pages/activity/add/index.vue | 171 +++++++++++++++- src/pages/activity/list/index.vue | 14 +- src/pages/preschool/list/index.vue | 14 +- src/pages/supplier/list/index.vue | 14 +- .../supplierClassification/list/index.vue | 192 ++++++++++++++++++ src/pages/user/list/index.vue | 12 +- src/router/modules/supplier.js | 16 +- src/router/modules/supplierClassification.js | 23 +++ 10 files changed, 456 insertions(+), 50 deletions(-) create mode 100644 src/pages/supplierClassification/list/index.vue create mode 100644 src/router/modules/supplierClassification.js diff --git a/src/api/index.js b/src/api/index.js index 9dee423..1ecaf32 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -43,4 +43,15 @@ export default { transferAdmin: `nakadai/nakadai/partnerAccount/transferAdmin`, savePartnerAccount: `nakadai/nakadai/partnerAccount/savePartnerAccount`, platformTeamAccountList: `nakadai/kindergarten/platformTeamAccount/platformTeamAccountList`, + + delSupplierClass: `nakadai/supplierClassification/batchDeletion`, + findSupplierClass: `nakadai/supplierClassification/findById`, + saveSupplierClass: `nakadai/supplierClassification/save`, + treeStructureList: `nakadai/supplierClassification/treeStructureList`, + updateSupplierClass: `nakadai/supplierClassification/update`, + + delComClass: `competition/competitionClassification/batchDeletion`, + listComClass: `competition/competitionClassification/categoryList`, + saveComClass: `competition/competitionClassification/save`, + updateComClass: `competition/competitionClassification/update`, } \ No newline at end of file diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index 576a11a..ae8440a 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -24,9 +24,19 @@ alt=""> {{ item.title }} - {{ subItem.title }} + @@ -227,8 +294,11 @@ export default { competitionRangeList: [], competitionRegistration: {}, createSource: 0, - quantityLimit: '' + quantityLimit: '', + classificationId: '' }, + classifications: [], + classVisible: false, competitionScope: [], scopes: [ { @@ -260,6 +330,17 @@ export default { Editor, Upload }, + computed: { + classificationId: { + get () { + const data = this.classifications.find(item => item.id == this.form.classificationId) + return data ? data.id : '' + }, + set (newVal) { + this.form.classificationId = newVal + } + }, + }, watch: { // 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 form: { @@ -320,6 +401,7 @@ export default { name: this.id ? this.name : '创建活动' }, ]) + this.getClassification() this.getData() }, methods: { @@ -353,6 +435,73 @@ export default { }) }).catch(err => { }) }, + // 获取活动分类 + async getClassification () { + const { page } = await this.$post(this.api.listComClass) + this.classifications = page + }, + // 显示所属分类弹框 + setClass () { + this.classVisible = true + }, + // 新增所属分类 + addClass () { + this.classifications.push({ + edit: true, + id: '', + classificationName: '' + }) + }, + // 编辑所属分类 + editClass (row) { + this.$set(row, 'edit', 1) + }, + // 删除所属分类 + delClass (row, i) { + if (row.id) { + this.$confirm('确定要删除吗?', '提示', { + type: 'warning' + }).then(() => { + this.$post(this.api.delComClass, [row.id]).then(res => { + Util.successMsg('删除成功') + this.getClassification() + }).catch(res => { }) + }).catch(() => { }) + } else { + this.classifications.splice(i, 1) + } + }, + // 提交所属分类 + submitClass (row, showMsg = 1) { + if (!row.classificationName) return Util.errorMsg('请输入分类名称') + this.$post(this.api[row.id ? 'updateComClass' : 'saveComClass'], { + classificationName: row.classificationName, + id: row.id, + }).then(res => { + showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') + this.getClassification() + }).catch(res => { }) + }, + // 关闭所属分类 + closeClass () { + const list = this.classifications + if (list.find(e => e.edit && e.classificationName)) { + this.$confirm('所填写内容暂未保存,是否保存?', '提示', { + type: 'warning' + }).then(() => { + list.map(e => { + e.edit && e.classificationName && this.submitClass(e, 0) + }) + this.classVisible = false + }).catch(() => { + this.classVisible = false + }) + } else { + this.classVisible = false + } + }, + + handleExceed (files, fileList) { Util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); }, @@ -614,6 +763,26 @@ $upload-lg-height: 150px; } } +.plus { + margin-bottom: 10px; + font-size: 18px; + color: #2962ff; + text-align: right; + cursor: pointer; +} +.set-btn { + margin-left: 10px !important; +} +.manage-dia { + .edit, + .del { + font-size: 14px; + cursor: pointer; + } + .edit { + margin-right: 10px; + } +} .add-btn { display: flex; justify-content: center; diff --git a/src/pages/activity/list/index.vue b/src/pages/activity/list/index.vue index d01f09d..054fbd1 100644 --- a/src/pages/activity/list/index.vue +++ b/src/pages/activity/list/index.vue @@ -25,13 +25,6 @@ value-format="yyyy-MM-dd" clearable> -
  • - -
  • @@ -59,6 +52,13 @@ :value="item.id"> +
  • + +
  • +
  • + +