Browse Source

归档增加抢险车辆填写表单

xiangyiyong 1 year ago
parent
commit
f12fb5db59

+ 3 - 0
src/api/configuration/model/rescueCarModel.ts

@@ -12,6 +12,9 @@ export type SearchParams = {
   carTypeCode?: string; //车辆类型
   areaCode?: string; //所属区域
   carName?: string; //车辆名称
+  page?: number;
+  pageSize?: number;
+  showAll?: number;
 };
 
 export interface RescueCar {

+ 141 - 31
src/views/lifeline/riskLinkageSystem/eventManage/eventUnfile/dialogFormHandle.vue

@@ -842,7 +842,76 @@
                   </a-row>
                 </div>
               </a-tab-pane>
-              <a-tab-pane key="4" :tab="`抢险车辆()`" />
+              <a-tab-pane key="4" :tab="`抢险车辆(${fourthData.rescueCars.length})`">
+                <div
+                  v-for="(_, index) in fourthData.rescueCars"
+                  :key="index"
+                  style="margin-bottom: 20px"
+                >
+                  <a-row>
+                    <a-col :span="21">
+                      <div
+                        style="
+                          background: #f8f8f8;
+                          padding: 10px 20px 0;
+                          box-sizing: border-box;
+                          height: 54px;
+                          margin-right: 20px;
+                        "
+                      >
+                        <a-row>
+                          <a-col :span="8">
+                            <a-form-item label="抢险车辆名称">
+                              <a-select
+                                v-model:value="fourthData.rescueCars[index].carTypeCode"
+                                allowClear
+                                showSearch
+                                @change="change9(index, fourthData.rescueCars[index].carTypeCode)"
+                              >
+                                <a-select-option
+                                  v-for="item in dictData.rescueCar"
+                                  :key="item.carTypeCode"
+                                  :value="item.carTypeCode"
+                                  :label="item.carName"
+                                  >{{ item.carName }}</a-select-option
+                                >
+                              </a-select>
+                            </a-form-item>
+                          </a-col>
+                          <a-col :span="6">
+                            <a-form-item
+                              label="使用数量"
+                              :label-col="{ style: { width: '130px' } }"
+                            >
+                              <a-input-number
+                                v-model:value="fourthData.rescueCars[index].amount"
+                                :min="0"
+                                :step="1"
+                              />
+                            </a-form-item>
+                          </a-col>
+                        </a-row>
+                      </div>
+                    </a-col>
+                    <a-col :span="3">
+                      <div style="height: 100%; padding-top: 10px">
+                        <a-button type="primary" style="margin-right: 20px" @click="addSupply4"
+                          ><PlusOutlined
+                        /></a-button>
+                        <a-button
+                          style="background: #e1ebfc"
+                          v-if="
+                            index == fourthData.rescueCars.length - 1 &&
+                            fourthData.rescueCars.length > 1
+                          "
+                          @click="subLast4"
+                          >删除</a-button
+                        >
+                      </div>
+                    </a-col>
+                  </a-row>
+                </div>
+              </a-tab-pane>
             </a-tabs>
           </a-form>
         </div>
@@ -1057,17 +1126,20 @@
       .then(() => {
         message.loading({ content: '归档中', key });
         // 新增
-        fourthData.id = addForm.value.id;
-        fourthData.materials.forEach((i) => {
+        fourthData.value.id = addForm.value.id;
+        fourthData.value.materials.forEach((i) => {
           i.eventId = addForm.value.id;
         });
-        fourthData.eventEmergencies.forEach((i) => {
+        fourthData.value.eventEmergencies.forEach((i) => {
           i.eventId = addForm.value.id;
         });
-        fourthData.rescues.forEach((i) => {
+        fourthData.value.rescues.forEach((i) => {
           i.eventId = addForm.value.id;
         });
-        secureFile({ ...fourthData }).then((res) => {
+        fourthData.value.rescueCars.forEach((i) => {
+          i.eventId = addForm.value.id;
+        });
+        secureFile({ ...fourthData.value }).then((res) => {
           if (res.code == '200') {
             message.success({ content: '成功', key, duration: 2 });
             visible.value = false;
@@ -1084,7 +1156,7 @@
   };
 
   // 第四步
-  let fourthData = reactive({
+  let fourthData = ref({
     id: '',
     isSecureFile: '1',
     summary: '',
@@ -1102,13 +1174,20 @@
       { emergencyHospitalId: '', doctorAmount: '', ambulanceAmount: '', eventId: '' },
     ],
     rescues: [
-      { companyId: '', rescueTeamId: '', rescuePersonAmount: '', eventId: '', rescueTeamName: '' },
+      {
+        companyId: '',
+        rescueTeamId: '',
+        rescuePersonAmount: '',
+        eventId: '',
+        rescueTeamName: '',
+      },
     ],
+    rescueCars: [{ carTypeCode: '', carTypeName: '', amount: '', eventId: '' }],
   });
   const nowSupply = ref([] as any);
   const change4 = (index, i) => {
-    fourthData.materials[index].residueAmount = '';
-    fourthData.materials[index].materialsId = '';
+    fourthData.value.materials[index].residueAmount = '';
+    fourthData.value.materials[index].materialsId = '';
     nowSupply.value = [];
     props.dictData.supply.forEach((item) => {
       if (i == item.productId) {
@@ -1119,12 +1198,12 @@
   const change5 = (index, i, obj) => {
     props.dictData.supply.forEach((item) => {
       if (i == item.id) {
-        fourthData.materials[index].residueAmount = item.storeAmount;
-        fourthData.materials[index].storeAmount = item.storeAmount;
+        fourthData.value.materials[index].residueAmount = item.storeAmount;
+        fourthData.value.materials[index].storeAmount = item.storeAmount;
       }
     });
     const arr: Array<number> = [];
-    fourthData.materials.forEach((item) => {
+    fourthData.value.materials.forEach((item) => {
       if (
         item.productId === obj.productId &&
         item.materialsId === obj.materialsId &&
@@ -1135,11 +1214,11 @@
     });
     if (arr.length) {
       const minNum = Math.min(...arr);
-      fourthData.materials[index].residueAmount = minNum + '';
+      fourthData.value.materials[index].residueAmount = minNum + '';
     }
   };
   const addSupply = () => {
-    fourthData.materials.push({
+    fourthData.value.materials.push({
       productId: '',
       materialsId: '',
       useAmount: '',
@@ -1149,9 +1228,9 @@
     });
   };
   const subLast = () => {
-    const popItem = fourthData.materials.pop();
+    const popItem = fourthData.value.materials.pop();
     if (popItem) {
-      fourthData.materials.forEach((item) => {
+      fourthData.value.materials.forEach((item) => {
         if (popItem.productId === item.productId && popItem.materialsId === item.materialsId) {
           item.residueAmount += popItem.useAmount;
         }
@@ -1162,13 +1241,13 @@
   const change6 = (index, i) => {
     props.dictData.hospital.forEach((item) => {
       if (i == item.id) {
-        fourthData.eventEmergencies[index].doctorAmount = item.doctorAmout;
-        fourthData.eventEmergencies[index].ambulanceAmount = item.ambulanceAmount;
+        fourthData.value.eventEmergencies[index].doctorAmount = item.doctorAmout;
+        fourthData.value.eventEmergencies[index].ambulanceAmount = item.ambulanceAmount;
       }
     });
   };
   const addSupply2 = () => {
-    fourthData.eventEmergencies.push({
+    fourthData.value.eventEmergencies.push({
       emergencyHospitalId: '',
       doctorAmount: '',
       ambulanceAmount: '',
@@ -1176,14 +1255,14 @@
     });
   };
   const subLast2 = () => {
-    fourthData.eventEmergencies.pop();
+    fourthData.value.eventEmergencies.pop();
   };
   // 救援队
   const nowRescueTeam = ref([] as any);
   const change7 = (index, i) => {
     nowRescueTeam.value = [];
-    fourthData.rescues[index].rescuePersonAmount = '';
-    fourthData.rescues[index].rescueTeamId = '';
+    fourthData.value.rescues[index].rescuePersonAmount = '';
+    fourthData.value.rescues[index].rescueTeamId = '';
     props.dictData.rescueTeam.forEach((item) => {
       if (i == item.companyId) {
         item.name = item.companyName + '-' + (item.liableName || item.contactName);
@@ -1194,21 +1273,22 @@
   const change8 = (index, i) => {
     props.dictData.rescueTeam.forEach((item) => {
       if (i == item.id) {
-        fourthData.rescues[index].rescuePersonAmount = item.maxResponsePerson;
-        fourthData.rescues[index].rescueTeamName = item.name;
+        fourthData.value.rescues[index].rescuePersonAmount = item.maxResponsePerson;
+        fourthData.value.rescues[index].rescueTeamName = item.name;
       }
     });
   };
   const addSupply3 = () => {
-    fourthData.rescues.push({
+    fourthData.value.rescues.push({
       companyId: '',
       rescueTeamId: '',
       rescuePersonAmount: '',
       eventId: '',
+      rescueTeamName: '',
     });
   };
   const subLast3 = () => {
-    fourthData.rescues.pop();
+    fourthData.value.rescues.pop();
   };
 
   const handleClick = (i) => {
@@ -1227,6 +1307,27 @@
     thirdData.value.economicLoss = i.economicLoss;
   };
   const activeKey = ref('1');
+
+  // 抢险车辆
+  const change9 = (index, i) => {
+    props.dictData.rescueCar.forEach((item) => {
+      if (i == item.carTypeCode) {
+        fourthData.value.rescueCars[index].carTypeName = item.carName;
+      }
+    });
+  };
+  const addSupply4 = () => {
+    fourthData.value.rescueCars.push({
+      carTypeCode: '',
+      carTypeName: '',
+      amount: '',
+      eventId: '',
+    });
+  };
+  const subLast4 = () => {
+    fourthData.value.rescueCars.pop();
+  };
+
   // 第三步
   const thirdData = ref({
     pushId: '',
@@ -1481,7 +1582,7 @@
       missingPeople: '',
       economicLoss: '',
     };
-    fourthData = {
+    fourthData.value = {
       id: '',
       isSecureFile: '1',
       summary: '',
@@ -1498,7 +1599,16 @@
       eventEmergencies: [
         { emergencyHospitalId: '', doctorAmount: '', ambulanceAmount: '', eventId: '' },
       ],
-      rescues: [{ companyId: '', rescueTeamId: '', rescuePersonAmount: '', eventId: '' }],
+      rescues: [
+        {
+          companyId: '',
+          rescueTeamId: '',
+          rescuePersonAmount: '',
+          eventId: '',
+          rescueTeamName: '',
+        },
+      ],
+      rescueCars: [{ carTypeCode: '', carTypeName: '', amount: '', eventId: '' }],
     };
   }
   function handleCancel() {
@@ -1524,7 +1634,7 @@
   }
   function changeUseAmount(value, residueAmount, obj, currentIndex) {
     let usedNum = 0;
-    fourthData.materials.forEach((item, index) => {
+    fourthData.value.materials.forEach((item, index) => {
       if (index === currentIndex) {
         return;
       }
@@ -1538,7 +1648,7 @@
     } else {
       obj.residueAmount = residueAmount - (value || 0) - usedNum;
     }
-    fourthData.materials.forEach((item) => {
+    fourthData.value.materials.forEach((item) => {
       if (item.productId === obj.productId && item.materialsId === obj.materialsId) {
         item.residueAmount = obj.residueAmount;
       }

+ 4 - 9
src/views/lifeline/riskLinkageSystem/eventManage/eventUnfile/dialogTableColumns.ts

@@ -215,18 +215,13 @@ export const fourththree: BasicColumn[] = [
 ];
 export const fourthFour: BasicColumn[] = [
   {
-    title: '工程抢险车',
-    dataIndex: 'materialsManagement.number',
-    width: 120,
-  },
-  {
-    title: '挖掘机',
-    dataIndex: 'materialsName',
+    title: '抢险车辆名称',
+    dataIndex: 'carTypeName',
     width: 120,
   },
   {
-    title: '抢险车',
-    dataIndex: 'useAmount',
+    title: '使用数量',
+    dataIndex: 'amount',
     width: 120,
   },
 ];

+ 10 - 0
src/views/lifeline/riskLinkageSystem/eventManage/eventUnfile/index.vue

@@ -119,6 +119,7 @@
   import { useRoute } from 'vue-router';
   import { useModal } from '/@/components/Modal';
   import { useUserStore } from '/@/store/modules/user';
+  import { rescueCarPage as getCarPage } from '/@/api/configuration/rescueCar';
   const userStore = useUserStore();
   const [registerDetail, { openModal: openModalDetail }] = useModal();
   // 添加事件数据
@@ -142,6 +143,7 @@
     hospital: [] as any,
     rescueTeam: [] as any,
     dataSource: {} as any,
+    rescueCar: [] as any,
   });
   const organizationId = ref<string>('');
 
@@ -304,6 +306,14 @@
     getRescueTeam({ page: 1, pageSize: 10000, showAll: 1 }).then((res) => {
       dictData.rescueTeam = res.items;
     });
+    // 抢险车辆
+    getCarPage({
+      page: 1,
+      pageSize: 100000,
+      showAll: 1,
+    }).then((res) => {
+      dictData.rescueCar = res.items;
+    });
   });
 
   const tagColor = (i) => {