ysy há 2 anos atrás
pai
commit
4a29e7e704

+ 9 - 0
src/api/workforceManagement/team.js

@@ -15,6 +15,15 @@ export async function listFactoryLineByParentId(params) {
     }
     return Promise.reject(new Error(res.data.message));
 }
+
+export async function listFactoryLine() {
+    const res = await request.get(`/main/factoryarea/listFactoryLine`);
+    if (res.data.code == 0) {
+        return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+}
+
 // 获取产线下的所有工位
 export async function listByProductionLineId(params) {
     const res = await request.get(`/main/factoryworkstation/listByProductionLineId/` + params, {});

+ 32 - 91
src/views/workforceManagement/team/components/edit.vue

@@ -1,77 +1,35 @@
 <!-- 用户编辑弹窗 -->
 <template>
-  <el-dialog
-    class="ele-dialog-form"
-    :title="title"
-    :visible.sync="visible"
-    :before-close="handleClose"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    width="1000px"
-  >
+  <el-dialog class="ele-dialog-form" :title="title" :visible.sync="visible" :before-close="handleClose"
+    :close-on-click-modal="false" :close-on-press-escape="false" width="1000px">
     <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-      <el-card
-        shadow="never"
-        header="基本信息"
-        body-style="padding: 22px 22px 0 22px;"
-      >
+      <el-card shadow="never" header="基本信息" body-style="padding: 22px 22px 0 22px;">
         <el-row>
           <el-col :span="8">
             <el-form-item label="编码:" prop="code" style="margin-bottom: 22px">
-              <el-input
-                clearable
-                :maxlength="20"
-                v-model="form.code"
-                placeholder="请输入"
-              />
+              <el-input clearable :maxlength="20" v-model="form.code" placeholder="请输入" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="名称:" prop="name" style="margin-bottom: 22px">
-              <el-input
-                clearable
-                :maxlength="20"
-                v-model="form.name"
-                placeholder="请输入"
-              />
+              <el-input clearable :maxlength="20" v-model="form.name" placeholder="请输入" />
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item
-              label="车间:"
-              prop="workshopId"
-              style="margin-bottom: 22px"
-            >
-              <el-select
-                v-model="form.workshopId"
-                @change="change_workshopId"
-                placeholder="请选择"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in options.workshopId"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+            <el-form-item label="车间:" prop="workshopId" style="margin-bottom: 22px">
+              <el-select v-model="form.workshopId" @change="change_workshopId" multiple placeholder="请选择"
+                style="width: 100%">
+                <el-option v-for="item in options.workshopId" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="8" style="margin-bottom: 22px">
             <el-form-item label="产线:" prop="productionLineId">
-              <el-select
-                v-model="form.productionLineId"
-                @change="change_productionLineId"
-                placeholder="请选择"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in options.productionLineId"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
+              <el-select v-model="form.productionLineId"  multiple placeholder="请选择"
+                style="width: 100%">
+                <el-option v-for="item in options.productionLineId" :key="item.value" :label="item.label"
+                  :value="item.value">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -79,18 +37,9 @@
           <el-col :span="8" style="margin-bottom: 22px">
             <el-form-item label="工作中心:" prop="workStationIds">
               <div class="location-warp">
-                <el-select
-                  v-model="form.workStationIds"
-                  multiple
-                  placeholder="请选择"
-                  style="width: 100%"
-                >
-                  <el-option
-                    v-for="item in options.workStationIds"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
+                <el-select v-model="form.workStationIds" multiple filterable placeholder="请选择" style="width: 100%">
+                  <el-option v-for="item in options.workStationIds" :key="item.value" :label="item.label"
+                    :value="item.value">
                   </el-option>
                 </el-select>
               </div>
@@ -98,11 +47,7 @@
           </el-col>
         </el-row>
       </el-card>
-      <el-card
-        shadow="never"
-        header="员工配置"
-        body-style="padding: 22px 22px 0 22px;"
-      >
+      <el-card shadow="never" header="员工配置" body-style="padding: 22px 22px 0 22px;">
         <userTable ref="userTable"></userTable>
       </el-card>
     </el-form>
@@ -118,11 +63,11 @@
 <script>
 import {
   listWorkshopByParentId,
-  listFactoryLineByParentId,
-  listByProductionLineId,
+  listFactoryLine,
   saveteam,
   updateteam
 } from '@/api/workforceManagement/team';
+import work from '@/api/technology/work';
 import userTable from './userTable.vue';
 export default {
   components: {
@@ -135,11 +80,11 @@ export default {
         code: '',
         leaderUserId: '',
         name: '',
-        productionLineId: '',
+        productionLineId: [],
         userIds: '',
         userNumber: '',
         workStationIds: [],
-        workshopId: ''
+        workshopId: []
       };
     };
     return {
@@ -212,8 +157,10 @@ export default {
         // 获取下拉列表
         await this.getlistWorkshopByParentId();
         await this.getlistFactoryLineByParentId();
-        this.getlistByProductionLineId();
+       
       }
+
+      this.getlistByProductionLineId();
     },
     /* 保存编辑 */
     save() {
@@ -236,7 +183,7 @@ export default {
         if (this.type == 'add') {
           delete par.id;
         }
-        const saveOrUpdate = this.type == 'add'? saveteam : updateteam
+        const saveOrUpdate = this.type == 'add' ? saveteam : updateteam
         saveOrUpdate(par)
           .then((msg) => {
             this.loading = false;
@@ -277,8 +224,7 @@ export default {
     },
     // 获取产线
     getlistFactoryLineByParentId() {
-      let par = this.form.workshopId;
-      return listFactoryLineByParentId(par).then((res) => {
+      return listFactoryLine().then((res) => {
         this.options.productionLineId = res.map((n) => {
           return {
             value: n.id,
@@ -289,9 +235,8 @@ export default {
     },
     // 获取工位
     getlistByProductionLineId() {
-      let par = this.form.productionLineId;
-      return listByProductionLineId(par).then((res) => {
-        this.options.workStationIds = res.map((n) => {
+      return work.list({pageNum: 1,  size: -1}).then((res) => {
+        this.options.workStationIds = res.list.map((n) => {
           return {
             value: n.id,
             label: n.name
@@ -302,23 +247,19 @@ export default {
     // 选择车间
     change_workshopId() {
       this.form.productionLineId = '';
-      this.form.workStationIds = [];
+
       this.options.productionLineId = [];
-      this.options.workStationIds = [];
+
       this.getlistFactoryLineByParentId();
     },
-    // 选择产线
-    change_productionLineId() {
-      this.form.workStationIds = [];
-      this.options.workStationIds = [];
-      this.getlistByProductionLineId();
-    }
+
   }
 };
 </script>
 <style lang="scss" scoped>
 .location-warp {
   display: flex;
+
   .detail {
     margin-left: 10px;
   }

+ 1 - 4
src/views/workforceManagement/team/index.vue

@@ -95,10 +95,7 @@
             label: '所属产线',
             prop: 'productionLineName'
           },
-          {
-            label: '关联工站',
-            prop: 'workStationNames'
-          },
+       
           {
             label: '人数',
             prop: 'userNumber'

+ 1 - 0
vue.config.js

@@ -35,6 +35,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         target: 'http://192.168.1.139:18086',
         // target: 'http://192.168.1.132:18086',
+        // target: 'http://192.168.1.100:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''