wangxin 1 سال پیش
والد
کامیت
8137966712

+ 22 - 0
src/api/business/daywork.js

@@ -26,6 +26,15 @@ export function getDayworkInfo(query) {
         params: query
     })
 }
+
+/** 查询批次信息 */
+export function getDayworkItemProcess(id) {
+    return request({
+        url: baseUrl + '/business/productionDaywork/getDayworkItemProcess/' + id,
+        method: 'get',
+    })
+}
+
 /**
  * 获取 生产批次报工 列表
  * @param {*} data
@@ -65,6 +74,19 @@ export function updateItem(data) {
     })
 }
 
+
+/**
+ * 查询是否为首序
+ */
+export function getIsFirstOrder(data) {
+    return request({
+        url: baseUrl + '/business/productionDaywork/getIsFirstOrder',
+        method: 'post',
+        data: data
+    })
+}
+
+
 /**
  * 获取报工批次工序列表
  * @param {*} data

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

@@ -0,0 +1,12 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询工序数据
+export function getProcessList(query) {
+  return request({
+    url: baseUrl + '/business/amend/processList',
+    method: 'get',
+    params: query
+  })
+}

+ 152 - 93
src/views/business/reviseBath/form.vue

@@ -1,16 +1,19 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
   <el-drawer
-      v-model="visible"
-      size="90%"
-      direction="rtl"
-      :close-on-press-escape="false"
+    v-model="visible"
+    size="90%"
+    direction="rtl"
+    :close-on-press-escape="false"
   >
     <div class="page-container form-container">
-      <div class="form-btns-container" style="display: flex; align-items: center;">
-        <span class="title-label" 
-        ><el-icon>
-            <Document/>
+      <div
+        class="form-btns-container"
+        style="display: flex; align-items: center"
+      >
+        <span class="title-label"
+          ><el-icon>
+            <Document />
           </el-icon>
           计划详情</span
         >
@@ -82,105 +85,149 @@
             >搜索</el-button
           >
         </el-form-item>
-        <div style="margin-top: 20px;">
-        <el-button type="primary"  @click="handleFallback"
-            >回退</el-button
-          >
+        <div style="margin-top: 20px">
+          <el-button type="primary" @click="handleFallback">回退</el-button>
           <el-button type="primary" @click="handleWasteRecycling"
             >添加废品回用</el-button
           >
-          <el-button type="primary"  @click="handleQuerydaywork"
-            >分批</el-button
-          >
-          <el-button type="primary"  @click="handleQuerydaywork"
+          <el-button type="primary" @click="handleQuerydaywork">分批</el-button>
+          <el-button
+            type="primary"
+            :disabled="once"
+            @click="handleOnceSingleChange"
             >单批单改</el-button
           >
-          <el-button type="primary"  @click="handleQuerydaywork"
+          <el-button
+            type="primary"
+            :disabled="multi"
+            @click="handleQuerydaywork"
             >多批单改</el-button
           >
-      </div>
+        </div>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <el-table
-            ref="dayworkTable"
-            v-loading="loading"
-            row-key="id"
-            @selection-change="handleSelectionChange"
-            height="100%"
-            :data="dayworkList"
+          ref="dayworkTable"
+          v-loading="loading"
+          row-key="id"
+          @selection-change="handleSelectionChange"
+          height="100%"
+          :data="dayworkList"
         >
-          <el-table-column type="selection" width="40" align="center"/>
-          <el-table-column label="客户简称" prop="companyAlias" align="center"/>
-          <el-table-column label="生产计划单号" width="100" prop="productionPlanNo" align="center"/>
-          <el-table-column label="批次号" prop="lotCode" align="center"/>
-          <el-table-column label="产品描述" prop="productDescription" align="center"/>
-          <el-table-column label="图纸版本" width="80" prop="technologyVersion" align="center"/>
-          <el-table-column label="投产量" width="100" prop="productionQuantity" align="center"/>
+          <el-table-column type="selection" width="40" align="center" />
+          <el-table-column
+            label="客户简称"
+            prop="companyAlias"
+            align="center"
+          />
+          <el-table-column
+            label="生产计划单号"
+            width="100"
+            prop="productionPlanNo"
+            align="center"
+          />
+          <el-table-column label="批次号" prop="lotCode" align="center" />
+          <el-table-column
+            label="产品描述"
+            prop="productDescription"
+            align="center"
+          />
+          <el-table-column
+            label="图纸版本"
+            width="80"
+            prop="technologyVersion"
+            align="center"
+          />
+          <el-table-column
+            label="投产量"
+            width="100"
+            prop="productionQuantity"
+            align="center"
+          />
           <el-table-column
-                label="下达日期"
-                prop="createTime"
-                width="100"
-                align="center"
-            >
-              <template #default="scope">
-                <span>{{
-                    proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
-                  }}</span>
-              </template>
-            </el-table-column>
-          <el-table-column label="当前工段" width="100" prop="deptName" align="center"/>
-          <el-table-column label="当前工序" width="120" prop="processAlias" align="center"/>
-          <el-table-column label="回退" width="60" prop="isFallback" align="center">
+            label="下达日期"
+            prop="createTime"
+            width="100"
+            align="center"
+          >
             <template #default="scope">
-              <dict-tag
-                  :options="yes_no"
-                  :value="scope.row.isFallback"
-              />
+              <span>{{
+                proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+              }}</span>
             </template>
           </el-table-column>
-          <el-table-column label="废品回用" width="70" prop="isWasteRecycling" align="center">
+          <el-table-column
+            label="当前工段"
+            width="100"
+            prop="deptName"
+            align="center"
+          />
+          <el-table-column
+            label="当前工序"
+            width="120"
+            prop="processAlias"
+            align="center"
+          />
+          <el-table-column
+            label="回退"
+            width="60"
+            prop="isFallback"
+            align="center"
+          >
             <template #default="scope">
-              <dict-tag
-                  :options="yes_no"
-                  :value="scope.row.isWasteRecycling"
-              />
+              <dict-tag :options="yes_no" :value="scope.row.isFallback" />
             </template>
           </el-table-column>
-          <el-table-column label="母批号" prop="fromCode" align="center"/>
           <el-table-column
-              fixed="right"
-              label="操作"
-              align="center"
-              width="140px"
+            label="废品回用"
+            width="70"
+            prop="isWasteRecycling"
+            align="center"
+          >
+            <template #default="scope">
+              <dict-tag :options="yes_no" :value="scope.row.isWasteRecycling" />
+            </template>
+          </el-table-column>
+          <el-table-column label="母批号" prop="fromCode" align="center" />
+          <el-table-column
+            fixed="right"
+            label="操作"
+            align="center"
+            width="140px"
           >
             <template #default="scope">
               <el-button
-                  link
-                  type="danger"
-                  icon="Delete"
-                  @click="handleDayworkWaste(scope.row)"
-              >批废
-              </el-button
-              >
+                link
+                type="danger"
+                icon="Delete"
+                @click="handleDayworkWaste(scope.row)"
+                >批废
+              </el-button>
             </template>
           </el-table-column>
         </el-table>
       </div>
+      <once-change ref="onceChangeRef" />
     </div>
   </el-drawer>
 </template>
 <script setup>
-import {
-  getDayworkInfo
-} from "@/api/business/daywork.js";
-const {proxy} = getCurrentInstance();
+import { getDayworkInfo } from "@/api/business/daywork.js";
+import onceChange from "./onceSingleChangeDialog";
+import { ref } from "vue";
+const { proxy } = getCurrentInstance();
 /** 字典数组区 */
 const { yes_no } = proxy.useDict("yes_no");
 /** 表单抽屉 页变量 */
 const loading = ref(false);
