| | |
| | | formData: { |
| | | id:null, |
| | | deptId: null, |
| | | deptName:'危险化学品监督管理处', |
| | | deptName:'', |
| | | projectName: '', |
| | | projectDateStart: '', |
| | | projectDateEnd: '', |
| | |
| | | remark: [{ required: true, message: "概况描述不能为空", trigger: "blur" }], |
| | | } |
| | | }) |
| | | |
| | | const formRef = ref(); |
| | | const userInfo = ref() |
| | | onMounted(() => { |
| | | userInfo.value = JSON.parse(Cookies.get('userInfo')) |
| | |
| | | |
| | | const riskOpen = async (type,val) => { |
| | | console.log("type",type,val) |
| | | let valid = null |
| | | if(type === 'add' || type === 'clickEdit'){ |
| | | valid = await formRef.value.validate(); |
| | | } |
| | | if(type === 'add'){ |
| | | //保存按钮 |
| | | const {id,...data} = state.formData |
| | | const res = await addProject(data); |
| | | if(res.code == 200){ |
| | | ElMessage.success('新增成功') |
| | | emit('getNextStatus', res.data); |
| | | reset() |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | if(valid){ |
| | | //保存按钮 |
| | | const {id,...data} = state.formData |
| | | const res = await addProject(data); |
| | | if(res.code == 200){ |
| | | ElMessage.success('新增成功') |
| | | emit('getNextStatus', res.data); |
| | | reset() |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | }else if(type === 'clickEdit'){ |
| | | //变更按钮 |
| | | const {...data} = state.formData |
| | | const res = await addProject(data); |
| | | if(res.code == 200){ |
| | | ElMessage.success('修改成功') |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | if(valid){ |
| | | //变更按钮 |
| | | const {...data} = state.formData |
| | | const res = await addProject(data); |
| | | if(res.code == 200){ |
| | | ElMessage.success('修改成功') |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | }else if(type === 'detail'){ |
| | | const res = await getProjectInfo(val) |
| | | if(res.code == 200){ |
| | |
| | | } |
| | | const reset = () => { |
| | | state.formData = { |
| | | id:null, |
| | | deptId: null, |
| | | deptName:'危险化学品监督管理处', |
| | | deptName:'', |
| | | projectName: '', |
| | | projectDateStart: '', |
| | | projectDateEnd: '', |