| | |
| | | <el-form ref="formRef" :model="state.formData" :rules="state.rules" class="register-form" label-position="top"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="10"> |
| | | <el-button type="primary" :disabled="projectType === 'edit'" @click="addUpload">新增附件列表</el-button> |
| | | <!-- <el-button type="primary" :disabled="projectType === 'edit'" @click="addUpload">新增附件列表</el-button>--> |
| | | <span style="font-size: 20px;font-weight: 600">附件列表</span> |
| | | <span style="font-size: 13px;color: rgb(232, 78, 79);font-weight: 400;margin-left: 10px">项目列表仅支持pdf、jpg、jpeg 等格式上传</span> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-table-column label="序号" width="60" align="center" type="index"></el-table-column> |
| | | <el-table-column label="名称" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.name" show-word-limit type="text" size="large"/> |
| | | <span type="text" size="large">{{scope.row.name}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="是否必须文件" align="center" class-name="small-padding fixed-width"> |
| | |
| | | </el-table-column> |
| | | <el-table-column label="原因说明" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.remark" show-word-limit type="text" size="large"/> |
| | | <el-input v-model="scope.row.remark" show-word-limit type="text" size="large" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="附件上传" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-upload accept=".pdf,.doc,.docx" |
| | | :action="state.uploadUrl" |
| | | :disabled="state.disabled" |
| | | :disabled="projectType === 'view' || isEnd" |
| | | :headers="state.header" |
| | | method="post" |
| | | :on-success="handleAvatarSuccess" |
| | | :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,scope.row)" |
| | | v-model:file-list="scope.row.fileList" |
| | | :on-remove="handleRemove" |
| | | :data="state.uploadData" |
| | |
| | | </el-upload> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template #default="scope"> |
| | | <el-button link type="danger" @click="delUpload(scope.$index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <el-button link type="danger" @click="delUpload(scope.$index)">删除</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | </el-table> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="6"> |
| | | <el-form-item prop="contractSignDate" label="合同签订日期"> |
| | | <el-form-item label="合同签订日期"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="state.formData.contractSignDate" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="18"> |
| | | <el-form-item prop="contractMoney"> |
| | | <el-form-item prop="actualContractMoney"> |
| | | <template #label> |
| | | 项目合同额<span style="font-size: 13px;color: red;font-weight: normal;display: inline-block;margin-left: 6px">预估合同金额,归档阶段可以进行修改。仅支持数字,单位万元,小数点后最多两位,数值范围(0.01-999.99)</span> |
| | | </template> |
| | | <el-input |
| | | v-model="state.actualContract.actualContractMoney" |
| | | @input="state.actualContract.actualContractMoney= state.actualContract.actualContractMoney.replace(/[^0-9.\/\-]/g,'')" |
| | | size="large" |
| | | type="number" |
| | | placeholder="请输入项目合同额" |
| | | > |
| | | <template #append>万元</template> |
| | |
| | | </template> |
| | | <script setup> |
| | | |
| | | import {defineEmits, onMounted, reactive, ref} from "vue"; |
| | | import {defineEmits, defineProps, onMounted, reactive, ref} from "vue"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {addRecord, editRecord, getDetail} from "@/api/projectManage/contractMng"; |
| | | import Cookies from "js-cookie"; |
| | |
| | | import axios from "axios"; |
| | | import {delAccessoryFile, getAccessoryFile} from "@/api/projectManage/project"; |
| | | import {addProcessMaterial, getProcessMaterialDetail, editProcessMaterial} from "@/api/projectManage/riskAnalysis"; |
| | | |
| | | import { useRoute } from 'vue-router' |
| | | const route = useRoute() |
| | | const props = defineProps(['projectId']) |
| | | const emit = defineEmits(["getNextStatus"]); |
| | | const state = reactive({ |
| | | formData: { |
| | |
| | | ], |
| | | rules: { |
| | | contractSignDate: [{required: true, message: '请选择合同签订日期', trigger: 'blur'}], |
| | | actualContractMoney: [{required: true, message: '请输入项目合同额', trigger: 'blur'}] |
| | | }, |
| | | fileList: [], |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/manage/accessory-file/uploadFile', |
| | |
| | | const isAmin = ref(false) |
| | | const formRef = ref(); |
| | | onMounted(async () => { |
| | | |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | if(userInfo.identity === 0){ |
| | | isAmin.value = true; |
| | | } |
| | | if(Cookies.get('projectId')){ |
| | | state.uploadData.projectId = Cookies.get('projectId'); |
| | | getRecord(state.uploadData.projectId); |
| | | if(props.projectId){ |
| | | state.uploadData.projectId = props.projectId; |
| | | await getRecord(state.uploadData.projectId); |
| | | // const res = await getAccessoryFile({projectId: val,moduleType: 9}); |
| | | // console.log('res',res) |
| | | } |
| | | |
| | | isEnd.value = Cookies.get('end') |
| | | projectType.value = route.query.type; |
| | | }); |
| | | |
| | | const getRecord = async (val) =>{ |
| | |
| | | } |
| | | |
| | | const projectType = ref('') |
| | | const isEnd = ref('') |
| | | const riskOpen = async (type,val) => { |
| | | projectType.value = type; |
| | | projectType.value = route.query.type; |
| | | isEnd.value = Cookies.get('end') |
| | | state.uploadData.projectId = val; |
| | | if(type === 'detail' || type === 'edit' ){ |
| | | const res = await getProcessMaterialDetail({projectId: val}); |
| | |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | getRecord(val); |
| | | } |
| | | if(type === 'add' || type === 'clickEdit') { |
| | | const valid = await formRef.value.validate(); |
| | |
| | | ElMessage.warning("当前用户暂无权限"); |
| | | return; |
| | | } |
| | | |
| | | if(state.actualContract.actualContractMoney == '' || !state.actualContract.actualContractMoney) { |
| | | ElMessage.warning("请输入项目合同额"); |
| | | return; |
| | | } |
| | | console.log(state.uploadList,'state.uploadList') |
| | | const file = state.uploadList.map(item => { |
| | | return{ |
| | | id: item.id ? item.id : null, |
| | | fileId: item.fileList ? item.fileList[0].response ? item.fileList[0].response.data.id : item.fileList[0].id : '', |
| | | fileId: item.fileList && item.fileList.length>0 ? item.fileList[0].response ? item.fileList[0].response.data.id : item.fileList[0].id : '', |
| | | name: item.name, |
| | | type: item.type, |
| | | remark: item.remark, |
| | | projectId: val |
| | | } |
| | | }) |
| | | |
| | | let isOk = false; |
| | | try{ |
| | | state.uploadList.forEach(item => { |
| | | if(item.type == 1 && (!item.fileList || item.fileList .length == 0) && item.remark == ""){ |
| | | isOk = true; |
| | | throw Error(); |
| | | } |
| | | }) |
| | | }catch (e) {} |
| | | |
| | | if(isOk){ |
| | | ElMessage.warning("请上传附件或完善原因说明!"); |
| | | return; |
| | | } |
| | | const { ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | data.actualContractMoney = state.actualContract.actualContractMoney; |
| | | data.actualContractIntroduction = state.actualContract.actualContractIntroduction; |
| | |
| | | const res = await editProcessMaterial(params); |
| | | if (res.code == 200) { |
| | | ElMessage.success('变更成功') |
| | | projectType.value='edit'; |
| | | formRef.value.clearValidate(); |
| | | // emit('getNextStatus', data.project.id); |
| | | } else { |
| | |
| | | } |
| | | }; |
| | | |
| | | const handleAvatarSuccess = (res, uploadFile) => { |
| | | const handleAvatarSuccess = (res, uploadFile,val) => { |
| | | if(res.code === 200){ |
| | | console.log("if",state.uploadList) |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '文件上传成功' |
| | | }) |
| | | }else { |
| | | const delVal = state.uploadList.findIndex(i => i.id === val.id); |
| | | state.uploadList[delVal].fileList.splice(state.uploadList[delVal].fileList.indexOf(uploadFile),1) |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | |
| | | } |
| | | const res = await delAccessoryFile(accessoryFileId) |
| | | if(res.code == 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '文件已删除' |
| | | }) |
| | | // ElMessage({ |
| | | // type: 'success', |
| | | // message: '文件已删除' |
| | | // }) |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |