LAPTOP-16IUEB3P\Lenovo hace 3 años
padre
commit
5856cf3692

+ 1 - 1
.env

@@ -1,2 +1,2 @@
-VUE_APP_NAME=凯德主数据平台
+VUE_APP_NAME=基础数据平台
 VUE_APP_API_BASE_URL=/api

+ 1 - 1
public/index.html

@@ -4,7 +4,7 @@
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
-  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+  <link rel="icon" href="<%= BASE_URL %>logo.png">
   <title><%= process.env.VUE_APP_NAME %></title>
   <style>
     .ele-admin-loading {

BIN
public/logo.png


+ 44 - 0
src/api/factoryModel/index.js

@@ -52,4 +52,48 @@ export async function deletefactoryarea(params) {
         return res.data.message;
     }
     return Promise.reject(new Error(res.data.message));
+}
+// 保存修改工位
+export async function saveOrUpdate_gw(params) {
+    const res = await request.post(
+        `/main/factoryworkstation/saveOrUpdate`,
+        params
+    );
+    if (res.data.code == 0) {
+        return res.data.message;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+// 工位分页查询
+export async function getFactoryworkstation(params) {
+    const res = await request.get(
+        `/main/factoryworkstation/page`,
+        {
+            params
+        }
+    );
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+// 工位删除
+export async function deleteFactoryworkstation(params) {
+    const res = await request.delete(
+        `/main/factoryworkstation/delete/${params}`,
+    );
+    if (res.data.code == 0) {
+        return res.data.message;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+// 工位详情
+export async function getById(params) {
+    const res = await request.get(
+        `/main/factoryworkstation/getById/${params}`,
+    );
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
 }

BIN
src/assets/logo.png


+ 10 - 1
src/layout/index.vue

@@ -53,7 +53,7 @@
     <router-layout />
     <!-- logo 图标 -->
     <template v-slot:logo>
-      <img src="@/assets/logo.svg" alt="logo" />
+      <img src="@/assets/logo.png" alt="logo" />
     </template>
     <!-- 顶栏右侧区域 -->
     <template v-slot:right>
@@ -242,6 +242,15 @@
 </script>
 
 <style lang="scss">
+  .ele-admin-layout {
+    .ele-admin-logo {
+      font-size: 18px !important;
+      img {
+        width: 50px !important;
+        height: auto !important;
+      }
+    }
+  }
   // 侧栏菜单徽章样式,定位在右侧垂直居中并调小尺寸
   .ele-menu-badge {
     position: absolute;

+ 140 - 76
src/views/factoryModel/factoryManagement/components/edit.vue

@@ -12,11 +12,7 @@
     <el-form ref="form" :model="form" :rules="rules" label-width="100px">
       <el-row>
         <el-col :span="8">
-          <el-form-item
-            label="工厂编码:"
-            prop="code"
-            style="margin-bottom: 22px"
-          >
+          <el-form-item label="工厂编码:" prop="code">
             <el-input
               clearable
               :maxlength="20"
@@ -26,11 +22,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item
-            label="工厂名称:"
-            prop="name"
-            style="margin-bottom: 22px"
-          >
+          <el-form-item label="工厂名称:" prop="name">
             <el-input
               clearable
               :maxlength="20"
@@ -40,11 +32,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item
-            label="所属公司:"
-            prop="groupId"
-            style="margin-bottom: 22px"
-          >
+          <el-form-item label="所属公司:" prop="groupId">
             <ele-tree-select
               clearable
               :data="options.groupId"
@@ -56,26 +44,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="16" style="margin-bottom: 22px">
-          <el-form-item label="地址:" prop="location_city">
-            <div class="location-warp">
-              <el-cascader
-                clearable
-                style="width: 385px"
-                v-model="form.location"
-                :options="options.cityDataLabel"
-              ></el-cascader>
-              <el-input
-                class="detail"
-                clearable
-                :maxlength="20"
-                v-model="form.locationDetail"
-                placeholder="请输入详细地址"
-              />
-            </div>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8" style="margin-bottom: 22px">
+        <el-col :span="8">
           <el-form-item label="状态:" prop="enabled">
             <div class="location-warp">
               <el-select
@@ -95,6 +64,56 @@
             </div>
           </el-form-item>
         </el-col>
+        <el-col :span="8">
+          <el-form-item label="负责人部门:" prop="extInfo.principalDep">
+            <ele-tree-select
+              clearable
+              :data="options_groupId"
+              v-model="form.extInfo.principalDep"
+              valueKey="id"
+              labelKey="name"
+              placeholder="请选择"
+              @change="change_principalDep"
+              default-expand-all
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="负责人:" prop="leaderId">
+            <el-select
+              v-model="form.leaderId"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in options.leaderId"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="16">
+          <el-form-item label="地址:" prop="location_city">
+            <div class="location-warp">
+              <el-cascader
+                clearable
+                style="width: 385px"
+                v-model="form.extInfo.location"
+                :options="options.cityDataLabel"
+              ></el-cascader>
+              <el-input
+                class="detail"
+                clearable
+                :maxlength="20"
+                v-model="form.extInfo.locationDetail"
+                placeholder="请输入详细地址"
+              />
+            </div>
+          </el-form-item>
+        </el-col>
       </el-row>
     </el-form>
     <template v-slot:footer>
@@ -110,28 +129,56 @@
 import { cityDataLabel } from 'ele-admin/packages/utils/regions';
 import { listOrganizations } from '@/api/system/organization';
 import { saveOrUpdate } from '@/api/factoryModel';
+import { getUserPage } from '@/api/system/organization';
 export default {
+  props: {
+    options_groupId: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  watch: {
+    options_groupId(nval) {
+      this.toTreeData(nval);
+    }
+  },
   data() {
-    const defaultForm = {
-      id: '',
-      code: '',
-      name: '',
-      groupId: '',
-      locationDetail: '',
-      location: [],
-      enabled: 1,
-      parentId: '',
-      type: 1 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+    const defaultForm = function () {
+      return {
+        id: '',
+        code: '',
+        name: '',
+        groupId: '',
+        extInfo: {
+          principalDep: '', // 负责人部门
+          location: [],
+          locationDetail: ''
+        },
+        enabled: 1,
+        parentId: 0,
+        leaderId: '',
+        type: 1 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+      };
     };
     return {
       defaultForm,
       // 表单数据
-      form: { ...defaultForm },
+      form: { ...defaultForm() },
       // 表单验证规则
       rules: {
         code: [{ required: true, message: '请输入', trigger: 'blur' }],
         name: [{ required: true, message: '请输入', trigger: 'blur' }],
-        groupId: [{ required: true, message: '请输入', trigger: 'blur' }]
+        groupId: [{ required: true, message: '请输入', trigger: 'blur' }],
+        leaderId: {
+          required: true,
+          message: '请输入',
+          trigger: 'change'
+        },
+        'extInfo.principalDep': [
+          { required: true, message: '请输入', trigger: 'change' }
+        ]
       },
       visible: false,
       type: '', // add/edit
@@ -148,7 +195,8 @@ export default {
           }
         ],
         groupId: [],
-        cityDataLabel
+        cityDataLabel,
+        leaderId: []
       }
     };
   },
@@ -174,17 +222,24 @@ export default {
       this.type = type;
       this.visible = true;
       if (type == 'edit') {
-        this.form.id = row.id;
-        this.form.code = row.code;
-        this.form.name = row.name;
-        this.form.groupId = row.groupId;
-        this.form.enabled = row.enabled;
-        this.form.parentId = row.parentId;
-        this.form.type = row.type;
-        this.form.location = row.extInfo.location.split('/');
-        this.form.locationDetail = row.extInfo.locationDetail;
+        for (const key of Object.keys(this.form)) {
+          if (key !== 'extInfo') {
+            this.form[key] = row[key];
+          } else {
+            for (const el of Object.keys(this.form.extInfo)) {
+              this.form.extInfo[el] = row.extInfo[el];
+            }
+          }
+        }
       }
     },
+    toTreeData(val) {
+      this.options.principalDep = this.$util.toTreeData({
+        data: val,
+        idField: 'id',
+        parentIdField: 'parentId'
+      });
+    },
     /* 保存编辑 */
     save() {
       this.$refs.form.validate((valid) => {
@@ -193,20 +248,10 @@ export default {
         }
         this.loading = true;
 
-        const data = {
-          code: this.form.code,
-          name: this.form.name,
-          groupId: this.form.groupId,
-          enabled: this.form.enabled,
-          parentId: this.form.groupId,
-          type: this.form.type,
-          extInfo: this.setLocation()
-        };
-        if (this.type == 'edit') {
-          data.id = this.form.id;
+        if (this.type == 'add') {
+          delete this.form.id;
         }
-        console.log(data);
-        saveOrUpdate(data)
+        saveOrUpdate(this.form)
           .then((msg) => {
             this.loading = false;
             this.$message.success(msg);
@@ -220,8 +265,10 @@ export default {
       });
     },
     restForm() {
-      this.$refs.form.clearValidate();
-      this.form = { ...this.defaultForm };
+      this.form = { ...this.defaultForm() };
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate();
+      });
     },
     handleClose() {
       this.restForm();
@@ -238,11 +285,20 @@ export default {
         });
       });
     },
-    setLocation() {
-      return {
-        location: this.form.location.join('/'),
-        locationDetail: this.form.locationDetail
+    // 选择负责人部门
+    change_principalDep() {
+      this.form.leaderId = '';
+      this.getUserPage();
+    },
+    // 获取人员
+    getUserPage() {
+      let par = {
+        groupId: this.form.extInfo.principalDep,
+        size: 999
       };
+      getUserPage(par).then((res) => {
+        this.options.leaderId = res.list;
+      });
     }
   }
 };
@@ -254,4 +310,12 @@ export default {
     margin-left: 10px;
   }
 }
+:deep(
+    .el-dialog:not(.ele-dialog-form)
+      .el-dialog__body
+      .el-form
+      .el-form-item:last-child
+  ) {
+  margin-bottom: 22px;
+}
 </style>

+ 1 - 1
src/views/factoryModel/factoryManagement/index.vue

@@ -50,7 +50,7 @@
         </template>
       </ele-pro-table>
     </el-card>
-    <edit ref="edit" @done="done"></edit>
+    <edit ref="edit" @done="done" :options_groupId="dict.groupId"></edit>
   </div>
 </template>
 <script>

+ 111 - 67
src/views/factoryModel/station/components/edit.vue

@@ -57,7 +57,7 @@
           <el-col :span="8">
             <el-form-item label="所属车间:" prop="extInfo.workshopId">
               <el-select
-                v-model="form.workshopId"
+                v-model="form.extInfo.workshopId"
                 placeholder="请选择"
                 style="width: 100%"
                 @change="change_workshop"
@@ -73,7 +73,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="所属产线:" prop="parentId">
+            <el-form-item label="所属产线:" prop="productionLineId">
               <el-select
                 v-model="form.productionLineId"
                 placeholder="请选择"
@@ -81,7 +81,7 @@
                 @change="change_productionLineId"
               >
                 <el-option
-                  v-for="item in options.productionLine"
+                  v-for="item in options.productionLineId"
                   :key="item.id"
                   :label="item.name"
                   :value="item.id"
@@ -94,7 +94,7 @@
             <el-form-item label="负责人部门:" prop="extInfo.principalDep">
               <ele-tree-select
                 clearable
-                :data="options.principalDep"
+                :data="options_groupId"
                 v-model="form.extInfo.principalDep"
                 valueKey="id"
                 labelKey="name"
@@ -105,15 +105,14 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="负责人:" prop="extInfo.principal">
+            <el-form-item label="负责人:" prop="leaderId">
               <el-select
                 v-model="form.leaderId"
                 placeholder="请选择"
-                @change="change_principal"
                 style="width: 100%"
               >
                 <el-option
-                  v-for="item in options.principal"
+                  v-for="item in options.leaderId"
                   :key="item.id"
                   :label="item.name"
                   :value="item.id"
@@ -135,7 +134,7 @@
                 />
                 <el-select
                   class="s2"
-                  v-model="form.enabled"
+                  v-model="form.extInfo.meterTimeUnit"
                   placeholder="请选择"
                 >
                   <el-option
@@ -200,7 +199,12 @@
 </template>
 
 <script>
-import { listWorkshopByParentId } from '@/api/factoryModel';
+import {
+  listWorkshopByParentId,
+  saveOrUpdate_gw,
+  listFactoryLineByParentId,
+  getById
+} from '@/api/factoryModel';
 import { getUserPage } from '@/api/system/organization';
 import equipmentTable from './equipmentTable.vue';
 export default {
@@ -227,26 +231,29 @@ export default {
     }
   },
   data() {
-    const defaultForm = {
-      id: '',
-      code: '',
-      name: '',
-      extInfo: {
-        factoryId: '', // 工厂
-        workshopId: '', // 车间
-        principalDep: '', // 负责人部门
-        meterTimeUnit: '时', // 节拍时间单位
-        meterTime: '' // 节拍时间
-      },
-      leaderId: '', // 负责人
-      enabled: 1,
-      productionLineId: '',
-      remark: ''
+    const defaultForm = function () {
+      return {
+        code: '',
+        enabled: 1,
+        extInfo: {
+          factoryId: '', // 工厂
+          workshopId: '', // 车间
+          principalDep: '', // 负责人部门
+          meterTimeUnit: '时', // 节拍时间单位
+          meterTime: '' // 节拍时间
+        },
+        id: '',
+        leaderId: '', // 负责人
+        name: '',
+        productionLineId: '',
+        remark: '',
+        workstationSubstanceList: []
+      };
     };
     return {
       defaultForm,
       // 表单数据
-      form: { ...defaultForm },
+      form: defaultForm(),
       // 表单验证规则
       rules: {
         code: [{ required: true, message: '请输入', trigger: 'blur' }],
@@ -254,23 +261,30 @@ export default {
         'extInfo.factoryId': [
           { required: true, message: '请输入', trigger: 'change' }
         ],
-        parentId: { required: true, message: '请输入', trigger: 'change' },
         'extInfo.principalDep': [
           { required: true, message: '请输入', trigger: 'change' }
         ],
-        'extInfo.principal': [
-          { required: true, message: '请输入', trigger: 'change' }
-        ],
-        'extInfo.phone': [
-          { min: 11, message: '手机号格式不正确', trigger: 'blur' }
-        ]
+        'extInfo.workshopId': {
+          required: true,
+          message: '请输入',
+          trigger: 'change'
+        },
+        productionLineId: {
+          required: true,
+          message: '请输入',
+          trigger: 'change'
+        },
+        leaderId: {
+          required: true,
+          message: '请输入',
+          trigger: 'change'
+        }
       },
       visible: false,
       type: '', // add/edit
       loading: false,
       options: {
-        principalDep: [],
-        principal: [],
+        leaderId: [],
         workshopId: [],
         enabled: [
           {
@@ -300,7 +314,7 @@ export default {
             label: '日'
           }
         ],
-        productionLine: []
+        productionLineId: []
       }
     };
   },
@@ -332,10 +346,14 @@ export default {
             }
           }
         }
+        this.getData(row.id);
         // 请求下拉数据
         if (this.form.extInfo.factoryId) {
           this.getListWorkshopByParentId();
         }
+        if (this.form.extInfo.workshopId) {
+          this.getlistFactoryLineByParentId();
+        }
         if (this.form.extInfo.principalDep) {
           this.getUserPage();
         }
@@ -352,25 +370,35 @@ export default {
         if (this.type == 'add') {
           delete this.form.id;
         }
-        // saveOrUpdate(this.form)
-        //   .then((msg) => {
-        //     this.loading = false;
-        //     this.$message.success(msg);
-        //     this.handleClose();
-        //     this.$emit('done');
-        //   })
-        //   .catch((e) => {
-        //     this.loading = false;
-        //     this.$message.error(e.message);
-        //   });
+        this.form.workstationSubstanceList =
+          this.$refs.equipmentTable.datasource.map((n) => {
+            return {
+              type: 1,
+              substanceId: n.id
+            };
+          });
+        saveOrUpdate_gw(this.form)
+          .then((msg) => {
+            this.loading = false;
+            this.$message.success(msg);
+            this.handleClose();
+            this.$emit('done');
+          })
+          .catch((e) => {
+            this.loading = false;
+            this.$message.error(e.message);
+          });
       });
     },
     restForm() {
-      this.$refs.form.clearValidate();
-      this.form = { ...this.defaultForm };
+      this.form = { ...this.defaultForm() };
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate();
+      });
     },
     handleClose() {
       this.restForm();
+      this.loading = false;
       this.visible = false;
     },
     // 格式化公司数据
@@ -384,7 +412,15 @@ export default {
     // 获取车间
     getListWorkshopByParentId() {
       listWorkshopByParentId(this.form.extInfo.factoryId).then((res) => {
-        this.options.workshop = res;
+        this.options.workshopId = res;
+      });
+    },
+    // 获取产线
+    getlistFactoryLineByParentId() {
+      console.log(this.form.extInfo.workshopId);
+      listFactoryLineByParentId(this.form.extInfo.workshopId).then((res) => {
+        console.log(res);
+        this.options.productionLineId = res;
       });
     },
     // 获取人员
@@ -394,38 +430,46 @@ export default {
         size: 999
       };
       getUserPage(par).then((res) => {
-        this.options.principal = res.list;
+        this.options.leaderId = res.list;
       });
     },
     // 选择工厂
     change_factoryId() {
-      this.form.parentId = '';
-      this.form.groupId = '';
-      this.options.workshop = [];
+      this.form.extInfo.workshopId = '';
+      this.form.leaderId = '';
+      this.options.workshopId = [];
+      this.options.leaderId = [];
       this.getListWorkshopByParentId();
     },
     // 选择负责人部门
     change_principalDep() {
-      this.form.extInfo.principal = '';
-      this.options.principal = [];
+      this.form.leaderId = '';
       this.getUserPage();
     },
     // 选择车间
     change_workshop() {
-      let result = this.options.workshop.find(
-        (n) => n.id == this.form.parentId
-      );
-      this.form.groupId = result.groupId;
-    },
-    // 选择负责人
-    change_principal() {
-      let result = this.options.principal.find(
-        (n) => n.id == this.form.extInfo.principal
-      );
-      this.form.extInfo.phone = result.phone;
+      this.form.leaderId = '';
+      this.options.leaderId = [];
+      this.getlistFactoryLineByParentId();
     },
     // 选择产线
-    change_productionLineId() {}
+    change_productionLineId() {},
+    // 请求详情
+    getData(id) {
+      getById(id).then((res) => {
+        if (
+          res.workstationSubstanceList &&
+          res.workstationSubstanceList.length > 0
+        ) {
+          let list = res.workstationSubstanceList.map((n) => {
+            return n.substance;
+          });
+          if (list.length > 0) {
+            this.$refs.equipmentTable.datasource = list;
+          }
+        }
+      });
+    }
   }
 };
 </script>

