From 3e1ff716864efda404f3cc231fddc525b04b5cfc Mon Sep 17 00:00:00 2001 From: guoyue Date: Thu, 3 Nov 2022 17:58:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/src/mixins/view-module.js | 73 +++++++++++-------- .../modules/ability/IntegratedServices.vue | 45 +++++++----- .../components/scene-one-input.vue | 19 ++++- .../components/scene-use-step.vue | 19 ++++- .../modules/ability/assignedScene/index.vue | 43 ++++++----- .../ability/components/common-question.vue | 15 +++- 6 files changed, 138 insertions(+), 76 deletions(-) diff --git a/back/src/mixins/view-module.js b/back/src/mixins/view-module.js index edd9378c..fae86b9b 100644 --- a/back/src/mixins/view-module.js +++ b/back/src/mixins/view-module.js @@ -2,7 +2,7 @@ import Cookies from 'js-cookie' import qs from 'qs' import { deepClone } from '@/utils/form-generator/index' export default { - data () { + data() { /* eslint-disable */ return { // 设置属性 @@ -38,19 +38,19 @@ export default { } /* eslint-enable */ }, - created () { + created() { if (this.mixinViewModuleOptions.createdIsNeed) { this.query() } }, - activated () { + activated() { if (this.mixinViewModuleOptions.activatedIsNeed) { this.query() } }, methods: { // 获取数据列表 - query () { + query() { this.dataListLoading = true this.$http.get( this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({ @@ -126,11 +126,11 @@ export default { }) }, // 多选 - dataListSelectionChangeHandle (val) { + dataListSelectionChangeHandle(val) { this.dataListSelections = val }, // 排序 - dataListSortChangeHandle (data) { + dataListSortChangeHandle(data) { if (!data.order || !data.prop) { this.order = '' this.orderField = '' @@ -141,13 +141,13 @@ export default { this.query() }, // 分页, 每页条数 - pageSizeChangeHandle (val) { + pageSizeChangeHandle(val) { this.page = 1 this.limit = val this.query() }, // 分页, 当前页 - pageCurrentChangeHandle (val) { + pageCurrentChangeHandle(val) { this.page = val this.query() }, @@ -156,7 +156,7 @@ export default { this.query() }, // 新增 - addOrUpdateHandle (id) { + addOrUpdateHandle(id) { this.addOrUpdateVisible = true this.disabled = false this.$nextTick(() => { @@ -167,7 +167,7 @@ export default { }, // 组件服务新增 - addOrUpdateHandleAI (id) { + addOrUpdateHandleAI(id) { // const infoList = [] let showList = [] this.$http.get('category/getCategoryTree').then(({ data: res }) => { @@ -225,7 +225,7 @@ export default { }, 100) }, // 应用资源新增 - addOrUpdateHandleServe (id) { + addOrUpdateHandleServe(id) { // const infoList = [] let showList = [] this.$http.get('category/getCategoryTree').then(({ data: res }) => { @@ -283,7 +283,7 @@ export default { }, 100) }, // 修改 - UpdateHandle (val) { + UpdateHandle(val) { this.addOrUpdateVisible = true this.disabled = false const cloneVal = deepClone(val) @@ -308,7 +308,7 @@ export default { }) }, // 关闭当前窗口 - closeCurrentTab (data) { + closeCurrentTab(data) { var tabName = this.$store.state.contentTabsActiveName this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName) if (this.$store.state.contentTabs.length <= 0) { @@ -320,7 +320,7 @@ export default { } }, // 删除 - deleteHandle (id) { + deleteHandle(id) { if (this.mixinViewModuleOptions.deleteIsBatch && !id && this.dataListSelections.length <= 0) { return this.$message({ message: this.$t('prompt.deleteBatch'), @@ -354,25 +354,40 @@ export default { }).catch(() => { }) }, - deleteHandle2 (id) { + deleteHandle2(id) { console.log('删除========================》', id, this.dataListSelections) - const ids = [] - if (id) { - ids.push(id) - } else { - if (this.dataListSelections.length > 0) { - this.dataListSelections.forEach(item => { - ids.push(item.id) - }) + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const ids = [] + if (id) { + ids.push(id) + } else { + if (this.dataListSelections.length > 0) { + this.dataListSelections.forEach(item => { + ids.push(item.id) + }) + } } - } - this.$http.post('/resource/delete', { ids: ids }).then(res => { - console.log('删除成功', res) - this.getDataList() - }) + this.$http.post('/resource/delete', { ids: ids }).then(res => { + console.log('删除成功', res) + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.getDataList() + }) + }).catch(() => { + // this.$message({ + // type: 'info', + // message: '已取消删除' + // }); + }); }, // 导出 - exportHandle () { + exportHandle() { var params = qs.stringify({ token: Cookies.get('ucsToken'), ...this.dataForm diff --git a/back/src/views/modules/ability/IntegratedServices.vue b/back/src/views/modules/ability/IntegratedServices.vue index e18a939b..d3e39a8f 100644 --- a/back/src/views/modules/ability/IntegratedServices.vue +++ b/back/src/views/modules/ability/IntegratedServices.vue @@ -70,7 +70,7 @@ export default { mixinViewModuleOptions: { getDataListURL: "/fuse/page", exportURL: "/ability/bsabilityai/export", - deleteURL: "/fuse", + deleteURL: "/fuse/delete", getDataListIsPage: true, deleteIsBatch: false, }, @@ -93,24 +93,31 @@ export default { }, methods: { deleteRow(id) { - this.$http.delete('/fuse/delete', { - data: [id] - }).then(res => { - console.log('删除成功', res) - if (res.data.code !== 0) { - return this.$message.error(res.msg); - } - this.$message({ - message: '删除成功', - type: "success", - duration: 500, - onClose: () => { - this.query() - }, - }); - }).catch(err => { - this.$message.error(err); - }) + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http.delete('/fuse/delete', { + data: [id] + }).then(res => { + console.log('删除成功', res) + if (res.data.code !== 0) { + return this.$message.error(res.msg); + } + this.$message({ + message: '删除成功', + type: "success", + duration: 500, + onClose: () => { + this.query() + }, + }); + }).catch(err => { + this.$message.error(err); + }) + }).catch(() => { + }); }, // 查询 searchData() { diff --git a/back/src/views/modules/ability/assignedScene/components/scene-one-input.vue b/back/src/views/modules/ability/assignedScene/components/scene-one-input.vue index 2cae290f..9664655f 100644 --- a/back/src/views/modules/ability/assignedScene/components/scene-one-input.vue +++ b/back/src/views/modules/ability/assignedScene/components/scene-one-input.vue @@ -12,8 +12,8 @@ v-if="dataInfo.length > 1">删除 - 添加 + + 添加 @@ -97,8 +97,19 @@ export default { }) }, // 删除 - deleteItem(list, index) { - this.dataInfo.splice(index, 1) + deleteItem(index) { + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dataInfo.splice(index, 1) + }).catch(() => { + }); } } } diff --git a/back/src/views/modules/ability/assignedScene/components/scene-use-step.vue b/back/src/views/modules/ability/assignedScene/components/scene-use-step.vue index afc0d6eb..bc94ee0c 100644 --- a/back/src/views/modules/ability/assignedScene/components/scene-use-step.vue +++ b/back/src/views/modules/ability/assignedScene/components/scene-use-step.vue @@ -16,8 +16,8 @@ v-if="!disabledType && dataInfo.length > 1">删除 - 添加 + 添加 @@ -100,8 +100,19 @@ export default { }) }, // 删除 - deleteItem(list, index) { - this.dataInfo.splice(index, 1) + deleteItem(index) { + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dataInfo.splice(index, 1) + }).catch(() => { + }); } } } diff --git a/back/src/views/modules/ability/assignedScene/index.vue b/back/src/views/modules/ability/assignedScene/index.vue index 8bd823df..4008f7e7 100644 --- a/back/src/views/modules/ability/assignedScene/index.vue +++ b/back/src/views/modules/ability/assignedScene/index.vue @@ -84,24 +84,31 @@ export default { }, methods: { deleteRow(id) { - this.$http.delete('/fuse/delete', { - data: [id] - }).then(res => { - console.log('删除成功', res) - if (res.data.code !== 0) { - return this.$message.error(res.msg); - } - this.$message({ - message: '删除成功', - type: "success", - duration: 500, - onClose: () => { - this.query() - }, - }); - }).catch(err => { - this.$message.error(err); - }) + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http.delete('/fuse/delete', { + data: [id] + }).then(res => { + console.log('删除成功', res) + if (res.data.code !== 0) { + return this.$message.error(res.msg); + } + this.$message({ + message: '删除成功', + type: "success", + duration: 500, + onClose: () => { + this.query() + }, + }); + }).catch(err => { + this.$message.error(err); + }) + }).catch(() => { + }); }, // 查询 searchData() { diff --git a/back/src/views/modules/ability/components/common-question.vue b/back/src/views/modules/ability/components/common-question.vue index c653cedb..1422b09f 100644 --- a/back/src/views/modules/ability/components/common-question.vue +++ b/back/src/views/modules/ability/components/common-question.vue @@ -110,8 +110,19 @@ export default { }) }, // 删除 - deleteItem(list, index) { - this.dataInfo.splice(index, 1) + deleteItem(index) { + this.$confirm('确认是否删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$message({ + type: 'success', + message: '删除成功!' + }); + this.dataInfo.splice(index, 1) + }).catch(() => { + }); } } } From c8d315934a3189afda4260e50568164f6b9916e0 Mon Sep 17 00:00:00 2001 From: guoyue Date: Thu, 3 Nov 2022 17:58:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD?= =?UTF-8?q?=EF=BC=8C=E5=B7=A6=E4=BE=A7=E6=A0=91=E5=A2=9E=E5=8A=A0tips?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/infrastructure-tree.vue | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/back/src/views/modules/ability/assignedScene/components/infrastructure-tree.vue b/back/src/views/modules/ability/assignedScene/components/infrastructure-tree.vue index a4ccdd1b..082ac4d5 100644 --- a/back/src/views/modules/ability/assignedScene/components/infrastructure-tree.vue +++ b/back/src/views/modules/ability/assignedScene/components/infrastructure-tree.vue @@ -19,7 +19,11 @@ - {{ val.name }}({{ val.channelCount }}) + +
{{val.name}}
+ {{ val.name }} +
+ ({{ val.channelCount }}) {{ val.total }} @@ -54,7 +58,7 @@ + const getDataTotalNum = () =>{ + let totalNum =0; + dataForm.value.forEach((item)=>{ + totalNum = totalNum +item.arr.length; + }); + totalDataNum.value = totalNum; + } + getDataTotalNum(); + //获取数据的总条数 + +