From 8e61f9516c313048b1d3dcce3a2f218be035ec71 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 12 十一月 2025 18:01:08 +0800
Subject: [PATCH] 新疆-生产流程定制化

---
 src/views/productionManagement/productionDispatching/components/autoDispatchDia.vue |  153 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 153 insertions(+), 0 deletions(-)

diff --git a/src/views/productionManagement/productionDispatching/components/autoDispatchDia.vue b/src/views/productionManagement/productionDispatching/components/autoDispatchDia.vue
new file mode 100644
index 0000000..9944600
--- /dev/null
+++ b/src/views/productionManagement/productionDispatching/components/autoDispatchDia.vue
@@ -0,0 +1,153 @@
+<template>
+  <div>
+    <el-dialog
+        v-model="dialogFormVisible"
+        title="鑷姩娲惧伐"
+        width="80%"
+        @close="closeDia"
+    >
+      <el-form :model="form" label-width="140px" label-position="top" ref="formRef">
+        <el-divider content-position="left">娲惧伐鍒楄〃</el-divider>
+        
+        <el-table
+            :data="dispatchList"
+            border
+            style="width: 100%; margin-top: 20px;"
+            :row-class-name="tableRowClassName"
+        >
+          <el-table-column label="搴忓彿" type="index" width="60" align="center" />
+          <el-table-column label="鍚堝悓鍙�" prop="salesContractNo" width="200" />
+          <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" width="200" />
+          <el-table-column label="椤圭洰鍚嶇О" prop="projectName" width="250" />
+          <el-table-column label="浜у搧澶х被" prop="productCategory" width="150" />
+          <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200" />
+          <el-table-column label="缁戝畾鏈哄櫒" prop="speculativeTradingName" width="120" />
+          <el-table-column label="鎬绘暟閲�" prop="quantity" width="100" align="right" />
+          <el-table-column label="宸叉帓浜�" prop="schedulingNum" width="100" align="right" fixed="right" />
+          <el-table-column label="寰呮帓浜�" prop="pendingQuantity" width="100" align="right" fixed="right" />
+          <el-table-column label="鏈鎺掍骇" width="150" align="center" fixed="right">
+            <template #default="{ row }">
+              <el-input-number
+                  v-model="row.schedulingNum"
+                  :min="0"
+                  :max="row.pendingQuantity"
+                  :step="1"
+                  :precision="0"
+                  size="small"
+                  style="width: 120px"
+                  @change="(value) => changeCurrentNum(value, row)"
+              />
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form>
+      
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">纭娲惧伐</el-button>
+          <el-button @click="closeDia">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import {ref, reactive, toRefs, computed} from "vue";
+import {productionDispatch, productionDispatchList} from "@/api/productionManagement/productionOrder.js";
+
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['close'])
+
+const dialogFormVisible = ref(false);
+const operationType = ref('')
+
+const data = reactive({
+  form: {},
+  dispatchList: [], // 娲惧伐鍒楄〃鏁版嵁
+});
+
+const { form, dispatchList } = toRefs(data);
+
+
+// 琛ㄦ牸琛屾牱寮�
+const tableRowClassName = ({ rowIndex }) => {
+  if (rowIndex % 2 === 1) {
+    return 'even-row'
+  }
+  return ''
+}
+
+// 淇敼鏈鎺掍骇鏁伴噺
+const changeCurrentNum = (value, row) => {
+  if (value > row.pendingQuantity) {
+    row.schedulingNum = row.pendingQuantity
+    proxy.$modal.msgWarning('鎺掍骇鏁伴噺涓嶅彲澶т簬寰呮帓浜ф暟閲�')
+  }
+}
+
+// 鎵撳紑寮规
+const openDialog = (type, rows) => {
+  operationType.value = type;
+  dialogFormVisible.value = true;
+  
+  // 澶勭悊浼犲叆鐨勬暟鎹�
+  dispatchList.value = rows.map(row => ({
+    ...row,
+    schedulingNum: 0, // 鍒濆鍖栨湰娆℃帓浜ф暟閲忎负0
+    pendingQuantity: (Number(row.quantity) || 0) - (Number(row.schedulingNum) || 0) // 璁$畻寰呮帓浜ф暟閲�
+  }))
+}
+
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+  // 妫�鏌ユ槸鍚︽湁鎺掍骇鏁版嵁
+  const hasSchedulingData = dispatchList.value.some(item => item.schedulingNum > 0)
+  if (!hasSchedulingData) {
+    proxy.$modal.msgWarning('璇疯嚦灏戜负涓�鏉¤褰曡缃帓浜ф暟閲�')
+    return
+  }
+  
+  // 鏋勯�犳彁浜ゆ暟鎹� - 鐩存帴浼犻�掓暟缁勶紝涓嶈繃婊�
+  const submitData = dispatchList.value
+  
+  console.log('鎻愪氦鑷姩娲惧伐鏁版嵁:', submitData)
+  
+  // 璋冪敤API锛堣繖閲岄渶瑕佹牴鎹疄闄呮帴鍙h皟鏁达級
+  productionDispatchList(submitData).then(res => {
+    proxy.$modal.msgSuccess(res.msg);
+    closeDia();
+  }).catch(err => {
+    proxy.$modal.msgError("娲惧伐澶辫触");
+    console.error('娲惧伐澶辫触:', err);
+  })
+}
+
+// 鍏抽棴寮规
+const closeDia = () => {
+  proxy.resetForm("formRef");
+  dialogFormVisible.value = false;
+  dispatchList.value = []
+  emit('close')
+};
+
+defineExpose({
+  openDialog,
+});
+</script>
+
+<style scoped>
+:deep(.even-row) {
+  background-color: #fafafa;
+}
+
+:deep(.el-table .cell) {
+  padding: 8px 12px;
+}
+
+:deep(.el-table th) {
+  background-color: #f5f7fa;
+  color: #606266;
+  font-weight: 600;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3