绘制并联调icd文件管理页面
绘制并联调终端型号管理页面
This commit is contained in:
@@ -1,27 +1,9 @@
|
||||
<template>
|
||||
<el-dialog draggable width="600px" v-model="dialogVisible" :title="title">
|
||||
<el-dialog draggable width="400px" v-model="dialogVisible" :title="title">
|
||||
<el-form :inline="false" :model="form" label-width="auto" class="form-one" :rules="rules" ref="formRef">
|
||||
<el-form-item label="文件名称" prop="name">
|
||||
<el-input
|
||||
v-model.trim="form.name"
|
||||
clearable
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
placeholder="请输入icd文件名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="存储的地址" prop="path">
|
||||
<el-input
|
||||
v-model.trim="form.path"
|
||||
clearable
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
placeholder="请输入icd文件名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件" prop="path">
|
||||
<el-form-item label="icd文件">
|
||||
<el-upload
|
||||
v-model:file-list="form.reportPath"
|
||||
v-model:file-list="reportPath"
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
accept=""
|
||||
@@ -46,42 +28,44 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject, onMounted } from 'vue'
|
||||
import { uploadFile } from '@/api/system-boot/file'
|
||||
import { reactive } from 'vue'
|
||||
import { getActionClasses, addTimer, updateTimer } from '@/api/system-boot/csDictData'
|
||||
import { UploadInstance, UploadProps, UploadRawFile, ElMessage, genFileId } from 'element-plus'
|
||||
import { addIcdPath, updateIcdPath } from '@/api/device-boot/icd'
|
||||
|
||||
const emit = defineEmits(['submit'])
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive<anyObj>({
|
||||
cron: '',
|
||||
path: '',
|
||||
reportPath: []
|
||||
fileName: '',
|
||||
filePath: '',
|
||||
id: ''
|
||||
})
|
||||
const reportPath: any = ref([])
|
||||
const formRef = ref()
|
||||
const rules = {
|
||||
path: [{ required: true, message: '请选择任务执行器', trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入任务名称', trigger: 'blur' }]
|
||||
fileName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
const open = (text: string, data?: any) => {
|
||||
reportPath.value = []
|
||||
title.value = text
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
// 表单赋值
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
}
|
||||
} else {
|
||||
// 在此处恢复默认表单
|
||||
for (let key in form) {
|
||||
key == 'sort' ? (form[key] = 100) : (form[key] = '')
|
||||
}
|
||||
if (data?.path) {
|
||||
reportPath.value = [
|
||||
{
|
||||
name: data?.path.split('/icd/')[1]
|
||||
}
|
||||
]
|
||||
}
|
||||
form.fileName = data?.name
|
||||
form.id = data?.id
|
||||
form.filePath = data?.path
|
||||
}
|
||||
// 上传报告
|
||||
const uploadRef = ref()
|
||||
|
||||
const handleExceed: UploadProps['onExceed'] = files => {
|
||||
uploadRef.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
@@ -91,30 +75,41 @@ const handleExceed: UploadProps['onExceed'] = files => {
|
||||
|
||||
//移除文件上传
|
||||
const removeFile = (file: any, uploadFiles: any) => {
|
||||
console.log(file, uploadFiles)
|
||||
form.filePath = ''
|
||||
}
|
||||
onMounted(() => {})
|
||||
const submit = () => {
|
||||
console.log('🚀 ~ form:', form)
|
||||
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (title.value == '新增定时任务') {
|
||||
// addTimer(form).then(res => {
|
||||
// ElMessage.success('新增成功')
|
||||
// dialogVisible.value = false
|
||||
// emit('submit')
|
||||
// })
|
||||
} else {
|
||||
// updateTimer(form).then(res => {
|
||||
// ElMessage.success('新增成功')
|
||||
// dialogVisible.value = false
|
||||
// emit('submit')
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
const submit = async () => {
|
||||
console.log(123, reportPath.value[0]?.raw)
|
||||
if (reportPath.value.length == 0) {
|
||||
return ElMessage.warning('请上传icd文件')
|
||||
}
|
||||
if (reportPath.value[0]?.raw != undefined) {
|
||||
await uploadFile(reportPath.value[0].raw, '/icd/').then(res => {
|
||||
//治理工程验收报告
|
||||
form.fileName = res.data.fileName.split('.')[0]
|
||||
form.filePath = res.data.name
|
||||
})
|
||||
}
|
||||
|
||||
if (title.value == '新增icd文件') {
|
||||
await addIcdPath(form).then(res => {
|
||||
ElMessage.success('新增成功!')
|
||||
dialogVisible.value = false
|
||||
emit('submit')
|
||||
})
|
||||
} else {
|
||||
await updateIcdPath(form).then(res => {
|
||||
ElMessage.success('编辑成功!')
|
||||
dialogVisible.value = false
|
||||
emit('submit')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-upload-list__item) {
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<taskForm ref="taskFormRef" @submit="tableStore.index()" />
|
||||
<taskForm ref="taskFormRef" v-if="taskFormFlag" @submit="tableStore.index()" />
|
||||
<!-- 补招 -->
|
||||
<el-dialog v-model="dialogVisible" title="选择补招时间" width="500">
|
||||
<el-date-picker
|
||||
@@ -42,9 +42,10 @@ import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import taskForm from './form.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
import { delIcdPath } from '@/api/device-boot/icd'
|
||||
defineOptions({
|
||||
name: 'icd'
|
||||
})
|
||||
@@ -54,15 +55,25 @@ const formDate = ref({
|
||||
})
|
||||
const taskFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const taskFormFlag = ref(false)
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/system-boot/timer/list',
|
||||
url: '/device-boot/icd/pageIcdList',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
column: [
|
||||
{ field: 'timerName', title: '文件名' },
|
||||
{ field: 'actionClass', title: '存储地址' },
|
||||
{ field: 'cron', title: '更新时间' },
|
||||
|
||||
{
|
||||
title: '序号',
|
||||
width: '80',
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{ field: 'name', title: 'icd名称' },
|
||||
{ field: 'path', title: 'icd路径', minWidth: 250 },
|
||||
{ field: 'createBy', title: '创建人' },
|
||||
{ field: 'createTime', title: '创建时间' },
|
||||
{ field: 'updateBy', title: '修改人' },
|
||||
{ field: 'updateTime', title: '修改时间' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '220',
|
||||
@@ -76,7 +87,27 @@ const tableStore: any = new TableStore({
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
taskFormRef.value.open('编辑icd文件', row)
|
||||
taskFormFlag.value = true
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('编辑icd文件', row)
|
||||
}, 10)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '下载',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: async row => {
|
||||
getFileNameAndFilePath({ filePath: row.path }).then(res => {
|
||||
const link = document.createElement('a')
|
||||
link.href = res.data.url
|
||||
link.download = res.data.name
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -93,7 +124,7 @@ const tableStore: any = new TableStore({
|
||||
title: '确定删除?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTimer([row.id]).then(res => {
|
||||
delIcdPath([row.id]).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
@@ -103,7 +134,9 @@ const tableStore: any = new TableStore({
|
||||
}
|
||||
],
|
||||
|
||||
loadCallback: () => {}
|
||||
loadCallback: () => {
|
||||
taskFormFlag.value = false
|
||||
}
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = ''
|
||||
@@ -111,6 +144,7 @@ tableStore.table.params.searchState = ''
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const add = () => {
|
||||
taskFormFlag.value = true
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('新增icd文件')
|
||||
}, 10)
|
||||
|
||||
81
src/views/system/modelManage/form.vue
Normal file
81
src/views/system/modelManage/form.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-dialog draggable width="400px" v-model="dialogVisible" :title="title">
|
||||
<el-form :inline="false" :model="form" label-width="auto" class="form-one" :rules="rules" ref="formRef">
|
||||
<el-form-item label="型号名称" prop="name">
|
||||
<el-input
|
||||
v-model.trim="form.name"
|
||||
clearable
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
placeholder="请输入型号名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联icd" prop="icdId">
|
||||
<el-select v-model="form.icdId" placeholder="选择关联icd">
|
||||
<el-option v-for="item in options" filterable :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject, onMounted } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { getIcdList } from '@/api/device-boot/icd'
|
||||
import { addDevType, updateDevType } from '@/api/device-boot/modelManage'
|
||||
import { UploadInstance, UploadProps, UploadRawFile, ElMessage, genFileId } from 'element-plus'
|
||||
const emit = defineEmits(['submit'])
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
const formRef = ref()
|
||||
const form = reactive<anyObj>({
|
||||
name: '',
|
||||
icdId: '',
|
||||
id:''
|
||||
})
|
||||
const options: any = ref([])
|
||||
const rules = {
|
||||
icdId: [{ required: true, message: '请选择关联icd', trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入型号名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
getIcdList().then(res => {
|
||||
options.value = res.data
|
||||
})
|
||||
form.icdId = data?.icdId
|
||||
form.name = data?.name
|
||||
form.id = data?.id
|
||||
title.value = text
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (title.value == '新增终端型号') {
|
||||
addDevType(form).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
dialogVisible.value = false
|
||||
emit('submit')
|
||||
})
|
||||
} else {
|
||||
updateDevType(form).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
dialogVisible.value = false
|
||||
emit('submit')
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
155
src/views/system/modelManage/index.vue
Normal file
155
src/views/system/modelManage/index.vue
Normal file
@@ -0,0 +1,155 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<div>
|
||||
<TableHeader ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="终端型号名称">
|
||||
<el-input
|
||||
v-model="tableStore.table.params.searchValue"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
clearable
|
||||
placeholder="请输入任务名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<taskForm ref="taskFormRef" v-if="taskFormFlag" @submit="tableStore.index()" />
|
||||
<!-- 补招 -->
|
||||
<el-dialog v-model="dialogVisible" title="选择补招时间" width="500">
|
||||
<el-date-picker
|
||||
v-model="formDate.date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期"
|
||||
></el-date-picker>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="okRun">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<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 taskForm from './form.vue'
|
||||
import { delDevType } from '@/api/device-boot/modelManage'
|
||||
import { getIcdList } from '@/api/device-boot/icd'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
defineOptions({
|
||||
name: 'modelManage'
|
||||
})
|
||||
const formDate = ref({
|
||||
date: '',
|
||||
id: ''
|
||||
})
|
||||
const options = ref([])
|
||||
const taskFormFlag = ref(false)
|
||||
const taskFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/device-boot/devType/pageDevTypeList',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
column: [
|
||||
{
|
||||
title: '序号',
|
||||
width: '80',
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{ field: 'name', title: '型号名称' },
|
||||
{
|
||||
field: 'icdId',
|
||||
title: '关联icd',
|
||||
formatter: (row: any) => {
|
||||
return options.value.find((item: any) => item.id === row.cellValue)?.name
|
||||
}
|
||||
},
|
||||
{ field: 'createBy', title: '创建人' },
|
||||
{ field: 'createTime', title: '创建时间' },
|
||||
{ field: 'updateBy', title: '修改人' },
|
||||
{ field: 'updateTime', title: '修改时间' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '220',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
taskFormFlag.value = true
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('编辑终端型号', row)
|
||||
}, 10)
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: 'del',
|
||||
text: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除?'
|
||||
},
|
||||
click: row => {
|
||||
delDevType([row.id]).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
loadCallback: () => {
|
||||
taskFormFlag.value = true
|
||||
}
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = ''
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const add = () => {
|
||||
taskFormFlag.value = true
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('新增终端型号')
|
||||
}, 10)
|
||||
}
|
||||
const okRun = () => {
|
||||
runTimer(formDate.value).then(res => {
|
||||
ElMessage.success('操作成功')
|
||||
dialogVisible.value = false
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getIcdList().then(res => {
|
||||
options.value = res.data
|
||||
})
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user