wangxin 1 rok pred
rodič
commit
b450aeb3f3

+ 3 - 4
src/api/business/daywork.js

@@ -78,11 +78,10 @@ export function updateItem(data) {
 /**
  * 查询是否为首序
  */
-export function getIsFirstOrder(data) {
+export function getIsFirstOrder(dayworkId) {
     return request({
-        url: baseUrl + '/business/productionDaywork/getIsFirstOrder',
-        method: 'post',
-        data: data
+        url: baseUrl + '/business/productionDaywork/getIsFirstOrder/' + dayworkId,
+        method: 'get',
     })
 }
 

+ 7 - 1
src/views/business/daywork/form.vue

@@ -264,6 +264,7 @@ import {
   getEquipmentInfo,
   getIsFirstOrder,
 } from "@/api/business/daywork.js";
+import { ref } from "vue";
 
 const { proxy } = getCurrentInstance();
 const emit = defineEmits(["handleSaveSuccess"]);
@@ -278,6 +279,7 @@ const processList = ref([]);
 const lotId = ref(null);
 const equipmentList = ref([]);
 const visible = ref(false);
+const isFirst = ref(true); //是否为首序
 const editStatus = ref(true);
 const currentDept = ref(false);
 const rejectAmount = ref(0);
@@ -382,6 +384,10 @@ const open = (row) => {
   reset();
   loading.value = true;
   if (row.id) {
+    //查询是否为首序
+    getIsFirstOrder(row.dayworkId).then((res) => {
+      isFirst.value = res.data.isFirstOrder;
+    });
     lotId.value = row.lotId;
     //页面操作是编辑还是删除
     console.log("row", row);
@@ -571,7 +577,7 @@ const handleSave = () => {
           console.log("firstProcessId", detailInfo.value.firstProcessId);
           console.log("processId", form.value.processId);
           //判断是否为首序
-          if (detailInfo.value.firstProcessId == form.value.processId) {
+          if (isFirst.value) {
             // 弹出确认对话框
             proxy.$modal
               .confirm(

+ 138 - 143
src/views/business/resourcePlan/index.vue

@@ -4,69 +4,68 @@
     <section class="list-part-container" style="flex: 2">
       <!-- 搜索区 -->
       <el-form class="list-search-container" ref="queryRef" :inline="true">
-        <el-form-item class="section-title" label="资源组"/>
+        <el-form-item class="section-title" label="资源组" />
         <el-form-item class="section-title" label="请选择当前工段:">
           <el-select-v2
-              v-model="queryParams.deptId"
-              :options="deptList"
-              placeholder="请选择工段"
-              style="width: 100%"
-              @change="handleChangeDeptId"
+            v-model="queryParams.deptId"
+            :options="deptList"
+            placeholder="请选择工段"
+            style="width: 100%"
+            @change="handleChangeDeptId"
           />
         </el-form-item>
         <el-form-item label="资源组名称:">
           <el-input
-              placeholder="请输入资源组名称"
-              v-model.trim="queryParams.code"
-              style="width: 150px"
-              clearable
-              @keydown.enter.prevent
+            placeholder="请输入资源组名称"
+            v-model.trim="queryParams.code"
+            style="width: 150px"
+            clearable
+            @keydown.enter.prevent
           />
         </el-form-item>
         <el-form-item>
           <el-button
-              type="info"
-              icon="Search"
-              :disabled="deptList.length === 0"
-              @click="handleQuery"
-          >搜索
-          </el-button
-          >
+            type="info"
+            icon="Search"
+            :disabled="deptList.length === 0"
+            @click="handleQuery"
+            >搜索
+          </el-button>
         </el-form-item>
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
           <el-table
-              ref="resourceGroupTable"
-              :data="resourceGroupList"
-              v-loading="resourceGroupLoading"
-              highlight-current-row
-              height="100%"
-              @current-change="handleResourceGroupCurrentChange"
+            ref="resourceGroupTable"
+            :data="resourceGroupList"
+            v-loading="resourceGroupLoading"
+            highlight-current-row
+            height="100%"
+            @current-change="handleResourceGroupCurrentChange"
           >
             <el-table-column
-                label="行号"
-                type="index"
-                width="50"
-                align="center"
+              label="行号"
+              type="index"
+              width="50"
+              align="center"
             />
             <el-table-column
-                label="资源组名称"
-                width="70"
-                prop="code"
-                align="center"
+              label="资源组名称"
+              width="70"
+              prop="code"
+              align="center"
             />
             <el-table-column
-                label="资源组人员"
-                width="200"
-                prop="nickName"
-                align="center"
+              label="资源组人员"
+              width="200"
+              prop="nickName"
+              align="center"
             />
             <el-table-column label="设备编码" width="120" align="center">
               <template #default="scope">
                 <div
-                    v-for="(item, index) in scope.row.groupEquipmentList"
-                    :key="index"
+                  v-for="(item, index) in scope.row.groupEquipmentList"
+                  :key="index"
                 >
                   <div style="height: auto">{{ item.commonCode }}</div>
                 </div>
@@ -75,8 +74,8 @@
             <el-table-column label="设备名称" align="center">
               <template #default="scope">
                 <div
-                    v-for="(item, index) in scope.row.groupEquipmentList"
-                    :key="index"
+                  v-for="(item, index) in scope.row.groupEquipmentList"
+                  :key="index"
                 >
                   <div style="height: auto">{{ item.commonName }}</div>
                 </div>
@@ -90,119 +89,116 @@
     <section class="list-part-container" style="flex: 2">
       <el-form class="list-search-container" :inline="true">
         <el-form-item
-            class="section-title"
-            label="生产计划"
-            label-width="60px"
+          class="section-title"
+          label="生产计划"
+          label-width="60px"
         />
         <el-form-item label="生产计划信息:">
           <el-input
-              v-model.trim="queryItemParams.productionPlanNo"
-              placeholder="请输入厂家/生产计划单号/产品描述"
-              clearable
-              style="width: 250px"
-              @keydown.enter.prevent
+            v-model.trim="queryItemParams.productionPlanNo"
+            placeholder="请输入厂家/生产计划单号/产品描述"
+            clearable
+            style="width: 250px"
+            @keydown.enter.prevent
           />
         </el-form-item>
         <el-form-item>
           <el-button
-              type="info"
-              icon="Search"
-              :disabled="!currentResourceGroup.id"
-              @click="handleQueryPlanDetails"
-          >搜索
-          </el-button
-          >
+            type="info"
+            icon="Search"
+            :disabled="!currentResourceGroup.id"
+            @click="handleQueryPlanDetails"
+            >搜索
+          </el-button>
           <el-button
-              type="primary"
-              icon="Plus"
-              :disabled="!currentResourceGroup.id"
-              @click="handleOpenPlanDetailDialog()"
-          >新增
-          </el-button
-          >
+            type="primary"
+            icon="Plus"
+            :disabled="!currentResourceGroup.id"
+            @click="handleOpenPlanDetailDialog()"
+            >新增
+          </el-button>
           <el-button
-              type="danger"
-              icon="Delete"
-              :disabled="!currentResourceGroup.id || planDetailIds.length == 0"
-              @click="handleDeletePlanDetail()"
-          >批量删除
-          </el-button
-          >
+            type="danger"
+            icon="Delete"
+            :disabled="!currentResourceGroup.id || planDetailIds.length == 0"
+            @click="handleDeletePlanDetail()"
+            >批量删除
+          </el-button>
         </el-form-item>
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
           <el-table
-              ref="planDetailsTable"
-              v-loading="planDetailLoading"
-              row-key="id"
-              :data="planDetailList"
-              highlight-current-row
-              height="100%"
-              @selection-change="handleSelectionChange"
+            ref="planDetailsTable"
+            v-loading="planDetailLoading"
+            row-key="id"
+            :data="planDetailList"
+            highlight-current-row
+            height="100%"
+            @selection-change="handleSelectionChange"
           >
-            <el-table-column type="selection" width="40" align="center"/>
+            <el-table-column type="selection" width="40" align="center" />
             <el-table-column
-                type="index"
-                label="行号"
-                width="50"
-                align="center"
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
             />
             <el-table-column
-                label="厂家"
-                prop="companyAlias"
-                width="150"
-                align="center"
+              label="厂家"
+              prop="companyAlias"
+              width="150"
+              align="center"
             />
             <el-table-column
-                label="生产计划单号"
-                prop="productionPlanNo"
-                width="100"
-                align="center"
+              label="生产计划单号"
+              prop="productionPlanNo"
+              width="100"
+              align="center"
             />
             <el-table-column
-                label="序号"
-                width="60"
-                prop="lineNumber"
-                align="center"
+              label="序号"
+              width="60"
+              prop="lineNumber"
+              align="center"
             />
             <el-table-column
-                label="产品描述"
-                prop="productDescription"
-                width="350"
-                align="center"
+              label="产品描述"
+              prop="productDescription"
+              width="350"
+              align="center"
             />
             <el-table-column
-                label="投产日期"
-                prop="issuanceDate"
-                width="100"
-                align="center"
+              label="投产日期"
+              prop="issuanceDate"
+              width="100"
+              align="center"
             >
               <template #default="scope">
                 <span>{{
-                    proxy.moment(scope.row.issuanceDate).format("YYYY-MM-DD")
-                  }}</span>
+                  proxy.moment(scope.row.issuanceDate).format("YYYY-MM-DD")
+                }}</span>
               </template>
             </el-table-column>
             <el-table-column
-                label="批次数"
-                prop="lotTotalNumber"
-                width="70"
-                align="center"
+              label="批次数"
+              prop="lotTotalNumber"
+              width="70"
+              align="center"
             ></el-table-column>
             <el-table-column
-                fixed="right"
-                label="操作"
-                width="80"
-                align="center"
+              fixed="right"
+              label="操作"
+              width="80"
+              align="center"
             >
               <template #default="scope">
                 <el-button
-                    icon="delete"
-                    link
-                    type="danger"
-                    @click="handleDelPlanDetail(scope.row)"
-                >删除
+                  icon="delete"
+                  link
+                  type="danger"
+                  @click="handleDelPlanDetail(scope.row)"
+                  >删除
                 </el-button>
               </template>
             </el-table-column>
@@ -211,33 +207,33 @@
       </div>
       <!-- 分页 -->
       <pagination
-          v-show="itemTotal > 0"
-          :total="itemTotal"
-          v-model:page="queryItemParams.pageNum"
-          v-model:limit="queryItemParams.pageSize"
-          @pagination="getPlanDetail"
+        v-show="itemTotal > 0"
+        :total="itemTotal"
+        v-model:page="queryItemParams.pageNum"
+        v-model:limit="queryItemParams.pageSize"
+        @pagination="getPlanDetail"
       />
     </section>
     <!-- 生产计划分配弹窗 -->
     <plan-detail-dialog
-        ref="planDetailRef"
-        :multiple-selected="handlePlanDetailSelected"
+      ref="planDetailRef"
+      :multiple-selected="handlePlanDetailSelected"
     ></plan-detail-dialog>
   </div>
 </template>
 
 <script setup>
-import {listResourceGroup} from "@/api/business/resourceGroup.js";
+import { listResourceGroup } from "@/api/business/resourceGroup.js";
 import {
   listResourcePlan,
   saveBatchResourcePlan,
   delResourcePlan,
 } from "@/api/business/resourcePlan.js";
-import {getDept} from "@/api/business/planDetailSubDetail.js";
+import { getDept } from "@/api/business/planDetailSubDetail.js";
 import planDetailDialog from "./form";
-import {ref} from "vue";
+import { ref } from "vue";
 
-const {proxy} = getCurrentInstance();
+const { proxy } = getCurrentInstance();
 
 /**资源组*/
 const resourceGroupList = ref([]);
@@ -353,15 +349,14 @@ function handleSelectionChange(selection) {
 /**多选删除生产计划 */
 function handleDeletePlanDetail() {
   proxy.$modal
-      .confirm("是否确认删除选中的数据项?")
-      .then(function () {
-        delResourcePlan(planDetailIds.value).then((res) => {
-          getPlanDetail();
-          proxy.$modal.msgSuccess("删除成功!");
-        });
-      })
-      .catch(() => {
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      delResourcePlan(planDetailIds.value).then((res) => {
+        getPlanDetail();
+        proxy.$modal.msgSuccess("删除成功!");
       });
+    })
+    .catch(() => {});
 }
 
 /** 生产计划带回 */
@@ -374,6 +369,7 @@ function handlePlanDetailSelected(selection) {
     planDetailInfo.technologicalProcessId = selection[i].technologicalProcessId;
     planDetailInfo.resourceGroupId = currentResourceGroup.value.id;
     planDetailInfo.resourceGroupCode = currentResourceGroup.value.code;
+    planDetailInfo.deptId = queryParams.value.deptId;
     planDetail.push(planDetailInfo);
   }
   saveBatchResourcePlan(planDetail).then((res) => {
@@ -387,15 +383,14 @@ function handlePlanDetailSelected(selection) {
 /**生产计划删除 */
 function handleDelPlanDetail(row) {
   proxy.$modal
-      .confirm("是否确认删除选中的数据项?")
-      .then(function () {
-        delResourcePlan(row.id).then((res) => {
-          getPlanDetail();
-          proxy.$modal.msgSuccess("删除成功!");
-        });
-      })
-      .catch(() => {
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      delResourcePlan(row.id).then((res) => {
+        getPlanDetail();
+        proxy.$modal.msgSuccess("删除成功!");
       });
+    })
+    .catch(() => {});
 }
 
 onMounted(() => {