ezhizao_zx 9 bulan lalu
induk
melakukan
88ab16477a

+ 17 - 0
src/api/business/packageResourceGroup.js

@@ -43,3 +43,20 @@ export function delGroup(id) {
     method: 'delete'
   })
 }
+
+// 导出包装线
+export function addDetails(data) {
+  return request({
+    url: baseUrl + '/business/packageResourceGroup/addDetails',
+    method: 'post',
+    data: data
+  })
+}
+
+export function listDetails(params) {
+  return request({
+    url: baseUrl + '/business/packageResourceGroup/listDetails',
+    method: 'get',
+    params: params
+  })
+}

+ 1 - 0
src/views/business/certificate/HistoryDialog.vue

@@ -6,6 +6,7 @@
     </el-form>
     <el-table v-loading="loading" row-key="deptId" :data="dataList" height="400px">
       <el-table-column label="行号" type="index" width="50" align="center" />
+      <el-table-column label="生成日期" prop="printDate" width="150" align="center" />
       <el-table-column label="部门名称" prop="deptName" width="150" align="center" />
       <el-table-column label="包装线名" prop="packageResourceGroupName" align="center" />
       <el-table-column label="包装线号" prop="packageLineNo" width="150" align="center" />

+ 1 - 1
src/views/business/certificate/form.vue

@@ -30,7 +30,7 @@
           <el-row :gutter="30" style="margin-top: 10px; padding-top: 10px">
             <el-col :span="6">
               <el-form-item label="生成日期:" prop="printDate">
-                <el-date-picker v-model="form.printDate" value-format="yyyy-MM-dd" style="width: 200px" />
+                <el-date-picker v-model="form.printDate" value-format="YYYY-MM-DD" style="width: 200px" />
               </el-form-item>
             </el-col>
             <el-col :span="6">

+ 2 - 11
src/views/business/packageLine/EmployeeChoiceDialog.vue

@@ -46,7 +46,7 @@
 <script setup>
 import { ref } from '@vue/reactivity'
 import { listEmployee } from '@/api/system/user'
-import { } from '@/api/business/packageResourceGroup'
+import { listUser, listByLikeNickNameOrUserName, getUsersByDeptId, getUsersItemByDeptId } from '@/api/system/user'
 
 
 const { proxy } = getCurrentInstance()
@@ -92,17 +92,8 @@ const { queryParams } = toRefs(data)
 /**
  * 对话框打开 事件
  */
