Files
admin-govern/src/views/govern/manage/basic/version.vue

149 lines
5.2 KiB
Vue
Raw Normal View History

2024-01-22 19:13:58 +08:00
<template>
2024-01-23 14:14:26 +08:00
<div class="default-main">
<TableHeader ref="tableHeaderRef">
2024-01-23 14:05:03 +08:00
<template #select>
2024-01-23 14:14:26 +08:00
<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>
2024-01-23 14:05:03 +08:00
</el-select>
</el-form-item>
</template>
<template #operation>
2024-01-23 14:14:26 +08:00
<el-button :icon="Plus" type="primary" @click="addMenu" class="ml10">新增版本</el-button>
2024-01-23 14:05:03 +08:00
</template>
</TableHeader>
2024-01-23 14:14:26 +08:00
<Table ref="tableRef" />
<PopupVersion ref="popupVersionRef"></PopupVersion>
2024-01-22 19:13:58 +08:00
</div>
</template>
2024-01-23 14:14:26 +08:00
<script setup lang="ts">
2024-01-22 19:13:58 +08:00
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'
2024-01-23 14:05:03 +08:00
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'
2024-01-22 19:13:58 +08:00
defineOptions({
name: 'govern/manage/basic/version'
})
2024-01-23 14:05:03 +08:00
const popupVersionRef = ref()
const dictData = useDictData()
const DevTypeOptions = ref()
const tableHeaderRef = ref()
2024-01-23 14:14:26 +08:00
queryByCode('Direct_Connected_Device').then(res => {
2024-01-23 14:05:03 +08:00
console.log(res)
2024-01-23 14:14:26 +08:00
queryByid(res.data.id).then(res => {
2024-01-23 14:05:03 +08:00
DevTypeOptions.value = res.data
})
})
2024-01-22 19:13:58 +08:00
const tableStore = new TableStore({
2024-01-23 14:05:03 +08:00
url: '/cs-device-boot/edData/queryEdDataPage',
2024-01-22 19:13:58 +08:00
method: 'POST',
column: [
2024-01-23 14:05:03 +08:00
{ 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] || '/'
}
}
})
}
2024-01-22 19:13:58 +08:00
})
2024-01-23 14:05:03 +08:00
tableStore.table.params.devType = ''
2024-01-22 19:13:58 +08:00
provide('tableStore', tableStore)
onMounted(() => {
2024-01-23 14:05:03 +08:00
tableHeaderRef.value.onComSearch()
2024-01-22 19:13:58 +08:00
})
2024-01-23 14:05:03 +08:00
const addMenu = () => {
popupVersionRef.value.open('新增版本')
}
2024-01-22 19:13:58 +08:00
</script>