From 91ccfa3ebdc7a68b6f632c3e59757ec03b15ac1f Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期五, 02 九月 2022 15:15:01 +0800 Subject: [PATCH] lct --- src/views/specialWorkManage/workTicket/workApply/components/power.vue | 104 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 65 insertions(+), 39 deletions(-) diff --git a/src/views/specialWorkManage/workTicket/workApply/components/power.vue b/src/views/specialWorkManage/workTicket/workApply/components/power.vue index 514cdce..505bca6 100644 --- a/src/views/specialWorkManage/workTicket/workApply/components/power.vue +++ b/src/views/specialWorkManage/workTicket/workApply/components/power.vue @@ -9,21 +9,30 @@ <el-select v-model="form.operatorUids" multiple> <el-option v-for="item in workerList" - :key="item.uid" - :label="item.username" - :value="item.uid" + :key="item.id" + :label="item.realname" + :value="item.id" /> </el-select> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="作业内容" prop="workContent"> + <el-input + v-model="form.workContent" + autosize + type="textarea" + placeholder="请输入作业内容" + /> + </el-form-item> + </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="作业时间" prop="workTimeLine"> <el-date-picker v-model="form.workTimeLine" - format="YYYY-MM-DD HH:mm" - value-format="YYYY-MM-DD HH:mm:00" + value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="至" start-placeholder="开始时间" @@ -31,28 +40,16 @@ /> </el-form-item> </el-col> - </el-row> - <el-row> - <el-col :span="12"> - <el-form-item label="作业内容" prop="workContent"> - <el-input - v-model="form.workContent" - autosize - type="textarea" - placeholder="请输入作业内容" - /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="作业地址" prop="workLocation"> - <el-input - v-model="form.workLocation" - autosize - type="textarea" - placeholder="请输入作业地址" - /> - </el-form-item> - </el-col> + <el-col :span="12"> + <el-form-item label="作业地址" prop="workLocation"> + <el-input + v-model="form.workLocation" + autosize + type="textarea" + placeholder="请输入作业地址" + /> + </el-form-item> + </el-col> </el-row> @@ -90,6 +87,16 @@ /> </el-form-item> </el-col> + <el-col :span="12"> + <el-form-item label="危险辨识" prop="hazardIdentification"> + <el-input + v-model="form.hazardIdentification" + autosize + type="textarea" + placeholder="请输入危险辨识" + /> + </el-form-item> + </el-col> </el-row> </div> </el-form> @@ -101,7 +108,9 @@ </template> <script> - export default{ + import {workApplyApi} from "../../../../../api/workApply"; + + export default{ name: 'hoistForm', components: {}, props:['workerList'], @@ -120,6 +129,7 @@ }, workTimeLine: [], expStartTime: '', + hazardIdentification: '', expEndTime: '' }, workLevelList: [ @@ -137,10 +147,11 @@ } ], applyRules:{ - operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], + operatorUids: [{ required: true, message: '该内容不能为空', trigger: 'change' }], workType: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], - workLevel: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], + workLevel: [{ required: true, message: '该内容不能为空', trigger: 'change' }], workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], + hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }], "workDetail.powerAccessPoint": [{ required: true, message: '该内容不能为空', trigger: 'blur' }], @@ -150,23 +161,38 @@ } }, methods:{ - async submitForm(formEl) { - if (!formEl) return - await formEl.validate(async (valid, fields) => { + submitForm() { + this.$refs["ruleFormRef"].validate(async (valid, fields) => { if (valid) { - state.form.expStartTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[0] - state.form.expEndTime = JSON.parse(JSON.stringify(state.form.workTimeLine))[1] - let { workTimeLine, ...data } = JSON.parse(JSON.stringify(state.form)) + this.form.expStartTime = JSON.parse(JSON.stringify(this.form.workTimeLine))[0] + this.form.expEndTime = JSON.parse(JSON.stringify(this.form.workTimeLine))[1] + let { workTimeLine, ...data } = JSON.parse(JSON.stringify(this.form)) // data.workDetail.weightMass = Number(data.workDetail.weightMass) const res = await workApplyApi().postPowerApply(data) if (res.data.code === '200') { - ElMessage({ + this.$message({ type: 'success', message: '提交成功!' }); - formEl.resetFields() + this.$refs["ruleFormRef"].clearValidate() + this.form = { + operatorUids: [], + workType: 7, + workLevel: 0, + workContent: '', + workLocation: '', + workDetail:{ + powerAccessPoint: '', + workingVoltage: null, + equipmentAndPower: '' + }, + workTimeLine: [], + expStartTime: '', + hazardIdentification: '', + expEndTime: '' + } } else { - ElMessage({ + this.$message({ type: 'warning', message: res.data.msg }); -- Gitblit v1.9.2