From 0d30539feb410e27d2bb8fbf69c36cffb58de8ea Mon Sep 17 00:00:00 2001 From: Xia Zekun Date: Fri, 22 Mar 2024 11:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=BA=93=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/lang/zh-cn.js | 18 ++-- .../AttributeIdentificationList.vue | 83 ++++++++++++++++--- 2 files changed, 83 insertions(+), 18 deletions(-) diff --git a/src/common/lang/zh-cn.js b/src/common/lang/zh-cn.js index 202433fc..2cb22c3e 100644 --- a/src/common/lang/zh-cn.js +++ b/src/common/lang/zh-cn.js @@ -261,7 +261,7 @@ module.exports = { userExists: '用户名已存在', workNoExists: '工号已存在', handStamp: '手写章', - uploadHandStamp:'上传手写章' + uploadHandStamp: '上传手写章' }, // 高级查询 superQuery: { @@ -477,8 +477,8 @@ module.exports = { enterQuantity: '请输入数量', numberRows: '行数', numberColumns: '列数', - maximumSelection:'最多选择', - pieceOfData:'条数据' + maximumSelection: '最多选择', + pieceOfData: '条数据' }, // 文档比对 comparison: { @@ -638,11 +638,13 @@ module.exports = { selectedData: '已选数据' }, // 属性标识管理 - attributeIdentification:{ - labelName:'标签名称', - firstLabel:'一级标签', - secondLabel:'二级标签', - thirdLabel:'三级标签', + attributeIdentification: { + labelName: '标签名称', + firstLabel: '一级标签', + secondLabel: '二级标签', + thirdLabel: '三级标签', + labelDelete: '请再次确认是否删除1级/2级标签。删除后该标签无法重新添加,同时该标签目录下所有标签都会被删除', + batchDelete: '您正在进行批量删除。1级/2级标签无法手动添加,请谨慎删除1级/2级标签。如果您选中了1级/2级标签,同时该标签目录下所有标签都会被删除' }, // 系统管理 diff --git a/src/views/system/AttributeIdentificationManage/AttributeIdentificationList.vue b/src/views/system/AttributeIdentificationManage/AttributeIdentificationList.vue index 3ea87928..13003b7f 100644 --- a/src/views/system/AttributeIdentificationManage/AttributeIdentificationList.vue +++ b/src/views/system/AttributeIdentificationManage/AttributeIdentificationList.vue @@ -49,7 +49,7 @@ @@ -65,7 +65,7 @@ import AttributeIdentificationModal from './modules/AttributeIdentificationModal export default { name: 'TreeSelectModal', - components:{AttributeIdentificationModal}, + components: { AttributeIdentificationModal }, mixins: [JeroListMixin], props: { dictId: { @@ -89,7 +89,7 @@ export default { type: Boolean, required: false, default: false - }, + } }, computed: { rowSelection () { @@ -107,9 +107,10 @@ export default { }, data () { return { - url:{ - queryLabelTree:'/laws/lawsLabelDatabase/queryLabelTree', - deleteBatch:'/laws/lawsLabelDatabase/deleteBatch' + url: { + queryLabelTree: '/laws/lawsLabelDatabase/queryLabelTree', + deleteBatch: '/laws/lawsLabelDatabase/deleteBatch', + delete: '/laws/lawsLabelDatabase/delete' }, confirmLoading: false, queryParam: {}, @@ -124,8 +125,8 @@ export default { /* 分页参数 */ ipagination: { current: 1, - pageSize: 5, - pageSizeOptions: ['5', '10', '20', '30', '100', '200'], + pageSize: 10, + pageSizeOptions: ['10', '20', '30', '100', '200'], showTotal: (total, range) => { return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip') }, @@ -151,7 +152,7 @@ export default { searchField: 'nodeName' } }, - mounted() { + mounted () { this.searchQuery() }, methods: { @@ -213,7 +214,7 @@ export default { this.dataSourceRight = selectedRows } }, - handleShowEdit(record){ + handleShowEdit (record) { // console.log('handlwShow record',record) // 只有第三级标签允许修改 return record.code.split('-').length === 3 @@ -228,6 +229,68 @@ export default { // 清空列表选中 this.onClearSelected() }, + handleDelete: function (record) { + if (!this.url.delete) { + this.$message.warning('请设置url.delete属性!') + return + } + console.log('record', record) + const that = this + let content = this.$t('areYouSure') + if (record.code.split('-').length <= 2) { + content = this.$t('attributeIdentification.labelDelete') + } + this.$confirm({ + title: this.$t('confirmDeletion'), + content: content, + onOk: function () { + postAction(that.url.delete, { id: record.id }).then((res) => { + if (res.success) { + that.$message.success(res.message) + // 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一 + if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) { + that.ipagination.current -= 1 + } + that.loadData() + } else { + that.$message.warning(res.message) + } + }) + } + }) + }, + batchDel: function () { + if (!this.url.deleteBatch) { + this.$message.warning('请设置url.deleteBatch属性!') + return + } + if (this.selectedRowKeys.length <= 0) { + this.$message.warning(this.$t('selectARecord')) + } else { + const ids = this.selectedRowKeys.join(',') + const that = this + this.$confirm({ + title: this.$t('confirmBatchDeletion'), + content: this.$t('attributeIdentification.batchDelete'), + onOk: function () { + that.loading = true + postAction(that.url.deleteBatch, { ids: ids }).then((res) => { + if (res.success) { + // 重新计算分页问题 + that.reCalculatePage(that.selectedRowKeys.length) + that.$message.success(res.message) + that.loadData() + that.onClearSelected() + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.loading = false + }) + } + }) + } + } } }