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

108 lines
3.8 KiB
Vue
Raw Normal View History

2024-01-22 19:13:58 +08:00
<template>
<div class="default-main" v-loading="loading">
2024-01-23 14:14:26 +08:00
<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="模版名称">
2024-12-25 10:53:07 +08:00
<el-input maxlength="32" show-word-limit v-model.trim="tableStore.table.params.name" clearable
2024-12-13 14:36:23 +08:00
placeholder="请输入名称"></el-input>
2024-01-23 14:05:03 +08:00
</el-form-item>
2024-01-23 14:14:26 +08:00
<el-form-item label="装置型号">
2024-12-25 10:53:07 +08:00
<el-select v-model.trim="tableStore.table.params.devType" placeholder="请选择" clearable>
2024-12-13 14:36:23 +08:00
<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-12-13 14:36:23 +08:00
<el-upload action="" class="upload-demo" :show-file-list="false" :auto-upload="false"
:on-change="chooseFile">
2024-01-23 14:14:26 +08:00
<el-button :icon="Plus" type="primary" class="ml10">新增模版</el-button>
2024-01-23 14:05:03 +08:00
</el-upload>
</template>
</TableHeader>
2024-01-23 14:14:26 +08:00
<Table ref="tableRef" />
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 { ElMessage } from 'element-plus'
import { queryByCode, queryByid } from '@/api/system-boot/dictTree'
import { Plus } from '@element-plus/icons-vue'
import { addDevModel } from '@/api/access-boot/analyzeModel'
import { AuditDevModel } from '@/api/cs-device-boot/devmodel'
2024-01-22 19:13:58 +08:00
defineOptions({
name: 'govern/manage/basic/template'
})
2024-01-23 14:05:03 +08:00
const DevTypeOptions = ref()
const tableHeaderRef = ref()
2024-01-23 14:14:26 +08:00
queryByCode('Direct_Connected_Device').then(res => {
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/devmodel/queryDevModelPage',
2024-01-22 19:13:58 +08:00
method: 'POST',
column: [
2024-01-23 14:05:03 +08:00
{ title: '装置型号', field: 'devTypeName' },
{ title: '模板名称', field: 'name' },
{ title: '版本号', field: 'versionNo' },
2025-07-15 16:31:06 +08:00
{ title: '版本时间', field: 'versionDate', sortable: true },
2024-01-23 14:05:03 +08:00
{
title: '操作',
align: 'center',
2024-01-30 14:11:29 +08:00
width: '180',
2024-01-23 14:05:03 +08:00
render: 'buttons',
buttons: [
{
name: 'del',
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除吗?'
},
click: row => {
AuditDevModel({
id: row.id,
status: 0
}).then(() => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
2024-01-23 14:14:26 +08:00
]
2024-01-22 19:13:58 +08:00
})
2024-01-23 14:05:03 +08:00
tableStore.table.params.devType = ''
tableStore.table.params.name = ''
2024-01-22 19:13:58 +08:00
provide('tableStore', tableStore)
onMounted(() => {
tableStore.index()
})
const loading = ref(false)
2024-01-23 14:05:03 +08:00
const chooseFile = (e: any) => {
console.warn(e)
loading.value = true
2024-01-23 14:05:03 +08:00
addDevModel(e.raw).then((res: any) => {
2024-12-13 14:36:23 +08:00
if (res.code == 'A0000') {
loading.value = false
tableStore.index()
}
2024-12-13 14:36:23 +08:00
}).catch((e) => {
loading.value = false
2024-01-23 14:05:03 +08:00
})
}
2024-01-22 19:13:58 +08:00
</script>