设备类型管理修改
This commit is contained in:
@@ -7,6 +7,8 @@ export interface SblxVO {
|
||||
parentId: number
|
||||
sort: number
|
||||
createTime: Date
|
||||
deptId?: number
|
||||
deptName?: string
|
||||
}
|
||||
|
||||
// 查询设备类型(精简)列表
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
style="width: 366px"
|
||||
/>
|
||||
</template>
|
||||
<template #deptId-form="{ column, disabled }">
|
||||
<DeptSelect
|
||||
v-model="tableForm.deptId"
|
||||
:column="column"
|
||||
:disabled="disabled"
|
||||
type="edit"
|
||||
prop="deptId"
|
||||
></DeptSelect>
|
||||
</template>
|
||||
<!-- 自定义按钮 -->
|
||||
<template #menu-left="{ size }">
|
||||
<el-button
|
||||
@@ -44,11 +53,16 @@
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import * as SblxApi from '@/api/system/sblx'
|
||||
import { DeptSelect } from '@/components/LowDesign/src/shareControl'
|
||||
import { useLowStoreWithOut } from '@/store/modules/low'
|
||||
import * as DicApi from '@/api/design/dic'
|
||||
|
||||
defineOptions({ name: 'SystemSblx' })
|
||||
|
||||
const lowStore = useLowStoreWithOut()
|
||||
|
||||
const crudRef = ref()
|
||||
useCrudHeight(crudRef)
|
||||
|
||||
@@ -89,13 +103,25 @@ const tableOption = reactive({
|
||||
minWidth: 100,
|
||||
rules: [{ required: true, message: '设备类型编码不能为空', trigger: 'blur' }]
|
||||
},
|
||||
deptId: {
|
||||
label: '所属部门',
|
||||
minWidth: 100,
|
||||
findType: 'all',
|
||||
multiple: false,
|
||||
cell: true,
|
||||
rules: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
|
||||
formatter: (row, value) => {
|
||||
return lowStore.dicObj['deptSelect']?.[value] || value
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
label: '显示顺序',
|
||||
width: 80,
|
||||
span: 12,
|
||||
type: 'number',
|
||||
rules: [{ required: true, message: '显示顺序不能为空', trigger: 'blur' }]
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}) //表格配置
|
||||
const tableForm = ref<any>({})
|
||||
@@ -113,7 +139,6 @@ const getTableData = async () => {
|
||||
for (let key in searchObj) if (searchObj[key] === '') delete searchObj[key]
|
||||
try {
|
||||
const data = await SblxApi.getSblxPage(searchObj)
|
||||
|
||||
tableData.value = handleTree(data)
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -137,7 +162,8 @@ const beforeOpen = async (done, type) => {
|
||||
await getTree()
|
||||
const id = tableForm.value.id
|
||||
if (['edit', 'view'].includes(type) && id) {
|
||||
tableForm.value = await SblxApi.getSblx(id)
|
||||
const data = await SblxApi.getSblx(id)
|
||||
tableForm.value = data
|
||||
}
|
||||
done()
|
||||
}
|
||||
@@ -191,8 +217,21 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
/** 初始化部门数据 **/
|
||||
const initDeptData = async () => {
|
||||
const data = await DicApi.getUserSelectDeptList('all')
|
||||
const deptObj = {}
|
||||
data.forEach((item) => {
|
||||
if (item.deptId && item.deptName) {
|
||||
deptObj[item.deptId] = item.deptName
|
||||
}
|
||||
})
|
||||
lowStore.setDicObj('deptSelect', deptObj)
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
await initDeptData()
|
||||
await getTableData()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user