+ 4 - 62
src/views/factoryModel/station/components/equipmentTable.vue

@@ -32,16 +32,6 @@
             </el-link>
           </template>
         </el-popconfirm>
-
-        <el-link :underline="false" v-if="row.isLeader"> 已设为班组长 </el-link>
-        <el-link
-          type="primary"
-          :underline="false"
-          v-else
-          @click="setLeader(row)"
-        >
-          设为班组长
-        </el-link>
       </template>
     </ele-pro-table>
     <staffSelection
@@ -66,16 +56,12 @@ export default {
           align: 'center'
         },
         {
-          prop: 'name',
-          label: '姓名'
-        },
-        {
-          prop: 'jobNumber',
-          label: '工号'
+          prop: 'code',
+          label: '设备编码'
         },
         {
-          prop: 'phone',
-          label: '电话'
+          prop: 'name',
+          label: '设备名称'
         },
         {
           columnKey: 'action',
@@ -103,56 +89,12 @@ export default {
       );
     },
     confirmStaffSelection(data) {
-      data.forEach((element) => {
-        if (!('isLeader' in element)) {
-          // isLeader 是否为班组长
-          element.isLeader = false;
-        }
-      });
       this.datasource = data;
-      this.setDefaultLeader();
     },
-    // 设置默认班组长
-    setDefaultLeader() {
-      if (this.datasource.length <= 0) {
-        return;
-      }
-      let result = this.datasource.find((n) => n.isLeader == true);
-      if (!result) {
-        this.datasource[0].isLeader = true;
-      }
-    },
-    // 设置班组长
-    setLeader(row) {
-      console.log(row);
-      this.datasource.forEach((n) => {
-        n.isLeader = false;
-      });
-      row.isLeader = true;
-    },
-    // 设置班组长(id)
-    setLeaderId(id) {
-      let result = this.datasource.find((n) => id == n.id);
 
-      if (result) {
-        this.datasource.forEach((n) => {
-          n.isLeader = false;
-        });
-        result.isLeader = true;
-      }
-    },
     // 清空表格
     restTable() {
       this.datasource = [];
-    },
-    // 获取班组长id
-    getTwi() {
-      let result = this.datasource.find((n) => n.isLeader == true);
-      if (result) {
-        return result.id;
-      } else {
-        return null;
-      }
     }
   }
 };

