From 8bc17a9ea84a6af0b7d01e451c702f404a3ff895 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期六, 10 一月 2026 11:36:34 +0800
Subject: [PATCH] Merge branch 'dev_tide' into dev_tide_cbsglxt

---
 src/views/productionManagement/operationScheduling/index.vue |  228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/src/views/productionManagement/operationScheduling/index.vue b/src/views/productionManagement/operationScheduling/index.vue
new file mode 100644
index 0000000..1427faf
--- /dev/null
+++ b/src/views/productionManagement/operationScheduling/index.vue
@@ -0,0 +1,228 @@
+<template>
+	<div class="app-container">
+		<div class="search_form">
+			<el-form :model="searchForm" :inline="true">
+				<el-form-item label="娲惧伐鏃ユ湡:">
+					<el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
+													placeholder="璇烽�夋嫨" clearable @change="changeDaterange" />
+				</el-form-item>
+				<el-form-item label="鐘舵��:">
+					<el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" @change="handleQuery" style="width: 140px" clearable>
+						<el-option label="寰呮帓浜�" :value="1"></el-option>
+						<el-option label="宸叉帓浜�" :value="3"></el-option>
+						<el-option label="鎺掍骇涓�" :value="2"></el-option>
+					</el-select>
+				</el-form-item>
+				<el-form-item>
+					<el-button type="primary" @click="handleQuery">鎼滅储</el-button>
+				</el-form-item>
+			</el-form>
+		</div>
+		<div class="table_list">
+			<div style="text-align: right" class="mb10">
+				<el-button type="primary" @click="openForm">宸ュ簭鎺掍骇</el-button>
+				<el-button type="danger" @click="handleDelete" plain>鍙栨秷鎺掍骇</el-button>
+			</div>
+			<PIMTable
+				rowKey="id"
+				:column="tableColumn"
+				:tableData="tableData"
+				:page="page"
+				:isSelection="true"
+				@selection-change="handleSelectionChange"
+				:tableLoading="tableLoading"
+				@pagination="pagination"
+				:total="page.total"
+			></PIMTable>
+		</div>
+		<form-dia ref="formDia" @close="handleQuery"></form-dia>
+	</div>
+</template>
+
+<script setup>
+import {onMounted, ref} from "vue";
+import FormDia from "@/views/productionManagement/operationScheduling/components/formDia.vue";
+import {ElMessageBox} from "element-plus";
+import dayjs from "dayjs";
+import {listPageProcess, productionDispatchDelete} from "@/api/productionManagement/operationScheduling.js";
+
+const data = reactive({
+	searchForm: {
+		staffName: "",
+		status: 1,
+		entryDate: [
+			dayjs().format("YYYY-MM-DD"),
+			dayjs().add(1, "day").format("YYYY-MM-DD"),
+		], // 褰曞叆鏃ユ湡
+		entryDateStart: dayjs().format("YYYY-MM-DD"),
+		entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
+	},
+});
+const { searchForm } = toRefs(data);
+const tableColumn = ref([
+	{
+		label: "鐘舵��",
+		prop: "status",
+		dataType: "tag",
+		formatData: (params) => {
+			if (params == 3) {
+				return "宸叉帓浜�";
+			} else if (params == 1) {
+				return "寰呮帓浜�";
+			} else {
+				return '鎺掍骇涓�';
+			}
+		},
+		formatType: (params) => {
+			if (params == 3) {
+				return "success";
+			} else if (params == 1) {
+				return "primary";
+			} else {
+				return 'warning';
+			}
+		},
+	},
+	{
+		label: "娲惧伐鏃ユ湡",
+		prop: "schedulingDate",
+		width: 120,
+	},
+	{
+		label: "娲惧伐浜�",
+		prop: "schedulingUserName",
+	},
+	{
+		label: "浜у搧澶х被",
+		prop: "productCategory",
+		width: 150,
+	},
+	{
+		label: "瑙勬牸鍨嬪彿",
+		prop: "specificationModel",
+		width: 150,
+	},
+	{
+		label: "鍗曚綅",
+		prop: "unit",
+	},
+	{
+		label: "鎺掍骇鎬绘暟",
+		prop: "schedulingNum",
+	},
+	{
+		label: "宸叉帓浜ф暟閲�",
+		prop: "successNum",
+		width: 100,
+	},
+	{
+		label: "寰呮帓浜ф暟閲�",
+		prop: "pendingNum",
+		width: 100,
+	},
+]);
+const tableData = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+const page = reactive({
+	current: 1,
+	size: 100,
+	total: 0,
+});
+const formDia = ref()
+const { proxy } = getCurrentInstance()
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+	page.current = 1;
+	getList();
+};
+const changeDaterange = (value) => {
+	if (value) {
+		searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+		searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+	} else {
+		searchForm.value.entryDateStart = undefined;
+		searchForm.value.entryDateEnd = undefined;
+	}
+	handleQuery();
+};
+const pagination = (obj) => {
+	page.current = obj.page;
+	page.size = obj.limit;
+	getList();
+};
+const getList = () => {
+	tableLoading.value = true;
+	const params = { ...searchForm.value, ...page };
+	params.entryDate = undefined
+	listPageProcess(params).then(res => {
+		tableLoading.value = false;
+		tableData.value = res.data.records.map(item => ({
+			...item,
+			pendingNum: (Number(item.schedulingNum) || 0) - (Number(item.successNum) || 0)
+		}));
+		page.total = res.data.total;
+	}).catch(err => {
+		tableLoading.value = false;
+	})
+};
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+	selectedRows.value = selection;
+};
+
+// 鎵撳紑寮规
+const openForm = (type, row) => {
+	if (selectedRows.value.length !== 1) {
+		proxy.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�");
+		return;
+	}
+	if (selectedRows.value[0].pendingNum == 0) {
+		proxy.$message.warning("鏃犻渶鍐嶆帓浜�");
+		return;
+	}
+	nextTick(() => {
+		formDia.value?.openDialog(type, selectedRows.value[0])
+	})
+};
+
+// 鍒犻櫎
+const handleDelete = () => {
+	let ids = [];
+	if (selectedRows.value.length > 0) {
+		// 鏂板锛氬垽鏂槸鍚︽湁宸叉帓浜х殑鏁版嵁
+		const hasScheduled = selectedRows.value.some(item => item.status == 3);
+		if (hasScheduled) {
+			proxy.$modal.msgWarning("宸叉帓浜ф暟鎹笉鑳藉彇娑堟帓浜�");
+			return;
+		}
+		ids = selectedRows.value.map((item) => item.id);
+	} else {
+		proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+		return;
+	}
+	ElMessageBox.confirm("鏄惁纭鍙栨秷鎺掍骇锛�", "鍒犻櫎鎻愮ず", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			tableLoading.value = true;
+			productionDispatchDelete(ids)
+				.then((res) => {
+					proxy.$modal.msgSuccess("鍙栨秷鎺掍骇鎴愬姛");
+					getList();
+				})
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+onMounted(() => {
+	getList();
+});
+</script>
+
+<style scoped></style>

--
Gitblit v1.9.3