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/hoist.vue |  114 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 71 insertions(+), 43 deletions(-)

diff --git a/src/views/specialWorkManage/workTicket/workApply/components/hoist.vue b/src/views/specialWorkManage/workTicket/workApply/components/hoist.vue
index 24e900e..77dbde7 100644
--- a/src/views/specialWorkManage/workTicket/workApply/components/hoist.vue
+++ b/src/views/specialWorkManage/workTicket/workApply/components/hoist.vue
@@ -9,41 +9,50 @@
 						<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="workLevel">
+                        <el-select v-model="form.workLevel">
+                            <el-option
+                                v-for="item in workLevelList"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value"
+                            />
+                        </el-select>
+                    </el-form-item>
+                </el-col>
 			</el-row>
-			<el-row>
-				<el-col :span="12">
-					<el-form-item label="作业等级" prop="workLevel">
-						<el-select v-model="form.workLevel">
-							<el-option
-									v-for="item in workLevelList"
-									:key="item.value"
-									:label="item.label"
-									:value="item.value"
-							/>
-						</el-select>
-					</el-form-item>
-				</el-col>
-				<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"
-								type="datetimerange"
-								range-separator="至"
-								start-placeholder="开始时间"
-								end-placeholder="结束时间"
-						/>
-					</el-form-item>
-				</el-col>
-			</el-row>
+                <el-row>
+                    <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-col :span="12">
+                        <el-form-item label="作业时间" prop="workTimeLine">
+                            <el-date-picker
+                                v-model="form.workTimeLine"
+                                value-format="yyyy-MM-dd HH:mm:ss"
+                                type="datetimerange"
+                                range-separator="至"
+                                start-placeholder="开始时间"
+                                end-placeholder="结束时间"
+                            />
+                        </el-form-item>
+                    </el-col>
+                </el-row>
 			<el-row>
 				<el-col :span="12">
 					<el-form-item label="作业内容" prop="workContent">
@@ -89,10 +98,11 @@
 					</el-form-item>
 				</el-col>
 			</el-row>
+
 			</div>
 		</el-form>
 		<div class="applyBtn">
-			<el-button type="primary" size="large" plain @click="submitForm(ruleFormRef)">发起申请</el-button>
+			<el-button type="primary" size="large" plain @click="submitForm()">发起申请</el-button>
 		</div>
 	</div>
 	</div>
@@ -100,7 +110,9 @@
 
 <script>
 
-	export default{
+	import {workApplyApi} from "../../../../../api/workApply";
+
+    export default{
 		name: 'hoistForm',
 		components: {},
 		props:['workerList'],
@@ -118,6 +130,7 @@
                     },
                     workTimeLine: [],
                     expStartTime: '',
+                    hazardIdentification: '',
                     expEndTime: ''
                 },
                 workLevelList: [
@@ -135,10 +148,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.hoistingToolName": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
@@ -147,23 +161,37 @@
             }
         },
         methods:{
-            async submitForm (formEl) {
-                if (!formEl) return
-                await formEl.validate(async (valid, fields) => {
+            submitForm (formEl) {
+                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().postHoistApply(data)
                         if (res.data.code === '200') {
-                            ElMessage({
+                            this.$message({
                                 type: 'success',
                                 message: '提交成功!'
                             });
-                            formEl.resetFields()
+                            this.$refs["ruleFormRef"].clearValidate()
+                            this.form = {
+                                operatorUids: [],
+                                workType: 3,
+                                workLevel: null,
+                                workContent: '',
+                                workLocation: '',
+                                workDetail:{
+                                    hoistingToolName: '',
+                                    weightMass: null
+                                },
+                                workTimeLine: [],
+                                expStartTime: '',
+                                hazardIdentification: '',
+                                expEndTime: ''
+                            }
                         } else {
-                            ElMessage({
+                            this.$message({
                                 type: 'warning',
                                 message: res.data.msg
                             });

--
Gitblit v1.9.2