ysy 1 yıl önce
ebeveyn
işleme
fe3ba8e5ea

+ 31 - 9
src/views/factoryModel/station/components/edit.vue

@@ -135,7 +135,7 @@
               <el-select
                 v-model="form.extInfo.workshopPlanId"
                 placeholder="请选择"
-                @change="getListWorkshopByParentId"
+                @change="getListWorkshopByParentId(false)"
                 style="width: 100%"
               >
                 <el-option
@@ -371,9 +371,8 @@
     },
 
     props: {
-      options_groupId: {}
+      options_groupId: Array
     },
-
     watch: {
       options_groupId(nval) {
         this.toTreeData(nval);
@@ -386,6 +385,7 @@
           enabled: 1,
           extInfo: {
             factoryId: '', // 工厂
+            workshopPlanId: '', // 厂房
             workshopId: '', // 车间
             principalDep: '', // 负责人部门
             meterTimeUnit: '时', // 节拍时间单位
@@ -428,6 +428,9 @@
           'extInfo.factoryId': [
             { required: true, message: '请输入', trigger: 'change' }
           ],
+          'extInfo.workshopPlanId': [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
           'extInfo.principalDep': [
             { required: true, message: '请输入', trigger: 'change' }
           ],
@@ -523,7 +526,7 @@
     created() {
       this.getGs();
       this.getFactoryList();
-      // this.getBasicAreaList()
+      this.getBasicAreaList();
     },
     methods: {
       chooseAsset() {
@@ -574,9 +577,14 @@
             }
           }
           this.getData(row.id);
+
           // 请求下拉数据
+          if (this.form.extInfo.factoryId) {
+            this.getlistCf();
+          }
+
           if (this.form.extInfo.workshopPlanId) {
-            this.getListWorkshopByParentId();
+            this.getListWorkshopByParentId(true);
           }
           if (this.form.extInfo.workshopId) {
             this.getlistFactoryLineByParentId();
@@ -665,7 +673,7 @@
       // 格式化公司数据
       toTreeData(val) {
         this.options.principalDep = this.$util.toTreeData({
-          data: val,
+          data: JSON.parse(JSON.stringify(val)),
           idField: 'id',
           parentIdField: 'parentId'
         });
@@ -686,7 +694,15 @@
       },
 
       // 获取车间
-      getListWorkshopByParentId() {
+      getListWorkshopByParentId(bol) {
+        if (!bol) {
+          this.form.extInfo.workshopId = '';
+
+          this.options.workshopId = [];
+
+          this.form.productionLineId = '';
+          this.options.productionLineId = [];
+        }
         listWorkshopByParentId(this.form.extInfo.workshopPlanId).then((res) => {
           this.options.workshopId = res;
         });
@@ -712,10 +728,16 @@
       },
       // 选择工厂
       change_factoryId() {
+        this.form.extInfo.workshopPlanId = '';
+        this.workshopPlanList = [];
+
         this.form.extInfo.workshopId = '';
-        this.form.leaderId = '';
+
         this.options.workshopId = [];
-        this.options.leaderId = [];
+
+        this.form.productionLineId = '';
+        this.options.productionLineId = [];
+
         this.getlistCf();
       },
       getlistCf() {

+ 1 - 3
src/views/factoryModel/station/index.vue

@@ -65,7 +65,6 @@
     <edit
       ref="edit"
       @done="done"
-      :options_groupId="dict.groupId"
 
     ></edit>
   </div>
@@ -185,8 +184,7 @@
       // 获取公司数据
       getGs () {
         listOrganizations().then((list) => {
-          console.log(list);
-          this.dict.groupId = list;
+          this.dict.groupId = JSON.parse(JSON.stringify(list));
         });
       },
       // 回显车间

+ 1 - 1
src/views/system/organization/components/org-user-edit.vue

@@ -21,7 +21,7 @@
           </el-form-item>
 
           <el-form-item label="所属工厂:">
-            <el-select style="width: 100%" clearable v-model="form.factoryId" multiple  filterable placeholder="请选择所属工厂">
+            <el-select style="width: 100%" clearable v-model="form.factoryId"   filterable placeholder="请选择所属工厂">
               <el-option
                 v-for="item in factoryList"
                 :label="item.name"