设备基础管理

This commit is contained in:
仲么了
2024-01-23 14:05:03 +08:00
parent 2dc9a788ed
commit 432244cd6b
8 changed files with 443 additions and 45 deletions

View File

@@ -1,41 +1,141 @@
<template>
<div class="default-main">
<TableHeader></TableHeader>
<Table ref="tableRef" />
<div class='default-main'>
<TableHeader ref='tableHeaderRef'>
<template #select>
<el-form-item label='装置型号:'>
<el-select v-model='tableStore.table.params.devType' placeholder='请选择' style='width: 100%'
clearable>
<el-option v-for='item in DevTypeOptions' :key='item.id' :label='item.name'
:value='item.id'></el-option>
</el-select>
</el-form-item>
</template>
<template #operation>
<el-button :icon='Plus' type='primary' @click='addMenu' class='ml10'>新增版本</el-button>
</template>
</TableHeader>
<Table ref='tableRef' />
<PopupVersion ref='popupVersionRef'></PopupVersion>
</div>
</template>
<script setup lang="ts">
<script setup lang='ts'>
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import { delCsDictData } from '@/api/system-boot/csDictData'
import { ElMessage } from 'element-plus'
import { queryByCode, queryByid } from '@/api/system-boot/dictTree'
import { useDictData } from '@/stores/dictData'
import PopupVersion from '@/views/govern/manage/basic/popupVersion.vue'
import { Plus } from '@element-plus/icons-vue'
import { auditEdData } from '@/api/cs-device-boot/edData'
defineOptions({
name: 'govern/manage/basic/version'
})
const popupVersionRef = ref()
const dictData = useDictData()
const DevTypeOptions = ref()
const tableHeaderRef = ref()
queryByCode('Direct_Connected_Device').then((res) => {
console.log(res)
queryByid(res.data.id).then((res) => {
console.log(res)
DevTypeOptions.value = res.data
})
})
const tableStore = new TableStore({
url: '/system-boot/csDictData/list',
url: '/cs-device-boot/edData/queryEdDataPage',
method: 'POST',
column: [
{ title: '数据分类', field: 'classId' },
{ title: '数据名称', field: 'name' },
{ title: '别名', field: 'otherName' },
{ title: '展示名称', field: 'showName' },
{ title: '相别', field: 'phase' },
{ title: '单位', field: 'unit' },
{ title: '基础数据类型', field: 'type' },
{ title: '数据谐波次数', field: 'harmStart' },
{ title: '数据统计方法', field: 'statMethod' },
{ title: '数据存储', field: 'classId' },
{ title: '数据来源', field: 'resourcesId' },
{ title: '操作', field: '操作' }
]
{ title: '装置型号', field: 'devTypeName' },
{ title: '版本号', field: 'versionNo' },
{ title: '版本协议', field: 'versionAgreement' },
{ title: '版本日期', field: 'versionDate' },
{ title: '归档日期', field: 'updateTime' },
{ title: '描述', field: 'description' },
{ title: '状态', field: 'statusName' },
{
title: '操作',
align: 'center',
width: '130',
render: 'buttons',
buttons: [
{
name: 'edit',
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'tipButton',
click: row => {
popupVersionRef.value.open('编辑版本', row)
}
},
{
name: 'edit',
title: '启用',
type: 'success',
icon: 'el-icon-Open',
render: 'tipButton',
disabled: row => {
return row.status == 1
},
click: row => {
auditEdData({
id: row.id,
status: 1
}).then((res: any) => {
ElMessage.success('启用成功')
tableStore.index()
})
}
},
{
name: 'del',
title: '禁用',
type: 'danger',
icon: 'el-icon-SwitchButton',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定禁用吗?'
},
disabled: row => {
return row.status == 0
},
click: row => {
auditEdData({
id: row.id,
status: 0
}).then((res: any) => {
ElMessage.success('禁用成功')
tableStore.index()
})
}
}
]
}
],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
item.statusName = item.status === 1 ? '启用' : '禁用'
for (let key in item) {
if (typeof item[key] !== 'number') {
item[key] = item[key] || '/'
}
}
})
}
})
tableStore.table.params.devType = ''
provide('tableStore', tableStore)
tableStore.table.params.searchState = 0
onMounted(() => {
tableStore.index()
tableHeaderRef.value.onComSearch()
})
const addMenu = () => {}
const addMenu = () => {
popupVersionRef.value.open('新增版本')
}
</script>