From 70c6eb1d5fe7d56fa4f1948e26bf6a86e863602b Mon Sep 17 00:00:00 2001
From: batman <978517621@qq.com>
Date: 星期一, 13 三月 2023 18:22:22 +0800
Subject: [PATCH] 新修改添加页面

---
 src/views/specialWorkSystem/workTicket/zysq/components/space.vue |   60 ++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/src/views/specialWorkSystem/workTicket/zysq/components/space.vue b/src/views/specialWorkSystem/workTicket/zysq/components/space.vue
index 73b9e4f..24e9837 100644
--- a/src/views/specialWorkSystem/workTicket/zysq/components/space.vue
+++ b/src/views/specialWorkSystem/workTicket/zysq/components/space.vue
@@ -61,6 +61,18 @@
 						/>
 					</el-form-item>
 				</el-col>
+        <el-col :span="12">
+          <el-form-item label="关联设备" prop="cameraIds">
+            <el-select v-model="form.cameraIds" multiple>
+              <el-option
+                  v-for="item in deviceList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+        </el-col>
 			</el-row>
 				<el-divider border-style="dashed" />
 			<el-row>
@@ -125,7 +137,7 @@
 </template>
 
 <script lang="ts">
-	import { toRefs, reactive, defineComponent, ref, defineAsyncComponent } from 'vue';
+import {toRefs, reactive, defineComponent, ref, defineAsyncComponent} from 'vue';
 	import { storeToRefs } from 'pinia';
 	import { initBackEndControlRoutes } from '/@/router/backEnd';
 	import {useUserInfo} from "/@/stores/userInfo";
@@ -134,7 +146,6 @@
 	import { ElMessage, ElMessageBox } from 'element-plus'
 	import type { FormInstance, FormRules } from 'element-plus'
 	import { workApplyApi } from '/@/api/specialWorkSystem/workApply';
-
 
 	interface stateType {
 		form: Object,
@@ -148,8 +159,8 @@
 		components: {
       materialDialog: defineAsyncComponent(() => import('/@/views/specialWorkSystem/workTicket/zysq/components/materialDialog.vue')),
     },
-		props:['workerList','departList'],
-		setup() {
+		props:['workerList','departList','deviceList'],
+		setup(props: any, context: any) {
 			const userInfo = useUserInfo()
 			const { userInfos } = storeToRefs(userInfo);
 			const state  = reactive<stateType>({
@@ -157,18 +168,19 @@
 				form: {
 					operatorUids: [],
 					workType: 2,
-					workLevel: null,
+					workLevel: 0,
 					workContent: '',
 					workLocation: '',
-          maId: null,
+          maBaseId: null,
 					hazardIdentification: '',
+          cameraIds: [],
 					workDetail:{
 						csDepId: null,
 						csName: '',
 						csOriginalName: '',
 						otherSpecialWork: []
 					},
-					wmAddReqDTOList: [],
+          receiveUids: [],
 					workTimeLine: [],
 					expStartTime: '',
 					expEndTime: ''
@@ -250,6 +262,7 @@
 				workContent: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
 				workLocation: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
 				hazardIdentification: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
+        cameraIds: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
 				workTimeLine: [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
 				"workDetail.csDepId": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
 				"workDetail.csName": [{ required: true, message: '该内容不能为空', trigger: 'blur' }],
@@ -263,21 +276,24 @@
 			// }
 
       const openMaList = ()=>{
-        material.value.equipmentDialog = true
-        material.value.getMaList(state.form.workType,state.form.workLevel)
-      }
-      const conFirmMaterials = (addList: Array<any>,chosenId: number) =>{
-        state.form.maId = null
-        state.form.wmAddReqDTOList = []
-        if(addList.length > 0){
-          for(let i in addList){
-            if(addList[i].depId != null && addList[i].useCount != null){
-              state.form.wmAddReqDTOList.push(addList[i])
-            }
+        if(state.form.operatorUids == []){
+          ElMessage({
+            type: 'warning',
+            message: '请先选择作业人再获取相应物资配置'
+          });
+        }else{
+          if(material.value.receiveUids.length==0){
+            material.value.receiveUids = state.form.operatorUids
           }
+          material.value.getMaList(state.form.workType,state.form.workLevel)
+          material.value.workerList = props.workerList
         }
-        // state.form.wmAddReqDTOList = addList
-        state.form.maId = chosenId
+      }
+      const conFirmMaterials = (receiveUids: Array<number>,chosenId: number) =>{
+        state.form.maBaseId = null
+        state.form.receiveUids = []
+        state.form.receiveUids = receiveUids
+        state.form.maBaseId = chosenId
       }
 
 			const submitForm = async (formEl: FormInstance | undefined) => {
@@ -302,8 +318,8 @@
 								message: res.data.msg
 							});
 						}
-            state.form.maId = null
-            state.form.wmAddReqDTOList = []
+            material.value.maBaseId = null
+            material.value.receiveUids = []
 					} else {
 						console.log('error submit!', fields)
 					}

--
Gitblit v1.9.2