|
@@ -8,26 +8,32 @@
|
|
:no-page="true"
|
|
:no-page="true"
|
|
default-expand-all
|
|
default-expand-all
|
|
>
|
|
>
|
|
|
|
+ <template #labelType-column-value="{scope}">
|
|
|
|
+ {{DictionaryStore.labelTypeMap.get(scope.row.labelType)}}
|
|
|
|
+ </template>
|
|
<template #do-column-value="{scope}">
|
|
<template #do-column-value="{scope}">
|
|
<template v-if="scope.row.labelLevel == 2">
|
|
<template v-if="scope.row.labelLevel == 2">
|
|
<CusButton type="table-add" title="新增下级" @click="onAdd(scope.row)"/>
|
|
<CusButton type="table-add" title="新增下级" @click="onAdd(scope.row)"/>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <CusButton type="table" icon="relation" title="关联"/>
|
|
|
|
- <CusButton type="table-edit"/>
|
|
|
|
- <CusButton type="table-del"/>
|
|
|
|
|
|
+ <CusButton type="table" icon="relation" title="关联" @click="onRelation(scope.row)"/>
|
|
|
|
+ <CusButton type="table-edit" @click="onEdit(scope.row)"/>
|
|
|
|
+ <CusButton type="table-del" @click="onDel(scope.row)"/>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</CusTable>
|
|
</CusTable>
|
|
</div>
|
|
</div>
|
|
- <DetailCom v-model:show="state.detail.show" :transfer="state.detail.transfer"/>
|
|
|
|
|
|
+ <DetailCom v-model:show="state.detail.show" :transfer="state.detail.transfer" @refresh="initTree"/>
|
|
|
|
+ <RelationCom v-model:show="state.relation.show" :transfer="state.relation.transfer" @refresh="initTree"/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import {getCurrentInstance, onMounted, reactive} from "vue";
|
|
import {getCurrentInstance, onMounted, reactive} from "vue";
|
|
import DetailCom from './detail.vue'
|
|
import DetailCom from './detail.vue'
|
|
|
|
+import RelationCom from './relation.vue'
|
|
import {useDictionaryStore} from "@/stores";
|
|
import {useDictionaryStore} from "@/stores";
|
|
|
|
+import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
|
|
|
const {proxy} = getCurrentInstance()
|
|
const {proxy} = getCurrentInstance()
|
|
const DictionaryStore = useDictionaryStore()
|
|
const DictionaryStore = useDictionaryStore()
|
|
@@ -36,11 +42,11 @@ const state: any = reactive({
|
|
loading: false,
|
|
loading: false,
|
|
tableHead: [
|
|
tableHead: [
|
|
{value: "labelName", label: "名称", align: 'left', headerAlign: 'left', minWidth: 400},
|
|
{value: "labelName", label: "名称", align: 'left', headerAlign: 'left', minWidth: 400},
|
|
- {value: "labelTypeName", label: "类型", width: 120},
|
|
|
|
|
|
+ {value: "labelType", label: "类型", width: 120},
|
|
{value: "labelOrder", label: "排序", width: 120},
|
|
{value: "labelOrder", label: "排序", width: 120},
|
|
{value: "indexNum", label: "索引数量", width: 120},
|
|
{value: "indexNum", label: "索引数量", width: 120},
|
|
- {value: "createTime", label: "创建时间", width: 180},
|
|
|
|
- {value: "updateTime", label: "最后修改时间", width: 180},
|
|
|
|
|
|
+ {value: "createTime", label: "创建时间", width: 200},
|
|
|
|
+ {value: "updateTime", label: "最后修改时间", width: 200},
|
|
{value: "remark", label: "备注", width: 200},
|
|
{value: "remark", label: "备注", width: 200},
|
|
{value: "do", label: "操作", width: 220, fixed: 'right'},
|
|
{value: "do", label: "操作", width: 220, fixed: 'right'},
|
|
],
|
|
],
|
|
@@ -51,6 +57,10 @@ const state: any = reactive({
|
|
detail: {
|
|
detail: {
|
|
show: false,
|
|
show: false,
|
|
transfer: {}
|
|
transfer: {}
|
|
|
|
+ },
|
|
|
|
+ relation: {
|
|
|
|
+ show: false,
|
|
|
|
+ transfer: {}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
const initTree = () => {
|
|
const initTree = () => {
|
|
@@ -63,13 +73,43 @@ const initTree = () => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
const onAdd = (row) => {
|
|
const onAdd = (row) => {
|
|
- console.log(row)
|
|
|
|
state.detail.transfer = {
|
|
state.detail.transfer = {
|
|
mode: 'add',
|
|
mode: 'add',
|
|
- pId: row.id
|
|
|
|
|
|
+ labelParentId: row.id,
|
|
|
|
+ labelType: row.labelType
|
|
}
|
|
}
|
|
state.detail.show = true
|
|
state.detail.show = true
|
|
}
|
|
}
|
|
|
|
+const onEdit = (row) => {
|
|
|
|
+ state.detail.transfer = {
|
|
|
|
+ mode: 'edit',
|
|
|
|
+ id: row.id,
|
|
|
|
+ }
|
|
|
|
+ state.detail.show = true
|
|
|
|
+}
|
|
|
|
+const onDel = (row) => {
|
|
|
|
+ ElMessageBox.confirm(`请确认是否删除${row.labelName}?`, "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ } as any).then(() => {
|
|
|
|
+ state.loading = true
|
|
|
|
+ proxy.$api.sysLabelDelete(row.id).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ ElMessage.success('删除成功!')
|
|
|
|
+ } else {
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
+ }
|
|
|
|
+ initTree()
|
|
|
|
+ })
|
|
|
|
+ }).catch(() => {})
|
|
|
|
+}
|
|
|
|
+const onRelation = (row) => {
|
|
|
|
+ state.relation.transfer = {
|
|
|
|
+ id: row.id
|
|
|
|
+ }
|
|
|
|
+ state.relation.show = true
|
|
|
|
+}
|
|
const initDictionary = () => {
|
|
const initDictionary = () => {
|
|
DictionaryStore.initDict('label_type')
|
|
DictionaryStore.initDict('label_type')
|
|
}
|
|
}
|