Sfoglia il codice sorgente

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

wangxin 1 anno fa
parent
commit
36aef26362

+ 1 - 1
Dockerfile

@@ -1,5 +1,5 @@
 # 基础镜像
-FROM nginx:1.22
+FROM nginx:1.23
 
 # 复制 nginx  配置文件
 COPY ./nginx.conf /etc/nginx/nginx.conf

+ 53 - 0
src/api/business/drawing.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+
+// 查询电子图纸列表
+export function listDrawing(query) {
+  return request({
+   url: baseUrl +'/business/drawing/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询图纸名
+export function drawingByName(query) {
+  return request({
+   url: baseUrl +'/business/drawing/byName',
+    method: 'get',
+    params: query
+  })
+}
+// 查询电子图纸详细
+export function getDrawing(id) {
+  return request({
+   url: baseUrl +'/business/drawing/' + id,
+    method: 'get'
+  })
+}
+
+// 新增电子图纸
+export function addDrawing(data) {
+  return request({
+   url: baseUrl +'/business/drawing',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改电子图纸
+export function updateDrawing(data) {
+  return request({
+   url: baseUrl +'/business/drawing',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除电子图纸
+export function delDrawing(id) {
+  return request({
+   url: baseUrl +'/business/drawing/' + id,
+    method: 'delete'
+  })
+}

+ 44 - 0
src/api/business/drawingRecords.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+// 查询电子图纸操作记录列表
+export function listRecords(query) {
+  return request({
+    url: baseUrl +'/business/records/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询电子图纸操作记录详细
+export function getRecords(id) {
+  return request({
+    url: baseUrl +'/business/records/' + id,
+    method: 'get'
+  })
+}
+
+// 新增电子图纸操作记录
+export function addRecords(data) {
+  return request({
+    url: baseUrl +'/business/records',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改电子图纸操作记录
+export function updateRecords(data) {
+  return request({
+    url: baseUrl +'/business/records',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除电子图纸操作记录
+export function delRecords(id) {
+  return request({
+    url: baseUrl +'/business/records/' + id,
+    method: 'delete'
+  })
+}

+ 8 - 1
src/api/business/outsourcedOrder.js

@@ -37,7 +37,14 @@ export function saveOrder(data) {
 	})
 }
 
-
+// 保存外协单
+export function submitDetails(data) {
+	return request({
+		url: baseUrl + '/business/outsource/submitDetails',
+		method: 'post',
+		data: data
+	})
+}
 export function processesForOutsource(data) {
 	return request({
 		url: baseUrl + '/business/outsource/processesForOutsource',

+ 45 - 0
src/api/business/outsourcedRecords.js

@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询外协发出单历史记录列表
+export function listOutsourcedRecords(query) {
+  return request({
+    url:baseUrl +  '/business/outsourcedRecords/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询外协发出单历史记录详细
+export function getOutsourcedRecords(id) {
+  return request({
+    url: baseUrl + '/business/outsourcedRecords/' + id,
+    method: 'get'
+  })
+}
+
+// 新增外协发出单历史记录
+export function addOutsourcedRecords(data) {
+  return request({
+    url:baseUrl +  '/business/outsourcedRecords',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改外协发出单历史记录
+export function updateOutsourcedRecords(data) {
+  return request({
+    url: baseUrl + '/business/outsourcedRecords',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除外协发出单历史记录
+export function delOutsourcedRecords(id) {
+  return request({
+    url:baseUrl +  '/business/outsourcedRecords/' + id,
+    method: 'delete'
+  })
+}

+ 12 - 7
src/views/business/daywork/index.vue

@@ -79,21 +79,19 @@
                 <dict-tag :options="daywork_status" :value="scope.row.status" />
               </template>
             </el-table-column>
-            <el-table-column fixed="right" label="操作" align="center" width="140px">
+            <el-table-column fixed="right" label="操作" align="center" width="200px">
               <template #default="scope">
                 <el-button v-show="scope.row.deptProcessStatus &&
         (scope.row.status == 2 || scope.row.status == 3) &&
-        scope.row.processId == latestProcessId
+        scope.row.id == latestProcessId && scope.row.deptId == latestDeptId && !(lastStatus == 4 || lastStatus == 5 ||lastStatus ==7)
         " link type="warning" icon="Edit" @click="handleUpdateDayworkItem(scope.row)">编辑
                 </el-button>
-                <el-button v-show="!(scope.row.deptProcessStatus &&
-        (scope.row.status == 2 || scope.row.status == 3) &&
-        scope.row.processId == latestProcessId)" link type="primary" icon="View"
+                <el-button  link type="primary" icon="View"
                   @click="handleCheckDayworkItem(scope.row)">查看
                 </el-button>
                 <el-button v-show="scope.row.deptProcessStatus &&
         (scope.row.status == 2 || scope.row.status == 3) &&
-        scope.row.processId == latestProcessId
+        scope.row.id == latestProcessId&& scope.row.deptId == latestDeptId &&!(lastStatus == 4 || lastStatus == 5 ||lastStatus ==7)
         " v-hasPermi="['business:daywork:remove']" link type="danger" icon="Delete"
                   @click="handleDeletedItem(scope.row.id)">删除
                 </el-button>
@@ -141,7 +139,9 @@ const loading = ref(false);
 const dayworkItemList = ref([]);
 const dayworkItemLoading = ref(false);
 const itemTotal = ref(0);
+const lastStatus = ref(null)
 const latestProcessId = ref(null);
+const latestDeptId = ref(null)
 const deptProcessList = ref([]);
 /**工序 */
 const processList = ref([]);
@@ -391,7 +391,11 @@ function getDayworkItems() {
       // }
     }
     if (res.others != null && res.others.latestProcessId != null) {
-      latestProcessId.value = latestProcessId
+      latestProcessId.value = res.others.latestProcessId
+    }
+    if (res.others != null && res.others.lastItem != null) {
+      latestDeptId.value = res.others.lastItem.deptId
+      lastStatus.value = res.others.lastItem.status
     }
     for (var i = 0; i < res.rows.length; i++) {
       let timeStamp = res.rows[i].workingHours;
@@ -407,6 +411,7 @@ function getDayworkItems() {
           res.rows[i].deptProcessStatus = true;
         }
       }
+      console.log(res.rows[i].deptProcessStatus)
     }
     dayworkItemList.value = res.rows;
     getProcess();

+ 56 - 0
src/views/business/outsource/DialogOutsourcedRecords.vue

@@ -0,0 +1,56 @@
+<template>
+	<el-dialog title="历史记录" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable  style="font-size: 14px;">
+		<el-table ref="dialogTable" :data="recordsList" size="small" v-loading="loading" border height="500px" header-row-class-name="list-header-row" row-class-name="list-row" >
+			<el-table-column type="index" label="序号" width="50" align="center" />
+			<el-table-column label="记录" align="center" prop="records" />
+		</el-table>
+	</el-dialog>
+</template>
+<script setup>
+import { listOutsourcedRecords } from "@/api/business/outsourcedRecords";
+/** 历史记录变量 */
+const recordsList = ref([])
+const visible = ref(false)
+const loading = ref(false)
+const data = reactive({
+	queryParams: {
+		masterId:null
+	}
+})
+const { queryParams } = toRefs(data)
+
+/**
+ * 对话框打开 事件
+ */
+function open(data) {
+	visible.value = true
+	queryParams.value.masterId = data
+	getList()
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+	visible.value = false
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+	loading.value = true
+	listOutsourcedRecords(queryParams.value).then((res) => {
+		recordsList.value = res.rows
+		loading.value = false
+	})
+}
+
+defineExpose({
+	open
+})
+</script>
+<style scoped>
+.el-table--small {
+    font-size: 14px;
+}</style>

+ 2 - 0
src/views/business/outsource/DialogProcesses.vue

@@ -124,7 +124,9 @@ const selections = ref([]);
  * 对话框打开 事件
  */
 function open(data) {
+  console.log(data)
   queryParams.value.lotId = data.lotId
+  queryParams.value.outsourceDetailId = data.id?data.id:0
   queryParams.value.pageNum = 1;
   queryParams.value.pageSize = 10;
   visible.value = true;

+ 1 - 1
src/views/business/outsource/DialogSuppliers.vue

@@ -2,7 +2,7 @@
   <el-dialog
     title="添加外协商"
     v-model="visible"
-    width="600px"
+    width="800px"
     height="400px"
     @close="close"
     append-to-body

+ 203 - 319
src/views/business/outsource/form.vue

@@ -1,99 +1,58 @@
 <template>
-  <el-drawer
-    title="外协单信息"
-    :with-header="false"
-    v-model="visible"
-    direction="rtl"
-    size="100%"
-  >
+  <el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
     <div class="form-container column-container">
       <div class="form-btns-container">
         <span class="title-label">
-          <el-icon><Document /></el-icon>
+          <el-icon>
+            <Document />
+          </el-icon>
           <span>外协单信息</span>
         </span>
 
-        <el-button
+        <!-- <el-button
           v-if="editStatus"
           type="success"
           icon="check"
           @click="saveFrom"
         >
           暂存
-        </el-button>
+        </el-button> -->
 
-        <el-button
-          v-if="!editStatus"
-          type="primary"
-          icon="Download"
-          @click="handleExport"
-          v-hasPermi="['business:outsource:export']"
-          >导出</el-button
-        >
-        <el-button
-          v-if="!editStatus"
-          type="warning"
-          icon="Download"
-          @click="handlePrint"
-          v-hasPermi="['business:outsource:export']"
-        >
+        <el-button v-show="editStatus && form.isSubmit == 1" type="primary" icon="Download" @click="handleExport"
+          v-hasPermi="['business:outsource:export']">导出</el-button>
+        <el-button v-show="editStatus && form.isSubmit == 1" type="warning" icon="Download" @click="handlePrint"
+          v-hasPermi="['business:outsource:export']">
           打印
         </el-button>
-        <el-button
-          v-if="editStatus"
-          type="primary"
-          icon="Finished"
-          @click="submitFrom"
-          >保存并提交</el-button
-        >
+        <el-button v-if="editStatus" type="primary" icon="Finished" @click="handleSubmit">保存</el-button>
+        <el-button v-if="editStatus && form.isSubmit == 1" type="info" icon="Calendar"
+          @click="handleViewRecords">历史记录</el-button>
         <div class="close-btn" @click="cancel">
           <i class="fa fa-times" aria-hidden="true" />
           <!-- <span>关闭</span> -->
         </div>
       </div>
-      <el-form
-        ref="formRef"
-        class="master-container"
-        :model="form"
-        v-loading="loading"
-        :rules="rules"
-        label-width="120px"
-      >
+      <el-form ref="formRef" class="master-container" :model="form" v-loading="loading" :rules="rules"
+        label-width="120px">
         <el-row :gutter="20">
           <el-col :span="6">
             <el-form-item label="单据号" prop="formCode">
-              <el-input
-                v-if="editStatus"
-                v-model="form.formCode"
-                disabled
-                placeholder="系统自动生成"
-              />
+              <el-input v-if="editStatus" v-model="form.formCode" disabled placeholder="系统自动生成" />
               <span v-else>{{ form.formCode }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="表单日期" prop="formDate">
-              <el-date-picker
-                v-if="editStatus"
-                clearable
-                v-model="form.formDate"
-                type="date"
-                value-format="YYYY-MM-DD"
-                placeholder="请选择表单日期"
-                style="width: 100%"
-              >
+              <el-date-picker v-if="editStatus" clearable v-model="form.formDate" type="date" value-format="YYYY-MM-DD"
+                placeholder="请选择表单日期" style="width: 100%">
               </el-date-picker>
               <span v-else>{{ parseTime(form.formDate, "{y}-{m}-{d}") }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="外协商名称" prop="supplierName">
-              <el-input
-                v-if="editStatus"
-                v-model="form.supplierName"
-                readonly
-                placeholder="请输入外协商名称"
-              >
+              <el-input v-if="editStatus && form.isSubmit == 0" v-model="form.supplierName" readonly
+                placeholder="请输入外协商名称">
                 <template #append>
                   <el-button icon="Search" @click="handleShowDialogSuppliers" />
                 </template>
@@ -101,96 +60,58 @@
               <span v-else>{{ form.supplierName }}</span>
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="6" v-if="false">
             <el-form-item label="运费单价" prop="freightPrice">
-              <el-input-number
-                v-if="editStatus"
-                v-model="form.freightPrice"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-              />
+              <el-input-number v-if="editStatus" v-model="form.freightPrice" :min="0" :precision="2"
+                controls-position="right" />
               <span v-else>{{ form.freightPrice }}</span>
             </el-form-item>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="6" v-if="false">
             <el-form-item label="运费总价" prop="freightAmount">
-              <el-input-number
-                v-if="editStatus"
-                v-model="form.freightAmount"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-              />
+              <el-input-number v-if="editStatus" v-model="form.freightAmount" :min="0" :precision="2"
+                controls-position="right" />
               <span v-else>{{ form.freightAmount }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="送货方式" prop="deliveryMethod">
-              <el-select
-                v-if="editStatus"
-                v-model="form.deliveryMethod"
-                placeholder="请选择"
-                @change="handleChangeDeliveryMethod"
-              >
-                <el-option
-                  v-for="dict in deliveryMethod"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus" v-model="form.deliveryMethod" placeholder="请选择"
+                @change="handleChangeDeliveryMethod">
+                <el-option v-for=" dict  in  deliveryMethod " :key="dict.value" :label="dict.label"
+                  :value="dict.value" />
               </el-select>
               <span v-else>{{
-                selectText(form.deliveryMethod, deliveryMethod)
-              }}</span>
+    selectText(form.deliveryMethod, deliveryMethod)
+  }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="带箱方式" prop="packagingMethod">
-              <el-select
-                v-if="editStatus"
-                v-model="form.packagingMethod"
-                placeholder="请选择"
-                @change="handleChangePackagingMethod"
-              >
-                <el-option
-                  v-for="dict in packagingMethod"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus" v-model="form.packagingMethod" placeholder="请选择"
+                @change="handleChangePackagingMethod">
+                <el-option v-for=" dict  in  packagingMethod " :key="dict.value" :label="dict.label"
+                  :value="dict.value" />
               </el-select>
               <span v-else>{{
-                selectText(form.packagingMethod, packagingMethod)
-              }}</span>
+    selectText(form.packagingMethod, packagingMethod)
+  }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="结算方式" prop="settlementType">
-              <el-select
-                v-if="editStatus"
-                v-model="form.settlementType"
-                placeholder="请选择"
-              >
-                <el-option
-                  v-for="dict in settlementType"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus" v-model="form.settlementType" placeholder="请选择">
+                <el-option v-for=" dict  in  settlementType " :key="dict.value" :label="dict.label"
+                  :value="dict.value" />
               </el-select>
               <span v-else>{{
-                selectText(form.settlementType, settlementType)
-              }}</span>
+    selectText(form.settlementType, settlementType)
+  }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="备注" prop="remark">
-              <el-input
-                v-if="editStatus"
-                v-model="form.remark"
-                placeholder="请输入备注"
-              />
+              <el-input v-if="editStatus" v-model.trim="form.remark" placeholder="请输入备注" />
               <span v-else>{{ form.remark }}</span>
             </el-form-item>
           </el-col>
@@ -203,107 +124,37 @@
       </el-form>
       <!-- 渲染数据区 -->
       <div class="form-details-btns-container">
-        <el-button
-          v-if="editStatus"
-          type="primary"
-          icon="Plus"
-          @click="handleShowDialogProducts"
-          v-hasPermi="['business:outsource:add']"
-        >
+        <el-button v-show="editStatus" type="primary" icon="Plus" @click="handleShowDialogProducts"
+          v-hasPermi="['business:outsource:add']">
           添加外协产品明细
         </el-button>
       </div>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table
-            v-loading="loading"
-            :data="form.details"
-            size="small"
-            border
-            height="100%"
-          >
-            <el-table-column
-              label="行号"
-              type="index"
-              align="center"
-              width="48"
-            />
-            <el-table-column
-              label="批次号"
-              align="center"
-              prop="lotCode"
-              width="104"
-            />
-            <el-table-column
-              label="产品描述"
-              align="center"
-              prop="productDescription"
-              width="320"
-            />
-            <el-table-column
-              label="产品数"
-              align="center"
-              width="160"
-              prop="productNum"
-            >
+          <el-table v-loading="loading" :data="form.details" size="small" border height="100%">
+            <el-table-column label="行号" type="index" align="center" width="48" />
+            <el-table-column label="批次号" align="center" prop="lotCode" width="104" />
+            <el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
+            <el-table-column label="产品数" align="center" width="160" prop="productNum">
               <template #default="scope">
-                <el-input-number
-                  v-if="editStatus"
-                  :min="0"
-                  v-model="scope.row.productNum"
-                  placeholder="产品数"
-                />
+                <el-input-number v-if="editStatus" :min="0" v-model="scope.row.productNum" placeholder="产品数"
+                  :controls="false" />
                 <span v-else>{{ scope.row.productNum }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              label="箱数"
-              align="center"
-              prop="carrierNum"
-              width="70"
-            />
-            <el-table-column
-              :label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
-              align="center"
-              prop="originalCarrier"
-              width="320"
-            />
-            <el-table-column
-              label="新箱号"
-              align="center"
-              prop="newCarrier"
-              width="320"
-            >
+            <el-table-column label="箱数" align="center" prop="carrierNum" width="70" />
+            <el-table-column :label="form.packagingMethod === '0' ? '箱号' : '原箱号'" align="center" prop="originalCarrier"
+              width="320" />
+            <el-table-column label="新箱号" align="center" prop="newCarrier" width="320">
               <template #default="scope">
-                <el-button
-                  link
-                  type="primary"
-                  icon="Refresh"
-                  v-if="!scope.row.editStatus && editStatus"
-                  @click="handleChangeCarrier(scope.row)"
-                  >换箱</el-button
-                >
-                <el-select
-                  v-if="editStatus && scope.row.editStatus"
-                  v-model="scope.row.carrierIds"
-                  multiple
-                  filterable
-                  remote
-                  reserve-keyword
-                  placeholder="请选择箱号"
-                  :remote-method="
-                    (arg) =>
-                      remoteCarriers(arg, scope.row.newCarriers, scope.row)
-                  "
-                  :loading="loadingCarrier"
-                  @change="(arg) => handleCarrierChange(arg, scope.row)"
-                >
-                  <el-option
-                    v-for="item in scope.row.carriers"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  />
+                <el-button link type="primary" icon="Refresh" v-if="!scope.row.editStatus && editStatus"
+                  @click="handleChangeCarrier(scope.row)">换箱</el-button>
+                <el-select v-if="editStatus && scope.row.editStatus" v-model="scope.row.carrierIds" multiple filterable
+                  remote reserve-keyword placeholder="请选择箱号" :remote-method="(arg) =>
+    remoteCarriers(arg, scope.row.newCarriers, scope.row)
+    " :loading="loadingCarrier" @change="(arg) => handleCarrierChange(arg, scope.row)">
+                  <el-option v-for=" item  in  scope.row.carriers " :key="item.value" :label="item.label"
+                    :value="item.value" />
                 </el-select>
                 <span v-if="!editStatus">{{ scope.row.newCarrier }}</span>
                 <!-- <el-input
@@ -318,28 +169,15 @@
                       @click="handleShowDialogOutsourceCarriers(scope.row)"
                     />
                   </template>
-                </el-input>
-                <span v-else>{{ scope.row.newCarrier }}</span>-->
+        </el-input>
+        <span v-else>{{ scope.row.newCarrier }}</span>-->
               </template>
             </el-table-column>
-            <el-table-column
-              label="外协工序"
-              align="center"
-              prop="processNames"
-              width="320"
-            >
+            <el-table-column label="外协工序" align="center" prop="processNames" width="320">
               <template #default="scope">
-                <el-input
-                  v-if="editStatus"
-                  v-model="scope.row.processNames"
-                  readonly
-                  placeholder="请选择工序"
-                >
+                <el-input v-if="editStatus" v-model="scope.row.processNames" readonly placeholder="请选择工序">
                   <template #append>
-                    <el-button
-                      icon="Search"
-                      @click="handleShowDialogProcesses(scope.row)"
-                    />
+                    <el-button icon="Search" @click="handleShowDialogProcesses(scope.row)" />
                   </template>
                 </el-input>
                 <span v-else>{{ scope.row.processNames }}</span>
@@ -347,29 +185,15 @@
             </el-table-column>
             <el-table-column label="备注" align="center" prop="remark">
               <template #default="scope">
-                <el-input
-                  v-if="editStatus"
-                  v-model="scope.row.remark"
-                  placeholder="备注"
-                />
+                <el-input v-if="editStatus" v-model="scope.row.remark" placeholder="备注" />
                 <span v-else>{{ scope.row.remark }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              v-if="editStatus"
-              label="操作"
-              align="center"
-              class-name="small-padding fixed-width"
-              width="64"
-            >
+            <el-table-column v-if="editStatus" label="操作" align="center" class-name="small-padding fixed-width"
+              width="64">
               <template #default="scope">
-                <el-button
-                  circle
-                  type="danger"
-                  icon="Delete"
-                  @click="handleDelete(scope.$index)"
-                  v-hasPermi="['business:outsource:remove']"
-                />
+                <el-button circle type="danger" icon="Delete" @click="handleDelete(scope.$index)"
+                  v-hasPermi="['business:outsource:remove']" />
               </template>
             </el-table-column>
           </el-table>
@@ -377,26 +201,16 @@
       </div>
     </div>
     <!-- 外协商选择 -->
-    <dialog-suppliers
-      ref="dialogSuppliersRef"
-      :single-selected="handleSingleSelectedSupplier"
-    />
+    <dialog-suppliers ref="dialogSuppliersRef" :single-selected="handleSingleSelectedSupplier" />
     <!-- 产品选择 -->
-    <dialog-products
-      ref="dialogProductsRef"
-      :supplier-id="form.supplierId"
-      :multiple-selected="handleMultipleSelectedProducts"
-    />
+    <dialog-products ref="dialogProductsRef" :supplier-id="form.supplierId"
+      :multiple-selected="handleMultipleSelectedProducts" />
     <!-- 工序选择 -->
-    <dialog-processes
-      ref="dialogProcessesRef"
-      :multiple-selected="handleMultipleSelectedProcesses"
-    />
+    <dialog-processes ref="dialogProcessesRef" :multiple-selected="handleMultipleSelectedProcesses" />
     <!-- 新箱号选择 -->
-    <dialog-carrier
-      ref="dialogCarrierRef"
-      :multiple-selected="handleMultipleSelectedOutsourceCarriers"
-    />
+    <dialog-carrier ref="dialogCarrierRef" :multiple-selected="handleMultipleSelectedOutsourceCarriers" />
+    <!-- 历史记录弹窗 -->
+    <dialog-outsourced-records ref="dialogOutsourcedRecordsRef" />
     <!-- 收回明细带回 -->
     <!-- <form-details-recycling ref="formDetailsRecyclingRef" :singleSelected="handleSingleSelectedRecycling"/> -->
   </el-drawer>
@@ -409,18 +223,20 @@ import {
   submitOrder,
   exportOutsource,
   printOutsource,
+  submitDetails
 } from "@/api/business/outsourcedOrder";
 import dialogCarrier from "./DialogCarrier";
 import dialogSuppliers from "./DialogSuppliers";
 import dialogProducts from "./DialogProducts";
 import dialogProcesses from "./DialogProcesses";
+import dialogOutsourcedRecords from "./DialogOutsourcedRecords"
 // import FormDetailsRecycling from "./detailsRecyclingForm";
 const { proxy } = getCurrentInstance();
 /** 父组件传参 */
 const props = defineProps({
   getList: {
     type: Function,
-    default: () => {},
+    default: () => { },
   },
   deliveryMethod: {
     type: Array,
@@ -446,6 +262,7 @@ const visible = ref(false);
 const editStatus = ref(true);
 const isFullscreen = ref(false);
 const totalCarriersNum = ref(0);
+const detailInfo = ref({});
 const loadingCarrier = ref(false);
 const carriers = ref([]);
 const webHost = import.meta.env.VITE_APP_BASE_API;
@@ -470,12 +287,14 @@ function handlePrint() {
 }
 
 /** 打开抽屉 */
-function open(id) {
+function open(row) {
   reset();
-  totalCarriersNum.value = 0;
+  totalCarriersNum.value = 0
   visible.value = true;
-  if (id) {
-    form.value.id = id;
+  if (row) {
+    console.log(row)
+    detailInfo.value = row
+    form.value.id = row.id;
     getForm();
   } else {
     editStatus.value = true;
@@ -502,65 +321,48 @@ function getForm() {
       totalCarriersNum.value += item.carrierNum;
     });
 
-    editStatus.value = form.value.isSubmit == 0;
+    editStatus.value = form.value.isSubmit == 1;
+    if (!detailInfo.value.flag) {
+      editStatus.value = false
+      console.log(editStatus.value)
+    }
+    console.log(editStatus.value)
     loading.value = false;
   });
 }
 //改变带箱方式
 function handleChangePackagingMethod() {
-  totalCarriersNum.value = 0;
+  totalCarriersNum.value = 0
   if (!editStatus) {
     if (form.value.packagingMethod == 1 && form.value.details.length > 0) {
-      form.value.details.forEach((item) => {
-        item.newCarriers = [];
-        item.carrierIds = [];
-        item.carriers = carriers.value;
-      });
-    }
-    if (form.value.packagingMethod == 0 && form.value.details.length > 0) {
-      form.value.details.forEach((item) => {
+      form.value.details.forEach(item => { item.newCarriers = []; item.carrierIds = []; item.carriers = carriers.value })
+    } if (form.value.packagingMethod == 0 && form.value.details.length > 0) {
+      form.value.details.forEach(item => {
         item.carriers = carriers.value;
         item.newCarriers = [];
         item.carrierIds = [];
-        item.newCarriers.push(
-          ...item.originalCarrierList.map((v) => ({
-            id: v.carrierId,
-            code: v.carrierCode,
-          }))
-        );
-        item.carriers.push(
-          ...item.originalCarrierList.map((v) => ({
-            value: v.carrierId,
-            label: v.carrierCode,
-          }))
-        );
-        item.carrierIds = item.originalCarrierList.map((info) => {
-          return info.carrierId;
-        });
-      });
+        item.newCarriers.push(...item.originalCarrierList.map(v => ({ id: v.carrierId, code: v.carrierCode })));
+        item.carriers.push(...item.originalCarrierList.map((v) => ({ value: v.carrierId, label: v.carrierCode })));
+        item.carrierIds = item.originalCarrierList.map(info => { return info.carrierId })
+      })
     }
   } else {
-    form.value.details.forEach((item) => {
-      item.newCarriers = [];
-      item.carrierIds = [];
-      item.carriers = carriers.value;
-    });
+    form.value.details.forEach(item => {
+      console.log(item.editStatus)
+      if (item.editStatus) {
+        item.newCarriers = []; item.carrierIds = []; item.carriers = carriers.value
+      }
+    })
   }
-  console.log(form.value.details);
+  console.log(form.value.details)
   for (let i = 0; i < form.value.details.length; i++) {
     if (form.value.packagingMethod == 1) {
-      form.value.details[i].carrierNum = form.value.details[i].newCarriers
-        ? form.value.details[i].newCarriers.length
-        : 0;
+      form.value.details[i].carrierNum = form.value.details[i].newCarriers ? form.value.details[i].newCarriers.length : 0
     } else {
-      form.value.details[i].carrierNum =
-        form.value.details[i].newCarriers &&
-        form.value.details[i].newCarriers.length > 0
-          ? form.value.details[i].newCarriers.length
-          : form.value.details[i].originalCarrier.split(",").length;
+      form.value.details[i].carrierNum = form.value.details[i].newCarriers && form.value.details[i].newCarriers.length > 0 ? form.value.details[i].newCarriers.length : form.value.details[i].originalCarrier.split(",").length
     }
-    console.log(form.value.details);
-    totalCarriersNum.value += form.value.details[i].carrierNum;
+    console.log(form.value.details)
+    totalCarriersNum.value += form.value.details[i].carrierNum
   }
 }
 //改变送货方式
@@ -570,6 +372,11 @@ function handleChangeDeliveryMethod() {
   } else {
     form.value.freightAmount = 0.0;
   }
+
+}
+//打开历史记录弹窗
+function handleViewRecords() {
+  proxy.$refs.dialogOutsourcedRecordsRef.open(form.value.id);
 }
 
 function selectText(value, data) {
@@ -581,7 +388,7 @@ function selectText(value, data) {
 /** 取消按钮 */
 function cancel() {
   visible.value = false;
-  reset();
+  // reset();
 }
 
 const handleDelete = (index) => {
@@ -596,6 +403,7 @@ const handleDelete = (index) => {
 
 /** 表单重置 */
 function reset() {
+  // console.log(proxy.parseTime(new Date(), "{y}-{m}-{d}"))
   form.value = {
     id: null,
     tenantId: null,
@@ -609,6 +417,7 @@ function reset() {
     packagingMethod: "0",
     remark: null,
     details: [],
+    isSubmit: 0
   };
   proxy.resetForm("formRef");
 }
@@ -688,7 +497,80 @@ function submitFrom() {
         }
       });
     })
-    .catch(() => {});
+    .catch(() => { });
+}
+//5.29保存
+function handleSubmit() {
+  if (form.value.isSubmit == 0) {
+    proxy.$modal
+      .confirm("是否确定保存,保存后外协商不可编辑!")
+      .then(function () {
+        return;
+      })
+      .then(() => {
+        if (!form.value.details || form.value.details.length == 0) {
+          proxy.$modal.msgError("请添加产品明细");
+          return;
+        }
+
+        proxy.$refs["formRef"].validate((valid) => {
+          for (const item of form.value.details) {
+            if (!item.processNames) {
+              proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+              return;
+            }
+          }
+          if (form.value.packagingMethod == 1) {
+            console.log("form.value.details", form.value.details);
+            for (const item of form.value.details) {
+              if (item.newCarriers.length == 0) {
+                proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+                return;
+              }
+            }
+          }
+          if (valid) {
+            console.log(form.value)
+            submitDetails(form.value).then((response) => {
+              proxy.$modal.msgSuccess("提交成功");
+              visible.value = false;
+              getList.value();
+            });
+          }
+        });
+      })
+  } else {
+    if (!form.value.details || form.value.details.length == 0) {
+      proxy.$modal.msgError("请添加产品明细");
+      return;
+    }
+
+    proxy.$refs["formRef"].validate((valid) => {
+      for (const item of form.value.details) {
+        if (!item.processNames) {
+          proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+          return;
+        }
+      }
+      if (form.value.packagingMethod == 1) {
+        console.log("form.value.details", form.value.details);
+        for (const item of form.value.details) {
+          if (item.newCarriers.length == 0) {
+            proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+            return;
+          }
+        }
+      }
+      if (valid) {
+        console.log(form.value)
+        submitDetails(form.value).then((response) => {
+          proxy.$modal.msgSuccess("提交成功");
+          visible.value = false;
+          getList.value();
+        });
+      }
+    });
+  }
 }
 
 /***************************** 外协商对话框相关 *****************************/
@@ -716,7 +598,7 @@ const handleSingleSelectedSupplier = (data) => {
 function handleDetailsRecycling() {
   proxy.$refs.formDetailsRecyclingRef.open(row);
 }
-function handleSingleSelectedRecycling() {}
+function handleSingleSelectedRecycling() { }
 /***************************** 产品对话框相关 *****************************/
 // 打开产品选择对话框
 const handleShowDialogProducts = () => {
@@ -764,7 +646,7 @@ const handleMultipleSelectedProducts = (selection) => {
 
 /***************************** 外协箱子对话框相关 *****************************/
 // 打开外协箱子选择对话框
-const handleShowDialogOutsourceCarriers = (row) => {};
+const handleShowDialogOutsourceCarriers = (row) => { };
 
 function remoteCarriers(code, newCarrier, row) {
   loadingCarrier.value = true;
@@ -786,6 +668,7 @@ function remoteCarriers(code, newCarrier, row) {
   carrierForOutsource({
     categoryId: categoryId,
     code: code,
+    dayworkId: row.dayworkId
   }).then((res) => {
     if (res.code === 200) {
       carriers.value = res.rows.map((v) => ({ value: v.id, label: v.code }));
@@ -911,6 +794,7 @@ const handleShowDialogProcesses = (row) => {
 
 // 工序选择带回
 const handleMultipleSelectedProcesses = (selection) => {
+  currentDetail.value.processes = []
   const processNames = selection.map((item) => item.processAlias);
   // 使用join方法将数组转换为以逗号分隔的字符串
   let commaSeparatedString = processNames.join(",");

+ 937 - 0
src/views/business/outsource/formOld.vue

@@ -0,0 +1,937 @@
+<template>
+  <el-drawer
+    title="外协单信息"
+    :with-header="false"
+    v-model="visible"
+    direction="rtl"
+    size="100%"
+  >
+    <div class="form-container column-container">
+      <div class="form-btns-container">
+        <span class="title-label">
+          <el-icon><Document /></el-icon>
+          <span>外协单信息</span>
+        </span>
+
+        <!-- <el-button
+          v-if="editStatus"
+          type="success"
+          icon="check"
+          @click="saveFrom"
+        >
+          暂存
+        </el-button> -->
+
+        <el-button
+          v-if="editStatus && form.isSubmit==1"
+          type="primary"
+          icon="Download"
+          @click="handleExport"
+          v-hasPermi="['business:outsource:export']"
+          >导出</el-button
+        >
+        <el-button
+          v-if="editStatus"
+          type="primary"
+          icon="Finished"
+          @click="handleSubmit"
+          >保存</el-button
+        >
+        <div class="close-btn" @click="cancel">
+          <i class="fa fa-times" aria-hidden="true" />
+          <!-- <span>关闭</span> -->
+        </div>
+      </div>
+      <el-form
+        ref="formRef"
+        class="master-container"
+        :model="form"
+        v-loading="loading"
+        :rules="rules"
+        label-width="120px"
+      >
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="单据号" prop="formCode">
+              <el-input
+                v-if="editStatus"
+                v-model="form.formCode"
+                disabled
+                placeholder="系统自动生成"
+              />
+              <span v-else>{{ form.formCode }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="表单日期" prop="formDate">
+              <el-date-picker
+                v-if="editStatus"
+                clearable
+                v-model="form.formDate"
+                type="date"
+                value-format="YYYY-MM-DD"
+                placeholder="请选择表单日期"
+                style="width: 100%"
+              >
+              </el-date-picker>
+              <span v-else>{{ parseTime(form.formDate, "{y}-{m}-{d}") }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="外协商名称" prop="supplierName">
+              <el-input
+                v-if="editStatus && form.isSubmit == 0"
+                v-model="form.supplierName"
+                readonly
+                placeholder="请输入外协商名称"
+              >
+                <template #append>
+                  <el-button icon="Search" @click="handleShowDialogSuppliers" />
+                </template>
+              </el-input>
+              <span v-else>{{ form.supplierName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="运费单价" prop="freightPrice">
+              <el-input-number
+                v-if="editStatus"
+                v-model="form.freightPrice"
+                :min="0"
+                :precision="2"
+                controls-position="right"
+              />
+              <span v-else>{{ form.freightPrice }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="运费总价" prop="freightAmount">
+              <el-input-number
+                v-if="editStatus"
+                v-model="form.freightAmount"
+                :min="0"
+                :precision="2"
+                controls-position="right"
+              />
+              <span v-else>{{ form.freightAmount }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="送货方式" prop="deliveryMethod">
+              <el-select
+                v-if="editStatus"
+                v-model="form.deliveryMethod"
+                placeholder="请选择"
+                @change="handleChangeDeliveryMethod"
+              >
+                <el-option
+                  v-for="dict in deliveryMethod"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+              <span v-else>{{
+                selectText(form.deliveryMethod, deliveryMethod)
+              }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="带箱方式" prop="packagingMethod">
+              <el-select
+                v-if="editStatus"
+                v-model="form.packagingMethod"
+                placeholder="请选择"
+                @change="handleChangePackagingMethod"
+              >
+                <el-option
+                  v-for="dict in packagingMethod"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+              <span v-else>{{
+                selectText(form.packagingMethod, packagingMethod)
+              }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="结算方式" prop="settlementType">
+              <el-select
+                v-if="editStatus"
+                v-model="form.settlementType"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="dict in settlementType"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                />
+              </el-select>
+              <span v-else>{{
+                selectText(form.settlementType, settlementType)
+              }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                v-if="editStatus"
+                v-model.trim="form.remark"
+                placeholder="请输入备注"
+              />
+              <span v-else>{{ form.remark }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="总箱数" prop="remark">
+              <span >{{ totalCarriersNum }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <!-- 渲染数据区 -->
+      <div class="form-details-btns-container">
+        <el-button
+          v-if="editStatus"
+          type="primary"
+          icon="Plus"
+          @click="handleShowDialogProducts"
+          v-hasPermi="['business:outsource:add']"
+        >
+          添加外协产品明细
+        </el-button>
+      </div>
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table
+            v-loading="loading"
+            :data="form.details"
+            size="small"
+            border
+            height="100%"
+          >
+            <el-table-column
+              label="行号"
+              type="index"
+              align="center"
+              width="48"
+            />
+            <el-table-column
+              label="批次号"
+              align="center"
+              prop="lotCode"
+              width="104"
+            />
+            <el-table-column
+              label="产品描述"
+              align="center"
+              prop="productDescription"
+              width="320"
+            />
+            <el-table-column label="产品数" align="center" width="160" prop="productNum">
+              <template #default="scope">
+                <el-input-number
+                  v-if="editStatus"
+                  :min="0"
+                  v-model="scope.row.productNum"
+                  placeholder="产品数"
+                />
+                <span v-else>{{ scope.row.productNum }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="箱数"
+              align="center"
+              prop="carrierNum"
+              width="70"
+            />
+            <el-table-column
+              :label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
+              align="center"
+              prop="originalCarrier"
+              width="320"
+            />
+            <el-table-column
+              label="新箱号"
+              align="center"
+              prop="newCarrier"
+              width="320"
+            >
+              <template #default="scope">
+                <el-button link type="primary" icon="Refresh" v-if="!scope.row.editStatus && editStatus" @click="handleChangeCarrier(scope.row)">换箱</el-button>
+                <el-select
+                  v-if="editStatus && scope.row.editStatus"
+                  v-model="scope.row.carrierIds"
+                  multiple
+                  filterable
+                  remote
+                  reserve-keyword
+                  placeholder="请选择箱号"
+                  :remote-method="
+                    (arg) => remoteCarriers(arg, scope.row.newCarriers,scope.row)
+                  "
+                  :loading="loadingCarrier"
+                  @change="(arg) => handleCarrierChange(arg, scope.row)"
+                >
+                  <el-option
+                    v-for="item in scope.row.carriers"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  />
+                </el-select>
+                <span v-if="!editStatus">{{ scope.row.newCarrier }}</span>
+                <!-- <el-input
+                  v-if="editStatus"
+                  v-model="scope.row.newCarrier"
+                  readonly
+                  placeholder="请选择新箱号"
+                >
+                  <template #append>
+                    <el-button
+                      icon="Search"
+                      @click="handleShowDialogOutsourceCarriers(scope.row)"
+                    />
+                  </template>
+                </el-input>
+                <span v-else>{{ scope.row.newCarrier }}</span>-->
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="外协工序"
+              align="center"
+              prop="processNames"
+              width="320"
+            >
+              <template #default="scope">
+                <el-input
+                  v-if="editStatus"
+                  v-model="scope.row.processNames"
+                  readonly
+                  placeholder="请选择工序"
+                >
+                  <template #append>
+                    <el-button
+                      icon="Search"
+                      @click="handleShowDialogProcesses(scope.row)"
+                    />
+                  </template>
+                </el-input>
+                <span v-else>{{ scope.row.processNames }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="备注" align="center" prop="remark">
+              <template #default="scope">
+                <el-input
+                  v-if="editStatus"
+                  v-model="scope.row.remark"
+                  placeholder="备注"
+                />
+                <span v-else>{{ scope.row.remark }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-if="editStatus"
+              label="操作"
+              align="center"
+              class-name="small-padding fixed-width"
+              width="64"
+            >
+              <template #default="scope">
+                <el-button
+                  circle
+                  type="danger"
+                  icon="Delete"
+                  @click="handleDelete(scope.$index)"
+                  v-hasPermi="['business:outsource:remove']"
+                />
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </div>
+    <!-- 外协商选择 -->
+    <dialog-suppliers
+      ref="dialogSuppliersRef"
+      :single-selected="handleSingleSelectedSupplier"
+    />
+    <!-- 产品选择 -->
+    <dialog-products
+      ref="dialogProductsRef"
+      :supplier-id="form.supplierId"
+      :multiple-selected="handleMultipleSelectedProducts"
+    />
+    <!-- 工序选择 -->
+    <dialog-processes
+      ref="dialogProcessesRef"
+      :multiple-selected="handleMultipleSelectedProcesses"
+    />
+    <!-- 新箱号选择 -->
+    <dialog-carrier
+      ref="dialogCarrierRef"
+      :multiple-selected="handleMultipleSelectedOutsourceCarriers"
+    />
+  </el-drawer>
+</template>
+<script setup>
+import {
+  getOrder,
+  saveOrder,
+  carrierForOutsource,
+  submitOrder,
+  exportOutsource,
+  submitDetails
+} from "@/api/business/outsourcedOrder";
+import dialogCarrier from "./DialogCarrier";
+import dialogSuppliers from "./DialogSuppliers";
+import dialogProducts from "./DialogProducts";
+import dialogProcesses from "./DialogProcesses";
+const { proxy } = getCurrentInstance();
+/** 父组件传参 */
+const props = defineProps({
+  getList: {
+    type: Function,
+    default: () => {},
+  },
+  deliveryMethod: {
+    type: Array,
+    default: [],
+  },
+  settlementType: {
+    type: Array,
+    default: [],
+  },
+  packagingMethod: {
+    type: Array,
+    default: [],
+  },
+});
+const { getList, deliveryMethod, packagingMethod, settlementType } =
+  toRefs(props);
+/** 字典数组区 */
+/** 表单抽屉 页变量 */
+
+const loading = ref(false);
+const multiple = ref(true);
+const visible = ref(false);
+const editStatus = ref(true);
+const detailInfo = ref({});
+const totalCarriersNum = ref(0)
+const loadingCarrier = ref(false);
+const carriers = ref([]);
+const webHost = import.meta.env.VITE_APP_BASE_API;
+const form = ref({});
+// const formatDetails = ref([])
+const currentDetail = ref({});
+const rules = {
+  supplierName: [
+    { required: true, message: "外协商名称不能为空", trigger: "change" },
+  ],
+};
+
+/***********************  方法区  ****************************/
+/** 导出按钮操作 */
+function handleExport() {
+  exportOutsource({ id: form.value.id });
+}
+
+/** 打开抽屉 */
+function open(row) {
+  reset();
+  totalCarriersNum.value = 0
+  visible.value = true;
+  if (row) {
+    console.log(row)
+    detailInfo.value = row
+    form.value.id = row.id;
+    getForm();
+  } else {
+    editStatus.value = true;
+  }
+}
+
+/** 查询表单信息  */
+function getForm() {
+  loading.value = true;
+  getOrder(form.value.id).then((response) => {
+    form.value = response.data
+    console.log(form.value.details)
+    form.value.details.forEach(item =>{
+      item.editStatus = false
+     if(!form.value.id) {
+        item.carrierNum = item.originalCarrier.split(",").length
+      }else {
+        if(item.newCarrier !=null) {
+        item.carrierNum = item.newCarrier.split(",").length
+      }else {
+        item.carrierNum = item.originalCarrier.split(",").length
+      }
+      }
+      totalCarriersNum.value += item.carrierNum
+    })
+
+    editStatus.value = form.value.isSubmit == 1;
+    if(!detailInfo.value.flag) {
+      editStatus.value = false
+      console.log(editStatus.value)
+    }
+    console.log(editStatus.value)
+    loading.value = false;
+  });
+}
+//改变带箱方式
+function handleChangePackagingMethod() {
+  totalCarriersNum.value = 0
+  if(!editStatus){
+  if(form.value.packagingMethod == 1 && form.value.details.length>0) {
+    form.value.details.forEach(item =>{item.newCarriers = [];item.carrierIds = [];item.carriers = carriers.value})
+  }if(form.value.packagingMethod == 0 &&form.value.details.length>0) {
+    form.value.details.forEach(item =>{
+      item.carriers = carriers.value;
+      item.newCarriers = [];
+      item.carrierIds = [];
+      item.newCarriers.push(...item.originalCarrierList.map(v => ({ id: v.carrierId, code: v.carrierCode })));
+      item.carriers.push( ...item.originalCarrierList.map((v) => ({ value: v.carrierId, label: v.carrierCode })));
+      item.carrierIds = item.originalCarrierList.map(info => { return info.carrierId }) 
+    })
+  }
+}else{
+  form.value.details.forEach(item =>{item.newCarriers = [];item.carrierIds = [];item.carriers = carriers.value})
+}
+  console.log(form.value.details)
+  for(let i = 0;i<form.value.details.length;i++) {
+    if(form.value.packagingMethod == 1) {
+        form.value.details[i].carrierNum =form.value.details[i].newCarriers? form.value.details[i].newCarriers.length:0
+      }else {
+        form.value.details[i].carrierNum = form.value.details[i].newCarriers && form.value.details[i].newCarriers.length>0? form.value.details[i].newCarriers.length:form.value.details[i].originalCarrier.split(",").length
+      }
+      console.log(form.value.details)
+      totalCarriersNum.value += form.value.details[i].carrierNum
+  }
+}
+//改变送货方式
+function handleChangeDeliveryMethod() {
+  if(form.value.deliveryMethod == 1) {
+    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
+  }else {
+    form.value.freightAmount = 0.0
+  }
+ 
+}
+
+function selectText(value, data) {
+  if (value) {
+    return data.filter((item) => item.value == value)[0].label;
+  }
+}
+
+/** 取消按钮 */
+function cancel() {
+  visible.value = false;
+  reset();
+}
+
+const handleDelete = (index) => {
+  totalCarriersNum.value -=form.value.details[index].carrierNum
+  if(form.value.deliveryMethod == 1) {
+    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
+  }else {
+    form.value.freightAmount = 0.0
+  }
+  form.value.details.splice(index, 1);
+};
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    id: null,
+    tenantId: null,
+    formCode: null,
+    formDate: proxy.parseTime(new Date(), "{y}-{m}-{d}"),
+    supplierId: "0",
+    supplierName: "",
+    deliveryMethod: "0",
+    freightPrice: 0.0,
+    freightAmount: 0.0,
+    packagingMethod: "0",
+    remark: null,
+    details: [],
+    isSubmit:0
+  };
+  proxy.resetForm("formRef");
+}
+/** 保存 */
+function saveFrom() {
+  if (!form.value.details || form.value.details.length == 0) {
+    proxy.$modal.msgError("请添加产品明细");
+    return;
+  }
+
+  proxy.$refs["formRef"].validate((valid) => {
+    for (const item of form.value.details) {
+      if (!item.processNames) {
+        proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+        return;
+      }
+    }
+
+    if (form.value.packagingMethod == 1) {
+      console.log("form.value.details", form.value.details);
+      for (const item of form.value.details) {
+        if (item.newCarriers.length == 0) {
+          proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+          return;
+        }
+      }
+    }
+    if (valid) {
+      saveOrder(form.value).then((response) => {
+        if (response.code == 200) {
+          proxy.$modal.msgSuccess("保存成功");
+          visible.value = false;
+          getList.value();
+        }
+      });
+    }
+  });
+}
+
+/** 保存并提交 */
+function submitFrom() {
+  console.log("from", form.value);
+  proxy.$modal
+    .confirm("是否确定提交,提交后不可修改,删除")
+    .then(function () {
+      return;
+    })
+    .then(() => {
+      if (!form.value.details || form.value.details.length == 0) {
+        proxy.$modal.msgError("请添加产品明细");
+        return;
+      }
+
+      proxy.$refs["formRef"].validate((valid) => {
+        for (const item of form.value.details) {
+          if (!item.processNames) {
+            proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+            return;
+          }
+        }
+        if (form.value.packagingMethod == 1) {
+          console.log("form.value.details", form.value.details);
+          for (const item of form.value.details) {
+            if (item.newCarriers.length == 0) {
+              proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+              return;
+            }
+          }
+        }
+        if (valid) {
+          console.log(form.value)
+          submitOrder(form.value).then((response) => {
+            proxy.$modal.msgSuccess("提交成功");
+            visible.value = false;
+            getList.value();
+          });
+        }
+      });
+    })
+    .catch(() => {});
+}
+//5.29保存
+function handleSubmit() {
+  if(form.value.isSubmit==0){
+  proxy.$modal
+    .confirm("是否确定保存,保存后外协商不可编辑!")
+    .then(function () {
+      return;
+    })
+    .then(() => {
+      if (!form.value.details || form.value.details.length == 0) {
+        proxy.$modal.msgError("请添加产品明细");
+        return;
+      }
+
+      proxy.$refs["formRef"].validate((valid) => {
+        for (const item of form.value.details) {
+          if (!item.processNames) {
+            proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+            return;
+          }
+        }
+        if (form.value.packagingMethod == 1) {
+          console.log("form.value.details", form.value.details);
+          for (const item of form.value.details) {
+            if (item.newCarriers.length == 0) {
+              proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+              return;
+            }
+          }
+        }
+        if (valid) {
+          console.log(form.value)
+          submitDetails(form.value).then((response) => {
+            proxy.$modal.msgSuccess("提交成功");
+            visible.value = false;
+            getList.value();
+          });
+        }
+      });
+    })
+  }else{
+    if (!form.value.details || form.value.details.length == 0) {
+        proxy.$modal.msgError("请添加产品明细");
+        return;
+      }
+
+      proxy.$refs["formRef"].validate((valid) => {
+        for (const item of form.value.details) {
+          if (!item.processNames) {
+            proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+            return;
+          }
+        }
+        if (form.value.packagingMethod == 1) {
+          console.log("form.value.details", form.value.details);
+          for (const item of form.value.details) {
+            if (item.newCarriers.length == 0) {
+              proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+              return;
+            }
+          }
+        }
+        if (valid) {
+          console.log(form.value)
+          submitDetails(form.value).then((response) => {
+            proxy.$modal.msgSuccess("提交成功");
+            visible.value = false;
+            getList.value();
+          });
+        }
+      });
+  }
+}
+
+/***************************** 外协商对话框相关 *****************************/
+// 打开外协商选择对话框
+const handleShowDialogSuppliers = () => {
+  proxy.$refs.dialogSuppliersRef.open();
+};
+// 外协商选择带回
+const handleSingleSelectedSupplier = (data) => {
+  console.log(data);
+  form.value.supplierId = data.id;
+  form.value.lossLimit = data.lossLimit;
+  form.value.supplierName = data.name;
+  form.value.deliveryMethod = data.deliveryMethod;
+  form.value.freightPrice = data.freightPrice
+  form.value.settlementType = data.settlementType;
+  if(form.value.deliveryMethod == 1) {
+    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
+  }else {
+    form.value.freightAmount = 0.0
+  }
+};
+/***************************** 产品对话框相关 *****************************/
+// 打开产品选择对话框
+const handleShowDialogProducts = () => {
+  const dayworkIds = form.value.details.map((item) => item.dayworkId);
+  // console.log(dayworkIds);
+  proxy.$refs.dialogProductsRef.open(dayworkIds);
+};
+// 产品选择带回
+const handleMultipleSelectedProducts = (selection) => {
+  selection.forEach((item) => {
+    const newDetail = {
+      lotId: item.lotId,
+      lotCode: item.lotCode,
+      dayworkId: item.id,
+      productId: item.productId,
+      productDescription: item.productDescription,
+      technologicalProcessId: item.technologicalProcessId,
+      technologyVersion: item.technologyVersion,
+      originalCarrier: item.originalCarrier,
+      originalCarrierCount: item.originalCarrier.split(",").length,
+      carrierNum:item.originalCarrier.split(",").length,
+      originalCarrierList:item.originalCarrierList,
+      productNum: item.productNum,
+      productCode: item.productCode,
+      newCarrier: "",
+      carriers:[],
+      newCarrierCount: 0,
+      newCarriers: [],
+      processNames: "",
+      remark: item.remark,
+      processes: [],
+    };
+    form.value.details.push(newDetail);
+    console.log(newDetail)
+    totalCarriersNum.value += newDetail.originalCarrierCount
+    if(form.value.deliveryMethod == 1) {
+    form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
+    }else {
+    form.value.freightAmount = 0.0
+  }
+    // console.log("form.value.details", form.value.details);
+  });
+};
+
+/***************************** 外协箱子对话框相关 *****************************/
+// 打开外协箱子选择对话框
+const handleShowDialogOutsourceCarriers = (row) => {};
+
+function remoteCarriers(code, newCarrier,row) {
+  loadingCarrier.value = true;
+  // console.log(row, carriers.value)
+  console.log("row", row);
+  // if (true) {
+  //   carriers.value = [{ value: '"1747500987856662535"', label: '000319' }]
+  //   return 
+  // }
+  let categoryId;
+  if (form.value.packagingMethod == 1) {
+    categoryId = "1783783697558847489";
+  } else {
+    categoryId = "2";
+  }
+  if (code == "") {
+    return;
+  }
+  carrierForOutsource({
+    categoryId: categoryId,
+    code: code,
+    dayworkId:row.dayworkId
+  }).then((res) => {
+    if (res.code === 200) {
+      carriers.value = res.rows.map((v) => ({ value: v.id, label: v.code }));
+      row.carriers = res.rows.map((v) => ({ value: v.id, label: v.code }));
+      if (Array.isArray(newCarrier)) {
+        // 安全地更新 carriers
+        row.carriers.push(
+          ...newCarrier
+            .filter((v) => !row.carriers.map((e) => e.value).includes(v.id))
+            .map((v) => ({ value: v.id, label: v.code }))
+        );
+      }
+    } else {
+      row.carriers = [];
+      row.carriers.push(...newCarrier);
+    }
+    loadingCarrier.value = false;
+  });
+}
+//换箱
+function handleChangeCarrier(row) {
+  console.log(row)
+  if(editStatus.value && !form.value.id){
+  if(form.value.packagingMethod == 0) {
+    row.newCarriers.push(...row.originalCarrierList.map(v => ({ id: v.carrierId, code: v.carrierCode })))
+    row.carriers.push( ...row.originalCarrierList.map((v) => ({ value: v.carrierId, label: v.carrierCode })))
+    row.carrierIds = row.originalCarrierList.map(info => { return info.carrierId })
+  }else{
+    row.newCarriers = null
+  }
+}
+if(editStatus.value && form.value.id){
+  row.carriers = []
+    row.newCarriers.map(v => ({ id: v.value, code: v.label }))
+    console.log(row.newCarriers)
+    row.carriers = row.newCarriers.map((v) => ({ value: v.id, label: v.code }))
+    row.carrierIds = row.newCarriers.map(info => { return info.id })
+    console.log(row)
+}
+  row.editStatus = true;
+}
+function handleCarrierChange(arg, item) {
+  totalCarriersNum.value = 0
+  item.newCarriers = item.carriers
+    .filter((v) => arg.includes(v.value))
+    .map((v) => ({ id: v.value, code: v.label }));
+    console.log(item.newCarriers)
+    item.carrierNum = item.newCarriers.length
+
+    for(let i = 0;i<form.value.details.length;i++) {
+    if(form.value.packagingMethod == 1) {
+        form.value.details[i].carrierNum =form.value.details[i].newCarriers? form.value.details[i].newCarriers.length:0
+      }else {
+        //原厂蓝箱
+        form.value.details[i].carrierNum =form.value.details[i].newCarriers? form.value.details[i].newCarriers.length:form.value.details[i].originalCarrier.split(",").length
+      }
+      console.log(form.value.details)
+      totalCarriersNum.value += form.value.details[i].carrierNum
+  }
+       if(form.value.deliveryMethod == 1) {
+        form.value.freightAmount= form.value.freightPrice * totalCarriersNum.value
+        }else {
+          form.value.freightAmount = 0.0
+        }
+}
+
+/** 使用新方式 */
+// const handleShowDialogOutsourceCarriers = (row) => {
+//   // 确保 form.details 存在且不是 undefined
+//   let allNewCarriers;
+//   if (form.value && form.value.details && Array.isArray(form.value.details)) {
+//     allNewCarriers = form.value.details
+//       .flatMap((detail) =>
+//         detail.newCarriers ? detail.newCarriers.filter((item) => item) : []
+//       )
+//       .filter(Boolean);
+
+//     // 现在 allNewCarriers 包含了所有非空的 newCarriers 数组的元素
+//   }
+//   // form.value.details.newCarriers
+//   // const allNewCarriers = form.details.flatMap((detail) => detail.newCarriers);
+//   console.log("allNewCarriers", allNewCarriers);
+//   proxy.$refs.dialogCarrierRef.open(row.lotId, from.value.deliveryMethod);
+// };
+
+// 箱子选择带回
+const handleMultipleSelectedOutsourceCarriers = (selection, lotId) => {
+  const carrierNames = selection.map((item) => item.code);
+  let carrierNamesString = carrierNames.join(",");
+  form.value.details.map((item) => {
+    if (item.lotId == lotId) {
+      item.newCarrier = carrierNamesString;
+      item.newCarrierCount = selection.length;
+      item.newCarriers = selection;
+    }
+  });
+};
+
+/***************************** 外协工序对话框相关 *****************************/
+// 打开外协工序选择对话框
+const handleShowDialogProcesses = (row) => {
+  currentDetail.value = row;
+  proxy.$refs.dialogProcessesRef.open(row);
+};
+
+// 工序选择带回
+const handleMultipleSelectedProcesses = (selection) => {
+  currentDetail.value.processes = []
+  const processNames = selection.map((item) => item.processAlias);
+  // 使用join方法将数组转换为以逗号分隔的字符串
+  let commaSeparatedString = processNames.join(",");
+  currentDetail.value.processes = [];
+  currentDetail.value.processNames = commaSeparatedString;
+  selection.forEach((item) => {
+    const newProcess = {
+      processId: item.processId,
+      processCode: item.processCode,
+      processAlias: item.processAlias,
+      processStepNumber: item.processStepNumber,
+      technologicalProcessDetailId: item.id,
+    };
+    currentDetail.value.processes.push(newProcess);
+  });
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>

+ 10 - 6
src/views/business/outsource/index.vue

@@ -192,11 +192,11 @@
             label="操作"
             align="center"
             class-name="small-padding fixed-width"
-            width="144"
+            width="200"
           >
             <template #default="scope">
               <el-button
-                v-if="scope.row.isSubmit == 0"
+                v-if="scope.row.isSubmit == 1"
                 link
                 type="warning"
                 icon="Edit"
@@ -206,17 +206,15 @@
                 编辑
               </el-button>
               <el-button
-                v-if="scope.row.isSubmit == 1"
                 link
                 type="primary"
                 icon="View"
-                @click="handleUpdate(scope.row)"
+                @click="handleView(scope.row)"
                 v-hasPermi="['business:outsource:query']"
               >
                 查看
               </el-button>
               <el-button
-                v-if="scope.row.isSubmit == 0"
                 link
                 type="danger"
                 icon="Delete"
@@ -328,7 +326,13 @@ function handleAdd() {
 /** 修改按钮操作 */
 function handleUpdate(row) {
   const id = row.id || ids.value;
-  proxy.$refs.orderRef.open(id);
+  row.flag = true
+  proxy.$refs.orderRef.open(row);
+}
+function handleView(row) {
+  const id = row.id || ids.value;
+  row.flag =false
+  proxy.$refs.orderRef.open(row);
 }
 
 /** 删除按钮操作 */

+ 341 - 0
src/views/business/product/drawingForm.vue

@@ -0,0 +1,341 @@
+<template>
+  <!-- 添加或修改项目信息对话框 -->
+  <el-drawer v-model="visible" size="30%" direction="rtl" :close-on-press-escape="false">
+    <div class="page-container form-container">
+      <div class="form-btns-container">
+        <span class="title-label"><el-icon>
+            <Document />
+          </el-icon>
+          电子工艺图纸</span>
+      </div>
+
+      <!-- 搜索区域 -->
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item>
+          <el-upload :action="webHost + '/common/upload'" :headers="headers" :on-success="handleSuccess"
+            :on-exceed="handleExceed" :before-upload="beforeUpload" :show-file-list="false">
+            <el-button type="success" icon="Plus" v-hasPermi="['business:drawing:add']">上传图纸
+            </el-button>
+          </el-upload>
+          <el-button type="primary" icon="Search"  v-hasPermi="['business:drawing:record']"  @click="handleRecords" style="margin-left: 10px;">操作历史
+          </el-button>
+        </el-form-item>
+      </el-form>
+      <!-- 列表区 -->
+      <div class="el-table-container">
+        <el-table ref="equipmentTable" v-loading="loading" row-key="id" @selection-change="handleSelectionChange"
+          :data="form.drawingList" height="100%">
+          <!-- <el-table-column type="selection" width="40" align="center" /> -->
+          <el-table-column label="图纸" prop="drawingName" align="center" />
+          <el-table-column fixed="right" label="操作" align="center" width="140px">
+            <template #default="scope">
+              <el-button link type="primary" v-hasPermi="['business:drawing:preview']" @click="handlePreview(scope.row)">预览
+              </el-button>
+              <el-button link type="success" plain v-hasPermi="['business:drawing:download']" @click="handleDownload(scope.row)">下载</el-button>
+
+              <el-button link type="danger" v-hasPermi="['business:drawing:remove']" @click="handleDelete(scope.row.id)">删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <!-- 分页 -->
+      <pagination v-show="total > 0" :total="total" v-model:page="queryparams.pageNum" v-model:limit="queryparams.pageSize"
+        @pagination="getList" />
+    </div>
+
+    <el-dialog v-model="dialogVisible" width="1500px">
+      <iframe :src="pdfCover" style="width: 100%; height: 800px"></iframe>
+    </el-dialog>
+
+    <!-- 添加或修改app版本管理对话框 -->
+    <el-dialog title="查询到有同名文件" v-model="openRecords" width="280px" append-to-body>
+
+      <template #footer>
+        <div>
+          <el-button type="primary" @click="coverDrawing">覆 盖</el-button>
+          <el-button type="success" @click="saveDrawing">不 覆 盖</el-button>
+          <el-button type="info" @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </el-drawer>
+  <!-- 图纸弹窗 -->
+  <redcord-dialog ref="redcordsForm" />
+  <!-- <pdf :src="pdfUrl" /> -->
+</template>
+<script setup>
+// import  PDF  from 'vue-pdf';
+import {
+  listDrawing,
+  addDrawing,
+  delDrawing,
+  updateDrawing,
+  drawingByName
+} from "@/api/business/drawing";
+import { addRecords } from '@/api/business/drawingRecords'
+import redcordDialog from './recordsDialog'
+import { getToken } from '@/utils/auth'
+import useUserStore from '@/store/modules/user'
+const webHost = import.meta.env.VITE_APP_BASE_API
+const { proxy } = getCurrentInstance();
+const total = ref(0)
+const emit = defineEmits(["handleSaveResourceSuccess"]);
+/** 表单抽屉 页变量 */
+const processDetail = ref({});
+/**覆盖对话框显示 */
+const openRecords = ref(false)
+const formLoading = ref(false)
+const pdfCover = ref('')
+const dialogVisible = ref(false)
+/**覆盖用对象 */
+const editRow = ref({})
+const pdfUrl = ref('')
+/**不覆盖文件名 */
+const coverName = ref('')
+const repeatingDrawings = ref([])
+const selections = ref([]);
+const headers = { Authorization: getToken() }
+const loading = ref(false);
+const visible = ref(false);
+/** 查询对象 */
+const data = reactive({
+  queryparams:{
+    pageNum: 1,
+    pageSize: 10,
+    technologicalProcessDetailId: null
+  },
+  form: {
+    pageNum: 1,
+    pageSize: 10,
+    groupDetailList: [],
+    code: "",
+    remark: "",
+    type: false
+  },
+  rules: {
+    code: [{ required: true, message: "资源组编码不能为空", trigger: "blur" }],
+  },
+});
+const { form, rules,queryparams } = toRefs(data);
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+function open(row) {
+
+  processDetail.value = row
+  queryparams.value.technologicalProcessDetailId = row.id
+  form.value.technologicalProcessDetailId = row.id
+  getList()
+  visible.value = true;
+};
+/**查询列表 */
+function getList(){
+  loading.value = true;
+  listDrawing(queryparams.value).then(res => {
+    form.value.drawingList = res.rows
+    total.value = res.total
+
+  })
+  loading.value = false;
+}
+/**
+ * 打开操作页面
+ */
+function handleRecords() {
+  proxy.$refs.redcordsForm.open(processDetail.value);
+}
+
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+  selections.value = selection;
+}
+
+
+
+/** 文件下载 */
+function handleDownload(row) {
+
+  return new Promise((resolve, reject) => {
+    const xhr = new XMLHttpRequest();
+    xhr.open('GET', webHost + row.url, true);
+    xhr.responseType = 'blob';
+    xhr.upload.onprogress = (e) => {
+      if (e.lengthComputable) {
+        let progress = e.loaded / e.total;
+      }
+    };
+    xhr.onload = function () {
+      const url = window.URL.createObjectURL(xhr.response);
+      const eleLink = document.createElement('a');
+      eleLink.href = webHost + row.url;
+      eleLink.download = `${row.drawingName}`;
+      eleLink.style.display = 'none';
+      document.body.appendChild(eleLink);
+      eleLink.click();
+      document.body.removeChild(eleLink);
+
+      var recordsItem = {}
+      recordsItem.technologicalProcessDetailId = row.technologicalProcessDetailId;
+      recordsItem.technologicalProcessDetailDrawingId = row.id
+      recordsItem.userId = useUserStore().user.userId
+      recordsItem.type = "下载"
+      recordsItem.drawingName = row.drawingName
+      addRecords(recordsItem).then(res => {
+        if (res.code == 200) {
+          resolve('success');
+        }
+      })
+
+    };
+    xhr.onerror = (e) => {
+      proxy.$modal.msgError('下载文件失败!')
+      reject(e);
+    };
+    xhr.send();
+  });
+
+  // window.location.href = webHost + url
+}
+/**删除 */
+function handleDelete(id) {
+  proxy.$modal
+    .confirm('是否确认删除选中的电子图纸?')
+    .then(function () {
+      return delDrawing(id)
+    })
+    .then(() => {
+      reset();
+      open(processDetail.value)
+      proxy.$modal.msgSuccess('删除成功!')
+    })
+
+}
+
+/**上传成功回调 */
+function handleSuccess(row) {
+  form.value.url = row.fileName
+  console.log(row.fileName, "上传成功")
+  var fileDrawing = {}
+  fileDrawing.drawingName = row.originalFilename
+  fileDrawing.technologicalProcessDetailId = processDetail.value.id
+  drawingByName(fileDrawing).then(res => {
+    // debugger;
+    if (res.code == 200) {
+      console.log(res, "数据库查询")
+      repeatingDrawings.value = res.data
+      if (repeatingDrawings.value.length == 0) {
+        coverName.value = row.originalFilename
+        saveDrawing();
+      } else {
+        /**覆盖对象 */
+        editRow.value = JSON.parse(JSON.stringify(repeatingDrawings.value[0]));
+        editRow.value.url = form.value.url
+        //有同名文件,询问是否覆盖
+        openRecords.value = true
+        coverName.value = row.originalFilename
+        // coverName.value = row.originalFilename.slice(0, -4) + "_" + row.newFileName.slice(-6, -4) + row.originalFilename.slice(-4);
+      }
+    }
+  })
+}
+//覆盖保存
+function coverDrawing() {
+  updateDrawing(editRow.value).then(res => {
+    if (res.code == 200) {
+      reset();
+      open(processDetail.value)
+      formLoading.value = false
+      openRecords.value = false
+      // form.value.type = true
+      // form.value.drawingName = coverName.value
+      // saveDrawing();
+
+    }
+  })
+}
+//不覆盖保存
+function saveDrawing() {
+
+  form.value.drawingName = coverName.value
+  addDrawing(form.value).then(res => {
+    if (res.code == 200) {
+      reset();
+      open(processDetail.value)
+      formLoading.value = false
+      openRecords.value = false
+    }
+  })
+}
+
+/**预览 */
+function handlePreview(row) {
+
+  //  pdfUrl.value = webHost +row.url
+  dialogVisible.value = true
+  pdfCover.value = webHost + row.url
+  // window.open((webHost + row.url))
+}
+
+// 取消按钮
+function cancel() {
+  openRecords.value = false
+}
+/**文件数量超出的回调 */
+function handleExceed(files) {
+  form.value.url = files[0].url
+}
+/** 文件上传前的 回调事件 */
+function beforeUpload(file) {
+  formLoading.value = true
+  const allowedTypes = ['application/pdf'];
+  const isAllowed = allowedTypes.includes(file.type);
+  if (!isAllowed) {
+    proxy.$modal.msgError('只能上传 PDF 格式的文件!')
+    return false
+  }
+
+}
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  reset();
+  visible.value = false;
+}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    pageNum: 1,
+    pageSize: 10,
+    code: null,
+    remark: null,
+    groupDetailList: [],
+    url: null,
+    drawingName: null,
+    type: false
+  };
+  coverName.value = ''
+  repeatingDrawings.value = []
+  proxy.resetForm("formRef");
+}
+
+
+
+
+
+/** 取消按钮 */
+const handleCancel = () => {
+  visible.value = false;
+  reset();
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>
+  

+ 17 - 0
src/views/business/product/index.vue

@@ -160,6 +160,7 @@
 							<el-table-column label="工序简称" align="center" prop="processAlias" />
 							<el-table-column v-if="!editStatus" label="操作" width="140px" align="center">
 								<template #default="scope">
+									<el-button link type="primary" @click="handleShowResourceGroupDetailForm(scope.row)"  v-hasPermi="['business:drawing:list']"> 图纸 </el-button>
 									<el-button v-show="false" v-if="scope.row.editStatus && !editStatus" link type="primary" icon="Check" @click="handleSaveTechnologicalProcessDetail(scope.row)" v-hasPermi="['business:product:add']"> 保存 </el-button>
 									<el-button v-show="false" v-else-if="!editStatus && !scope.row.editStatus" link type="warning" icon="Edit" @click.prevent="scope.row.editStatus = true" v-hasPermi="['business:product:edit']"> 编辑 </el-button>
 									<el-button v-show="false" link type="danger" icon="Delete" @click="handleDeleteTechnologicalProcessDetail(scope.row, scope.$index)" v-hasPermi="['business:product:remove']"> 删除 </el-button>
@@ -174,6 +175,8 @@
 		<product-form ref="productRef" @handleSaveSuccess="handleQueryProduct"></product-form>
 		<!-- 工序弹窗 -->
 		<process-choice ref="processChoiceRef" :multiple-selected="handleProcessSelected"></process-choice>
+		<!-- 图纸弹窗 -->
+		<drawing ref="drawingForm" @handleSaveResourceSuccess="handleRefreshEquipment"/>
 	</div>
 </template>
 
@@ -182,6 +185,7 @@ import { listProduct, delProduct } from '@/api/business/product'
 import { getP2Product } from '@/api/business/p2.js'
 import productForm from './form'
 import processChoice from './DialogProcessChoice'
+import drawing from './drawingForm'
 import { listTechnologicalProcessDetail, saveTechnologicalProcessDetail, delTechnologicalProcessDetail, saveSingleTechnologicalProcessDetail } from '@/api/business/technologicalProcessDetail'
 import { listTechnologicalProcess, saveTechnologicalProcess, delTechnologicalProcess } from '@/api/business/technologicalProcess'
 import { ref } from 'vue'
@@ -526,6 +530,19 @@ function handleAddProcess() {
 	proxy.$refs.processChoiceRef.open()
 }
 
+/**
+ * 打开图纸抽屉
+ */
+function handleShowResourceGroupDetailForm(row) {
+	console.log(row)
+    proxy.$refs.drawingForm.open(row);
+ 
+}
+
+function handleRefreshEquipment(){
+
+}
+
 onMounted(() => {
 	getList()
 })

+ 110 - 0
src/views/business/product/recordsDialog.vue

@@ -0,0 +1,110 @@
+<template>
+  <el-dialog title="电子图纸操作记录" v-model="visible" :width="width" @close="close" append-to-body draggable>
+    <template #header>
+      <span style="color: #fff">电子图纸操作记录</span>
+    </template>
+    <div class="page-container column-container">
+      <el-table ref="dialogTable" :data="list" height="460px" row-key="id" align="center">
+        <el-table-column label="行号" type="index" width="50" align="center" />
+        <el-table-column label="操作人" prop="userName" align="center" />
+        <el-table-column label="操作图纸名称" prop="drawingName" align="center" />
+        <el-table-column label="产品描述"  align="center" >
+          <template #default="scope" >
+            <span>{{ scope.row.processDetail.productDescription }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="工艺版本" prop="type" align="center" >
+          <template #default="scope" >
+            <span>{{ scope.row.processDetail.technologyVersion }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="工序编码" prop="type" align="center"  >
+          <template #default="scope" >
+            <span>{{ scope.row.processDetail.processCode }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="工序简称" prop="type" align="center"  >
+          <template #default="scope" >
+            <span>{{ scope.row.processDetail.processAlias }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作时间" prop="createTime" align="center" />
+        <el-table-column label="操作类型" prop="type" align="center" />
+      </el-table>
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </div>
+    
+  </el-dialog>
+</template>
+<script setup>
+import { ref } from '@vue/reactivity'
+import { listRecords } from '@/api/business/drawingRecords'
+const { proxy } = getCurrentInstance()
+const visible = ref(false)
+/**设备弹窗变量 */
+const total = ref(0)
+const props = defineProps({
+  width: {
+    type: String,
+    default: '900px'
+  }
+})
+const list = ref([])
+
+/**查询对象 */
+const data = reactive({
+  queryParams: {
+    name: '',
+    pageSize: 10,
+    pageNum: 1
+  }
+})
+const { queryParams } = toRefs(data)
+/***********************  方法区  ****************************/
+/**
+ * 对话框打开 事件
+ */
+function open(row) {
+  reset();
+  visible.value = true
+  if (row) {
+    console.log(row)
+    queryParams.value.technologicalProcessDetailId = row.id
+    getList()
+
+  }
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  // proxy.$refs.dialogForm.resetFields()
+  proxy.$refs.dialogTable.clearSelection()
+  // handleSearch('clear')
+  visible.value = false
+}
+
+/** 表单重置 */
+function reset() {
+  queryParams.value = {
+    pageNum: 1,
+    pageSize: 10,
+  };
+  proxy.resetForm("formRef");
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+  listRecords(queryParams.value).then((res) => {
+    list.value = res.rows
+    total.value = res.total
+  })
+}
+
+defineExpose({
+  open
+})
+</script>

+ 37 - 20
src/views/business/productionBatch/computedMaterialForm.vue

@@ -23,14 +23,13 @@
               prop="materialpickUpQuantity"
               label-width="100px"
             >
-              <el-input-number
-                v-model="form.materialpickUpQuantity"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-                style="width: 200px; margin-left: 30px"
-                @input="handleInputMaterialpickUpQuantity"
-              />
+            <el-input
+              v-model="form.materialpickUpQuantity"
+              placeholder="0"
+              type="text"
+              style="width: 200px; margin-left: 30px"
+              @input="handleInputMaterialpickUpQuantity"
+            />
             </el-form-item>
           </el-col>
         </el-row>
@@ -41,6 +40,7 @@
               v-model="form.peqty"
               prop="peqty"
               label-width="100px"
+              
               style="margin-top: 30px"
             >
               <span style="margin-left: 40px">{{ form.peqty }}</span>
@@ -62,8 +62,8 @@
         </el-row>
       </el-form>
       <div class="bottom-buttons">
-        <el-button size="large" style="width: 200px;height: 50px;" type="info"  @click="cancel">取 消</el-button>
-      <el-button size="large" style="width: 200px;height: 50px;" type="primary"  @click="handleInputLotNumber"
+        <el-button size="large" style="width: 160px;height: 50px;" type="info"  @click="cancel">取 消</el-button>
+      <el-button size="large" style="width: 160px;height: 50px;" type="primary"  @click="handleInputLotNumber"
         >填入</el-button
       >
     </div>
@@ -93,13 +93,15 @@ const detailInfo = ref({})
 function open(data) {
   reset();
   detailInfo.value = proxy.deepClone(data);
-  getProductionLotAmount({lotno:detailInfo.value.productionPlanNo,lotseq:detailInfo.value.lineNumber}).then(res =>{
-    if(res.code == 200) {
-      form.value.peqty = res.data[0].peqty
-       visible.value = true;
-    }
-  }
-)
+  form.value.peqty = 22.8
+  visible.value =true
+//   getProductionLotAmount({lotno:detailInfo.value.productionPlanNo,lotseq:detailInfo.value.lineNumber}).then(res =>{
+//     if(res.code == 200) {
+//       form.value.peqty = res.data[0].peqty
+//        visible.value = true;
+//     }
+//   }
+// )
  
 }
 
@@ -113,14 +115,29 @@ function cancel() {
 function reset() {
   form.value = {
     lotNumber: 0,
-    materialpickUpQuantity:0
+    materialpickUpQuantity:''
   };
   proxy.resetForm("formRef");
 }
 //填写领料量
 function handleInputMaterialpickUpQuantity(data) {
-   form.value.lotNumber = Math.ceil(data / form.value.peqty);
-}
+  // if (data < 0) {
+  //       form.value.materialpickUpQuantity = 0;
+  //     }else{
+  //  form.value.lotNumber = Math.ceil(data / form.value.peqty);
+  //     }
+  const regex =/^(?!0+(?:\.0+)?$)[1-9]\d*(\.\d*)?$/;
+      // 检查输入值是否符合正则表达式规则
+      if (!regex.test(data)) {
+        // 如果不符合规则,清空输入或设置为0
+        form.value.materialpickUpQuantity = '';
+      } else {
+        // 如果符合规则,更新模型
+        form.value.materialpickUpQuantity = data;
+        form.value.lotNumber = Math.ceil(data / form.value.peqty);
+      }
+      
+    };
 
 // 投产批数带回
 function handleInputLotNumber(){

+ 2 - 1
src/views/business/productionBatch/form.vue

@@ -29,7 +29,8 @@
                 @input="handleUpdateLotNumber"
                 :min="0"
               />
-              <el-button style="margin-left: 10px;" type="primary" @click="handleComputedMaterial"
+              <el-button v-hasPermi="['business:productionBatch:outsourcedAdd']" :disabled="detailsRow.status"
+               style="margin-left: 10px;" type="primary" @click="handleComputedMaterial"
         >外协投料计算</el-button>
             </el-form-item>
             <el-form-item label="下达日期" prop="issuanceDate">

+ 32 - 11
src/views/business/returnReceipt/DialogOutsourceDetails.vue

@@ -1,13 +1,27 @@
 <template>
 	<el-dialog title="添加收回明细" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
-			<el-form-item label="批次号:" prop="lotCode" label-width="70">
-				<el-input v-model.trim="queryParams.lotCode" type="text" @keydown.enter.prevent style="width: 160px"
-					placeholder="请输入批次号" :clearable="true" @keyup.enter="handleSearch" />
+			<el-form-item label="产品描述:" prop="productDescription" label-width="100">
+				<el-input
+					v-model.trim="queryParams.productDescription"
+					type="text"
+					@keydown.enter.prevent
+					style="width: 140px"
+					placeholder="请输入产品描述"
+					:clearable="true"
+					@keyup.enter="handleSearch"
+				/>
 			</el-form-item>
-			<el-form-item label="产品描述:" prop="productDescription" label-width="90">
-				<el-input v-model.trim="queryParams.productDescription" type="text" @keydown.enter.prevent style="width: 160px"
-					placeholder="请输入关键字" :clearable="true" @keyup.enter="handleSearch" />
+			<el-form-item label="箱号:" prop="newCarrier" label-width="70">
+				<el-input
+					v-model.trim="queryParams.newCarrier"
+					type="text"
+					@keydown.enter.prevent
+					style="width: 140px"
+					placeholder="请输入箱号"
+					:clearable="true"
+					@keyup.enter="handleSearch"
+				/>
 			</el-form-item>
 			<el-form-item label-width="20px">
 				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
@@ -31,13 +45,12 @@
             " @click="handleShowFinishedDetail">+查看已完成明细</span>
 			</div>
 		</el-form>
-
-		<el-table ref="dialogTable" :data="dataList" size="small" v-loading="loading" border height="370px"
+		<div><span style="color: red;">注:如果选择框为灰色,外协厂已填写收回单,暂未提交!</span></div>
+		<el-table ref="dialogTable" :data="dataList" row-key="id" size="small" v-loading="loading" border height="370px"
 			@selection-change="handleSelectionChange">
-			<el-table-column type="selection" width="40" align="center" />
+			<el-table-column type="selection" width="40" align="center" :selectable="handleAllowSelected"/>
 			<el-table-column type="index" label="行号" width="50" align="center" />
 			<el-table-column label="批次号" align="center" prop="lotCode" width="96" />
-			<el-table-column label="料号" align="center" prop="productCode" width="96" />
 			<el-table-column label="产品描述" align="center" prop="productDescription" />
 			<el-table-column label="箱号" align="center" prop="originalCarrier" width="220">
 				<template #default="scope">
@@ -62,6 +75,7 @@
 </template>
 <script setup>
 import { listDetailForReceipt, listDetailForAllReceipt } from '@/api/business/outsourcedOrderDetail'
+
 const { proxy } = getCurrentInstance()
 const total = ref(0)
 const props = defineProps({
@@ -97,16 +111,22 @@ function open(data) {
 
 //查看对应外协所有批次
 function handleShowAllDetail() {
+	queryParams.value.pageNum =1
 	queryParams.value.pageSize = 10
 	showAll.value = true
 	getAllList()
 }
 //查看对应外协已完成批次
 function handleShowFinishedDetail() {
+	queryParams.value.pageNum =1
 	queryParams.value.pageSize = 10
 	showAll.value = false
 	getList()
 }
+function handleAllowSelected(row) {
+  return row.returnReceiptDetailList.length >0?false:true
+}
+//查找分配给外协商的所有明细,除了已经德迈仕已经确认的批次
 function getAllList() {
 	loading.value = true
 	listDetailForAllReceipt(queryParams.value).then((res) => {
@@ -115,6 +135,7 @@ function getAllList() {
 		loading.value = false
 	})
 }
+
 function handleChangePageSize() {
 	if (showAll.value) {
 		console.log("1")
@@ -136,7 +157,7 @@ function close() {
 }
 
 /**
- * 加载数据
+ * 查看已完成的外协单明细(已完成代表分配给外协商的活,都报完工)
  */
 function getList() {
 	loading.value = true

+ 1 - 1
src/views/business/returnReceipt/DialogSuppliers.vue

@@ -1,5 +1,5 @@
 <template>
-	<el-dialog title="选择外协商" v-model="visible" width="600px" height="400px" @close="close" append-to-body draggable>
+	<el-dialog title="选择外协商" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 		<el-form ref="dialogForm" class="master-container" :model="queryParams" :inline="true" style="align-items: center">
 			<div style="display: flex">
 				<el-form-item label="外协商名称:" prop="name">

+ 82 - 19
src/views/business/returnReceipt/form.vue

@@ -117,14 +117,14 @@
               prop="productNum"
               width="96"
             />
-            <el-table-column
+            <!-- <el-table-column
               label="原箱号"
               align="center"
               prop="originalCarrier"
               width="320"
-            />
+            /> -->
             <el-table-column
-              label="箱号"
+              label="箱号"
               align="center"
               prop="newCarrier"
               width="320"
@@ -133,7 +133,7 @@
               label="外协工序"
               align="center"
               prop="processAlias"
-              width="120"
+              width="200"
             />
             <el-table-column
               label="收回数量"
@@ -149,14 +149,20 @@
             >
               <template #default="scope">
                 <el-input-number
+                v-if=" scope.row.productionDeptId == 0"
                   v-model="scope.row.auditNum"
                   :min="0"
                   controls-position="right"
                   style="text-align: center"
                 />
+                <el-input v-model="scope.row.auditNum" v-else readonly />
               </template>
             </el-table-column>
             <el-table-column label="备注" align="center" prop="remark">
+              <template #default="scope">
+                <el-input v-model.trim="scope.row.remark" v-if="editStatus" />
+                <el-input v-model="scope.row.remark" v-else readonly />
+              </template>
             </el-table-column>
             <el-table-column
               label="审核状态"
@@ -256,6 +262,7 @@ const reset = () => {
     supplierName: "",
     remark: "",
     details: [],
+    detailInfo:[]
   };
   proxy.resetForm("formRef");
 };
@@ -315,11 +322,30 @@ const handleMultipleSelectedOutsourceDetails = (selection) => {
         processAlias: selection[i].processes[j].processAlias,
         processCode: selection[i].processes[j].processCode,
         processStepNumber: selection[i].processes[j].processStepNumber,
+        productionDeptId: selection[i].productionDeptId,
         status: 0,
         auditNum: 0,
       };
-      form.value.details.push(newDetail);
+      form.value.detailInfo.push(newDetail);
     }
+    //页面显示内容,一个批次一行
+    const detail = {
+      outsourceDetailId: selection[i].id,
+      productDescription: selection[i].productDescription,
+      lotCode: selection[i].lotCode,
+      productNum: selection[i].productNum,
+      receiptNum:
+      selection[i].processes[selection[i].processes.length - 1].qualifiedNum
+          ? selection[i].processes[selection[i].processes.length - 1].qualifiedNum
+          : 0,
+      newCarrier: selection[i].newCarrier,
+      remark: "",
+      processAlias: selection[i].processNames,
+      productionDeptId: selection[i].productionDeptId,
+      status: 0,
+      auditNum: 0,
+    };
+    form.value.details.push(detail);
   }
 };
 //审核状态按钮
@@ -365,22 +391,20 @@ function submitForm() {
         flag = false;
         proxy.$modal.msgError("收回明细不能为空");
       }
-      console.log(form.value.details.length);
       if (flag) {
-        console.log(form.value);
+        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+        handleSetAuditStatus();
         if (confirmFlag) {
           proxy.$modal
             .confirm("存在填写确定数量为0的工序,确定要收回吗?")
             .then(function () {
               if (form.value.id != null) {
-                console.log(form.value);
                 updateReceipt(form.value).then((response) => {
                   proxy.$modal.msgSuccess("修改成功");
                   visible.value = false;
                   emit("handleSaveSuccess");
                 });
               } else {
-                console.log(form.value);
                 addReceipt(form.value).then((response) => {
                   proxy.$modal.msgSuccess("新增成功");
                   visible.value = false;
@@ -414,19 +438,58 @@ function submitForm() {
 }
 //反选操作
 function handleDelReturnReceiveDetail(row) {
-  if(row.productionDeptId!=0) {
-    proxy.$modal.msgError("该批次已周转,不能删除");
-  }else{
-  proxy.$modal
-    .confirm("是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?")
-    .then(function () {
-      form.value.details = form.value.details.filter((item) => {
-        return item.lotId != row.lotId;
-      });
+  console.log(row);
+  if (form.value.id) {
+    if (row.productionDeptId != 0) {
+      proxy.$modal.msgError("该批次已周转,不能删除");
+    } else {
+      proxy.$modal
+        .confirm(
+          "是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?"
+        )
+        .then(function () {
+          form.value.details = form.value.details.filter((item) => {
+            return item.lotCode != row.lotCode;
+          });
+          //修改存进数据库的数据
+          let index = [];
+          for (let i = 0; i < form.value.detailInfo.length; i++) {
+            if (form.value.detailInfo[i].lotCode == row.lotCode) {
+              index.push(i);
+            }
+          }
+          for (let i = index.length - 1; i >= 0; i--) {
+            form.value.detailInfo.splice(index[i], 1);
+          }
+        });
+    }
+  } else {
+    form.value.details.splice(form.value.details.indexOf(row), 1);
+       //修改存进数据库的数据
+       let index = [];
+          for (let i = 0; i < form.value.detailInfo.length; i++) {
+            if (form.value.detailInfo[i].lotCode == row.lotCode) {
+              index.push(i);
+            }
+          }
+          for (let i = index.length - 1; i >= 0; i--) {
+            form.value.detailInfo.splice(index[i], 1);
+          }
+  }
+  console.log(form.value)
+}
+//审核状态,备注,确定数量赋值
+function handleSetAuditStatus() {
+  for (let i = 0; i < form.value.details.length; i++) {
+    form.value.detailInfo.forEach((element) => {
+      if (form.value.details[i].lotCode == element.lotCode) {
+        element.remark = form.value.details[i].remark;
+        element.status = form.value.details[i].status;
+        element.auditNum = form.value.details[i].auditNum;
+      }
     });
   }
 }
-
 /** 暴露给父组件的方法 */
 defineExpose({
   open,

+ 1 - 1
src/views/business/returnReceipt/index.vue

@@ -57,7 +57,7 @@
       <el-button
         type="danger"
         icon="Delete"
-        :disabled="multiple"
+        :disabled="ids.length == 0"
         v-hasPermi="['business:returnReceipt:remove']"
         @click="handleDelete"
       >

+ 53 - 148
src/views/business/supplier/index.vue

@@ -5,24 +5,16 @@
 			<el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
 				<el-form-item class="section-title" label="外协商管理" />
 				<el-form-item label="外协商名称:">
-					<el-input
-						placeholder="请输入关键字"
-						v-model.trim="queryParams.name"
-						style="width: 120px"
-						clearable
-						@keyup.enter="handleQuery"
-						@keydown.enter.prevent
-					/>
+					<el-input placeholder="请输入关键字" v-model.trim="queryParams.name" style="width: 120px" clearable
+						@keyup.enter="handleQuery" @keydown.enter.prevent />
 				</el-form-item>
 				<el-form-item label="助记码:">
-					<el-input
-						placeholder="请输入关键字"
-						v-model.trim="queryParams.mnemonicCode"
-						style="width: 120px"
-						clearable
-						@keyup.enter="handleQuery"
-						@keydown.enter.prevent
-					/>
+					<el-input placeholder="请输入助记码" v-model.trim="queryParams.mnemonicCode" style="width: 120px" clearable
+						@keyup.enter="handleQuery" @keydown.enter.prevent />
+				</el-form-item>
+				<el-form-item label="外协厂编码:">
+					<el-input placeholder="请输入外协厂编码" v-model.trim="queryParams.code" style="width: 120px" clearable
+						@keyup.enter="handleQuery" @keydown.enter.prevent />
 				</el-form-item>
 				<el-form-item>
 					<el-button type="info" icon="Search" @click="handleQuery">搜索</el-button>
@@ -32,18 +24,11 @@
 			<!-- 列表区 -->
 			<div class="el-table-container">
 				<div class="el-table-inner-container">
-					<el-table
-						ref="supplierTable"
-						v-loading="loading"
-						border
-						:data="supplierList"
-						highlight-current-row
-						height="100%"
-						@current-change="handleCurrentSupplierChange"
-					>
+					<el-table ref="supplierTable" v-loading="loading" border :data="supplierList" highlight-current-row
+						height="100%" @current-change="handleCurrentSupplierChange">
 						<el-table-column type="index" label="行号" width="50" align="center" />
 						<el-table-column label="外协商名称" width="320" align="center" prop="name" />
-						<el-table-column label="助记码" width="120" align="center" prop="mnemonicCode" />
+						<el-table-column label="外协厂编码" width="120" align="center" prop="code" />
 						<el-table-column label="发货方式" width="96" align="center" prop="deliveryMethod">
 							<template #default="scope">
 								<dict-tag :options="delivery_method" :value="scope.row.deliveryMethod" />
@@ -58,44 +43,24 @@
 							<template #default="scope"> {{ scope.row.lossLimit }}% </template>
 						</el-table-column>
 						<el-table-column label="默认联系人" width="120" align="center" prop="contactName" />
-							<el-table-column label="默认联系电话" width="120" align="center" prop="contactPhoneNumber" />
+						<el-table-column label="默认联系电话" width="120" align="center" prop="contactPhoneNumber" />
 						<el-table-column label="备注" align="center" prop="remark" />
 						<el-table-column label="操作" width="350" align="center">
 							<template #default="scope">
-								<el-button
-									v-hasPermi="['business:supplier:edit']"
-									link
-									type="primary"
-									icon="User"
-									@click="handleSetSupplierAdmin(scope.row)"
-								>
+								<el-button v-hasPermi="['business:supplier:edit']" link type="primary" icon="User"
+									@click="handleSetSupplierAdmin(scope.row)">
 									设置管理员
 								</el-button>
-								<el-button
-									v-hasPermi="['business:supplier:edit']"
-									link
-									type="success"
-									icon="Iphone"
-									@click="handleSetSupplierContacts(scope.row)"
-								>
+								<el-button v-hasPermi="['business:supplier:edit']" link type="success" icon="Iphone"
+									@click="handleSetSupplierContacts(scope.row)">
 									设置联系人
 								</el-button>
-								<el-button
-									v-hasPermi="['business:supplier:edit']"
-									link
-									type="warning"
-									icon="Edit"
-									@click="handleShowSupplierDialog(scope.row)"
-								>
+								<el-button v-hasPermi="['business:supplier:edit']" link type="warning" icon="Edit"
+									@click="handleShowSupplierDialog(scope.row)">
 									编辑
 								</el-button>
-								<el-button
-									v-hasPermi="['business:supplier:remove']"
-									link
-									type="danger"
-									icon="Delete"
-									@click="handleDelete(scope.row)"
-								>
+								<el-button v-hasPermi="['business:supplier:remove']" link type="danger" icon="Delete"
+									@click="handleDelete(scope.row)">
 									删除
 								</el-button>
 							</template>
@@ -105,13 +70,8 @@
 			</div>
 		</section>
 		<!-- 分页 -->
-		<pagination
-			v-show="supplierTotal > 0"
-			:total="supplierTotal"
-			v-model:page="queryParams.pageNum"
-			v-model:limit="queryParams.pageSize"
-			@pagination="getList"
-		/>
+		<pagination v-show="supplierTotal > 0" :total="supplierTotal" v-model:page="queryParams.pageNum"
+			v-model:limit="queryParams.pageSize" @pagination="getList" />
 
 		<section class="list-part-container row-container" style="flex: 1">
 			<section class="list-part-container" style="flex: 2">
@@ -119,39 +79,22 @@
 				<el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
 					<el-form-item class="section-title" label="产品" />
 					<el-form-item label="产品描述:">
-						<el-input
-							placeholder="请输入关键字"
-							v-model.trim="queryProductParams.productDescription"
-							style="width: 120px"
-							clearable
-							@keyup.enter="handleQuery"
-							@keydown.enter.prevent
-						/>
+						<el-input placeholder="请输入关键字" v-model.trim="queryProductParams.productDescription" style="width: 120px"
+							clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
 					</el-form-item>
 					<el-form-item>
 						<el-button type="info" icon="Search" @click="handleQueryProducts">搜索</el-button>
-						<el-button
-							type="primary"
-							icon="Plus"
-							@click="handleShowProductsDialog(null)"
-							:disabled="!currentSupplier.id"
-						>
+						<el-button type="primary" icon="Plus" @click="handleShowProductsDialog(null)"
+							:disabled="!currentSupplier.id">
 							添加产品
 						</el-button>
 					</el-form-item>
 				</el-form>
 				<div class="el-table-container">
 					<div class="el-table-inner-container">
-						<el-table
-							ref="productTable"
-							:data="supplierProductList ? supplierProductList : []"
-							v-loading="supplierProductLoading"
-							highlight-current-row
-							height="100%"
-							size="small"
-							header-row-class-name="list-header-row"
-							@current-change="handleCurrentProductChange"
-						>
+						<el-table ref="productTable" :data="supplierProductList ? supplierProductList : []"
+							v-loading="supplierProductLoading" highlight-current-row height="100%" size="small"
+							header-row-class-name="list-header-row" @current-change="handleCurrentProductChange">
 							<el-table-column type="index" label="行号" width="50" align="center" />
 							<el-table-column label="料号" width="120" align="center" prop="productCode" />
 							<el-table-column label="产品描述" align="center" prop="productDescription" />
@@ -164,38 +107,21 @@
 					</div>
 				</div>
 				<!-- 分页 -->
-				<pagination
-					v-show="productTotal > 0"
-					:total="productTotal"
-					v-model:page="queryProductParams.pageNum"
-					v-model:limit="queryProductParams.pageSize"
-					@pagination="getCurrentSupplierProduct"
-				/>
+				<pagination v-show="productTotal > 0" :total="productTotal" v-model:page="queryProductParams.pageNum"
+					v-model:limit="queryProductParams.pageSize" @pagination="getCurrentSupplierProduct" />
 			</section>
 			<section class="list-part-container" style="flex: 3">
-				<el-form
-					class="list-search-container list-search-container-child"
-					:model="queryParams"
-					ref="queryRef"
-					:inline="true"
-				>
+				<el-form class="list-search-container list-search-container-child" :model="queryParams" ref="queryRef"
+					:inline="true">
 					<el-form-item class="section-title" label="外协工序" />
 					<el-form-item>
-						<el-button
-							type="primary"
-							icon="Plus"
-							@click="handleShowProcessesDialog"
-							:disabled="!currentProduct.id || processEditStatus"
-						>
+						<el-button type="primary" icon="Plus" @click="handleShowProcessesDialog"
+							:disabled="!currentProduct.id || processEditStatus">
 							添加工序
 						</el-button>
-						<el-button
-							v-if="!processEditStatus"
-							type="warning"
-							icon="Edit"
+						<el-button v-if="!processEditStatus" type="warning" icon="Edit"
 							:disabled="!currentProduct.id || supplierProductProcessList.length === 0"
-							@click="processEditStatus = true"
-						>
+							@click="processEditStatus = true">
 							编辑
 						</el-button>
 						<template v-if="processEditStatus">
@@ -206,38 +132,24 @@
 				</el-form>
 				<div class="el-table-container">
 					<div class="el-table-inner-container">
-						<el-table
-							:data="supplierProductProcessList"
-							v-loading="supplierProductProcessLoading"
-							highlight-current-row
-							height="100%"
-						>
+						<el-table :data="supplierProductProcessList" v-loading="supplierProductProcessLoading" highlight-current-row
+							height="100%">
 							<el-table-column type="index" label="行号" width="50" align="center" />
 							<el-table-column label="工序编码" width="120" align="center" prop="processCode" />
 							<el-table-column label="工序简称" width="120" align="center" prop="processAlias" />
 							<el-table-column label="结算方式" width="120" align="center" prop="settlementType">
 								<template #default="scope">
 									<el-select v-if="processEditStatus" v-model="scope.row.settlementType" clearable placeholder="请选择">
-										<el-option
-											v-for="dict in settlement_type"
-											:key="dict.value"
-											:label="dict.label"
-											:value="dict.value"
-										/>
+										<el-option v-for="dict in settlement_type" :key="dict.value" :label="dict.label"
+											:value="dict.value" />
 									</el-select>
 									<dict-tag v-else :options="settlement_type" :value="scope.row.settlementType" />
 								</template>
 							</el-table-column>
 							<el-table-column label="单价(元)" width="120" align="center" prop="price">
 								<template #default="scope">
-									<el-input-number
-										v-if="processEditStatus"
-										v-model="scope.row.price"
-										:precision="8"
-										:min="0.0"
-										:step="0.00000001"
-										controls-position="right"
-									/>
+									<el-input-number v-if="processEditStatus" v-model="scope.row.price" :precision="8" :min="0.0"
+										:step="0.00000001" controls-position="right" />
 									<span v-else>{{ scope.row.priceLabel }}</span>
 								</template>
 							</el-table-column>
@@ -258,24 +170,17 @@
 			</section>
 		</section>
 		<!-- 供应商表单 -->
-		<dialog-form
-			ref="formRef"
-			@handleSaveSuccess="handleQuery"
-			:delivery-method="delivery_method"
-			:settlement-type="settlement_type"
-		/>
+		<dialog-form ref="formRef" @handleSaveSuccess="handleQuery" :delivery-method="delivery_method"
+			:settlement-type="settlement_type" />
 		<!-- 产品添加对话框 -->
 		<dialog-products ref="productsRef" :supplier-id="currentSupplier.id" :multiple-selected="handleProductSelected" />
 		<!-- 工序添加对话框 -->
-		<dialog-processes
-			ref="processesRef"
-			:product-id="currentProduct.productId"
-			:multiple-selected="handleProcessSelected"
-		/>
+		<dialog-processes ref="processesRef" :product-id="currentProduct.productId"
+			:multiple-selected="handleProcessSelected" />
 		<!-- 管理员设置 -->
 		<dialog-set-admin ref="setAdminRef" />
 		<!-- 联系人设置 -->
-		<contacts-form ref="setContactsRef" @handleSaveSuccess =getList() />
+		<contacts-form ref="setContactsRef" @handleSaveSuccess=getList() />
 	</div>
 </template>
 
@@ -384,7 +289,7 @@ const handleDelete = (row) => {
 				}
 			})
 		})
-		.catch(() => {})
+		.catch(() => { })
 }
 
 /** 设置管理员 **/
@@ -413,7 +318,7 @@ const getCurrentSupplierProduct = () => {
 		if (supplierProductList.value.length > 0) {
 			currentProduct.value = supplierProductList.value[0]
 			proxy.$refs.productTable.setCurrentRow(supplierProductList.value[0])
-		}else{
+		} else {
 			supplierProductProcessList.value = []
 			currentProduct.value = {}
 		}
@@ -463,7 +368,7 @@ const handleDelProduct = (row) => {
 				}
 			})
 		})
-		.catch(() => {})
+		.catch(() => { })
 }
 
 /**************************************** 工序相关 ****************************************/
@@ -505,7 +410,7 @@ const handleProcessSelected = (selection) => {
 			price: 0.0,
 			settlementType: currentSupplier.value.settlementType,
 			remark: '',
-			supplierProductId:currentProduct.value.id
+			supplierProductId: currentProduct.value.id
 		}
 		dataList.push(newProcess)
 	})
@@ -539,7 +444,7 @@ const handleDelProcess = (row) => {
 				}
 			})
 		})
-		.catch(() => {})
+		.catch(() => { })
 }
 
 onMounted(() => {