|
@@ -18,8 +18,8 @@
|
|
|
@delete="toDelete"
|
|
|
>
|
|
|
<template #is_use="{ row }">
|
|
|
- <el-tag v-if="row.is_use == '0'" type="success">启用</el-tag>
|
|
|
- <el-tag v-else type="info">禁用</el-tag>
|
|
|
+ <el-tag v-if="row.is_use == '0'" type="success" @click="toUse(row, '1')">启用</el-tag>
|
|
|
+ <el-tag v-else type="info" @click="toUse(row, '0')">禁用</el-tag>
|
|
|
</template>
|
|
|
</custom-table>
|
|
|
<el-dialog
|
|
@@ -208,5 +208,16 @@ const toClose = () => {
|
|
|
form.value = { type: '1', children: [] }
|
|
|
dialog.value = { show: false }
|
|
|
}
|
|
|
+// 开启或禁用
|
|
|
+const toUse = async (data, is_use) => {
|
|
|
+ ElMessageBox.confirm(`确定修改【${data.title}】数据?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
|
|
|
+ .then(async () => {
|
|
|
+ let res = await store.update({ _id: get(data, '_id'), is_use })
|
|
|
+ if ($checkRes(res, true)) {
|
|
|
+ search({ skip: 0, limit })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+}
|
|
|
</script>
|
|
|
<style scoped lang="scss"></style>
|