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(() => { + }); } } }