添加海南技术监督
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button icon="el-icon-Check" type="primary" @click="preserve">保存</el-button>
|
||||
<el-button icon="el-icon-Grid" type="primary" @click="dialogVisible = true">配置保存年限</el-button>
|
||||
<div class="mt10" :style="`height: calc(${height} - 43px)`">
|
||||
<vxe-table
|
||||
v-bind="defaultAttribute"
|
||||
height="auto"
|
||||
ref="tableRef"
|
||||
:data="tableData"
|
||||
:tree-config="{ children: 'children' }"
|
||||
:edit-config="{ trigger: 'click', mode: 'cell' }"
|
||||
>
|
||||
<vxe-table-column field="name" align="left" title="部门" tree-node></vxe-table-column>
|
||||
|
||||
<vxe-table-column
|
||||
field="proportion"
|
||||
title="占比(%)"
|
||||
:edit-render="{
|
||||
name: '$input',
|
||||
props: { type: 'float', digits: 2, max: 100, min: 0 }
|
||||
}"
|
||||
></vxe-table-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<el-dialog draggable v-model="dialogVisible" title="年限设置" width="500" :before-close="handleClose">
|
||||
<el-input-number v-model="num" :min="0" :max="1000" />
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="define">保存</el-button>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getAreaList } from '@/api/common'
|
||||
import { addPlanConfig, addPlanCycle, queryPlanConfig } from '@/api/process-boot/generalTest'
|
||||
const dialogVisible = ref(false)
|
||||
const num = ref(0)
|
||||
const tableRef = ref()
|
||||
const height = mainHeight(80).height
|
||||
const tableData: any = ref([])
|
||||
const treeData = ref([])
|
||||
const treeList: any = ref([])
|
||||
const info = async () => {
|
||||
await queryPlanConfig().then(res => {
|
||||
treeData.value = res.data
|
||||
})
|
||||
await getAreaList().then((res: any) => {
|
||||
tableData.value = circulationTreeData(res.data)
|
||||
setTimeout(() => {
|
||||
tableRef.value.setAllTreeExpand(true)
|
||||
}, 0)
|
||||
})
|
||||
}
|
||||
const circulationTreeData = (rows: any) => {
|
||||
let children: any = []
|
||||
|
||||
rows.forEach((item: any) => {
|
||||
let proportion = 0
|
||||
treeData.value.forEach((val: any) => {
|
||||
if (val.orgId == item.id) {
|
||||
proportion = val.proportion
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
if (item.children && item.children.length > 0) {
|
||||
children.push({
|
||||
name: item.name,
|
||||
id: item.id,
|
||||
proportion: proportion,
|
||||
children: circulationTreeData(item.children)
|
||||
})
|
||||
} else {
|
||||
children.push({
|
||||
name: item.name,
|
||||
id: item.id,
|
||||
proportion: proportion
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return children
|
||||
}
|
||||
const preserve = () => {
|
||||
treeList.value = []
|
||||
circulation(tableData.value)
|
||||
setTimeout(() => {
|
||||
addPlanConfig(treeList.value).then(res => {
|
||||
ElMessage.success('保存成功!')
|
||||
info()
|
||||
})
|
||||
}, 0)
|
||||
}
|
||||
// 保存配置
|
||||
const define = () => {
|
||||
addPlanCycle({
|
||||
cycleNum: num.value
|
||||
}).then(res => {
|
||||
if (res.data.flag == true) {
|
||||
ElMessage.success('年限设置成功!')
|
||||
handleClose()
|
||||
} else {
|
||||
ElMessage.warning(`本次普测计划周期还未结束,请在 ${res.data.endYear} 后设置!`)
|
||||
}
|
||||
})
|
||||
}
|
||||
const circulation = (rows: any) => {
|
||||
let children: any = []
|
||||
|
||||
rows.forEach((item: any) => {
|
||||
treeList.value.push({
|
||||
orgName: item.name,
|
||||
orgId: item.id,
|
||||
proportion: item.proportion
|
||||
})
|
||||
if (item.children && item.children.length > 0) {
|
||||
circulation(item.children)
|
||||
}
|
||||
})
|
||||
|
||||
return children
|
||||
}
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
num.value = 0
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
info()
|
||||
})
|
||||
</script>
|
||||
186
src/views/pqs/supervise_jb/harmonicSurvey/components/outcome.vue
Normal file
186
src/views/pqs/supervise_jb/harmonicSurvey/components/outcome.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div>
|
||||
<TableHeader area datePicker ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="是否上传">
|
||||
<el-select v-model="tableStore.table.params.isFileUpload" placeholder="请选择是否上传">
|
||||
<el-option label="未上传" value="0" />
|
||||
<el-option label="已上传" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Upload" type="primary">上传</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary">导出</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<!-- 上传弹窗 -->
|
||||
<el-dialog draggable title="上传" v-model="addUpload" width="500px">
|
||||
<el-upload
|
||||
multiple
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:limit="999"
|
||||
:file-list="fileList"
|
||||
:on-remove="handleRemove"
|
||||
:on-change="chooseBatch"
|
||||
ref="upload"
|
||||
>
|
||||
<el-button type="primary" icon="el-icon-Upload">选择文件</el-button>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="BatchUpload">保存</el-button>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 文件查看 -->
|
||||
<el-dialog draggable title="文件查看" v-model="dataShow" width="600px">
|
||||
<vxe-table height="400" auto-resize :data="uploadList" v-bind="defaultAttribute">
|
||||
<vxe-column field="minFileName" title="文件名称"></vxe-column>
|
||||
|
||||
<vxe-column title="操作" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" size="small" link @click="downLownFn(row)">下载</el-button>
|
||||
<!-- <el-popconfirm title="是否确认删除策略!" @confirm="details(row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm> -->
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, nextTick } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { MultipartFile, surveyResultDownload } from '@/api/process-boot/generalTest'
|
||||
|
||||
const dictData = useDictData()
|
||||
|
||||
const addUpload = ref(false)
|
||||
const dataShow = ref(false)
|
||||
const TableHeaderRef = ref()
|
||||
const fileList: any = ref([])
|
||||
const uploadList: any = ref([])
|
||||
|
||||
const planId = ref('')
|
||||
const tableStore = new TableStore({
|
||||
url: '/process-boot/rGeneralSurveyPlan/queryPlanResult',
|
||||
publicHeight: 65,
|
||||
method: 'POST',
|
||||
column: [
|
||||
// { width: '60', type: 'checkbox' },
|
||||
{ field: 'orgName', title: '责任单位' },
|
||||
{ field: 'planNo', title: '普测计划编号' },
|
||||
{ field: 'planName', title: '普测计划名称' },
|
||||
{ field: 'planStartTime', title: '开始时间' },
|
||||
{ field: 'planEndTime', title: '结束时间' },
|
||||
{ field: 'subCount', title: '普测变电站数量' },
|
||||
{
|
||||
field: 'isFileUpload',
|
||||
title: '是否上传',
|
||||
render: 'tag',
|
||||
custom: {
|
||||
0: 'warning',
|
||||
1: 'success'
|
||||
},
|
||||
replaceValue: {
|
||||
0: '否',
|
||||
1: '是'
|
||||
}
|
||||
},
|
||||
{ field: 'fileCount', title: '上传文件数量' },
|
||||
{ field: 'uploadTime', title: '上传时间' },
|
||||
{
|
||||
title: '操作文件',
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
title: '上传',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
planId.value = row.planNo
|
||||
addUpload.value = true
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '查看',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
disabled: row => {
|
||||
return row.isFileUpload !== 1
|
||||
},
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
surveyResultDownload({ planNo: row.planNo }).then(res => {
|
||||
uploadList.value = res.data
|
||||
dataShow.value = true
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.planStartTime = tableStore.table.params.searchBeginTime
|
||||
tableStore.table.params.planEndTime = tableStore.table.params.searchEndTime
|
||||
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
|
||||
tableStore.table.params.currentPage = tableStore.table.params.pageNum
|
||||
}
|
||||
})
|
||||
|
||||
tableStore.table.params.isFileUpload = ''
|
||||
|
||||
const handleRemove = (e: any) => {
|
||||
fileList.value = fileList.value.filter((item: any) => item.uid !== e.uid)
|
||||
}
|
||||
const chooseBatch = (e: any) => {
|
||||
fileList.value.push(e)
|
||||
}
|
||||
|
||||
// 上传
|
||||
const BatchUpload = () => {
|
||||
let form = new FormData()
|
||||
form.append('planId', planId.value)
|
||||
fileList.value.forEach((item: any) => {
|
||||
form.append('file', item.raw)
|
||||
})
|
||||
MultipartFile(form).then((res: any) => {
|
||||
ElMessage.success('上传成功!')
|
||||
handleClose()
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
const handleClose = () => {
|
||||
fileList.value = []
|
||||
addUpload.value = false
|
||||
}
|
||||
// 下载
|
||||
const downLownFn = async (row: any) => {
|
||||
let response = await fetch(row.minFileUrl)
|
||||
let blob = await response.blob()
|
||||
let a = document.createElement('a')
|
||||
a.href = window.URL.createObjectURL(blob)
|
||||
a.download = row.minFileName
|
||||
a.click()
|
||||
a.remove()
|
||||
}
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
335
src/views/pqs/supervise_jb/harmonicSurvey/components/planAdd.vue
Normal file
335
src/views/pqs/supervise_jb/harmonicSurvey/components/planAdd.vue
Normal file
@@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<el-dialog draggable :title="title" v-model="planAddition" width="500px" :before-close="cancelFn">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" scroll-to-error
|
||||
:validate-on-rule-change="false" class="form-one">
|
||||
<el-form-item for="-" label="计划负责单位:">
|
||||
<Area v-model="form.deptId" @change="changeArea" />
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划名称:" prop="planName">
|
||||
<el-input v-model="form.planName" placeholder="请输入计划名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="监督类型:" prop="supvType">
|
||||
<el-select v-model="form.supvType" placeholder="请选择监督类型" style="width: 100%" @change="++key">
|
||||
<el-option v-for="item in supvTypeOptionList" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="监督对象名称:" prop="supvObjectName">
|
||||
<el-input v-model="form.supvObjectName" placeholder="请输入监督对象名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划开始时间:" prop="planStartTime">
|
||||
<el-date-picker v-model="form.planStartTime" type="date" placeholder="选择计划开始时间"
|
||||
value-format="YYYY-MM-DD" :disabled-date="disableStartDate"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="计划结束时间:" prop="planEndTime">
|
||||
<el-date-picker v-model="form.planEndTime" type="date" placeholder="选择计划结束时间"
|
||||
:disabled-date="disableEndDate" value-format="YYYY-MM-DD"></el-date-picker>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item for="-" label="实际完成时间:" prop="planComplateTime">
|
||||
<el-date-picker
|
||||
v-model="form.planComplateTime"
|
||||
type="date"
|
||||
placeholder="选择实际完成时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item for="-" label="测试负责人:" prop="leader">
|
||||
<el-input v-model="form.leader" placeholder="请输入测试负责人"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item for="-" label="系统电站:" prop="customSubstationFlag">
|
||||
<!-- 默认值 开启 -->
|
||||
<el-radio-group v-model="form.customSubstationFlag" @change="changeSubstationFlag">
|
||||
<el-radio :value="0">是</el-radio>
|
||||
<el-radio :value="1">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :key="key" label="关联电站:" v-if="form.customSubstationFlag == 0" :prop="dynamicProp"
|
||||
style="display: flex; align-items: center">
|
||||
<el-cascader v-model="form.substation" :options="treeData" :props="defaultProps" clearable filterable
|
||||
collapse-tags collapse-tags-tooltip placeholder="请选择关联电站" />
|
||||
<!-- <el-tree-select
|
||||
accordion
|
||||
ref="treeRef"
|
||||
:default-expand-all="false"
|
||||
show-checkbox
|
||||
check-strictly
|
||||
:highlight-current="true"
|
||||
readonly
|
||||
node-key="id"
|
||||
:props="defaultProps"
|
||||
v-model="form.substation"
|
||||
:data="treeList"
|
||||
:render-after-expand="false"
|
||||
/> -->
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item for="-" label="关联电站:" :key="key" v-if="form.customSubstationFlag == 1" :prop="dynamicProp">
|
||||
<el-input v-model="form.substation" placeholder="请输入关联电站"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form :model="form" label-width="auto"> -->
|
||||
<!-- <el-form-item for="-" class="uploadFile" label="普测报告:" prop="fileList">
|
||||
<el-upload
|
||||
v-model:file-list="form.fileList"
|
||||
ref="upload"
|
||||
action=""
|
||||
:limit="5"
|
||||
:on-exceed="handleExceed"
|
||||
:auto-upload="false"
|
||||
:on-remove="removeFile"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item> -->
|
||||
<!-- </el-form> -->
|
||||
</el-form>
|
||||
<!-- <el-divider content-position="left" style="font-size: 18px; font-weight: bolder">添加电站</el-divider> -->
|
||||
<!-- <generalTestTree ref="treeRef" /> -->
|
||||
<!-- <div
|
||||
v-if="
|
||||
(title == '查看计划' || title == '计划审核') &&
|
||||
(title == '计划审核' || form.status == 1 || form.status == 3 || form.status == 4)
|
||||
"
|
||||
>
|
||||
<el-divider content-position="left" style="font-size: 18px; font-weight: bolder">审核意见</el-divider>
|
||||
<el-input
|
||||
:disabled="title != '计划审核'"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4 }"
|
||||
v-model="form.checkComment"
|
||||
></el-input>
|
||||
</div> -->
|
||||
<template #footer v-if="title != '查看计划'">
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancelFn">取消</el-button>
|
||||
|
||||
<el-button type="primary" @click="submitFn(true)" :loading="loading">保存</el-button>
|
||||
<el-button type="primary" @click="submitFn(false)" :loading="loading">提交审批</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, nextTick } from 'vue'
|
||||
import {
|
||||
addSurvey,
|
||||
auditSurvey,
|
||||
addSurveyPlan,
|
||||
getById,
|
||||
initDetpStataionTree,
|
||||
updateSurveyPlan
|
||||
} from '@/api/process-boot/generalTest'
|
||||
import Area from '@/components/form/area/index.vue'
|
||||
import { ElMessage, UploadProps } from 'element-plus'
|
||||
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
const emit = defineEmits(['onsubmit'])
|
||||
const loading = ref(false)
|
||||
const dictData = useDictData()
|
||||
const supvTypeOptionList = dictData.getBasicData('supv_type')
|
||||
const title = ref('')
|
||||
const planAddition = ref(false)
|
||||
const key: any = ref(0)
|
||||
const dynamicProp = computed(() => {
|
||||
// report_supervision
|
||||
let code = supvTypeOptionList.filter(item => item.id === form.value.supvType)[0]?.code
|
||||
return code == 'Technical_Super' ? '' : code == 'report_supervision' ? '' : 'substation'
|
||||
})
|
||||
|
||||
const defaultProps = ref({
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
checkStrictly: true,
|
||||
emitPath: false,
|
||||
expandTrigger: 'hover' as const,
|
||||
multiple: true
|
||||
})
|
||||
//开始时间不能大于结束时间
|
||||
const disableStartDate = (time: any) => {
|
||||
if (time && form.value.planEndTime) {
|
||||
return time.getTime() > new Date(form.value.planEndTime).getTime()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
//结束时间不能小于开始时间
|
||||
const disableEndDate = (time: any) => {
|
||||
if (time && form.value.planStartTime) {
|
||||
return time.getTime() <= new Date(form.value.planStartTime).getTime() - 8.64e7
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
const form: any = ref({
|
||||
// orgName: '',
|
||||
deptId: dictData.state.area[0].id,
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
planName: '',
|
||||
// fileList: [],
|
||||
// checkComment: '',
|
||||
// filePath: '',
|
||||
substation: '', //关联电站
|
||||
customSubstationFlag: 0 //电站类型
|
||||
})
|
||||
const props = {
|
||||
expandTrigger: 'hover' as const
|
||||
}
|
||||
const formRef = ref()
|
||||
const treeRef = ref()
|
||||
const rules = ref({
|
||||
planStartTime: [{ required: true, message: '选择计划开始时间', trigger: 'change' }],
|
||||
planEndTime: [{ required: true, message: '选择计划结束时间', trigger: 'change' }],
|
||||
supvType: [{ required: true, message: '请选择监督类型', trigger: 'change' }],
|
||||
planComplateTime: [{ required: true, message: '选择实际完成时间 ', trigger: 'change' }],
|
||||
supvObjectName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||
leader: [{ required: true, message: '请输入测试负责人', trigger: 'blur' }],
|
||||
substation: [{ required: true, message: '请选择关联电站', trigger: 'blur' }]
|
||||
// fileList: [{ required: true, message: '请上传文件', trigger: 'change' }],
|
||||
})
|
||||
const changeSubstationFlag = () => {
|
||||
console.log(form.value.customSubstationFlag)
|
||||
//处理所属变电站手都输入1/下拉数据0
|
||||
key.value += 1
|
||||
if (form.value.customSubstationFlag == 0) {
|
||||
rules.value.substation[0].message = '请选择关联电站'
|
||||
form.value.substation = []
|
||||
} else {
|
||||
rules.value.substation[0].message = '请输入关联电站'
|
||||
form.value.substation = ''
|
||||
}
|
||||
}
|
||||
const cancelFn = () => {
|
||||
formRef.value?.resetFields()
|
||||
// treeRef.value.setKey([])
|
||||
planAddition.value = false
|
||||
}
|
||||
const treeList = ref()
|
||||
const treeListCgy = ref()
|
||||
const treeData = ref()
|
||||
const loadData = () => {
|
||||
initDetpStataionTree({ orgId: dictData.state.area[0].id }).then(res => {
|
||||
treeList.value = res.data
|
||||
initDetpStataionTree({ orgId: 'a3069759b0b6072c99cf9a7af6c162e9' }).then(res => {
|
||||
treeListCgy.value = res.data
|
||||
setTimeout(() => {
|
||||
changeArea()
|
||||
}, 10)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const detailById = (id: any) => {
|
||||
getById(id).then(res => {
|
||||
form.value = res.data
|
||||
|
||||
form.value.substation =
|
||||
res.data.customSubstationFlag == 0 ? res.data.substation.split(',') : res.data.substation
|
||||
key.value += 1
|
||||
})
|
||||
}
|
||||
// 提交
|
||||
const submitFn = async (flag: boolean) => {
|
||||
loading.value = true
|
||||
if (flag) {
|
||||
const addForm = JSON.parse(JSON.stringify(form.value))
|
||||
|
||||
if (form.value.customSubstationFlag == 0) {
|
||||
addForm.substation = addForm.substation.length == 0 ? '' : addForm.substation.join(',')
|
||||
}
|
||||
addForm.saveOrCheckflag = '1'
|
||||
|
||||
await addSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
ElMessage.success('保存成功!')
|
||||
emit('onsubmit')
|
||||
})
|
||||
} else {
|
||||
formRef.value.validate(async (valid: any) => {
|
||||
if (valid) {
|
||||
//选择系统变电站
|
||||
const addForm = JSON.parse(JSON.stringify(form.value))
|
||||
if (form.value.customSubstationFlag == 0) {
|
||||
addForm.substation = addForm.substation.length == 0 ? '' : addForm.substation.join(',')
|
||||
}
|
||||
addForm.saveOrCheckflag = '2'
|
||||
if (title.value == '计划新增') {
|
||||
await addSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
ElMessage.success('计划新增成功!')
|
||||
emit('onsubmit')
|
||||
})
|
||||
} else {
|
||||
await updateSurveyPlan(addForm).then(res => {
|
||||
cancelFn()
|
||||
ElMessage.success('重新发起成功!')
|
||||
emit('onsubmit')
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
await setTimeout(() => {
|
||||
loading.value = false
|
||||
}, 0)
|
||||
}
|
||||
// 修改关联电站
|
||||
const changeArea = () => {
|
||||
let list: any = []
|
||||
|
||||
treeList.value.forEach((item: any) => {
|
||||
if (item.id == form.value.deptId) {
|
||||
list.push(item)
|
||||
if (item.id != treeListCgy.value[0].id && item.name != '冀北电力有限公司' && item.name != '超高压') {
|
||||
list.push(...treeListCgy.value)
|
||||
}
|
||||
} else {
|
||||
list.push(item.children.filter((v: any) => v.id == form.value.deptId)[0])
|
||||
if (form.value.deptId != treeListCgy.value[0].id) {
|
||||
list.push(...treeListCgy.value)
|
||||
}
|
||||
}
|
||||
})
|
||||
treeData.value = list
|
||||
}
|
||||
const audit = (filePath: any) => {
|
||||
return
|
||||
}
|
||||
// 上传文件
|
||||
// 文件数超出提示
|
||||
const handleExceed: UploadProps['onExceed'] = (): void => {
|
||||
ElMessage.error(`上传文件数量不能超过5个!`)
|
||||
}
|
||||
//移除文件上传
|
||||
const removeFile = (file: any, uploadFiles: any) => {
|
||||
console.log(file, uploadFiles)
|
||||
}
|
||||
const open = (text: string, id: any) => {
|
||||
loadData()
|
||||
form.value = Object.assign({
|
||||
// orgName: '',
|
||||
deptId: dictData.state.area[0].id,
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
planName: '',
|
||||
substation: '', //关联电站
|
||||
customSubstationFlag: 0 //电站类型
|
||||
})
|
||||
title.value = text
|
||||
planAddition.value = true
|
||||
setTimeout(() => {
|
||||
key.value += 1
|
||||
}, 10)
|
||||
if (id) {
|
||||
detailById(id)
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// :deep(.el-upload-list__item-info) {
|
||||
// width: 250px;
|
||||
// }</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<TableHeader area datePicker ref="TableHeaderRef" />
|
||||
<Table ref="tableRef" />
|
||||
<!-- 审核 -->
|
||||
<planAdd ref="planAddRef" @onsubmit="tableStore.index()" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, nextTick } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import planAdd from './planAdd.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
const dictData = useDictData()
|
||||
|
||||
const TableHeaderRef = ref()
|
||||
const planAddRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
url: '/process-boot/rGeneralSurveyPlan/queryPlanAudit',
|
||||
publicHeight: 65,
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ field: 'orgName', title: '所属单位' },
|
||||
{ field: 'planNo', title: '普测计划编号' },
|
||||
{ field: 'planName', title: '普测计划名称' },
|
||||
{ field: 'planStartTime', title: '开始时间' },
|
||||
{ field: 'planEndTime', title: '结束时间' },
|
||||
{ field: 'subCount', title: '普测变电站数量' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '120',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '审核',
|
||||
type: 'primary',
|
||||
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
planAddRef.value.open('计划审核', row)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.planStartTime = tableStore.table.params.searchBeginTime
|
||||
tableStore.table.params.planEndTime = tableStore.table.params.searchEndTime
|
||||
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
|
||||
tableStore.table.params.currentPage = tableStore.table.params.pageNum
|
||||
}
|
||||
})
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,336 @@
|
||||
<template>
|
||||
<TableHeader area datePicker nextFlag theCurrentTime ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="监督类型">
|
||||
<el-select v-model="tableStore.table.params.supvType" clearable placeholder="请选择流程状态">
|
||||
<el-option v-for="item in supvTypeOptionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="流程状态">
|
||||
<el-select v-model="tableStore.table.params.status" clearable placeholder="请选择流程状态">
|
||||
<el-option v-for="item in statusSelect" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增计划</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" :checkbox-config="checkboxConfig" />
|
||||
<!-- 新增 -->
|
||||
<planAdd ref="planAddRef" @onsubmit="tableStore.index()" :openType="openType" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
import { ref, onMounted, provide, watch, nextTick } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { cancel, getById } from '@/api/process-boot/generalTest'
|
||||
import planAdd from './planAdd.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { queryPlan, removeSurvey } from '@/api/process-boot/generalTest'
|
||||
import { getUserByRoleType } from '@/api/user-boot/user'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { deleteSurveyPlan } from '@/api/supervision-boot/delete/index'
|
||||
import { getUserReportById } from "@/api/supervision-boot/interfere";
|
||||
|
||||
const dictData = useDictData()
|
||||
const supvTypeOptionList = dictData.getBasicData('supv_type')
|
||||
const statusSelect = dictData.statusSelect()
|
||||
const { push, options, currentRoute } = useRouter()
|
||||
const dialogVisible = ref(false)
|
||||
const tableRef = ref()
|
||||
const planAddRef = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const auditList: any = ref([])
|
||||
const auditUser = ref('')
|
||||
const flag = ref(false)
|
||||
const openType = ref('create')
|
||||
const tableStore = new TableStore({
|
||||
url: '/supervision-boot/surveyPlan/surveyPlanPage',
|
||||
publicHeight: 65,
|
||||
method: 'POST',
|
||||
column: [
|
||||
{
|
||||
width: '60',
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
title: '序号',
|
||||
width: 60,
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'planName',
|
||||
title: '计划名称',
|
||||
minWidth: 130
|
||||
},
|
||||
{
|
||||
field: 'supvType',
|
||||
title: '监督类型',
|
||||
minWidth: 130,
|
||||
formatter: (row: any) => {
|
||||
return supvTypeOptionList.filter(item => item.id === row.cellValue)[0]?.name
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'supvObjectName',
|
||||
minWidth: 130,
|
||||
title: '监督对象名称'
|
||||
},
|
||||
{
|
||||
field: 'deptName',
|
||||
minWidth: 130,
|
||||
title: '负责单位'
|
||||
},
|
||||
{
|
||||
field: 'substation',
|
||||
title: '变电站',
|
||||
minWidth: 110,
|
||||
formatter: (row: any) => {
|
||||
return row.cellValue
|
||||
}
|
||||
},
|
||||
|
||||
{ field: 'planStartTime', minWidth: 130, title: '计划开始时间' },
|
||||
{ field: 'planEndTime', minWidth: 130, title: '计划结束时间' },
|
||||
{
|
||||
field: 'status',
|
||||
title: '流程状态',
|
||||
render: 'tag',
|
||||
minWidth: 80,
|
||||
custom: {
|
||||
0: 'warning',
|
||||
1: 'primary',
|
||||
2: 'success',
|
||||
3: 'danger',
|
||||
4: 'warning'
|
||||
},
|
||||
replaceValue: {
|
||||
0: '待提交审批',
|
||||
1: '审批中',
|
||||
2: '审批通过',
|
||||
3: '审批不通过',
|
||||
4: '已取消'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '填报人',
|
||||
minWidth: 80,
|
||||
formatter: (row: any) => {
|
||||
return dictData.state.userList.filter(item => item.id == row.cellValue)[0]?.name
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: '180',
|
||||
fixed: 'right',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'productSetting',
|
||||
title: '流程详情',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return !row.processInstanceId
|
||||
},
|
||||
click: row => {
|
||||
flag.value = true
|
||||
handleAudit(row.processInstanceId, row.historyInstanceId)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
showDisabled: row => {
|
||||
return row.createBy != adminInfo.$state.id || !(row.status == 0)
|
||||
},
|
||||
disabled: row => {
|
||||
return !(row.status == 0)
|
||||
},
|
||||
click: row => {
|
||||
planAddRef.value.open('编辑', row.id, false)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '重新发起',
|
||||
type: 'warning',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.createBy != adminInfo.$state.id || !(row.status == 3 || row.status == 4)
|
||||
},
|
||||
click: row => {
|
||||
// deviceQuitPopup.value.open('重新发起退运', row)
|
||||
planAddRef.value.open('重新发起计划', row.id, false)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'cancel',
|
||||
title: '取消',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.createBy != adminInfo.$state.id || row.status != 1
|
||||
},
|
||||
click: row => {
|
||||
cancelLeave(row)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
|
||||
tableStore.table.params.currentPage = tableStore.table.params.pageNum
|
||||
}
|
||||
})
|
||||
|
||||
tableStore.table.params.status = ''
|
||||
tableStore.table.params.supvType = ''
|
||||
provide('tableStore', tableStore)
|
||||
// 新增计划
|
||||
const add = () => {
|
||||
// title.value = '普测计划新增'
|
||||
planAddRef.value.open('计划新增')
|
||||
}
|
||||
// 禁止点击
|
||||
const checkboxConfig = reactive({
|
||||
checkMethod: ({ row }) => {
|
||||
return adminInfo.roleCode.includes('delete_info')
|
||||
? true
|
||||
: row.createBy == adminInfo.$state.id && row.status == 0
|
||||
}
|
||||
})
|
||||
const deleteEven = () => {
|
||||
if (tableStore.table.selection.length == 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
} else {
|
||||
|
||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deleteSurveyPlan(tableStore.table.selection.map(item => item.id)).then(res => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
const exportFn = () => {
|
||||
let form = JSON.parse(JSON.stringify(tableStore.table.params))
|
||||
form.pageNum = 1
|
||||
form.pageSize = tableStore.table.total
|
||||
queryPlan(form).then(res => {
|
||||
tableRef.value.getRef().exportData({
|
||||
filename: '计划', // 文件名字
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
useStyle: true,
|
||||
data: res.data.records, // 数据源 // 过滤那个字段导出
|
||||
columnFilterMethod: function (column: any) {
|
||||
return !(column.$columnIndex === 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**取消流程操作*/
|
||||
const cancelLeave = async (row: any) => {
|
||||
// 二次确认
|
||||
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'textarea',
|
||||
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
|
||||
inputErrorMessage: '取消原因不能为空'
|
||||
})
|
||||
// 发起取消
|
||||
let data = {
|
||||
id: row.id,
|
||||
processInstanceId: row.processInstanceId,
|
||||
reason: value
|
||||
}
|
||||
await cancel(data)
|
||||
ElMessage.success('取消成功')
|
||||
// 加载数据
|
||||
tableStore.index()
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
auditUser.value = ''
|
||||
}
|
||||
|
||||
/** 处理审批按钮 */
|
||||
const handleAudit = (instanceId: string, historyInstanceId: string) => {
|
||||
push({
|
||||
name: 'BpmProcessInstanceDetail',
|
||||
state: {
|
||||
id: instanceId,
|
||||
historyInstanceId
|
||||
}
|
||||
})
|
||||
}
|
||||
// 取消
|
||||
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
getUserByRoleType(3).then(res => {
|
||||
auditList.value = res.data
|
||||
})
|
||||
})
|
||||
watch(
|
||||
() => currentRoute.value.path,
|
||||
() => {
|
||||
if (flag.value && options.history.state.forward?.split('/')[1] == 'bpm') {
|
||||
tableStore.index()
|
||||
flag.value = false
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
const props = defineProps({ id: { type: String, default: 'null' } })
|
||||
watch(() => props.id, async (newValue, oldValue) => {
|
||||
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
|
||||
const fullId = newValue.split('@')[0]
|
||||
let nowTime = Date.now()
|
||||
const routeTime = Number(newValue.split('@')[1])
|
||||
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms,则不执行
|
||||
nextTick(() => {
|
||||
planAddRef.value.open('重新发起计划', fullId, false)
|
||||
})
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -0,0 +1,385 @@
|
||||
<template>
|
||||
<el-dialog draggable :title="title" width="900px" v-model="planAddition" :before-close="cancelFn">
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="auto" class="form-two" scroll-to-error>
|
||||
<el-form-item label="计划负责单位:">
|
||||
<el-input v-model="form.deptName" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划名称:" prop="planName">
|
||||
<el-input v-model="form.planName" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="监督类型:">
|
||||
<el-input v-model="form.supvType" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="监督对象名称:">
|
||||
<el-input v-model="form.supvObjectName" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划开始时间:" prop="planStartTime">
|
||||
<el-input v-model="form.planStartTime" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划结束时间:" prop="planEndTime">
|
||||
<el-input v-model="form.planEndTime" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="测试变电站:" prop="subIds" style="display: flex; align-items: center">
|
||||
<el-input v-model="form.substationName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="实际完成时间:" prop="completeTime">
|
||||
<el-date-picker
|
||||
v-model="form.completeTime"
|
||||
type="date"
|
||||
placeholder="选择实际完成时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="测试负责人:" prop="completeBy">
|
||||
<el-input v-model="form.completeBy" placeholder="请输入测试负责人"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" label="测试是否有问题:" prop="problemFlag">
|
||||
<!-- 默认值 否 -->
|
||||
<el-radio-group v-model="form.problemFlag">
|
||||
<el-radio :value="1">是</el-radio>
|
||||
<el-radio :value="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" class="uploadFile" label="技术监督报告:" prop="supervisionReport">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
v-model:file-list="form.supervisionReport"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="event => choose(event, 'supervisionReport')"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<!-- :on-progress="uploadFileName('supervisionReport')" -->
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" class="uploadFile" label="测试报告:" prop="testReport">
|
||||
<el-upload
|
||||
ref="upload1Ref"
|
||||
v-model:file-list="form.testReport"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed1"
|
||||
:on-change="event => choose(event, 'testReport')"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item for="-" class="uploadFile" label="其他报告:">
|
||||
<el-upload
|
||||
ref="upload2Ref"
|
||||
v-model:file-list="form.otherReport"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:on-exceed="handleExceed2"
|
||||
:on-change="event => choose(event, 'otherReport')"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
style="width: 100%"
|
||||
for="-"
|
||||
label="问题描述:"
|
||||
prop="problemDetail"
|
||||
v-if="form.problemFlag == '1'"
|
||||
>
|
||||
<el-input type="textarea" v-model="form.problemDetail" placeholder="请输入问题描述"></el-input>
|
||||
</el-form-item>
|
||||
<!-- </el-form> -->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancelFn">取消</el-button>
|
||||
<!-- <el-button type="primary" @click="submitFn">确定</el-button> -->
|
||||
<el-button type="primary" @click="submitFn(true)" :loading="loading">保存</el-button>
|
||||
<el-button type="primary" @click="submitFn(false)" :loading="loading" >提交审批</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, inject, nextTick } from 'vue'
|
||||
import { addSurvey, auditSurvey } from '@/api/process-boot/generalTest'
|
||||
import TableStore from '@/utils/tableStore' // 若不是列表页面弹框可删除
|
||||
import { ElMessage, genFileId, UploadProps, UploadRawFile, UploadUserFile } from 'element-plus'
|
||||
import { uploadFile, getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { addSurveyTest, updateSurveyTest, getTestById } from '@/api/supervision-boot/survey/test'
|
||||
const loading = ref(false)
|
||||
const acceptType = ref('')
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
let uploadName = ref('')
|
||||
// 上传报告
|
||||
const uploadRef = ref()
|
||||
const upload1Ref = ref()
|
||||
const upload2Ref = ref()
|
||||
const fileList = ref<UploadUserFile[]>([])
|
||||
const emit = defineEmits(['onsubmit'])
|
||||
const dictData = useDictData()
|
||||
const supvTypeOptionList = dictData.getBasicData('supv_type')
|
||||
const addFlagRef = ref(true)
|
||||
const title = ref('')
|
||||
const planAddition = ref(false)
|
||||
const form: any = ref({
|
||||
id: '',
|
||||
deptName: '',
|
||||
planStartTime: '',
|
||||
planEndTime: '',
|
||||
planName: '',
|
||||
substationName: '',
|
||||
completeTime: '',
|
||||
completeBy: '',
|
||||
testReport: [],
|
||||
otherReport: [],
|
||||
supervisionReport: [],
|
||||
problemDetail: '', //测试问题
|
||||
problemFlag: 0 //是否有问题
|
||||
})
|
||||
|
||||
/**
|
||||
* addFlag为true,则为填报测试数据,创建新流程
|
||||
* 为false,则为修改测试数据,重新发起流程
|
||||
*/
|
||||
const open = async (text: string, id: string, addFlag: boolean) => {
|
||||
title.value = text
|
||||
formRef.value?.resetFields()
|
||||
addFlagRef.value = addFlag
|
||||
//根据测试id获取数据
|
||||
await getTestById(id).then(res => {
|
||||
//如果是新增,则只需将计划的一些信息回显即可
|
||||
form.value.id = id
|
||||
form.value.deptName = res.data.deptName
|
||||
form.value.planStartTime = res.data.planStartTime
|
||||
form.value.planEndTime = res.data.planEndTime
|
||||
form.value.planName = res.data.planName
|
||||
form.value.supvType = supvTypeOptionList.find(item => {
|
||||
return item.id == res.data.supvType
|
||||
})?.name
|
||||
form.value.supvObjectName = res.data.supvObjectName
|
||||
form.value.substationName = res.data.substationName
|
||||
//部分清空
|
||||
// uploadRef.value?.clearFiles()
|
||||
form.value.completeTime = ''
|
||||
form.value.completeBy = ''
|
||||
form.value.testReport = []
|
||||
form.value.otherReport = []
|
||||
form.value.supervisionReport = []
|
||||
form.value.problemDetail = ''
|
||||
form.value.problemFlag = 0
|
||||
fileList.value = []
|
||||
|
||||
if (!addFlag) {
|
||||
//还需回显上次填报的测试数据 todo...,待重新发起的时候去做
|
||||
form.value = {
|
||||
...form.value,
|
||||
completeTime: res.data.completeTime,
|
||||
completeBy: res.data.completeBy,
|
||||
problemFlag: res.data.problemFlag,
|
||||
testReport:
|
||||
res.data.testReport == null
|
||||
? []
|
||||
: [
|
||||
{
|
||||
name: res.data.testReport.split('/')[2]
|
||||
}
|
||||
],
|
||||
supervisionReport:
|
||||
res.data.supervisionReport == null
|
||||
? []
|
||||
: [
|
||||
{
|
||||
name: res.data.supervisionReport.split('/')[2]
|
||||
}
|
||||
],
|
||||
|
||||
// otherReport:
|
||||
// res.data.otherReport == null
|
||||
// ? []
|
||||
// : [
|
||||
// {
|
||||
// name: res.data.otherReport.split('/')[2]
|
||||
// }
|
||||
// ],
|
||||
|
||||
problemDetail: res.data.problemDetail
|
||||
}
|
||||
form.value.otherReport = []
|
||||
if (res.data.otherReport != null) {
|
||||
for (let i = 0; i < res.data.otherReport.split(',').length - 1; i++) {
|
||||
form.value.otherReport.push({
|
||||
name: res.data.otherReport.split(',')[i]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
testReport.value = res.data.testReport
|
||||
otherReport.value = res.data.otherReport
|
||||
supervisionReport.value = res.data.supervisionReport
|
||||
}
|
||||
})
|
||||
|
||||
planAddition.value = true
|
||||
}
|
||||
|
||||
//处理成效报告
|
||||
const testReport = ref('')
|
||||
const otherReport = ref('')
|
||||
const supervisionReport = ref('')
|
||||
|
||||
const formRef = ref()
|
||||
const rules = {
|
||||
completeTime: [{ required: true, message: '选择实际完成时间 ', trigger: 'change' }],
|
||||
completeBy: [{ required: true, message: '请输入测试负责人', trigger: 'blur' }],
|
||||
testReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
|
||||
otherReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
|
||||
supervisionReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
|
||||
problemFlag: [{ required: true, message: '请选择测试是否有问题', trigger: 'change' }],
|
||||
problemDetail: [{ required: true, message: '请输入测试问题', trigger: 'blur' }]
|
||||
}
|
||||
const cancelFn = () => {
|
||||
formRef.value.resetFields()
|
||||
planAddition.value = false
|
||||
}
|
||||
// 提交
|
||||
const submitFn = async (flag: boolean) => {
|
||||
loading.value = true
|
||||
const subForm = JSON.parse(JSON.stringify(form.value))
|
||||
subForm.otherReport = ''
|
||||
|
||||
if (form.value.otherReport.length > 0) {
|
||||
form.value.otherReport.forEach((item: any) => {
|
||||
// + '/supervision/'
|
||||
subForm.otherReport = subForm.otherReport + item.name + ','
|
||||
})
|
||||
}
|
||||
if (flag) {
|
||||
subForm.testReport = testReport.value
|
||||
subForm.supervisionReport = supervisionReport.value
|
||||
subForm.saveOrCheckflag = '1'
|
||||
|
||||
//新增,则组装业务数据提交后台
|
||||
await addSurveyTest(subForm).then(res => {
|
||||
ElMessage.success('保存成功!')
|
||||
tableStore.index()
|
||||
planAddition.value = false
|
||||
})
|
||||
//查询进线数据,避免一直处于loading状态
|
||||
} else {
|
||||
formRef.value.validate(async (valid: any) => {
|
||||
if (!testReport.value) {
|
||||
return ElMessage({
|
||||
message: '请上传处理成效报告!',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
|
||||
if (!supervisionReport.value) {
|
||||
return ElMessage({
|
||||
message: '请上传技术监督报告!',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
if (valid) {
|
||||
subForm.testReport = testReport.value
|
||||
// subForm.otherReport = otherReport.value
|
||||
subForm.supervisionReport = supervisionReport.value
|
||||
subForm.saveOrCheckflag = '2'
|
||||
if (addFlagRef.value) {
|
||||
//新增,则组装业务数据提交后台
|
||||
await addSurveyTest(subForm).then(res => {
|
||||
//查询进线数据,避免一直处于loading状态
|
||||
ElMessage.success('申请成功')
|
||||
tableStore.index()
|
||||
planAddition.value = false
|
||||
})
|
||||
} else {
|
||||
await updateSurveyTest(subForm).then(res => {
|
||||
//查询进线数据,避免一直处于loading状态
|
||||
ElMessage.success('重新申请成功')
|
||||
tableStore.index()
|
||||
planAddition.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
await setTimeout(() => {
|
||||
loading.value = false
|
||||
}, 0)
|
||||
}
|
||||
const audit = (filePath: any) => {
|
||||
if (title.value == '计划测试填报') {
|
||||
addSurvey({ ...form.value, filePath: filePath }).then((res: any) => {
|
||||
ElMessage.success('新增成功!')
|
||||
emit('onsubmit')
|
||||
cancelFn()
|
||||
})
|
||||
} else if (title.value == '重新发起计划') {
|
||||
auditSurvey({ ...form.value, filePath: filePath }).then((res: any) => {
|
||||
ElMessage.success('重新发起计划成功!')
|
||||
emit('onsubmit')
|
||||
cancelFn()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
||||
const choose = (e: any, text: string) => {
|
||||
if (text == 'testReport') {
|
||||
uploadFile(e.raw, '/supervision/').then(res => {
|
||||
testReport.value = res.data.name
|
||||
})
|
||||
} else if (text == 'otherReport') {
|
||||
uploadFile(e.raw, '/supervision/').then(res => {
|
||||
otherReport.value = res.data.name
|
||||
})
|
||||
} else {
|
||||
uploadFile(e.raw, '/supervision/').then(res => {
|
||||
supervisionReport.value = res.data.name
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const handleExceed: UploadProps['onExceed'] = files => {
|
||||
uploadRef.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
uploadRef.value!.handleStart(file)
|
||||
}
|
||||
const handleExceed1: UploadProps['onExceed'] = files => {
|
||||
upload1Ref.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
upload1Ref.value!.handleStart(file)
|
||||
}
|
||||
const handleExceed2: UploadProps['onExceed'] = files => {
|
||||
upload2Ref.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
upload2Ref.value!.handleStart(file)
|
||||
}
|
||||
|
||||
//上传报告改变
|
||||
const uploadFileName = val => {
|
||||
uploadName.value = val
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// :deep(.el-upload-list__item-info) {
|
||||
// width: 250px;
|
||||
// }
|
||||
</style>
|
||||
@@ -0,0 +1,339 @@
|
||||
<template>
|
||||
<TableHeader area datePicker nextFlag theCurrentTime ref='TableHeaderRef'>
|
||||
<template v-slot:select>
|
||||
<el-form-item label='监督类型'>
|
||||
<el-select v-model='tableStore.table.params.supvType' clearable placeholder='请选择流程状态'>
|
||||
<el-option v-for='item in supvTypeOptionList' :key='item.id' :label='item.name'
|
||||
:value='item.id'></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='流程状态'>
|
||||
<el-select v-model='tableStore.table.params.status' clearable placeholder='请选择流程状态'>
|
||||
<el-option v-for='item in statusSelect' :key='item.id' :label='item.name'
|
||||
:value='item.id'></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon='el-icon-Delete' type='primary' @click='deleteEven'>删除</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref='tableRef' :checkbox-config='checkboxConfig' />
|
||||
<!-- 新增 -->
|
||||
<planTest ref='planTestRef' @onsubmit='tableStore.index()' />
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
import { ref, onMounted, provide, watch, nextTick } from 'vue'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { cancelTest } from '@/api/process-boot/generalTest'
|
||||
import planTest from './planTest.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { deleteSurveyPlanTest } from '@/api/supervision-boot/delete/index'
|
||||
import { queryPlan, removeSurvey } from '@/api/process-boot/generalTest'
|
||||
import { getUserByRoleType } from '@/api/user-boot/user'
|
||||
|
||||
const { push } = useRouter()
|
||||
const tableRef = ref()
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
const dictData = useDictData()
|
||||
const supvTypeOptionList = dictData.getBasicData('supv_type')
|
||||
const statusSelect = dictData.statusSelect()
|
||||
|
||||
const planTestRef = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const auditList: any = ref([])
|
||||
|
||||
const tableStore = new TableStore({
|
||||
url: '/supervision-boot/surveyTest/surveyTestPage',
|
||||
publicHeight: 65,
|
||||
method: 'POST',
|
||||
column: [
|
||||
{
|
||||
width: '60',
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
title: '序号',
|
||||
width: 60,
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{ field: 'planName', title: '计划名称', minWidth: 140 },
|
||||
{
|
||||
field: 'supvType',
|
||||
title: '监督类型',
|
||||
minWidth: 130,
|
||||
formatter: (row: any) => {
|
||||
return supvTypeOptionList.filter(item => item.id === row.cellValue)[0]?.name
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'supvObjectName',
|
||||
minWidth: 130,
|
||||
title: '监督对象名称'
|
||||
},
|
||||
{ field: 'substationName', title: '变电站', minWidth: 140 },
|
||||
{ field: 'planStartTime', title: '计划开始时间', minWidth: 140 },
|
||||
{ field: 'planEndTime', title: '计划结束时间', minWidth: 140 },
|
||||
{
|
||||
field: 'problemFlag',
|
||||
title: '是否存在问题',
|
||||
minWidth: 120,
|
||||
render: 'tag',
|
||||
custom: {
|
||||
0: 'success',
|
||||
1: 'danger',
|
||||
null: 'primary'
|
||||
},
|
||||
replaceValue: {
|
||||
0: '合格',
|
||||
1: '存在问题',
|
||||
null: '待测试'
|
||||
}
|
||||
},
|
||||
{ field: 'deptName', title: '负责单位', minWidth: 140 },
|
||||
{ field: 'completeBy', title: '计划负责人', minWidth: 130 },
|
||||
{ field: 'completeTime', title: '实际完成时间', minWidth: 140 },
|
||||
{
|
||||
field: 'status',
|
||||
title: '流程状态',
|
||||
render: 'tag',
|
||||
minWidth: 140,
|
||||
custom: {
|
||||
0: 'warning',
|
||||
|
||||
1: 'primary',
|
||||
2: 'success',
|
||||
3: 'danger',
|
||||
4: 'warning'
|
||||
},
|
||||
replaceValue: {
|
||||
0: '待提交审批',
|
||||
|
||||
1: '审批中',
|
||||
2: '审批通过',
|
||||
3: '审批不通过',
|
||||
4: '已取消'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '填报人',
|
||||
minWidth: 120,
|
||||
formatter: (row: any) => {
|
||||
return dictData.state.userList.filter(item => item.id == row.cellValue)[0]?.name
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
minWidth: 180,
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
name: 'productSetting',
|
||||
title: '测试填报',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.status != 6
|
||||
},
|
||||
click: row => {
|
||||
add(row.id)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'productSetting',
|
||||
title: '流程详情',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.status == 6 || !row.processInstanceId
|
||||
},
|
||||
click: row => {
|
||||
// planTestRef.value.open('查看计划', row)
|
||||
handleAudit(row.processInstanceId, row.historyInstanceId)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
showDisabled: row => {
|
||||
return row.deptId != adminInfo.$state.deptId || !(row.status == 0)
|
||||
},
|
||||
disabled: row => {
|
||||
return !(row.status == 0)
|
||||
},
|
||||
click: row => {
|
||||
planTestRef.value.open('编辑', row.id, false)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '重新发起',
|
||||
type: 'warning',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.deptId != adminInfo.$state.deptId || !(row.status == 3 || row.status == 4)
|
||||
},
|
||||
click: row => {
|
||||
planTestRef.value.open('重新发起计划测试', row.id, false)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'cancel',
|
||||
title: '取消',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
return row.deptId != adminInfo.$state.deptId || row.status != 1
|
||||
},
|
||||
click: row => {
|
||||
cancelLeave(row)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.orgNo = tableStore.table.params.deptIndex
|
||||
tableStore.table.params.currentPage = tableStore.table.params.pageNum
|
||||
}
|
||||
})
|
||||
|
||||
tableStore.table.params.status = ''
|
||||
tableStore.table.params.supvType = ''
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
// 新增计划
|
||||
const add = (id: string) => {
|
||||
planTestRef.value.open('计划测试填报', id, true)
|
||||
}
|
||||
// 禁止点击
|
||||
const checkboxConfig = reactive({
|
||||
checkMethod: ({ row }) => {
|
||||
return adminInfo.roleCode.includes('delete_info')
|
||||
? true
|
||||
: row.createBy == adminInfo.$state.id && row.status == 0
|
||||
}
|
||||
})
|
||||
const deleteEven = () => {
|
||||
if (tableStore.table.selection.length == 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
} else {
|
||||
|
||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deleteSurveyPlanTest(tableStore.table.selection.map(item => item.id)).then(res => {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
const exportFn = () => {
|
||||
let form = JSON.parse(JSON.stringify(tableStore.table.params))
|
||||
form.pageNum = 1
|
||||
form.pageSize = tableStore.table.total
|
||||
queryPlan(form).then(res => {
|
||||
tableRef.value.getRef().exportData({
|
||||
filename: '计划', // 文件名字
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
useStyle: true,
|
||||
data: res.data.records, // 数据源 // 过滤那个字段导出
|
||||
columnFilterMethod: function (column: any) {
|
||||
return !(column.$columnIndex === 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**取消流程操作*/
|
||||
const cancelLeave = async (row: any) => {
|
||||
// 二次确认
|
||||
const { value } = await ElMessageBox.prompt('请输入取消原因', '取消流程', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'textarea',
|
||||
inputPattern: /^[\s\S]*.*\S[\s\S]*$/, // 判断非空,且非空格
|
||||
inputErrorMessage: '取消原因不能为空'
|
||||
})
|
||||
// 发起取消
|
||||
let data = {
|
||||
id: row.id,
|
||||
processInstanceId: row.processInstanceId,
|
||||
reason: value
|
||||
}
|
||||
await cancelTest(data)
|
||||
ElMessage.success('取消成功')
|
||||
// 加载数据
|
||||
tableStore.index()
|
||||
}
|
||||
|
||||
/** 处理审批按钮 */
|
||||
const handleAudit = (instanceId: any, historyInstanceId: any) => {
|
||||
push({
|
||||
name: 'BpmProcessInstanceDetail',
|
||||
state: {
|
||||
id: instanceId,
|
||||
historyInstanceId
|
||||
}
|
||||
})
|
||||
}
|
||||
// 取消
|
||||
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
getUserByRoleType(3).then(res => {
|
||||
auditList.value = res.data
|
||||
})
|
||||
})
|
||||
|
||||
const props = defineProps(['id', 'businessKey'])
|
||||
watch(() => props.id, async (newValue, oldValue) => {
|
||||
if (newValue === 'null') return // 直接返回,避免后续逻辑执行
|
||||
const fullId = newValue.split('@')[0]
|
||||
let nowTime = Date.now()
|
||||
const routeTime = Number(newValue.split('@')[1])
|
||||
if (isNaN(routeTime) || nowTime - routeTime > import.meta.env.VITE_ROUTE_TIME_OUT) return // 路由时间超过500ms,则不执行
|
||||
nextTick(() => {
|
||||
if (props.businessKey == '3') {
|
||||
planTestRef.value.open('编辑', fullId, false)
|
||||
} else {
|
||||
planTestRef.value.open('重新发起计划测试', fullId, false)
|
||||
}
|
||||
})
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'></style>
|
||||
Reference in New Issue
Block a user