huang_an 2 年之前
父節點
當前提交
44afb23867

+ 9 - 0
src/api/ledgerAssets/index.js

@@ -119,3 +119,12 @@ export async function batchDel(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 查询实例详情
+export async function factoryworkstation(id) {
+  const res = await request.get(`/main/factoryworkstation/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 0
src/components/CommomSelect/factory-area-select.vue

@@ -66,6 +66,7 @@
     methods: {
       returnName(item) {
         this.$emit('returnName', item.name);
+        this.$emit('returnItem', item);
       },
       async getList() {
         let params = {

+ 140 - 109
src/views/ledgerAssets/equipment/edit.vue

@@ -220,55 +220,6 @@
                 </el-select>
               </el-form-item>
             </el-descriptions-item>
-            <el-descriptions-item>
-              <template slot="label"> 权属部门 </template>
-              <el-form-item label-width="0">
-                <div class="input">
-                  <DeptSelect
-                    v-model="zcInfo.ownershipGroupId"
-                    @input="getqsbm"
-                  />
-                </div>
-              </el-form-item>
-            </el-descriptions-item>
-            <el-descriptions-item>
-              <template slot="label"> 权属人 </template>
-              <el-form-item label-width="0">
-                <el-select
-                  style="width: 100%"
-                  v-model="zcInfo.ownershipUserId"
-                  placeholder="请选择"
-                >
-                  <el-option
-                    v-for="item in options.ownershipUserId"
-                    :key="item.id"
-                    :label="item.name"
-                    :value="item.id"
-                  >
-                  </el-option>
-                </el-select>
-              </el-form-item>
-            </el-descriptions-item>
-            <el-descriptions-item>
-              <template slot="label"> 设备用途 </template>
-              <el-form-item label-width="0">
-                <el-input v-model="zcInfo.purpose" class="input"></el-input>
-              </el-form-item>
-            </el-descriptions-item>
-            <el-descriptions-item>
-              <template slot="label"> 所属工序 </template>
-              <el-form-item label-width="0">
-                <WorkingProcedureSelect
-                  v-model="zcInfo.roteId"
-                ></WorkingProcedureSelect>
-              </el-form-item>
-            </el-descriptions-item>
-            <el-descriptions-item>
-              <template slot="label"> 品牌 </template>
-              <el-form-item label-width="0">
-                <el-input v-model="zcInfo.brand" class="input"></el-input>
-              </el-form-item>
-            </el-descriptions-item>
             <el-descriptions-item>
               <template slot="label"> 供应商 </template>
               <el-form-item label-width="0">
@@ -287,47 +238,7 @@
                 </el-select>
               </el-form-item>
             </el-descriptions-item>
-
-            <el-descriptions-item :span="4">
-              <template slot="label"> 所属厂房 </template>
-              <el-form-item label-width="0">
-                <FactoryAreaSelect
-                  placeholder="请选择工厂"
-                  style="margin-right: 10px"
-                  v-model="zcInfo.factoryRoomId1"
-                  :augr="1"
-                  @returnName="returnName1"
-                />
-                <FactoryAreaSelect
-                  placeholder="请选择厂房"
-                  style="margin-right: 10px"
-                  v-model="zcInfo.factoryRoomId2"
-                  :augr="2"
-                  @returnName="returnName2"
-                />
-                <FactoryAreaSelect
-                  placeholder="请选择车间"
-                  style="margin-right: 10px"
-                  v-model="zcInfo.factoryRoomId3"
-                  :augr="3"
-                  @returnName="returnName3"
-                />
-                <FactoryAreaSelect
-                  style="margin-right: 10px"
-                  placeholder="请选择产线"
-                  v-model="zcInfo.factoryRoomId4"
-                  :augr="4"
-                  @returnName="returnName4"
-                />
-                <FactoryAreaSelect
-                  style="margin-right: 10px"
-                  placeholder="请输入工位"
-                  v-model="zcInfo.factoryRoomId5"
-                  @returnName="returnName5"
-                />
-              </el-form-item>
-            </el-descriptions-item>
-            <el-descriptions-item :span="4">
+            <el-descriptions-item>
               <template slot="label"> 设备位置 </template>
               <el-form-item label-width="0">
                 <div style="display: flex">
@@ -412,7 +323,7 @@
                     :options="options.cityDataLabel"
                   ></el-cascader>
                   <el-input
-                    style="width: 30%; margin-left: 10px"
+                    style="width: 60%; margin-left: 10px"
                     placeholder="详细地址"
                     v-model="positionInfo.detailPosition"
                   ></el-input>
@@ -426,6 +337,102 @@
                 </div>
               </el-form-item>
             </el-descriptions-item>
+
+            <el-descriptions-item>
+              <template slot="label"> 设备用途 </template>
+              <el-form-item label-width="0">
+                <el-input v-model="zcInfo.purpose" class="input"></el-input>
+              </el-form-item>
+            </el-descriptions-item>
+            <!-- <el-descriptions-item>
+              <template slot="label"> 所属工序 </template>
+              <el-form-item label-width="0">
+                <WorkingProcedureSelect
+                  v-model="zcInfo.roteId"
+                ></WorkingProcedureSelect>
+              </el-form-item>
+            </el-descriptions-item> -->
+
+            <el-descriptions-item>
+              <template slot="label"> 品牌 </template>
+              <el-form-item label-width="0">
+                <el-input v-model="zcInfo.brand" class="input"></el-input>
+              </el-form-item>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 权属部门 </template>
+              <el-form-item label-width="0">
+                <div class="input">
+                  <DeptSelect
+                    v-model="zcInfo.ownershipGroupId"
+                    @input="getqsbm"
+                  />
+                </div>
+              </el-form-item>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 权属人 </template>
+              <el-form-item label-width="0">
+                <el-select
+                  style="width: 100%"
+                  v-model="zcInfo.ownershipUserId"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in options.ownershipUserId"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-descriptions-item>
+
+            <el-descriptions-item :span="3">
+              <template slot="label"> 所属厂房 </template>
+              <el-form-item label-width="0">
+                <FactoryAreaSelect
+                  placeholder="请选择工厂"
+                  style="margin-right: 10px; width: 20%"
+                  v-model="zcInfo.factoryRoomId1"
+                  :augr="1"
+                />
+                <FactoryAreaSelect
+                  placeholder="请选择厂房"
+                  style="margin-right: 10px; width: 20%"
+                  v-model="zcInfo.factoryRoomId2"
+                  :augr="2"
+                />
+                <FactoryAreaSelect
+                  placeholder="请选择车间"
+                  style="margin-right: 10px; width: 20%"
+                  v-model="zcInfo.factoryRoomId3"
+                  :augr="3"
+                />
+                <FactoryAreaSelect
+                  style="margin-right: 10px; width: 20%"
+                  placeholder="请选择产线"
+                  v-model="zcInfo.factoryRoomId4"
+                  :augr="4"
+                />
+                <FactoryAreaSelect
+                  style="margin-right: 10px; width: 15%"
+                  placeholder="请输入工位"
+                  v-model="zcInfo.factoryRoomId5"
+                  @returnItem="returnItem"
+                />
+              </el-form-item>
+            </el-descriptions-item>
+
+            <el-descriptions-item>
+              <template slot="label"> 所属工序 </template>
+              <el-form-item label-width="0">
+                <WorkingProcedureSelect
+                  v-model="zcInfo.roteId"
+                ></WorkingProcedureSelect>
+              </el-form-item>
+            </el-descriptions-item>
           </el-descriptions>
 
           <div class="basic-details-title border-none">
@@ -746,7 +753,11 @@
   //   getSupplier
   // } from '@/api/ledgerAssets/equipment';
   import { getFactoryarea } from '@/api/factoryModel';
-  import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
+  import {
+    saveOrEdit,
+    getAssetInfo,
+    factoryworkstation
+  } from '@/api/ledgerAssets';
   import { getUserPage } from '@/api/system/organization';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   export default {
@@ -840,6 +851,7 @@
           purpose: '',
           // 工序
           roteId: '',
+          roteName: '',
           //品牌
           brand: '',
           // 	供应商code
@@ -946,21 +958,40 @@
       }
     },
     methods: {
-      returnName1(val) {
-        this.zcInfo.factoryRoomName1 = val;
-      },
-      returnName2(val) {
-        this.zcInfo.factoryRoomName2 = val;
-      },
-      returnName3(val) {
-        this.zcInfo.factoryRoomName3 = val;
-      },
-      returnName4(val) {
-        this.zcInfo.factoryRoomName4 = val;
-      },
-      returnName5(val) {
-        this.zcInfo.factoryRoomName5 = val;
+      async returnItem(item) {
+        const data = await factoryworkstation(item.id);
+        console.log(data);
+        this.zcInfo.factoryRoomId1 = data.factoryId;
+        this.zcInfo.factoryRoomName1 = data.factoryName;
+        this.zcInfo.factoryRoomId2 = data.workshopPlanId;
+        this.zcInfo.factoryRoomName2 = data.workshopPlanName;
+        this.zcInfo.factoryRoomId3 = data.workshopId;
+        this.zcInfo.factoryRoomName3 = data.workshopName;
+        this.zcInfo.factoryRoomId4 = data.productionLineId;
+        this.zcInfo.factoryRoomName4 = data.productionLineName;
+
+        this.zcInfo.roteId = data.taskList[0].id;
+        this.zcInfo.roteName = data.taskList[0].name;
+
+        this.zcInfo.ownershipGroupId = data.extInfo.principalDep;
+        await this.getqsbm();
+        this.zcInfo.ownershipUserId = data.leaderId;
       },
+      // returnName1(val) {
+      //   this.zcInfo.factoryRoomName1 = val;
+      // },
+      // returnName2(val) {
+      //   this.zcInfo.factoryRoomName2 = val;
+      // },
+      // returnName3(val) {
+      //   this.zcInfo.factoryRoomName3 = val;
+      // },
+      // returnName4(val) {
+      //   this.zcInfo.factoryRoomName4 = val;
+      // },
+      // returnName5(val) {
+      //   this.zcInfo.factoryRoomName5 = val;
+      // },
       async twoClick(val) {
         this.positionInfo.workshopName = val.name;
         const res = await warehouseDefinition.getListByAreaId(val.id);
@@ -1139,9 +1170,9 @@
         if (!this.zcInfo.factoryRoomId4) {
           return this.$message.error('请选择产线');
         }
-        if (!this.zcInfo.factoryRoomId5) {
-          return this.$message.error('请选择工位');
-        }
+        // if (!this.zcInfo.factoryRoomId5) {
+        //   return this.$message.error('请选择工位');
+        // }
         this.$refs.form.validate((valid) => {
           if (valid) {
             console.log('ppp', this.positionInfo);