-const dayworkList = ref([])
+const ids = ref([]); //多选框选中数据
+const once = ref(true); //单批单改按钮是否可点击
+const multi = ref(true); //多批单改按钮是否可点击
+const dayworkList = ref([]);
 const visible = ref(false);
+const formOpen = ref(false);
+
 /** 查询对象 */
 const queryParams = ref({
   pageNum: 1,
@@ -194,33 +241,45 @@ const queryParams = ref({
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 const open = (row) => {
-  console.log(row)
-  queryParams.value.lineNumber = row.lineNumber
-  queryParams.value.productionPlanNo = row.productionPlanNo
-
+  console.log(row);
+  queryParams.value.lineNumber = row.lineNumber;
+  queryParams.value.productionPlanNo = row.productionPlanNo;
 
   //获取工段信息
-  getDayworkList()
+  getDayworkList();
   visible.value = true;
 };
 /**获取生产计划列表 */
 function getDayworkList() {
   loading.value = true;
-  getDayworkInfo(queryParams.value).then(res => {
-    if(res.code == 200) {
-      dayworkList.value = res.rows
-      loading.value = false
+  getDayworkInfo(queryParams.value).then((res) => {
+    if (res.code == 200) {
+      dayworkList.value = res.rows;
+      loading.value = false;
     }
-  })
+  });
 }
+
+/** 多选框选中数据 */
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.lotCode);
+  console.log(selection);
+  once.value = ids.value.length == 1 ? false : true;
+  multi.value = ids.value.length > 1 ? false : true;
+}
+
+/** 单批单改按钮操作 */
+function handleOnceSingleChange() {
+  proxy.$refs.onceChangeRef.open(ids.value[0]);
+}
+
 /**搜索 */
 function handleQuerydaywork() {
-  getDayworkList()
+  getDayworkList();
 }
-/**批量删除 */
-function handleDelete() {
 
-}
+/**批量删除 */
+function handleDelete() {}
 
 /**
  * 对话框关闭 事件
@@ -231,14 +290,14 @@ function close() {
 
 /**搜索栏清空 */
 function reset() {
- queryParams = ref({
-  pageNum: 1,
-  pageSize: 10,
-  lotCode: "",
-  deptId: null,
-  isFallback: "",
-  isWasteRecycling: "",
-});
+  queryParams = ref({
+    pageNum: 1,
+    pageSize: 10,
+    lotCode: "",
+    deptId: null,
+    isFallback: "",
+    isWasteRecycling: "",
+  });
 }
 
 /** 取消按钮 */

+ 194 - 0
src/views/business/reviseBath/onceSingleChangeDialog.vue

@@ -0,0 +1,194 @@
+<template>
+  <el-dialog
+    title="单批单改"
+    v-model="visible"
+    width="680px"
+    append-to-body
+    draggable
+    @close="cancel"
+  >
+    <el-form class="list-search-container" :inline="true">
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="Plus"
+          :disabled="click"
+          @click="handleAdd"
+          >在此工序前添加新工序</el-button
+        >
+        <el-button type="danger" :disabled="click" icon="delete"
+          >删除</el-button
+        >
+      </el-form-item>
+    </el-form>
+    <div class="el-table-inner-container">
+      <el-table
+        v-loading="loading"
+        height="100%"
+        @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="工序名称"
+          width="100"
+          prop="processAlias"
+          align="center"
+        />
+        <el-table-column
+          label="工序编号"
+          prop="processStepNumber"
+          align="center"
+        />
+      </el-table>
+    </div>
+    <div></div>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+
+  <el-dialog
+    title="选择工序"
+    v-model="addProcess"
+    width="400px"
+    append-to-body
+    draggable
+    @close="cancel"
+  >
+    <el-form style="padding: 16px" :inline="true">
+      <el-form-item label="工序:">
+        <el-autocomplete
+          :fetch-suggestions="querySearchAsync"
+          style="width: 100%"
+          placeholder="请选择工序"
+          v-model="process.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="cancel">取 消</el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { getDayworkItemProcess } from "@/api/business/daywork.js";
+import { getProcessList } from "@/api/business/technologicalAmend.js";
+
+/** 变量 */
+const visible = ref(false);
+const loading = ref(false);
+const addProcess = ref(false); //新增工序弹窗
+const ids = ref([]); //多选框选中数据
+const click = ref(true); //按钮不可点
+const processList = ref([]); //工序列表
+const process = ref({}); //新增工序
+const lot = ref({});
+
+const { proxy } = getCurrentInstance();
+
+/** 查询对象 */
+
+/***********************  方法区  ****************************/
+/** 打开弹窗 */
+function open(id) {
+  visible.value = true;
+  loading.value = true;
+  getDayworkItemProcess(id).then((res) => {
+    lot.value = res.data.item;
+    processList.value = res.data.processDetails;
+    loading.value = false;
+  });
+}
+
+/** 多选框选中数据 */
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  click.value = ids.value.length == 1 ? false : true;
+}
+
+/** 输入框输出建议 */
+function querySearchAsync(queryString, cb) {
+  const query = { keyword: queryString };
+  getProcessList(query).then((res) => {
+    cb(res.rows);
+  });
+}
+
+/** 新增工序确认按钮 操作*/
+function handleProcess() {
+  if (process) {
+    proxy.$modal.msgError("请选择一条数据");
+    return;
+  }
+  let id = ids.value[0];
+  let index = processList.value.findIndex((item) => item.id === id);
+  let pro = processList.value[index];
+  console.log(pro);
+}
+
+/** 选择输出建议 */
+function handleSelectEmployee(item) {
+  process.value = item;
+}
+
+/** 是否可选 */
+function checkSelectable(row) {
+  return lot.value.status != 0
+    ? row.processStepNumber > lot.value.processStepNumber
+    : row.processStepNumber >= lot.value.processStepNumber;
+}
+
+/** 添加新工序按钮操作 */
+function handleAdd() {
+  addProcess.value = true;
+}
+
+/** 关闭弹窗 */
+function cancel() {
+  visible.value = false;
+  addProcess.value = false;
+}
+/** 确定按钮 */
+function submitForm() {}
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>