+ 38 - 4
src/views/factoryModel/station/components/search.vue

@@ -8,15 +8,33 @@
   >
     <el-row :gutter="15">
       <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
-        <el-form-item label="产线编码:">
+        <el-form-item label="工位编码:">
           <el-input clearable v-model="where.code" placeholder="请输入" />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
-        <el-form-item label="产线名称:">
+        <el-form-item label="工位名称:">
           <el-input clearable v-model="where.name" placeholder="请输入" />
         </el-form-item>
       </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
+        <el-form-item label="负责人:">
+          <el-select
+            v-model="where.leaderId"
+            filterable
+            placeholder="请选择"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in options.leaderId"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
       <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
         <div class="ele-form-actions">
           <el-button
@@ -35,6 +53,7 @@
 </template>
 
 <script>
+import { getUserPage } from '@/api/system/organization';
 export default {
   props: {
     options_groupId: {
@@ -59,14 +78,16 @@ export default {
     // 默认表单数据
     const defaultWhere = {
       code: '',
-      name: ''
+      name: '',
+      leaderId: ''
     };
     return {
       defaultWhere,
       // 表单数据
       where: { ...defaultWhere },
       options: {
-        groupId: []
+        groupId: [],
+        leaderId: []
       }
     };
   },
@@ -76,6 +97,9 @@ export default {
       return this.$store.state.theme.styleResponsive;
     }
   },
+  created() {
+    this.getUserPage();
+  },
   methods: {
     /* 搜索 */
     search() {
@@ -94,6 +118,16 @@ export default {
         idField: 'id',
         parentIdField: 'parentId'
       });
+    },
+    // 获取人员
+    getUserPage() {
+      let par = {
+        size: 999
+      };
+      getUserPage(par).then((res) => {
+        console.log(res);
+        this.options.leaderId = res.list;
+      });
     }
   }
 };

