Explorar o código

单批单改-第2版

wangxin hai 1 ano
pai
achega
bf6787e805

+ 11 - 0
src/api/business/technologicalAmend.js

@@ -11,6 +11,17 @@ export function getProcessList(query) {
   })
 }
 
+// 查询工序数据
+export function selectStandardProcess(processId) {
+  return request({
+    url: baseUrl + '/business/amend/standardProcess/'+processId,
+    method: 'get',
+  })
+}
+
+
+
+
 //新增修改后工艺信息
 export function addAmend(lotId,data) {
   return request({

+ 59 - 2
src/views/business/reviseBath/lotFormParticulars.vue

@@ -229,6 +229,7 @@
         v-if="lot.isAmend == 1"
         type="primary"
         style="float: right; margin-left: 10px"
+        @click="handleStandardProcess(lot.technologicalProcessId)"
       >
         查看标准工艺
       </el-button>
@@ -269,8 +270,49 @@
         </el-table>
       </div>
     </div>
-    <once-change ref="onceChangeRef" />
+    <once-change ref="onceChangeRef" @handleSaveSuccess="init" />
     <lot-waste-dialog ref="lotWasteDialogRef" @handleSaveSuccess="init" />
+    <el-dialog
+      title="标准工序"
+      v-model="visible"
+      width="680px"
+      append-to-body
+      draggable
+      @close="cancel"
+    >
+      <div class="el-table-inner-container">
+        <el-table
+          style="height: 600px"
+          @selection-change="handleSelectionChange"
+          :data="processList"
+        >
+          <el-table-column
+            type="selection"
+            :selectable="checkSelectable"
+            width="50"
+            align="center"
+          />
+          <el-table-column
+            type="index"
+            label="序号"
+            width="50"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="工序名称"
+            prop="processAlias"
+            align="center"
+          />
+
+          <el-table-column
+            label="工序编号"
+            prop="processStepNumber"
+            width="200"
+            align="center"
+          />
+        </el-table>
+      </div>
+    </el-dialog>
   </div>
   <div v-else v-loading="loading" class="page-container column-container"></div>
 </template>
@@ -278,13 +320,18 @@
 <script setup name="LotProductionPlan">
 import { ref } from "vue";
 import onceChange from "./onceSingleChangeDialog";
-import { lotParticulars } from "@/api/business/technologicalAmend.js";
+import {
+  lotParticulars,
+  selectStandardProcess,
+} from "@/api/business/technologicalAmend.js";
 import lotWasteDialog from "./dayworkWasteDialog.vue";
 const { proxy } = getCurrentInstance();
 
 /** 查询 对象 */
 const processDetails = ref([]);
 const loading = ref(true);
+const visible = ref(false);
+const processList = ref([]); //工序列表
 const route = useRoute();
 
 const lot = ref({
@@ -329,6 +376,16 @@ function init(data) {
   }
 }
 
+/** 查询标准工艺操作 */
+function handleStandardProcess(processId) {
+  selectStandardProcess(processId).then((res) => {
+    if (res.code == 200) {
+      processList.value = res.rows;
+      visible.value = true;
+    }
+  });
+}
+
 //批废
 function handlelotWaste(lotCode) {
   console.log(lot.value);

+ 94 - 72
src/views/business/reviseBath/onceSingleChangeDialog.vue

@@ -27,8 +27,8 @@
     </el-form>
     <div class="el-table-inner-container">
       <el-table
+        style="height: 600px"
         v-loading="loading"
-        height="100%"
         @selection-change="handleSelectionChange"
         :data="processList"
       >
@@ -44,22 +44,16 @@
           width="50"
           align="center"
         ></el-table-column>
-        <el-table-column
-          label="工序名称"
-          width="100"
-          prop="processAlias"
-          align="center"
-        />
+        <el-table-column label="工序名称" prop="processAlias" align="center" />
 
         <el-table-column
           label="工序编号"
           prop="processStepNumber"
+          width="200"
           align="center"
         />
-        <!-- <el-table-column label="工序编号" prop="processCode" align="center" /> -->
       </el-table>
     </div>
-    <div></div>
     <template #footer>
       <div class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -71,46 +65,67 @@
   <el-dialog
     title="选择工序"
     v-model="addProcess"
-    width="400px"
+    width="800px"
     append-to-body
     draggable
     @close="processClose"
   >
-    <el-form style="padding: 16px" :inline="true">
-      <el-form-item label="工序:">
-        <el-autocomplete
-          :fetch-suggestions="querySearchAsync"
-          style="width: 100%"
-          placeholder="请选择工序"
-          v-model="newProcess.processAlias"
-          popper-class="my-autocomplete"
-          @select="handleSelectEmployee"
-        >
-          <template #default="{ item }">
-            <div
-              style="
-                display: flex;
-                flex-direction: row;
-                justify-content: space-between;
-              "
-            >
-              <div class="name" style="font-size: 12px">
-                {{ item.processAlias }}
-              </div>
-              <span class="code" style="font-size: 10px; color: darkgrey">{{
-                item.processKey
-              }}</span>
-            </div>
-          </template>
-        </el-autocomplete></el-form-item
-      >
-    </el-form>
-    <template #footer>
-      <div class="dialog-footer">
-        <el-button type="primary" @click="handleProcess">确 定</el-button>
-        <el-button @click="processClose">取 消</el-button>
+    <div class="page-container column-container">
+      <el-form style="padding: 16px" :inline="true">
+        <el-form-item label="工序名称:">
+          <el-input
+            placeholder="请输入工序名称或简称"
+            @keydown.enter.prevent
+            @keyup.enter="handleQuery"
+            clearable
+            v-model="queryParams.keyword"
+            style="width: 200px"
+          />
+          <el-button
+            style="margin-left: 20px"
+            type="primary"
+            @click="handleSelect"
+            >搜索</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <div class="el-table-inner-container">
+        <el-table height="95%" :data="addProcessList">
+          <el-table-column
+            label="工序编号"
+            prop="processCode"
+            align="center"
+          ></el-table-column>
+
+          <el-table-column
+            label="工序名称"
+            prop="processAlias"
+            align="center"
+          ></el-table-column>
+
+          <el-table-column label="操作" width="80" align="center">
+            <template #default="scope">
+              <el-button
+                link
+                size="small"
+                type="primary"
+                icon="check"
+                @click="handleProcess(scope.row)"
+                >选择</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
       </div>
-    </template>
+
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="handleSelect"
+      />
+    </div>
   </el-dialog>
 </template>
 <script setup>
@@ -123,16 +138,23 @@ const visible = ref(false);
 const loading = ref(false);
 const haveModified = ref(false); //是否已经修改
 const addProcess = ref(false); //新增工序弹窗
+const total = ref(0);
+const emit = defineEmits(["handleSaveSuccess"]);
 const ids = ref([]); //多选框选中数据
 const click = ref(true); //按钮不可点
+const addProcessList = ref([]); //新增选择工序列表
 const processList = ref([]); //工序列表
-const newProcess = ref({}); //新增工序
 const lot = ref({}); //批次信息
 const dayworkItem = ref({}); //报工信息
 
 const { proxy } = getCurrentInstance();
 
 /** 查询对象 */
+const queryParams = ref({
+  keyword: "",
+  pageNum: 1,
+  pageSize: 10,
+});
 
 /***********************  方法区  ****************************/
 /** 打开弹窗 */
@@ -147,6 +169,14 @@ function open(id) {
   });
 }
 
+/** 新增工序弹窗搜索按钮操作 */
+function handleSelect() {
+  getProcessList(queryParams.value).then((res) => {
+    addProcessList.value = res.rows;
+    total.value = res.total;
+  });
+}
+
 /** 多选框选中数据 */
 function handleSelectionChange(selection) {
   ids.value = selection.map((item) => item.id);
@@ -170,44 +200,37 @@ function handleDel() {
   });
 }
 
-/** 输入框输出建议 */
-function querySearchAsync(queryString, cb) {
-  const query = { keyword: queryString };
-  getProcessList(query).then((res) => {
-    cb(res.rows);
-  });
-}
-
 /** 新增工序确认按钮 操作*/
-function handleProcess() {
-  if (!newProcess.value.id) {
-    proxy.$modal.msgError("请选择一条数据");
-    return;
-  }
-
+function handleProcess(row) {
   //查询选中工序位置
   let id = ids.value[0];
-  let index = processList.value.findIndex((item) => item.id === id);
+  let indexNum = processList.value.findIndex((item) => item.id === id);
+
+  //获取新增工序上一条排序
+  let num = processList.value[indexNum - 1].processStepNumber; //
 
   //复制选中数据
-  let process = { ...processList.value[index] };
+  let process = { ...processList.value[indexNum] };
 
   //修改新增数据
-  process.processAlias = newProcess.value.processAlias;
-  process.processCode = newProcess.value.processCode;
-  process.processId = newProcess.value.id;
+  process.processAlias = row.processAlias;
+  process.processCode = row.processCode;
+  process.processId = row.id;
 
   //插入数据
-  processList.value.splice(index, 0, process);
+  processList.value.splice(indexNum, 0, process);
+
+  //修改排序数据
+  processList.value.forEach((item, index) => {
+    if (index >= indexNum) {
+      num = Number(num) + 1;
+      item.processStepNumber = Number(num);
+    }
+  });
   haveModified.value = true;
   processClose();
 }
 
-/** 选择输出建议 */
-function handleSelectEmployee(item) {
-  newProcess.value = item;
-}
-
 /** 是否可选 */
 function checkSelectable(row) {
   if (dayworkItem.value) {
@@ -227,7 +250,6 @@ function handleAdd() {
   }
 
   addProcess.value = true;
-  newProcess.value = {};
 }
 
 /** 关闭新增工序弹窗 */
@@ -240,13 +262,13 @@ function cancel() {
   visible.value = false;
   addProcess.value = false;
   haveModified.value = false;
-  newProcess.value = {};
 }
 /** 确定按钮 */
 function submitForm() {
   addAmend(lot.value.id, processList.value).then((res) => {
     if (res.code == 200) {
       proxy.$modal.msgSuccess("修改成功");
+      emit("handleSaveSuccess", lot.value.lotCode);
       cancel();
     } else {
       proxy.$modal.msgError(res.msg);