|
|
@@ -1,5 +1,23 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
+<!-- <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">-->
|
|
|
+<!-- <div class="search" v-show="showSearch">-->
|
|
|
+<!-- <el-form ref="queryFormRef" :model="state.queryParams" :inline="true" label-width="68px">-->
|
|
|
+<!-- <el-form-item label="部门名称" prop="menuName">-->
|
|
|
+<!-- <el-input v-model="state.queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter="handleQuery" />-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- <el-form-item label="状态" prop="status">-->
|
|
|
+<!-- <el-select v-model="state.queryParams.status" placeholder="部门状态" clearable>-->
|
|
|
+<!-- <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />-->
|
|
|
+<!-- </el-select>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- <el-form-item>-->
|
|
|
+<!-- <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>-->
|
|
|
+<!-- <el-button icon="Refresh" @click="resetQuery">重置</el-button>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+<!-- </el-form>-->
|
|
|
+<!-- </div>-->
|
|
|
+<!-- </transition>-->
|
|
|
<yt-crud
|
|
|
v-bind="options"
|
|
|
ref="crudRef"
|
|
|
@@ -141,9 +159,22 @@ import YtCrud from '@/components/common/yt-crud.vue'
|
|
|
import { ElPopconfirm } from 'element-plus'
|
|
|
import StatusTag from '@/components/StatusTag/index.vue'
|
|
|
import { hasPermission } from '@/utils/auth'
|
|
|
+import { listDept} from '@/api/system/dept'
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
+
|
|
|
+interface DeptOptionsType {
|
|
|
+ id: number | string
|
|
|
+ deptName: string
|
|
|
+ children: DeptOptionsType[]
|
|
|
+}
|
|
|
const state = reactive({
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ deptName: undefined,
|
|
|
+ status: undefined,
|
|
|
+ },
|
|
|
page: {
|
|
|
pageSize: 12,
|
|
|
pageNum: 1,
|
|
|
@@ -180,7 +211,7 @@ const nodeTypeOptions = [
|
|
|
label: '直连设备',
|
|
|
},
|
|
|
]
|
|
|
-
|
|
|
+// const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
// 打开子设备
|
|
|
const childrenDialogRef = ref()
|
|
|
const showChidrenDevices = (row: any) => {
|
|
|
@@ -194,6 +225,7 @@ const copyIdSuccess = () => {
|
|
|
|
|
|
// 产品字典
|
|
|
const productOptions = ref<IProductsVO[]>([])
|
|
|
+const deptOptions = ref<DeptOptionsType[]>([])
|
|
|
|
|
|
// 组列表
|
|
|
const groupOptions = [
|
|
|
@@ -349,7 +381,21 @@ const column = ref<IColumn[]>([{
|
|
|
search: true,
|
|
|
hide: true,
|
|
|
formHide: true,
|
|
|
-}, {
|
|
|
+},
|
|
|
+ {
|
|
|
+ label: '所属部门',
|
|
|
+ key: 'createDept',
|
|
|
+ search: true,
|
|
|
+ type: 'select',
|
|
|
+ hide: true,
|
|
|
+ formHide: true,
|
|
|
+ componentProps: {
|
|
|
+ labelAlias: 'deptName',
|
|
|
+ valueAlias: 'id',
|
|
|
+ options: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '创建时间',
|
|
|
key: 'createAt',
|
|
|
tableWidth: 180,
|
|
|
@@ -357,6 +403,7 @@ const column = ref<IColumn[]>([{
|
|
|
type: 'date',
|
|
|
formHide: true,
|
|
|
}])
|
|
|
+
|
|
|
const crudRef = ref()
|
|
|
const data = ref<any[]>([])
|
|
|
const getData = () => {
|
|
|
@@ -386,6 +433,25 @@ const getDict = () => {
|
|
|
})
|
|
|
}
|
|
|
getDict()
|
|
|
+
|
|
|
+const getDept = () => {
|
|
|
+ listDept().then((res) => {
|
|
|
+ // const data = proxy?.handleTree<DeptOptionsType>(res.data, 'id')
|
|
|
+ deptOptions.value = res.data || []
|
|
|
+ console.log("################"+JSON.stringify(deptOptions.value))
|
|
|
+ column.value.forEach(item => {
|
|
|
+ if (item.key === 'createDept') {
|
|
|
+ item.componentProps.options = deptOptions.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // const data = proxy?.handleTree<DeptOptionsType>(res.data, 'id')
|
|
|
+ // console.log("####################"+JSON.stringify(data))
|
|
|
+ // if (data) {
|
|
|
+ // deptOptions.value = data
|
|
|
+ // }
|
|
|
+ })
|
|
|
+}
|
|
|
+getDept()
|
|
|
const getProductName = (key: string) => {
|
|
|
return productOptions.value.find(f => f.productKey === key)?.name || ''
|
|
|
}
|
|
|
@@ -393,6 +459,7 @@ const getNodeTypeName = (key) => {
|
|
|
const type = productOptions.value.find(f => f.productKey === key)?.nodeType
|
|
|
return nodeTypeOptions.find(f => f.value === type)?.label || ''
|
|
|
}
|
|
|
+
|
|
|
// 保存数据
|
|
|
const onSave = async ({type, data, cancel}: any) => {
|
|
|
state.loading = true
|