+ 22 - 32
src/views/factoryModel/station/components/staffSelection.vue

@@ -2,7 +2,7 @@
   <div class="container">
     <!-- 单据弹窗 -->
     <el-dialog
-      title="员工"
+      title="选择设备"
       :before-close="handleClose"
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
@@ -48,14 +48,14 @@
                     border: 'none'
                   }"
                 >
-                  <el-table-column prop="code" label="姓名">
+                  <el-table-column prop="code" label="设备编码">
                     <template slot-scope="{ row }">
-                      <div>{{ row.name }}</div>
+                      <div>{{ row.code }}</div>
                     </template>
                   </el-table-column>
-                  <el-table-column label="工号">
+                  <el-table-column label="设备名称">
                     <template slot-scope="{ row }">
-                      <div>{{ row.jobNumber }}</div>
+                      <div>{{ row.name }}</div>
                     </template>
                   </el-table-column>
                   <el-table-column width="80" label="操作">
@@ -100,14 +100,14 @@
                     border: 'none'
                   }"
                 >
-                  <el-table-column prop="code" label="姓名">
+                  <el-table-column prop="code" label="设备编码">
                     <template slot-scope="{ row }">
-                      <div>{{ row.name }}</div>
+                      <div>{{ row.code }}</div>
                     </template>
                   </el-table-column>
