Compare commits

...

2 Commits

Author SHA1 Message Date
guoyue c8d315934a 基础设施,左侧树增加tips显示 2022-11-03 17:58:46 +08:00
guoyue 3e1ff71686 删除增加二次确认 2022-11-03 17:58:28 +08:00
7 changed files with 161 additions and 78 deletions

View File

@ -2,7 +2,7 @@ import Cookies from 'js-cookie'
import qs from 'qs' import qs from 'qs'
import { deepClone } from '@/utils/form-generator/index' import { deepClone } from '@/utils/form-generator/index'
export default { export default {
data () { data() {
/* eslint-disable */ /* eslint-disable */
return { return {
// 设置属性 // 设置属性
@ -38,19 +38,19 @@ export default {
} }
/* eslint-enable */ /* eslint-enable */
}, },
created () { created() {
if (this.mixinViewModuleOptions.createdIsNeed) { if (this.mixinViewModuleOptions.createdIsNeed) {
this.query() this.query()
} }
}, },
activated () { activated() {
if (this.mixinViewModuleOptions.activatedIsNeed) { if (this.mixinViewModuleOptions.activatedIsNeed) {
this.query() this.query()
} }
}, },
methods: { methods: {
// 获取数据列表 // 获取数据列表
query () { query() {
this.dataListLoading = true this.dataListLoading = true
this.$http.get( this.$http.get(
this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({ this.mixinViewModuleOptions.getDataListURL + '?' + qs.stringify({
@ -126,11 +126,11 @@ export default {
}) })
}, },
// 多选 // 多选
dataListSelectionChangeHandle (val) { dataListSelectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
// 排序 // 排序
dataListSortChangeHandle (data) { dataListSortChangeHandle(data) {
if (!data.order || !data.prop) { if (!data.order || !data.prop) {
this.order = '' this.order = ''
this.orderField = '' this.orderField = ''
@ -141,13 +141,13 @@ export default {
this.query() this.query()
}, },
// 分页, 每页条数 // 分页, 每页条数
pageSizeChangeHandle (val) { pageSizeChangeHandle(val) {
this.page = 1 this.page = 1
this.limit = val this.limit = val
this.query() this.query()
}, },
// 分页, 当前页 // 分页, 当前页
pageCurrentChangeHandle (val) { pageCurrentChangeHandle(val) {
this.page = val this.page = val
this.query() this.query()
}, },
@ -156,7 +156,7 @@ export default {
this.query() this.query()
}, },
// 新增 // 新增
addOrUpdateHandle (id) { addOrUpdateHandle(id) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.disabled = false this.disabled = false
this.$nextTick(() => { this.$nextTick(() => {
@ -167,7 +167,7 @@ export default {
}, },
// 组件服务新增 // 组件服务新增
addOrUpdateHandleAI (id) { addOrUpdateHandleAI(id) {
// const infoList = [] // const infoList = []
let showList = [] let showList = []
this.$http.get('category/getCategoryTree').then(({ data: res }) => { this.$http.get('category/getCategoryTree').then(({ data: res }) => {
@ -225,7 +225,7 @@ export default {
}, 100) }, 100)
}, },
// 应用资源新增 // 应用资源新增
addOrUpdateHandleServe (id) { addOrUpdateHandleServe(id) {
// const infoList = [] // const infoList = []
let showList = [] let showList = []
this.$http.get('category/getCategoryTree').then(({ data: res }) => { this.$http.get('category/getCategoryTree').then(({ data: res }) => {
@ -283,7 +283,7 @@ export default {
}, 100) }, 100)
}, },
// 修改 // 修改
UpdateHandle (val) { UpdateHandle(val) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.disabled = false this.disabled = false
const cloneVal = deepClone(val) const cloneVal = deepClone(val)
@ -308,7 +308,7 @@ export default {
}) })
}, },
// 关闭当前窗口 // 关闭当前窗口
closeCurrentTab (data) { closeCurrentTab(data) {
var tabName = this.$store.state.contentTabsActiveName var tabName = this.$store.state.contentTabsActiveName
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName) this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
if (this.$store.state.contentTabs.length <= 0) { 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) { if (this.mixinViewModuleOptions.deleteIsBatch && !id && this.dataListSelections.length <= 0) {
return this.$message({ return this.$message({
message: this.$t('prompt.deleteBatch'), message: this.$t('prompt.deleteBatch'),
@ -354,25 +354,40 @@ export default {
}).catch(() => { }) }).catch(() => { })
}, },
deleteHandle2 (id) { deleteHandle2(id) {
console.log('删除========================》', id, this.dataListSelections) console.log('删除========================》', id, this.dataListSelections)
const ids = [] this.$confirm('确认是否删除?', '提示', {
if (id) { confirmButtonText: '确定',
ids.push(id) cancelButtonText: '取消',
} else { type: 'warning'
if (this.dataListSelections.length > 0) { }).then(() => {
this.dataListSelections.forEach(item => { const ids = []
ids.push(item.id) 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 => {
this.$http.post('/resource/delete', { ids: ids }).then(res => { console.log('删除成功', res)
console.log('删除成功', res) this.$message({
this.getDataList() type: 'success',
}) message: '删除成功!'
});
this.getDataList()
})
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
}, },
// 导出 // 导出
exportHandle () { exportHandle() {
var params = qs.stringify({ var params = qs.stringify({
token: Cookies.get('ucsToken'), token: Cookies.get('ucsToken'),
...this.dataForm ...this.dataForm

View File

@ -70,7 +70,7 @@ export default {
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: "/fuse/page", getDataListURL: "/fuse/page",
exportURL: "/ability/bsabilityai/export", exportURL: "/ability/bsabilityai/export",
deleteURL: "/fuse", deleteURL: "/fuse/delete",
getDataListIsPage: true, getDataListIsPage: true,
deleteIsBatch: false, deleteIsBatch: false,
}, },
@ -93,24 +93,31 @@ export default {
}, },
methods: { methods: {
deleteRow(id) { deleteRow(id) {
this.$http.delete('/fuse/delete', { this.$confirm('确认是否删除?', '提示', {
data: [id] confirmButtonText: '确定',
}).then(res => { cancelButtonText: '取消',
console.log('删除成功', res) type: 'warning'
if (res.data.code !== 0) { }).then(() => {
return this.$message.error(res.msg); this.$http.delete('/fuse/delete', {
} data: [id]
this.$message({ }).then(res => {
message: '删除成功', console.log('删除成功', res)
type: "success", if (res.data.code !== 0) {
duration: 500, return this.$message.error(res.msg);
onClose: () => { }
this.query() this.$message({
}, message: '删除成功',
}); type: "success",
}).catch(err => { duration: 500,
this.$message.error(err); onClose: () => {
}) this.query()
},
});
}).catch(err => {
this.$message.error(err);
})
}).catch(() => {
});
}, },
// //
searchData() { searchData() {

View File

@ -19,7 +19,11 @@
<path d="M512 624a112 112 0 1 0 0-224 112 112 0 0 0 0 224z" p-id="2157" <path d="M512 624a112 112 0 1 0 0-224 112 112 0 0 0 0 224z" p-id="2157"
fill="#0058e1"></path> fill="#0058e1"></path>
</svg> </svg>
<span class="name">{{ val.name }}({{ val.channelCount }})</span> <el-tooltip effect="dark" placement="top-start">
<div class="tooltip-name" slot="content">{{val.name}}</div>
<span class="name">{{ val.name }}</span>
</el-tooltip>
<span class="num">({{ val.channelCount }})</span>
</div> </div>
<span v-if="item.children.length < 0">{{ val.total }}</span> <span v-if="item.children.length < 0">{{ val.total }}</span>
<span v-else> <span v-else>
@ -54,7 +58,7 @@
<script> <script>
export default { export default {
data() { data() {
return { return {
selectedKeys: [], selectedKeys: [],
checkedKeys: [], checkedKeys: [],
showKey: 0, showKey: 0,
@ -311,4 +315,21 @@ export default {
} }
} }
} }
.name {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
word-break: break-all;
width: 190px;
text-align: left;
}
.num {
width: 40px;
text-align: right;
}
.tooltip-name {
max-width: 300px;
}
</style> </style>

View File

@ -12,8 +12,8 @@
v-if="dataInfo.length > 1">删除 v-if="dataInfo.length > 1">删除
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="add-btn" size="small" v-if="index == dataInfo.length - 1" @click="addItem" <el-button class="add-btn" size="small" v-if="index == dataInfo.length - 1" @click="addItem" type="primary">
type="primary">添加 添加
</el-button> </el-button>
</div> </div>
</div> </div>
@ -97,8 +97,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.dataInfo.splice(index, 1) this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }

View File

@ -16,8 +16,8 @@
v-if="!disabledType && dataInfo.length > 1">删除 v-if="!disabledType && dataInfo.length > 1">删除
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="add-btn" size="small" <el-button class="add-btn" size="small" v-if="!disabledType && index == dataInfo.length - 1"
v-if="!disabledType && index == dataInfo.length - 1" @click="addItem" type="primary">添加 @click="addItem" type="primary">添加
</el-button> </el-button>
</div> </div>
@ -100,8 +100,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.dataInfo.splice(index, 1) this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }

View File

@ -84,24 +84,31 @@ export default {
}, },
methods: { methods: {
deleteRow(id) { deleteRow(id) {
this.$http.delete('/fuse/delete', { this.$confirm('确认是否删除?', '提示', {
data: [id] confirmButtonText: '确定',
}).then(res => { cancelButtonText: '取消',
console.log('删除成功', res) type: 'warning'
if (res.data.code !== 0) { }).then(() => {
return this.$message.error(res.msg); this.$http.delete('/fuse/delete', {
} data: [id]
this.$message({ }).then(res => {
message: '删除成功', console.log('删除成功', res)
type: "success", if (res.data.code !== 0) {
duration: 500, return this.$message.error(res.msg);
onClose: () => { }
this.query() this.$message({
}, message: '删除成功',
}); type: "success",
}).catch(err => { duration: 500,
this.$message.error(err); onClose: () => {
}) this.query()
},
});
}).catch(err => {
this.$message.error(err);
})
}).catch(() => {
});
}, },
// //
searchData() { searchData() {

View File

@ -110,8 +110,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.dataInfo.splice(index, 1) this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }