联调案例库
This commit is contained in:
@@ -25,7 +25,7 @@ export const deleteyById = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libalgorithm/deleteyById',
|
||||
method: 'GET',
|
||||
params:data
|
||||
params: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ export const libcaseBeleteyById = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libcase/deleteyById',
|
||||
method: 'GET',
|
||||
params:data
|
||||
params: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
@@ -68,3 +68,72 @@ export const updateCaseLibrary = (data: any) => {
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 标准库查询
|
||||
*/
|
||||
export const queryAll = () => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libstandard/queryAll',
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 标准库删除
|
||||
*/
|
||||
export const deleteyLibstandard = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libstandard/deleteyById',
|
||||
method: 'GET',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 标准库新增
|
||||
*/
|
||||
export const libstandardAdd = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libstandard/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 标准库更新
|
||||
*/
|
||||
export const updateStandardLibrary = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libstandard/updateStandardLibrary',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 模版更新
|
||||
*/
|
||||
export const updateTemplate = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libtemplate/updateTemplate',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 新增模版
|
||||
*/
|
||||
export const libtemplateAdd = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libtemplate/add',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 新增删除
|
||||
*/
|
||||
export const libtemplateDel = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libtemplate/deleteyById',
|
||||
method: 'GET',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -85,3 +85,4 @@ defineExpose({ loadData })
|
||||
border: 1px solid var(--el-border-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
<template>
|
||||
<div class="point-tree">
|
||||
<div style="flex: 1; overflow: hidden">
|
||||
<Tree ref="treeRef" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" />
|
||||
<Tree
|
||||
ref="treeRef"
|
||||
:data="tree"
|
||||
:canExpand="false"
|
||||
style="width: 100%; height: 100%"
|
||||
v-bind="$attrs"
|
||||
default-expand-all
|
||||
@onAddTree="onAddTree"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -13,11 +21,11 @@ import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree'
|
||||
import { useConfig } from '@/stores/config'
|
||||
|
||||
import { queryAll } from '@/api/supervision-boot/database/index'
|
||||
defineOptions({
|
||||
name: 'pms/pointTree'
|
||||
})
|
||||
const emit = defineEmits(['init'])
|
||||
const emit = defineEmits(['init', 'onAddTree'])
|
||||
const attrs = useAttrs()
|
||||
const adminInfo = useAdminInfo()
|
||||
const dictData = useDictData()
|
||||
@@ -26,48 +34,45 @@ const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Ty
|
||||
const tree = ref()
|
||||
const treeRef = ref()
|
||||
|
||||
const loadData = () => {
|
||||
const loadData = (id?: any) => {
|
||||
console.log('🚀 ~ loadData ~ id:', id)
|
||||
let nodeKey = ''
|
||||
let res = {
|
||||
data: [
|
||||
{
|
||||
name: '运行管理',
|
||||
id: '1',
|
||||
children: [
|
||||
{
|
||||
name: '运行指标',
|
||||
id: '2'
|
||||
},
|
||||
{
|
||||
name: '数据质量核查',
|
||||
id: '3'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
// getTerminalTreeForFive(form).then(res => {
|
||||
queryAll().then(res => {
|
||||
res.data.forEach((item: any) => {
|
||||
item.icon = 'el-icon-FolderOpened'
|
||||
item.color = config.getColorVal('elementUiPrimary')
|
||||
item.children.forEach((item2: any) => {
|
||||
item2.icon = 'el-icon-Document'
|
||||
item.color = config.getColorVal('elementUiPrimary')
|
||||
item2.color = config.getColorVal('elementUiPrimary')
|
||||
item2.childrens = item2.children
|
||||
item2.children = []
|
||||
if (item2.id == id) {
|
||||
emit('init', item2)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
nodeKey = res.data[0].children[0].id
|
||||
emit('init', res.data[0].children[0])
|
||||
nodeKey = res.data[0].children[0]?.id? res.data[0].children[0].id: res.data[0].id
|
||||
|
||||
tree.value = res.data
|
||||
if (nodeKey) {
|
||||
if (id) {
|
||||
setTimeout(() => {
|
||||
treeRef.value.treeRef.setCurrentKey(id)
|
||||
}, 10)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
treeRef.value.treeRef.setCurrentKey(nodeKey)
|
||||
emit('init', res.data[0].children[0])
|
||||
}, 10)
|
||||
}
|
||||
// })
|
||||
})
|
||||
}
|
||||
|
||||
const onAddTree = () => {
|
||||
emit('onAddTree')
|
||||
}
|
||||
loadData()
|
||||
defineExpose({ loadData })
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.point-tree {
|
||||
|
||||
165
src/views/pqs/database/standard/components/addTree.vue
Normal file
165
src/views/pqs/database/standard/components/addTree.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
|
||||
<el-scrollbar>
|
||||
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
|
||||
<el-form-item label="上级名称">
|
||||
<!-- <el-input v-model="form.pid" placeholder="上级名称" /> -->
|
||||
<!-- <el-tree-select
|
||||
v-model="form.pid"
|
||||
:data="dataTree"
|
||||
check-strictly
|
||||
clearable
|
||||
:render-after-expand="false"
|
||||
:props="defaultProps"
|
||||
/> -->
|
||||
<el-select v-model="form.pid" placeholder="请选择上级名称" clearable>
|
||||
<el-option v-for="item in dataTree" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="名称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="案例" v-if="form.pid?.length > 0">
|
||||
<el-upload v-model:file-list="urlList" action="" :limit="1" :auto-upload="false" multiple>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
<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 } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { queryAll, libstandardAdd, updateStandardLibrary } from '@/api/supervision-boot/database/index'
|
||||
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
const emit = defineEmits(['getTree', 'onSubmit'])
|
||||
const formRef = ref()
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive<anyObj>({
|
||||
name: '',
|
||||
pid: '',
|
||||
url: ''
|
||||
})
|
||||
const urlList: any = ref([])
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
const rules = {
|
||||
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
const dataTree: any = ref([])
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
getTheTree()
|
||||
title.value = text
|
||||
urlList.value = []
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
// 表单赋值
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
}
|
||||
form.id = data.id
|
||||
if (form.pid == 0) {
|
||||
form.pid = ''
|
||||
}
|
||||
if (data.url?.length > 0) {
|
||||
getFileNameAndFilePath({ filePath: data.url }).then(res => {
|
||||
urlList.value.push({
|
||||
name: res.data.fileName,
|
||||
url: res.data.name
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 在此处恢复默认表单
|
||||
for (let key in form) {
|
||||
form[key] = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
const getTheTree = () => {
|
||||
queryAll().then(res => {
|
||||
dataTree.value = res.data
|
||||
})
|
||||
}
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (urlList.value.length > 0 && form.pid != '') {
|
||||
const promises = urlList.value.map(async (item: any) => {
|
||||
if (urlList.value[0].raw) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uploadFile(item.raw, '/supervision/')
|
||||
.then((res: any) => {
|
||||
resolve(res.data.name)
|
||||
})
|
||||
.catch(reject)
|
||||
})
|
||||
} else {
|
||||
return item.url
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
const fileNames = await Promise.all(promises)
|
||||
form.url = fileNames.join(',') + ''
|
||||
} catch (error) {
|
||||
console.error('上传文件出错', error)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
form.url = ''
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (title.value == '新增') {
|
||||
libstandardAdd({
|
||||
pid: form.pid == '' ? '' : form.pid,
|
||||
name: form.name,
|
||||
url: form.url
|
||||
}).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
handleClose()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
updateStandardLibrary({
|
||||
pid: form.pid == '' ? '' : form.pid,
|
||||
name: form.name,
|
||||
url: form.url,
|
||||
id: form.id
|
||||
}).then(res => {
|
||||
ElMessage.success('修改成功')
|
||||
handleClose()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleClose = () => {
|
||||
urlList.value = []
|
||||
emit('onSubmit')
|
||||
dialogVisible.value = false
|
||||
}
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-upload-list__item) {
|
||||
width: 400px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,10 +1,11 @@
|
||||
<template>
|
||||
<div class="default-main" :style="height">
|
||||
<!-- 标准库 -->
|
||||
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<standardTree
|
||||
:default-expand-all="false"
|
||||
ref="treeRef"
|
||||
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
|
||||
:current-node-key="monitoringPoint.state.lineId"
|
||||
@node-click="handleNodeClick"
|
||||
@@ -13,13 +14,32 @@
|
||||
</pane>
|
||||
<pane style="background: #fff" :style="height">
|
||||
<div class="pd10" style="display: flex; justify-content: end">
|
||||
<el-button icon="el-icon-Plus" type="primary">新增</el-button>
|
||||
<el-button icon="el-icon-Edit" type="primary">修改</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary">删除</el-button>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button>
|
||||
<el-button icon="el-icon-Edit" type="primary" @click="editUser">修改</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
|
||||
</div>
|
||||
<el-empty
|
||||
v-if="url.length == 0"
|
||||
description="暂无数据"
|
||||
class="custom-empty"
|
||||
:style="`height: calc(${height.height} - 60px);`"
|
||||
/>
|
||||
<div :style="`height: calc(${height.height} - 60px);overflow: auto;`" v-else>
|
||||
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
|
||||
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" />
|
||||
<vue-office-pdf v-if="url.includes('.pdf')" :src="url" />
|
||||
<img
|
||||
v-if="
|
||||
url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')
|
||||
"
|
||||
:src="url"
|
||||
/>
|
||||
</div>
|
||||
<div :style="`height: calc(${height.height} - 60px) `"></div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
<!-- 新增 -->
|
||||
|
||||
<addTree ref="addTreeRef" @onSubmit="treeRef.loadData(dotList.id)"></addTree>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -28,22 +48,29 @@ import 'splitpanes/dist/splitpanes.css'
|
||||
import { Splitpanes, Pane } from 'splitpanes'
|
||||
import standardTree from '@/components/tree/pqs/standardTree.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getLineExport, getList, selectReleation } from '@/api/event-boot/report'
|
||||
import addTree from './components/addTree.vue'
|
||||
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
//引入相关样式
|
||||
import '@vue-office/excel/lib/index.css'
|
||||
//引入VueOfficeDocx组件
|
||||
import VueOfficeDocx from '@vue-office/docx'
|
||||
import VueOfficeExcel from '@vue-office/excel'
|
||||
//引入VueOfficePdf组件
|
||||
import VueOfficePdf from '@vue-office/pdf'
|
||||
import { deleteyLibstandard } from '@/api/supervision-boot/database/index'
|
||||
|
||||
defineOptions({
|
||||
name: 'database/standard'
|
||||
})
|
||||
const monitoringPoint = useMonitoringPoint()
|
||||
const height = mainHeight(20)
|
||||
const size = ref(0)
|
||||
|
||||
const TableHeaderRef = ref()
|
||||
const dotList: any = ref({
|
||||
name: monitoringPoint.state.lineName.split('>')[3],
|
||||
id: monitoringPoint.state.lineId,
|
||||
level: 6
|
||||
})
|
||||
const treeRef = ref()
|
||||
const addTreeRef = ref()
|
||||
const url = ref('')
|
||||
const dotList: any = ref({})
|
||||
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
@@ -54,9 +81,37 @@ onMounted(() => {
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
dotList.value = data
|
||||
url.value = ''
|
||||
if (data?.url != null && data?.url != '') {
|
||||
getFileNameAndFilePath({ filePath: data.url }).then(res => {
|
||||
url.value = res.data.url
|
||||
})
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
const deleteEven = () => {
|
||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteyLibstandard({ id: dotList.value.id }).then(() => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
treeRef.value.loadData()
|
||||
})
|
||||
})
|
||||
}
|
||||
const addUser = () => {
|
||||
addTreeRef.value.open('新增')
|
||||
}
|
||||
const editUser = () => {
|
||||
addTreeRef.value.open('修改', dotList.value)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background: #eaeef1;
|
||||
}
|
||||
@@ -86,4 +141,19 @@ const handleNodeClick = (data: any, node: any) => {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
/* 自定义 el-empty 的样式 */
|
||||
:deep(.custom-empty) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%; /* 调整高度 */
|
||||
padding: 20px; /* 调整内边距 */
|
||||
.el-empty__image {
|
||||
display: none; /* 隐藏默认图片 */
|
||||
}
|
||||
.el-empty__description {
|
||||
font-size: 14px; /* 调整字体大小 */
|
||||
color: var(--vxe-font-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,55 +1,14 @@
|
||||
<template>
|
||||
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="1200px">
|
||||
<el-dialog draggable class="cn-operate-dialog" v-model="dialogVisible" :title="title" width="700px">
|
||||
<el-scrollbar>
|
||||
<el-form :inline="false" :model="form" class="form-two" label-width="auto" :rules="rules" ref="formRef">
|
||||
<el-form-item label="事件名称">
|
||||
<el-input v-model="form.name" placeholder="请输入事件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发生事件">
|
||||
<el-input v-model="form.code" placeholder="请输入发生事件" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发生地点">
|
||||
<el-input v-model="form.remark" placeholder="请输入发生地点" />
|
||||
<el-form :inline="false" :model="form" label-width="auto" :rules="rules" ref="formRef">
|
||||
<el-form-item label="模版名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入模版名称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="事件简介">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入事件简介"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="事件经过">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入事件经过"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理措施">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入处理措施"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="治理效果">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入治理效果"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件">
|
||||
<el-upload v-model:file-list="fileList" action="" multiple :limit="3" :on-exceed="handleExceed">
|
||||
<el-button type="primary">Click to upload</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">jpg/png files with a size less than 500KB.</div>
|
||||
</template>
|
||||
<el-form-item label="模版">
|
||||
<el-upload v-model:file-list="urlList" action="" :limit="1" :auto-upload="false" multiple>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -66,35 +25,46 @@
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除
|
||||
|
||||
import { libtemplateAdd, updateTemplate } from '@/api/supervision-boot/database/index'
|
||||
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const emit = defineEmits([ 'onSubmit'])
|
||||
const formRef = ref()
|
||||
const fileList = ref([])
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive<anyObj>({
|
||||
code: '',
|
||||
name: '',
|
||||
remark: '',
|
||||
id: ''
|
||||
url: ''
|
||||
})
|
||||
const rules = {
|
||||
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }]
|
||||
const urlList: any = ref([])
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
|
||||
const handleExceed = (files: any, uploadFiles: any) => {}
|
||||
|
||||
const rules = {
|
||||
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
const dataTree: any = ref([])
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
title.value = text
|
||||
urlList.value = []
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
// 表单赋值
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
}
|
||||
form.id = data.id
|
||||
|
||||
if (data.url?.length > 0) {
|
||||
getFileNameAndFilePath({ filePath: data.url }).then(res => {
|
||||
urlList.value.push({
|
||||
name: res.data.fileName,
|
||||
url: res.data.name
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 在此处恢复默认表单
|
||||
for (let key in form) {
|
||||
@@ -102,20 +72,70 @@ const open = (text: string, data?: anyObj) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (form.id) {
|
||||
// await update(form)
|
||||
if (urlList.value.length > 0) {
|
||||
const promises = urlList.value.map(async (item: any) => {
|
||||
if (urlList.value[0].raw) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uploadFile(item.raw, '/supervision/')
|
||||
.then((res: any) => {
|
||||
resolve(res.data.name)
|
||||
})
|
||||
.catch(reject)
|
||||
})
|
||||
} else {
|
||||
// await create(form)
|
||||
return item.url
|
||||
}
|
||||
ElMessage.success('保存成功')
|
||||
tableStore.index()
|
||||
})
|
||||
|
||||
try {
|
||||
const fileNames = await Promise.all(promises)
|
||||
form.url = fileNames.join(',') + ''
|
||||
} catch (error) {
|
||||
console.error('上传文件出错', error)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
form.url = ''
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (title.value == '新增模版') {
|
||||
libtemplateAdd({
|
||||
name: form.name,
|
||||
url: form.url
|
||||
}).then(res => {
|
||||
ElMessage.success('新增成功')
|
||||
handleClose()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else {
|
||||
updateTemplate({
|
||||
name: form.name,
|
||||
url: form.url,
|
||||
id: form.id
|
||||
}).then(res => {
|
||||
ElMessage.success('修改成功')
|
||||
handleClose()
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
urlList.value = []
|
||||
emit('onSubmit')
|
||||
dialogVisible.value = false
|
||||
}
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-upload-list__item) {
|
||||
width: 400px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</TableHeader>
|
||||
<Table ref="tableRef"></Table>
|
||||
<!-- 弹框 -->
|
||||
<PopupEdit ref="popupEditRef" />
|
||||
<PopupEdit ref="popupEditRef" @onSubmit="tableStore.index()" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -16,7 +16,8 @@ import { onMounted, ref, provide } from 'vue'
|
||||
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
|
||||
import { libtemplateDel } from '@/api/supervision-boot/database/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import PopupEdit from './components/form.vue'
|
||||
defineOptions({
|
||||
@@ -28,52 +29,72 @@ const popupEditRef = ref()
|
||||
const TableHeaderRef = ref()
|
||||
|
||||
const tableStore = new TableStore({
|
||||
url: '/user-boot/dept/deptTree',
|
||||
url: '/supervision-boot/libtemplate/pageQuery',
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ title: '模版名称', field: 'name' },
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'name1'
|
||||
},
|
||||
// {
|
||||
// title: '发生地点',
|
||||
// field: 'name2'
|
||||
// },
|
||||
// {
|
||||
// title: '处理措施',
|
||||
// field: 'name3'
|
||||
// },
|
||||
// {
|
||||
// title: '治理效果',
|
||||
// field: 'name4'
|
||||
// }
|
||||
],
|
||||
loadCallback: () => {
|
||||
tableStore.table.data = [
|
||||
{
|
||||
name: '测试名称',
|
||||
name1: 'xxx',
|
||||
name2: 'XXX',
|
||||
name3: '1月',
|
||||
name4: '单体系统',
|
||||
name5: '1'
|
||||
field: 'createTime'
|
||||
},
|
||||
{
|
||||
name: '测试名称',
|
||||
name1: 'xxx',
|
||||
name2: 'XXX',
|
||||
name3: '1月',
|
||||
name4: '单体系统',
|
||||
name5: '0'
|
||||
title: '操作',
|
||||
width: '280',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '预览 ',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '下载 ',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '修改 ',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
popupEditRef.value.open('修改模版', row)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除吗?'
|
||||
},
|
||||
click: row => {
|
||||
libtemplateDel({ id: row.id }).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
loadCallback: () => {}
|
||||
})
|
||||
|
||||
// 弹框
|
||||
const addUser = () => {
|
||||
popupEditRef.value.open('新增案例')
|
||||
popupEditRef.value.open('新增模版')
|
||||
}
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
@@ -560,7 +560,7 @@
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="close()">取消</el-button>
|
||||
<el-button type="primary" @click="confirmForm(true)">保存</el-button>
|
||||
<el-button type="primary" v-if="control" @click="confirmForm(false)">提交审批</el-button>
|
||||
<el-button type="primary" v-if="props.openType != 'create'" @click="confirmForm(false)">提交审批</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -567,9 +567,8 @@ const getInfo = async () => {
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
if (props.openType == 'sourcesOfInterference') {
|
||||
|
||||
queryFiles()
|
||||
}
|
||||
}
|
||||
const proviteData = ref()
|
||||
//可研报告
|
||||
|
||||
@@ -141,7 +141,7 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.importType != null || !row.processInstanceId
|
||||
return row.importType != 0 || !row.processInstanceId
|
||||
},
|
||||
click: row => {
|
||||
flag.value = true
|
||||
|
||||
Reference in New Issue
Block a user