-function open(userInfo) {
+function open() {
   //部门管理新增
-  if (userInfo.identifying) {
-    identifying.value = userInfo.identifying
-    //queryParams.value.deptId = userInfo.deptId;
-  } else {
-    queryParams.value.deptId = userInfo.deptId
-  }
-  if (userInfo.userIds) {
-    userIds.value = userInfo.userIds
-  }
   visible.value = true
   getList()
 }

+ 66 - 36
src/views/business/packageLine/index.vue

@@ -91,20 +91,21 @@
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table v-loading="deptProcessLoading" :data="deptProcessList" row-key="id" height="100%"
+          <el-table v-loading="deptProcessLoading" :data="userList" row-key="id" height="100%"
             @selection-change="deptProcessSelectionChange">
             <el-table-column type="selection" width="40" align="center" :reserve-selection="true" />
             <el-table-column label="行号" type="index" width="50" align="center" />
-            <el-table-column label="工序编码" prop="processCode" align="center" />
-            <el-table-column label="工序名称" prop="processAlias" align="center" />
+            <el-table-column label="员工号" prop="userName" align="center" />
+            <el-table-column label="员工姓名" prop="nickName" align="center" />
           </el-table>
         </div>
       </div>
       <pagination v-show="deptProcessTotal > 0" :total="deptProcessTotal" v-model:page="queryDeptProcessParams.pageNum"
-        v-model:limit="queryDeptProcessParams.pageSize" @pagination="getDeptProcess"
+        v-model:limit="queryDeptProcessParams.pageSize" @pagination="getDetails"
         layout="total, sizes, prev, next, jumper" />
     </section>
-    <EmployeeChoiceDialog ref="employeeChoiceDialogRef" :multiple="true" />
+    <EmployeeChoiceDialog ref="employeeChoiceDialogRef" :multiple="true"
+      :multipleSelected="handleEmployeeMultipleSelected" />
     <DeptChoiceDialog ref="deptChoiceDialogRef" @handleSelectBelongingDept="handleSelectBelongingDept" />
   </div>
 </template>
@@ -112,9 +113,9 @@
 <script setup>
 import {
   listResourceGroup,
-  delResourceGroup,
+  delResourceGroup
 } from "@/api/business/resourceGroup";
-import { listGroup, addGroup, updateGroup, delGroup } from "@/api/business/packageResourceGroup";
+import { listGroup, addGroup, updateGroup, delGroup, listDetails, addDetails } from "@/api/business/packageResourceGroup";
 import {
   listDeptProcess,
   addDeptProcess,
@@ -167,7 +168,7 @@ const groupLoading = ref(false);
 const groupDetailLoading = ref(false);
 const groupDetailList = ref([]);
 /**工序 */
-const deptProcessList = ref([]);
+const userList = ref([]);
 const deptProcessLoading = ref(false);
 const deptProcessTotal = ref(0);
 const deptProcessIds = ref([]);
@@ -198,43 +199,24 @@ const handleWorkSectionChange = (row) => {
   if (row) {
     currentGroup.value = row;
     queryParams.value.deptId = row.id;
-    getResourceGroup();
-    getDeptProcess();
+    getDetails();
   }
 };
 
-/****************************  资源组方法区  ****************************/
-/**获取资源组 */
-function getResourceGroup() {
-  groupLoading.value = true;
-  listResourceGroup(queryParams.value).then((res) => {
-    if (res.code == 200) {
-      groupList.value = res.rows;
-      if (groupList.value.length > 0) {
-        currentGroup.value = groupList.value[0];
-        proxy.$refs.groupTable.setCurrentRow(groupList.value[0]);
-      } else {
-        groupDetailList.value = [];
-      }
-    }
-    groupLoading.value = false;
-  });
-}
-
 /*******************************工序方法区*********************************** */
 /**获取工序 */
-const getDeptProcess = () => {
+const getDetails = () => {
   deptProcessLoading.value = true;
-  queryDeptProcessParams.value.deptId = currentGroup.value.id;
-  listDeptProcess(queryDeptProcessParams.value).then((res) => {
-    deptProcessList.value = res.rows;
+  queryDeptProcessParams.value.packageResourceGroupId = currentGroup.value.id;
+  listDetails(queryDeptProcessParams.value).then((res) => {
+    userList.value = res.rows;
     deptProcessLoading.value = false;
     deptProcessTotal.value = res.total;
   });
 };
 /**工序搜索框 */
 function handleQueryProcess() {
-  getDeptProcess();
+  getDetails();
 }
 /** 打开工序对话框事件 */
 function handleShowProcessFormDialog(row) {
@@ -256,7 +238,7 @@ function handledelDeptProcess() {
       return delDeptProcess(deptProcessIds.value);
     })
     .then(() => {
-      getDeptProcess();
+      getDetails();
       proxy.$modal.msgSuccess("删除成功!");
     })
     .catch((e) => {
@@ -276,7 +258,7 @@ function handleDeleteGroup(row, index) {
         return packageResourceGroups.splice(index, 1)
     })
     .then(() => {
-      getDeptProcess();
+      getDetails();
       proxy.$modal.msgSuccess("删除成功!");
     })
     .catch((e) => {
@@ -295,7 +277,7 @@ function showDeptChoiceDialog(row) {
 }
 
 function handleAdd() {
-  packageResourceGroups.value.push({ editStatus: true })
+  packageResourceGroups.value.push({ editStatus: true, year: proxy.moment().format('YY'), code: '000000' })
 }
 
 function handleSelectBelongingDept(info) {
@@ -309,6 +291,42 @@ function handleGroupCancel(row) {
 }
 
 function handleGroupSave(row) {
+  // 判断工段包装线名都不能为空
+  if (row.name == null || row.name == '') {
+    proxy.$modal.msgError("包装线名不能为空")
+    return
+  }
+  if (row.deptId == null) {
+    proxy.$modal.msgError("工段不能为空")
+    return
+  }
+  if (row.year == null || row.year == '') {
+    proxy.$modal.msgError("年份不能为空")
+    return
+  }
+  if (row.deptNo == null || row.deptNo == '') {
+    proxy.$modal.msgError("工段号不能为空")
+    return
+  }
+  if (row.packageLineNo == null || row.packageLineNo == '') {
+    proxy.$modal.msgError("包装线号不能为空")
+    return
+  }
+  if (row.code == null || row.code == '') {
+    proxy.$modal.msgError("当前编码不能为空")
+    return
+  }
+  // 判断年是否是2位数字
+  if (!isNaN(Number(row.year)) && row.year.length > 2) {
+    proxy.$modal.msgError("年份不能为非数字或大于2位")
+    return
+  }
+  // 判断code只能是小于6位数字
+  if (!isNaN(Number(row.code)) && row.code.length > 6) {
+    proxy.$modal.msgError("当前编码不能为非数字或大于6位")
+    return
+  }
+
   if (row.id == null) {
     addGroup(row).then(() => {
       getList()
@@ -320,6 +338,18 @@ function handleGroupSave(row) {
   }
 }
 
+function handleEmployeeMultipleSelected(infos) {
+  const data = {
+    ...currentGroup.value,
+    employees: infos
+  }
+  addDetails(data).then(res => {
+    if (res.code == 200) {
+      getDetails()
+    }
+  })
+}
+
 onMounted(() => {
   getList();
 });