-                  <el-table-column label="工号">
+                  <el-table-column label="设备名称">
                     <template slot-scope="{ row }">
-                      <div>{{ row.jobNumber }}</div>
+                      <div>{{ row.name }}</div>
                     </template>
                   </el-table-column>
                   <el-table-column width="80" label="操作">
@@ -144,6 +144,8 @@ export default {
         groupId: null
       },
       treeList: [],
+      // 选择的分类
+      currentTree: '',
       staffList: [],
       selectStafflist: [], //已选员工
       defaultProps: {
@@ -176,17 +178,17 @@ export default {
     },
     //选择分类
     handleNodeClick(data) {
-      this.staffList = [];
-
-      this.form.groupId = data.id;
+      this.currentTree = data;
       let params = {
         pageNum: 1,
         size: this.size,
-        groupId: this.form.groupId
+        categoryLevelId: this.currentTree.id,
+        rootCategoryLevelId: this.treeList[0].id
       };
+      this.staffList = [];
       this.getStaffList(params);
     },
-    //获取员工列表
+    //获取设备列表
     async getStaffList(params) {
       let res = await getAssetList(params);
       let list = res.list;
@@ -206,34 +208,22 @@ export default {
       this.staffList = [...this.staffList, ...list];
       this.pageNum = res.pageNum;
     },
-    //查询更多员工
+    //查询更多设备
     async getMore() {
       this.pageNum += 1;
       let params = {
         pageNum: 1,
         size: this.size,
-        groupId: this.form.groupId
+        categoryLevelId: this.currentTree.id,
+        rootCategoryLevelId: this.treeList[0].id
       };
       this.getStaffList(params);
     },
     //选择员工
     choiceAsset(info) {
       let data = JSON.parse(JSON.stringify(info));
-      if (info.teamId) {
-        this.$confirm('当前员工已有所属班组, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-          .then(() => {
-            this.selectStafflist.push(data);
-            info.disabled = true;
-          })
-          .catch(() => {});
-      } else {
-        this.selectStafflist.push(data);
-        info.disabled = true;
-      }
+      this.selectStafflist.push(data);
+      info.disabled = true;
     },
     //删除已选员工
     deleteSelectStaff(info, index) {
@@ -247,7 +237,7 @@ export default {
     //保存
     sumbit() {
       if (this.selectStafflist.length === 0) {
-        this.$message.warning('请选择员工');
+        this.$message.warning('请选择设备');
       } else {
         this.$emit('confirm', JSON.parse(JSON.stringify(this.selectStafflist)));
         this.handleClose();

+ 23 - 27
src/views/factoryModel/station/index.vue

@@ -26,10 +26,12 @@
           </el-button>
         </template>
         <template v-slot:workshop="{ row }">
-          {{ showWorkshop(row) }}
+          <!-- {{ showWorkshop(row) }} -->
         </template>
-        <template v-slot:factory="{ row }">
-          {{ showgfactory(row) }}
+        <template v-slot:meterTime="{ row }">
+          <div v-if="row.extInfo.meterTime">
+            {{ `${row.extInfo.meterTime}  ${row.extInfo.meterTimeUnit}/次 ` }}
+          </div>
         </template>
         <template v-slot:enabled="{ row }">
           {{ dict.enabled[row.enabled] }}
@@ -69,7 +71,11 @@
 <script>
 import search from './components/search.vue';
 import edit from './components/edit.vue';
-import { getFactoryarea, deletefactoryarea } from '@/api/factoryModel';
+import {
+  deleteFactoryworkstation,
+  getFactoryworkstation,
+  getFactoryarea
+} from '@/api/factoryModel';
 import { listOrganizations } from '@/api/system/organization';
 export default {
   components: {
@@ -87,29 +93,29 @@ export default {
         },
         {
           prop: 'code',
-          label: '产线编码'
+          label: '工位编码'
         },
         {
-          label: '产线名称',
+          label: '工位名称',
           prop: 'name'
         },
         {
-          label: '所属工厂',
-          prop: 'extInfo.factoryId',
+          label: '责任人',
+          prop: 'leaderName',
           slot: 'factory'
         },
         {
           label: '所属车间',
-          prop: 'parentId',
-          slot: 'workshop'
+          prop: 'workshopName'
         },
         {
-          label: '省/市/区',
-          prop: 'extInfo.location'
+          label: '所属产线',
+          prop: 'productionLineName'
         },
         {
-          label: '详细地址',
-          prop: 'extInfo.locationDetail'
+          label: '节拍时间',
+          prop: 'extInfo.meterTime',
+          slot: 'meterTime'
         },
         {
           label: '状态',
@@ -142,11 +148,10 @@ export default {
   },
   methods: {
     datasource({ page, where, limit }) {
-      return getFactoryarea({
+      return getFactoryworkstation({
         ...where,
         pageNum: page,
-        size: limit,
-        type: 4
+        size: limit
       });
     },
     search(where) {
@@ -165,15 +170,6 @@ export default {
         this.dict.groupId = list;
       });
     },
-    // 回显工厂名称
-    showgfactory(row) {
-      let result = row.parent.find((n) => n.id == row.extInfo.factoryId);
-      if (result) {
-        return result.name;
-      } else {
-        return '';
-      }
-    },
     // 回显车间
     showWorkshop(row) {
       let result = row.parent.find((n) => n.id == row.parentId);
@@ -194,7 +190,7 @@ export default {
       });
     },
     remove(row) {
-      deletefactoryarea(row.id)
+      deleteFactoryworkstation(row.id)
         .then((message) => {
           this.$message.success(message);
           this.done();

+ 78 - 16
src/views/factoryModel/workshop/components/edit.vue

@@ -73,6 +73,37 @@
             </el-select>
           </el-form-item>
         </el-col>
+        <el-col :span="12">
+          <el-form-item label="负责人部门:" prop="extInfo.principalDep">
+            <ele-tree-select
+              clearable
+              :data="options_groupId"
+              v-model="form.extInfo.principalDep"
+              valueKey="id"
+              labelKey="name"
+              placeholder="请选择"
+              @change="change_principalDep"
+              default-expand-all
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="负责人:" prop="leaderId">
+            <el-select
+              v-model="form.leaderId"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in options.leaderId"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col :span="12" style="margin-bottom: 22px">
           <el-form-item label="地址:" prop="location_city">
             <el-input
@@ -96,6 +127,7 @@
 
 <script>
 import { saveOrUpdate } from '@/api/factoryModel';
+import { getUserPage } from '@/api/system/organization';
 export default {
   props: {
     options_groupId: {
@@ -117,34 +149,47 @@ export default {
     }
   },
   data() {
-    const defaultForm = {
-      id: '',
-      code: '',
-      name: '',
-      extInfo: {
-        location: ''
-      },
-      groupId: '',
-      enabled: 1,
-      parentId: '',
-      type: 3 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+    const defaultForm = function () {
+      return {
+        id: '',
+        code: '',
+        name: '',
+        extInfo: {
+          location: '',
+          principalDep: '' // 负责人部门
+        },
+        leaderId: '', // 负责人
+        groupId: '',
+        enabled: 1,
+        parentId: '',
+        type: 3 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+      };
     };
     return {
       defaultForm,
       // 表单数据
-      form: { ...defaultForm },
+      form: { ...defaultForm() },
       // 表单验证规则
       rules: {
         code: [{ required: true, message: '请输入', trigger: 'blur' }],
         name: [{ required: true, message: '请输入', trigger: 'blur' }],
         groupId: [{ required: true, message: '请输入', trigger: 'blur' }],
-        parentId: [{ required: true, message: '请输入', trigger: 'blur' }]
+        parentId: [{ required: true, message: '请输入', trigger: 'blur' }],
+        leaderId: {
+          required: true,
+          message: '请输入',
+          trigger: 'change'
+        },
+        'extInfo.principalDep': [
+          { required: true, message: '请输入', trigger: 'change' }
+        ]
       },
       visible: false,
       type: '', // add/edit
       loading: false,
       options: {
-        groupId: []
+        groupId: [],
+        leaderId: []
       }
     };
   },
@@ -204,8 +249,10 @@ export default {
       });
     },
     restForm() {
-      this.$refs.form.clearValidate();
-      this.form = { ...this.defaultForm };
+      this.form = { ...this.defaultForm() };
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate();
+      });
     },
     handleClose() {
       this.restForm();
@@ -218,6 +265,21 @@ export default {
         idField: 'id',
         parentIdField: 'parentId'
       });
+    },
+    // 选择负责人部门
+    change_principalDep() {
+      this.form.leaderId = '';
+      this.getUserPage();
+    },
+    // 获取人员
+    getUserPage() {
+      let par = {
+        groupId: this.form.extInfo.principalDep,
+        size: 999
+      };
+      getUserPage(par).then((res) => {
+        this.options.leaderId = res.list;
+      });
     }
   }
 };

+ 36 - 26
src/views/workforceManagement/schedule/detail.vue

@@ -119,7 +119,8 @@ export default {
       classesColor: {
         1: '#979d9d',
         clear: '#979d9d'
-      }
+      },
+      addInfo: ''
     };
   },
   computed: {
@@ -148,30 +149,8 @@ export default {
       if (this.$route.query.type) {
         this.type = this.$route.query.type;
         if (this.type == 'add') {
-          let addInfo = this.$store.state.team.addInfo;
-          if (addInfo) {
-            // 人员数据
-            let personDetails = addInfo.personDetails.map((n) => {
-              return {
-                item: {
-                  name: n.userName,
-                  ...n
-                }
-              };
-            });
-            // 班组数据
-            let teamDetails = addInfo.teamDetails.map((n) => {
-              return {
-                item: {
-                  name: n.teamName,
-                  ...n
-                }
-              };
-            });
-            this.$nextTick(() => {
-              this.$refs.ManagementTable.setData(personDetails, teamDetails);
-            });
-          }
+          this.addInfo = this.$store.state.team.addInfo;
+          this.setAddinfo();
         } else if (this.type == 'edit') {
           // 按班排班
           let isSchedule = this.$route.query.isSchedule;
@@ -262,6 +241,33 @@ export default {
         this.rest();
       });
     },
+    // 处理新增信息
+    setAddinfo() {
+      if (this.addInfo) {
+        let addInfo = this.addInfo;
+        // 人员数据
+        let personDetails = addInfo.personDetails.map((n) => {
+          return {
+            item: {
+              name: n.userName,
+              ...n
+            }
+          };
+        });
+        // 班组数据
+        let teamDetails = addInfo.teamDetails.map((n) => {
+          return {
+            item: {
+              name: n.teamName,
+              ...n
+            }
+          };
+        });
+        this.$nextTick(() => {
+          this.$refs.ManagementTable.setData(personDetails, teamDetails);
+        });
+      }
+    },
     // 新增
     add() {
       let addInfo = this.$store.state.team.addInfo;
@@ -329,7 +335,11 @@ export default {
     },
     // 重置
     rest() {
-      this.getByIdteamqueue(this.$route.query.id);
+      if (this.type == 'add') {
+        this.setAddinfo();
+      } else if (this.type == 'edit') {
+        this.getByIdteamqueue(this.$route.query.id);
+      }
     },
     // 配置颜色
     configColor() {

+ 21 - 15
src/views/workforceManagement/team/components/edit.vue

@@ -128,21 +128,23 @@ export default {
     userTable
   },
   data() {
-    const defaultForm = {
-      id: '',
-      code: '',
-      leaderUserId: '',
-      name: '',
-      productionLineId: '',
-      userIds: '',
-      userNumber: '',
-      workStationIds: [],
-      workshopId: ''
+    const defaultForm = function () {
+      return {
+        id: '',
+        code: '',
+        leaderUserId: '',
+        name: '',
+        productionLineId: '',
+        userIds: '',
+        userNumber: '',
+        workStationIds: [],
+        workshopId: ''
+      };
     };
     return {
       defaultForm,
       // 表单数据
-      form: { ...defaultForm },
+      form: { ...defaultForm() },
       // 表单验证规则
       rules: {
         code: [{ required: true, message: '请输入', trigger: 'blur' }],
@@ -222,6 +224,7 @@ export default {
         let userIds = this.$refs.userTable.datasource.map((n) => n.id);
         if (userIds.length <= 0) {
           this.$message.error('请选择员工');
+          this.loading = false;
           return false;
         }
 
@@ -247,13 +250,16 @@ export default {
     },
     // 重置表单
     restForm() {
-      this.$refs.form.clearValidate();
-      this.form = { ...this.defaultForm };
+      this.form = { ...this.defaultForm() };
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate();
+      });
     },
     handleClose() {
       this.restForm();
       this.$refs.userTable.restTable();
       this.visible = false;
+      this.loading = false;
     },
     // 获取车间
     getlistWorkshopByParentId() {
@@ -294,14 +300,14 @@ export default {
     // 选择车间
     change_workshopId() {
       this.form.productionLineId = '';
-      this.form.workStationIds = '';
+      this.form.workStationIds = [];
       this.options.productionLineId = [];
       this.options.workStationIds = [];
       this.getlistFactoryLineByParentId();
     },
     // 选择产线
     change_productionLineId() {
-      this.form.workStationIds = '';
+      this.form.workStationIds = [];
       this.options.workStationIds = [];
       this.getlistByProductionLineId();
     }

+ 1 - 1
vue.config.js

@@ -31,7 +31,7 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        // target: 'http://192.168.3.51:86', // 测试
+        // target: 'http://192.168.3.51:18086', // 测试
         // target: 'http://192.168.3.35:8080', // kang杨威
         target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