| | |
| | | <el-form ref="formRef" :model="state.formData" :rules="state.rules" class="register-form" label-position="top"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="6"> |
| | | <el-button type="primary" @click="addRectify">新增整改</el-button> |
| | | <el-button type="primary" @click="addRectify('add',{})">新增整改</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-table :data="state.rectifyList" :border="true" style="margin: 20px 0"> |
| | | <el-table :data="state.recitificationList" :border="true" style="margin: 20px 0"> |
| | | <el-table-column label="序号" width="60" align="center" type="index"></el-table-column> |
| | | <el-table-column label="整改时间" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="整改时间" prop="rectifyTime" align="center"></el-table-column> |
| | | <el-table-column label="提交时间" prop="updateTime" align="center"></el-table-column> |
| | | <el-table-column label="整改说明" prop="reason" align="center"></el-table-column> |
| | | <el-table-column label="整改人" prop="rectifyPerson" align="center"></el-table-column> |
| | | <el-table-column label="附件" prop="" align="center"> |
| | | <template #default="scope"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="scope.row.startDate" |
| | | type="date" |
| | | value-format="YYYY-MM-DD 00:00:00" |
| | | placeholder="选择日期" |
| | | size="large" |
| | | /> |
| | | <span @click="handlePreview(scope.row.accessoryFile)" style="color: #3b82f6;cursor:pointer">{{scope.row.accessoryFile.originName}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="整改人" header-align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.deviceName" maxlength="50" show-word-limit type="text" size="large"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="附件" header-align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-upload accept=".pdf" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" :limit='1' v-model:file-list="state.fileList[scope.$index]" :before-upload="picSize" :on-remove="handleRemove" :before-remove="beforeRemove"> |
| | | <el-button type="primary">附件上传</el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传pdf尺寸小于5M,最多可上传1张</div> |
| | | </template> |
| | | </el-upload> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" header-align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-button link type="danger" @click="delRectify(scope.$index)">删除</el-button> |
| | | <el-button link type="primary" @click="addRectify('edit',scope.row)">编辑</el-button> |
| | | <el-button link type="danger" @click="del(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form> |
| | | <div class="pag-container"> |
| | | <el-pagination |
| | | v-model:current-page="state.queryParams.pageNum" |
| | | v-model:page-size="state.queryParams.pageSize" |
| | | :page-sizes="[10,15,20,25]" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :total="total" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | <confirm-end-dialog ref="confirmRef" @getList="getList"></confirm-end-dialog> |
| | | </div> |
| | | |
| | | </template> |
| | | <script setup> |
| | | |
| | | import {defineEmits, onMounted, reactive, ref} from "vue"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {addRecord, editRecord, getDetail} from "@/api/projectManage/contractMng"; |
| | | import Cookies from "js-cookie"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import confirmEndDialog from './confirmEndDialog.vue' |
| | | import {delProject, getAccessoryFile} from "@/api/projectManage/project"; |
| | | import {delRecitification, doConfirm, getRecognitionList} from "@/api/projectManage/riskAnalysis"; |
| | | import axios from "axios"; |
| | | |
| | | const confirmRef = ref(null); |
| | | const emit = defineEmits(["getNextStatus"]); |
| | | const state = reactive({ |
| | | formData: { |
| | | id: '', |
| | | contractSignDate: '', |
| | | contractMoney: '', |
| | | contractIntroduction: '' |
| | | formData: {}, |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }, |
| | | rectifyList: [], |
| | | rules: { |
| | | contractSignDate: [{required: true, message: '请选择合同签订日期', trigger: 'blur'}], |
| | | contractMoney: [{required: true, message: '请输入项目合同额', trigger: 'blur'}] |
| | | }, |
| | | fileList: [], |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', |
| | | header: { |
| | | Authorization: 'Bearer ' + getToken() |
| | | } |
| | | recitificationList: [], |
| | | }) |
| | | |
| | | const total = ref(0); |
| | | const isAmin = ref(false) |
| | | const formRef = ref(); |
| | | onMounted(() => { |
| | |
| | | if(userInfo.identity === 0){ |
| | | isAmin.value = true; |
| | | } |
| | | if(Cookies.get('projectId')){ |
| | | state.formData.projectId = Cookies.get('projectId'); |
| | | getList(state.formData.projectId); |
| | | } |
| | | // getList(); |
| | | }); |
| | | |
| | | const riskOpen = async (type,val) => { |
| | | state.formData.projectId = val; |
| | | if(type === 'detail' || type === 'edit' ){ |
| | | const res = await getDetail({projectId: val}); |
| | | if(res.code == 200){ |
| | | state.formData = res.data; |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | |
| | | const getList = async (val) => { |
| | | const res = await getRecognitionList({projectId: val}); |
| | | if(res.code == 200){ |
| | | state.recitificationList = res.data.list; |
| | | total.value = res.data.total; |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | if(type === 'add' || type === 'clickEdit') { |
| | | const valid = await formRef.value.validate(); |
| | | if(valid){ |
| | | if (isAmin.value) { |
| | | ElMessage.warning("当前用户暂无权限"); |
| | | return; |
| | | } |
| | | if(type === 'add'){ |
| | | const {id, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await addRecord(data); |
| | | if (res.code == 200) { |
| | | ElMessage.success('保存成功') |
| | | formRef.value.clearValidate(); |
| | | emit('getNextStatus', state.formData.projectId); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }else if(type === 'clickEdit'){ |
| | | const { ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await editRecord(data); |
| | | if (res.code == 200) { |
| | | ElMessage.success('变更成功') |
| | | formRef.value.clearValidate(); |
| | | // emit('getNextStatus', data.project.id); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const riskOpen = async (type,val) => { |
| | | await getList(val); |
| | | state.formData.projectId = val; |
| | | if(type === 'confirm') { |
| | | const res = await doConfirm({projectId: val}); |
| | | if (res.code == 200) { |
| | | ElMessage.success('保存成功') |
| | | formRef.value.clearValidate(); |
| | | emit('getNextStatus', state.formData.projectId); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const addRectify = ()=>{ |
| | | let file = { |
| | | fileName: '', |
| | | deviceName: '', |
| | | startDate: '', |
| | | endDate: '' |
| | | } |
| | | state.rectifyList.push(file) |
| | | const addRectify = (type,val)=>{ |
| | | val.projectId = state.formData.projectId; |
| | | confirmRef.value.openDialog(type,val) |
| | | } |
| | | |
| | | const delRectify = (index)=>{ |
| | | state.rectifyList.splice(index,1) |
| | | } |
| | | const handleSizeChange = (val) => { |
| | | state.queryParams.pageNum = 1; |
| | | state.queryParams.pageSize = val |
| | | getList() |
| | | } |
| | | const handleCurrentChange = (val) => { |
| | | state.queryParams.pageNum = val |
| | | getList() |
| | | } |
| | | |
| | | // 图片上传 |
| | |
| | | }) |
| | | } |
| | | } |
| | | const handlePreview = (file) => { |
| | | const url = import.meta.env.VITE_APP_BASE_API + '/' + file.path |
| | | axios.get( url,{ |
| | | headers: |
| | | { |
| | | 'Content-Type': 'application/json', |
| | | 'Authorization':getToken(), |
| | | }, |
| | | responseType: 'blob' |
| | | } |
| | | ).then(res=>{ |
| | | if (res) { |
| | | const link = document.createElement('a') |
| | | let blob = new Blob([res.data],{type: res.data.type}) |
| | | link.style.display = "none"; |
| | | link.href = URL.createObjectURL(blob); // 创建URL |
| | | link.setAttribute("download", file.originName); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } else { |
| | | this.$message.error('获取文件失败') |
| | | } |
| | | }) |
| | | } |
| | | const del = (val) => { |
| | | ElMessageBox.confirm( |
| | | '确定删除此条数据?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | const res = await delRecitification(val) |
| | | if(res.code == 200){ |
| | | ElMessage.success('数据删除成功') |
| | | getList() |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | defineExpose({ |
| | | riskOpen |
| | |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | .pag-container{ |
| | | float: right; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | </style> |