695593266@qq.com 7 ヶ月 前
コミット
35ad1b4ade

+ 9 - 1
src/api/system/organization/index.js

@@ -103,6 +103,15 @@ export async function saveOrUpdateUser(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//绑定关键工序
+export async function userBandingOperation(params) {
+  const res = await request.post('/main/user/batchSaveCriticalTaskIds', params);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 删除人员
  * @param params 人员信息
@@ -127,7 +136,6 @@ export async function checkExistence(jobNumber) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 /**
  * 解除绑定用户账号
  * @param id 人员id

+ 285 - 0
src/views/system/organization/components/criticalProcess.vue

@@ -0,0 +1,285 @@
+<template>
+  <ele-modal
+    width="70vw"
+    :visible.sync="visible"
+    v-if="visible"
+    :close-on-click-modal="false"
+    append-to-body
+    custom-class="ele-dialog-form"
+    title="选择工序"
+    :maxable="true"
+  >
+    <el-form label-width="120px">
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="工序编码" prop="code">
+            <el-input v-model="searchData.code"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="工序名称" prop="name">
+            <el-input v-model="searchData.name"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="6">
+          <el-form-item label="工作中心" prop="name">
+            <el-select
+              v-model="searchData.workCenterId"
+              placeholder="请选择"
+              filterable
+              clearable
+            >
+              <el-option
+                v-for="item in workCenterList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="6">
+          <div class="ele-form-actions">
+            <el-button type="primary" @click="search">搜索</el-button>
+            <el-button @click="reset">重置</el-button>
+          </div>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <ele-pro-table
+      :columns="columns"
+      :datasource="datasource"
+      ref="table"
+      height="45vh"
+      :initLoad="false"
+      row-key="id"
+      :selection.sync="selection"
+      highlight-current-row
+      :row-click-checked="true"
+      :row-click-checked-intelligent="false"
+      @update:selection="handleSelectionChange"
+    >
+      <template v-slot:type="{ row }">
+        {{ typeLabel(row.type) }}
+      </template>
+    </ele-pro-table>
+
+    <div slot="footer">
+      <el-button type="primary" @click="confirm">确定</el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import producetask from '@/api/technology/production';
+  import work from '@/api/technology/work';
+  import { userBandingOperation } from '@/api/system/organization';
+  export default {
+    props: {
+      disabledListId: {
+        type: Array,
+        default: () => []
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        selection: [],
+        searchData: {
+          code: '',
+          name: '',
+          workCenterId: '',
+          type: 99
+        },
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: 'left',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '工序编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '工序名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            align: 'center',
+            prop: 'controlName',
+            label: '工序控制码',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'workCenterName',
+            label: '所属工作中心',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'type',
+            slot: 'type',
+            label: '工序类型',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          }
+        ],
+        workCenterList: [],
+        typeList: [
+          {
+            value: 99,
+            label: '关键工序'
+          },
+          {
+            value: 1,
+            label: '普通工序'
+          },
+          // {
+          //   value: 2,
+          //   label: '抽样质检'
+          // },
+
+          {
+            value: 3,
+            label: '抽样质检'
+          },
+          {
+            value: 4,
+            label: '包装工序'
+          },
+          {
+            value: 6,
+            label: '质检工序'
+          },
+          {
+            value: 7,
+            label: '生产准备'
+          }
+        ],
+        userIds: [],
+        type: '',
+        allSelection: []
+      };
+    },
+    methods: {
+      open(list, type) {
+        this.visible = true;
+        this.getListWorkCenter();
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+        this.type = type;
+        if (this.type == 'batch') {
+          this.userIds = list.map((item) => {
+            return item.id;
+          });
+        } else {
+          this.allSelection = list || [];
+          console.log(this.allSelection);
+          this.$nextTick(() => {
+            this.allSelection.forEach((item) => {
+              this.$refs.table.toggleRowSelection(item, true);
+            });
+          });
+        }
+      },
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+        const res = await producetask.list({
+          ...where,
+          ...this.searchData,
+          pageNum: page,
+          size: limit
+        });
+        return res;
+      },
+      cancel() {
+        this.searchData = { type: 99 };
+        this.visible = false;
+      },
+
+      handleSelectionChange(data) {
+        this.allSelection = data;
+      },
+
+      confirm() {
+        if (this.allSelection.length == 0) {
+          return this.$message.warning('请选择工序');
+        }
+
+        if (this.type == 'batch') {
+          const taskIds = this.allSelection.map((item) => {
+            return item.id;
+          });
+
+          const loading = this.$loading({
+            lock: true,
+            text: 'Loading',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+
+          userBandingOperation({
+            userIds: this.userIds,
+            taskIds
+          })
+            .then(() => {
+              loading.close();
+              this.$message({
+                message: '绑定成功',
+                type: 'success'
+              });
+              this.$emit('chooseProcess');
+              this.cancel();
+            })
+            .catch(() => {
+              loading.close();
+            });
+        } else {
+          this.$emit('chooseProcess', this.allSelection);
+          this.cancel();
+        }
+      },
+
+      search() {
+        this.$refs.table.reload();
+      },
+      reset() {
+        this.searchData = {
+          type: 99
+        };
+        this.$refs.table.reload();
+      },
+
+      async getListWorkCenter() {
+        await work.list({ pageNum: 1, size: -1 }).then((res) => {
+          this.workCenterList = res.list;
+        });
+      },
+      typeLabel(type) {
+        return (
+          this.typeList.find((m) => m.value == type) &&
+          this.typeList.find((m) => m.value == type).label
+        );
+      }
+    }
+  };
+</script>

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

@@ -248,8 +248,8 @@
     mainProduct: '',
     remark: '',
     fax: '',
-    businessRegistrationNo:'',
-    contact:''
+    businessRegistrationNo: '',
+    contact: ''
   };
   import {
     addOrganization,

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

@@ -156,7 +156,11 @@
             </el-switch>
           </el-form-item>
           <el-form-item label="审批签名:" prop="signature">
-            <WithView :assetName="''" v-model="form.signature" style="max-height:370px"></WithView>
+            <WithView
+              :assetName="''"
+              v-model="form.signature"
+              style="max-height: 370px"
+            ></WithView>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
@@ -247,6 +251,36 @@
               placeholder="户籍地址"
             />
           </el-form-item>
+
+          <!-- <el-form-item label="关键工序:" prop="censusAddress">
+            <el-input
+              clearable
+              :maxlength="100"
+              v-model="form.censusAddress"
+              placeholder="请选择关键工序"
+              @click.native="chooseOperation"
+              readonly
+            />
+          </el-form-item> -->
+          <el-form-item label="关键工序:" prop="operations">
+            <div class="multi-select-input" @click="chooseOperation">
+              <div class="tag-box">
+                <el-tag
+                  v-for="(item, index) in form.criticalTaskList"
+                  :key="item.taskId"
+                  closable
+                  @close="removeOperation(index)"
+                >
+                  {{ item.taskName }}
+                </el-tag>
+
+                <!-- 占位符 -->
+                <span v-if="!form.criticalTaskList.length" class="placeholder">
+                  请选择关键工序
+                </span>
+              </div>
+            </div>
+          </el-form-item>
         </el-col>
       </el-row>
       <el-tabs v-model="activeName">
@@ -1113,6 +1147,11 @@
       @success="chooseAptitude"
       :disabledIds="form.professions?.map((item) => item.id)"
     ></aptitudeDialog>
+
+    <critical-process
+      ref="criticalProcessRef"
+      @chooseProcess="chooseProcess"
+    ></critical-process>
   </ele-modal>
 </template>
 
@@ -1133,6 +1172,8 @@
   import dictMixins from '@/mixins/dictMixins';
   import aptitudeDialog from '@/views/factoryModel/jobManagement/components/aptitudeDialog.vue';
   import { del } from 'vue';
+  import criticalProcess from './criticalProcess.vue';
+
   // D:\中赢\kd-aiot-frontend\src\views\system\user
 
   export default {
@@ -1144,7 +1185,8 @@
       RegionsSelect,
       WithView,
       FileUpload,
-      aptitudeDialog
+      aptitudeDialog,
+      criticalProcess
     },
     props: {
       // 弹窗是否打开
@@ -1185,7 +1227,8 @@
         signature: {},
         postName: '',
         professions: [],
-        censusAddress:''
+        censusAddress: '',
+        criticalTaskList: []
       };
       return {
         defaultForm,
@@ -1973,6 +2016,31 @@
         this.factoryList = list || [];
       },
 
+      // chooseOperation() {
+      //   this.$refs.criticalProcessRef.open();
+      // },
+
+      chooseProcess(listData) {
+        this.form.criticalTaskList = listData.map((item) => ({
+          taskId: item.id,
+          taskName: item.name
+        }));
+      },
+
+      removeOperation(index) {
+        this.form.criticalTaskList.splice(index, 1);
+      },
+
+      chooseOperation() {
+        const list = this.form.criticalTaskList.map((item) => ({
+          id: item.taskId,
+          taskId: item.taskId,
+          taskName: item.taskName,
+          name: item.taskName
+        }));
+        this.$refs.criticalProcessRef.open(list, 'single');
+      },
+
       /* 保存编辑 */
       save() {
         this.$refs.form.validate((valid) => {
@@ -2111,4 +2179,30 @@
   ::v-deep .el-tabs__header {
     margin-bottom: 10px;
   }
+
+  .multi-select-input {
+    border: 1px solid #dcdfe6;
+    border-radius: 4px;
+    padding: 3px 5px;
+    min-height: 36px;
+    display: flex;
+    align-items: center;
+    flex-wrap: wrap;
+    cursor: pointer;
+  }
+
+  .multi-select-input:hover {
+    border-color: #409eff;
+  }
+
+  .tag-box {
+    display: flex;
+    align-items: center;
+    flex-wrap: wrap;
+  }
+
+  .placeholder {
+    color: #c0c4cc;
+    padding-left: 5px;
+  }
 </style>

+ 76 - 35
src/views/system/organization/components/org-user-list.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
     <!-- 数据表格 -->
+    <org-user-search @search="reload" ref="searchRef"></org-user-search>
     <ele-pro-table
       ref="table"
       :columns="columns"
@@ -9,40 +10,49 @@
       full-height="calc(100vh - 116px)"
       tool-class="ele-toolbar-form"
       :page-size="pageSize"
+      row-key="id"
+      :selection.sync="selection"
       @columns-change="handleColumnChange"
       :cache-key="cacheKeyUrl"
+      @update:selection="handleSelectionChange"
     >
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
-        <org-user-search @search="reload" ref="searchRef">
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            class="ele-btn-icon"
-            @click="openEdit()"
-            v-if="$hasPermission('main:user:save')"
-          >
-            添加
-          </el-button>
-          <el-button
-            type="primary"
-            size="mini"
-            icon="el-icon-upload2"
-            plain
-            @click="uploadFile"
-            v-if="$hasPermission('main:user:save')"
-            >导入</el-button
-          >
-          <el-button
-            type="primary"
-            size="mini"
-            icon="el-icon-download"
-            plain
-            @click="exportUsers"
-            >导出</el-button
-          >
-        </org-user-search>
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-plus"
+          class="ele-btn-icon"
+          @click="openEdit()"
+          v-if="$hasPermission('main:user:save')"
+        >
+          添加
+        </el-button>
+        <el-button
+          type="primary"
+          size="mini"
+          icon="el-icon-upload2"
+          plain
+          @click="uploadFile"
+          v-if="$hasPermission('main:user:save')"
+          >导入</el-button
+        >
+        <el-button
+          type="primary"
+          size="mini"
+          icon="el-icon-download"
+          plain
+          @click="exportUsers"
+          >导出</el-button
+        >
+        <el-button
+          type="success"
+          size="mini"
+          icon="el-icon-guide"
+          plain
+          @click="bindingProcess"
+          >绑定关键工序</el-button
+        >
       </template>
       <!-- 角色列 -->
       <template v-slot:roles="{ row }">
@@ -157,7 +167,7 @@
       :close-on-click-modal="false"
       custom-class="ele-dialog-form"
       :maxable="true"
-        @close="userShow = false"
+      @close="userShow = false"
     >
       <UserSearch @search="reload1"></UserSearch>
       <!-- 数据表格 -->
@@ -175,6 +185,11 @@
         <el-button type="primary" @click="getUser"> 确认 </el-button>
       </template>
     </ele-modal>
+
+    <critical-process
+      ref="criticalProcessRef"
+      @chooseProcess="chooseProcess"
+    ></critical-process>
   </div>
 </template>
 
@@ -194,6 +209,7 @@
   import { pageUsers, exportUsers } from '@/api/system/user';
   import dictMixins from '@/mixins/dictMixins';
   import { getFactoryarea } from '@/api/factoryModel';
+  import criticalProcess from './criticalProcess.vue';
 
   export default {
     mixins: [tabMixins, dictMixins],
@@ -202,7 +218,8 @@
       OrgUserSearch,
       OrgUserEdit,
       addUsers,
-      UserSearch
+      UserSearch,
+      criticalProcess
     },
     props: {
       // 机构id
@@ -226,10 +243,17 @@
       columns() {
         let columnsVersion = this.columnsVersion;
         return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
           {
             columnKey: 'index',
+            label: '序号',
             type: 'index',
-            width: 45,
+            width: 55,
             align: 'center',
             showOverflowTooltip: true,
             fixed: 'left'
@@ -339,7 +363,7 @@
             width: 200,
             align: 'left',
             resizable: false,
-            fixed:'right',
+            fixed: 'right',
             slot: 'action',
             showOverflowTooltip: true
           }
@@ -432,7 +456,8 @@
           { value: 6, label: '离职' }
         ],
         pageSize: this.$store.state.tablePageSize,
-        cacheKeyUrl: 'ef00833a-system-organization'
+        cacheKeyUrl: 'ef00833a-system-organization',
+        selection: []
       };
     },
     methods: {
@@ -470,7 +495,7 @@
           size: limit,
           groupId: this.organizationId,
           isQueryLZ: 1,
-          affiDeptId:1
+          affiDeptId: 1
         });
       },
       /* 表格数据源 */
@@ -507,6 +532,22 @@
         this.$refs.userEditRef.setDisabled(disabled);
       },
 
+      bindingProcess() {
+        if (this.selection.length == 0) {
+          return this.$message.warning('请至少选择一名需要绑定的人员');
+        }
+
+        this.$refs.criticalProcessRef.open(this.selection, 'batch');
+      },
+
+      chooseProcess() {
+        this.reload();
+      },
+
+      handleSelectionChange(data) {
+        this.selection = data;
+      },
+
       // 解除绑定
       toUnBind(row) {
         const loading = this.$loading({ lock: true });

+ 103 - 107
src/views/system/organization/index.vue

@@ -28,7 +28,6 @@
                 :disabled="!current"
                 @click="openEdit(current)"
                 v-if="$hasPermission('main:group:update')"
-
               >
                 修改
               </el-button>
@@ -40,7 +39,6 @@
                 :disabled="!current"
                 @click="remove"
                 v-if="$hasPermission('main:group:delete')"
-
               >
                 删除
               </el-button>
@@ -77,125 +75,123 @@
       :organization-list="data"
       @done="query"
     />
-   
   </div>
 </template>
 
 <script>
-import OrgUserList from './components/org-user-list.vue';
-import OrgEdit from './components/org-edit.vue';
-import {
-  listOrganizations,
-  removeOrganization
-} from '@/api/system/organization';
+  import OrgUserList from './components/org-user-list.vue';
+  import OrgEdit from './components/org-edit.vue';
+  import {
+    listOrganizations,
+    removeOrganization
+  } from '@/api/system/organization';
 
-export default {
-  name: 'SystemOrganization',
-  components: {OrgUserList,OrgEdit},
-  data() {
-    return {
-      // 加载状态
-      loading: true,
-      // 列表数据
-      data: [],
-      institutionList: [],
-      // 选中数据
-      current: null,
-      // 是否显示表单弹窗
-      showEdit: false,
-      // 编辑回显数据
-      editData: null,
-      // 上级id
-      parentId: null
-    };
-  },
-  created() {
-    this.query();
-  },
-  methods: {
-    /* 查询 */
-    query() {
-      this.loading = true;
-      listOrganizations()
-        .then((list) => {
-          let _list = list.filter((i) => i.name != '超级管理员')
-          // let _institutionList = _list.filter((i) => [10, 20].includes(i.type));
-          console.log(this.institutionList);
-          this.loading = false;
-          this.data = this.$util.toTreeData({
-            data: _list,
-            idField: 'id',
-            parentIdField: 'parentId'
-          });
-          this.institutionList = this.$util.toTreeData({
-            data: _list,
-            idField: 'id',
-            parentIdField: 'parentId'
-          });
-          this.$nextTick(() => {
-            this.onNodeClick(this.data[0]);
-          });
-        })
-        .catch((e) => {
-          this.loading = false;
-          // this.$message.error(e.message);
-        });
-    },
-    /* 选择数据 */
-    onNodeClick(row) {
-      if (row) {
-        this.current = row;
-        this.parentId = row.id;
-        this.$refs.tree.setCurrentKey(row.id);
-      } else {
-        this.current = null;
-        this.parentId = null;
-      }
+  export default {
+    name: 'SystemOrganization',
+    components: { OrgUserList, OrgEdit },
+    data() {
+      return {
+        // 加载状态
+        loading: true,
+        // 列表数据
+        data: [],
+        institutionList: [],
+        // 选中数据
+        current: null,
+        // 是否显示表单弹窗
+        showEdit: false,
+        // 编辑回显数据
+        editData: null,
+        // 上级id
+        parentId: null
+      };
     },
-    /* 显示编辑 */
-    openEdit(item) {
-      this.editData = item;
-      this.showEdit = true;
+    created() {
+      this.query();
     },
-    /* 删除 */
-    remove() {
-      this.$confirm('确定要删除选中的机构吗?', '提示', {
-        type: 'warning'
-      })
-        .then(() => {
-          const loading = this.$loading({lock: true});
-          removeOrganization([this.current.id])
-            .then((msg) => {
-              loading.close();
-              this.$message.success(msg);
-              this.query();
-            })
-            .catch((e) => {
-              loading.close();
-              // this.$message.error(e.message);
+    methods: {
+      /* 查询 */
+      query() {
+        this.loading = true;
+        listOrganizations()
+          .then((list) => {
+            let _list = list.filter((i) => i.name != '超级管理员');
+            // let _institutionList = _list.filter((i) => [10, 20].includes(i.type));
+            console.log(this.institutionList);
+            this.loading = false;
+            this.data = this.$util.toTreeData({
+              data: _list,
+              idField: 'id',
+              parentIdField: 'parentId'
             });
+            this.institutionList = this.$util.toTreeData({
+              data: _list,
+              idField: 'id',
+              parentIdField: 'parentId'
+            });
+            this.$nextTick(() => {
+              this.onNodeClick(this.data[0]);
+            });
+          })
+          .catch((e) => {
+            this.loading = false;
+            // this.$message.error(e.message);
+          });
+      },
+      /* 选择数据 */
+      onNodeClick(row) {
+        if (row) {
+          this.current = row;
+          this.parentId = row.id;
+          this.$refs.tree.setCurrentKey(row.id);
+        } else {
+          this.current = null;
+          this.parentId = null;
+        }
+      },
+      /* 显示编辑 */
+      openEdit(item) {
+        this.editData = item;
+        this.showEdit = true;
+      },
+      /* 删除 */
+      remove() {
+        this.$confirm('确定要删除选中的机构吗?', '提示', {
+          type: 'warning'
         })
-        .catch(() => {
-        });
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            removeOrganization([this.current.id])
+              .then((msg) => {
+                loading.close();
+                this.$message.success(msg);
+                this.query();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.sys-organization-list {
-  height: calc(100vh - 264px);
-  box-sizing: border-box;
-  border-width: 1px;
-  border-style: solid;
-  overflow: auto;
-}
+  .sys-organization-list {
+    height: calc(100vh - 264px);
+    box-sizing: border-box;
+    border-width: 1px;
+    border-style: solid;
+    overflow: auto;
+  }
 
-.sys-organization-list :deep(.el-tree-node__content) {
-  height: 30px;
+  .sys-organization-list :deep(.el-tree-node__content) {
+    height: 30px;
 
-  & > .el-tree-node__expand-icon {
-    margin-left: 10px;
+    & > .el-tree-node__expand-icon {
+      margin-left: 10px;
+    }
   }
-}
 </style>

+ 2 - 2
src/views/technology/production/index.vue

@@ -67,7 +67,7 @@
           >
             生产前生产后配置
           </el-button>
-          <el-button
+          <!-- <el-button
             size="small"
             type="primary"
             class="ele-btn-icon"
@@ -82,7 +82,7 @@
             @click="bingdingWork"
           >
             绑定任务
-          </el-button>
+          </el-button> -->
         </template>
 
         <template v-slot:name="{ row }">