From 552ec6b7d8ccc56c379da195fc6c9c74312b1070 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 22 五月 2026 17:57:46 +0800
Subject: [PATCH] OA部分查询条件变更
---
src/pages/productionManagement/productionDispatching/components/DispatchModal.vue | 708 ++++++++++++++++++++++++++++------------------------------
1 files changed, 344 insertions(+), 364 deletions(-)
diff --git a/src/pages/productionManagement/productionDispatching/components/DispatchModal.vue b/src/pages/productionManagement/productionDispatching/components/DispatchModal.vue
index 95c3705..2a836e9 100644
--- a/src/pages/productionManagement/productionDispatching/components/DispatchModal.vue
+++ b/src/pages/productionManagement/productionDispatching/components/DispatchModal.vue
@@ -1,399 +1,379 @@
<template>
- <up-popup
- v-model:show="show"
- mode="bottom"
- :round="20"
- :safeAreaInsetBottom="true"
- @close="handleClose"
- @open="handleOpen"
- >
- <view class="dispatch-modal">
- <!-- 澶撮儴 -->
- <view class="modal-header">
- <text class="modal-title">鐢熶骇娲惧伐</text>
- <view class="close-btn" @click="handleClose">
- <up-icon name="close" size="20" color="#999"></up-icon>
- </view>
- </view>
-
- <!-- 琛ㄥ崟鍐呭 -->
- <view class="modal-content">
- <up-form
- :model="form"
- ref="formRef"
- :rules="rules"
- labelWidth="120"
- >
- <!-- 椤圭洰鍩烘湰淇℃伅 -->
- <view class="form-section">
- <text class="section-title">椤圭洰淇℃伅</text>
- <up-form-item label="椤圭洰鍚嶇О" prop="projectName">
- <up-input
- v-model="form.projectName"
- disabled
- placeholder="椤圭洰鍚嶇О"
- />
- </up-form-item>
- <up-form-item label="浜у搧澶х被" prop="productCategory">
- <up-input
- v-model="form.productCategory"
- disabled
- placeholder="浜у搧澶х被"
- />
- </up-form-item>
- </view>
-
- <!-- 鏁伴噺淇℃伅 -->
- <view class="form-section">
- <text class="section-title">鏁伴噺淇℃伅</text>
- <up-form-item label="鎬绘暟閲�" prop="quantity">
- <up-input
- v-model="form.quantity"
- disabled
- placeholder="鎬绘暟閲�"
- />
- </up-form-item>
- <up-form-item label="寰呮帓浜ф暟閲�" prop="pendingQuantity">
- <up-input
- v-model="form.pendingQuantity"
- disabled
- placeholder="寰呮帓浜ф暟閲�"
- />
- </up-form-item>
- <up-form-item label="鏈鎺掍骇鏁伴噺" prop="schedulingNum" required>
- <up-number-box
- v-model="form.schedulingNum"
- :min="0"
- :max="form.pendingQuantity"
- :step="0.1"
- :precision="2"
- @change="handleNumChange"
- />
- </up-form-item>
- </view>
-
- <!-- 娲惧伐淇℃伅 -->
- <view class="form-section">
- <text class="section-title">娲惧伐淇℃伅</text>
- <up-form-item label="娲惧伐浜�" prop="schedulingUserId" required>
- <up-input
- v-model="selectedUserName"
- placeholder="璇烽�夋嫨娲惧伐浜�"
- readonly
- @click="showUserPicker = true"
- suffixIcon="arrow-down"
- />
- </up-form-item>
- <up-form-item label="娲惧伐鏃ユ湡" prop="schedulingDate" required>
- <up-input
- v-model="form.schedulingDate"
- placeholder="璇烽�夋嫨娲惧伐鏃ユ湡"
- readonly
- @click="showDatePicker = true"
- suffixIcon="calendar"
- />
- </up-form-item>
- </view>
- </up-form>
- </view>
-
- <!-- 搴曢儴鎸夐挳 -->
- <view class="modal-footer">
- <up-button
- @click="handleClose"
- text="鍙栨秷"
- type="info"
- plain
- :customStyle="{ marginRight: '12px', flex: 1 }"
- />
- <up-button
- @click="handleConfirm"
- text="纭娲惧伐"
- type="primary"
- :customStyle="{ flex: 1 }"
- :loading="submitting"
- />
- </view>
- </view>
-
- <!-- 浜哄憳閫夋嫨鍣� -->
- <up-picker
- v-model="showUserPicker"
- :columns="userColumns"
- @confirm="handleUserSelect"
- @cancel="showUserPicker = false"
- />
-
- <!-- 鏃ユ湡閫夋嫨鍣� -->
- <up-datetime-picker
- v-model="showDatePicker"
- mode="date"
- @confirm="handleDateSelect"
- @cancel="showDatePicker = false"
- />
- </up-popup>
+ <up-popup v-model:show="show"
+ mode="bottom"
+ :round="20"
+ :safeAreaInsetBottom="true"
+ @close="handleClose"
+ @open="handleOpen">
+ <view class="dispatch-modal">
+ <!-- 澶撮儴 -->
+ <view class="modal-header">
+ <text class="modal-title">鐢熶骇娲惧伐</text>
+ <view class="close-btn"
+ @click="handleClose">
+ <up-icon name="close"
+ size="20"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ <!-- 琛ㄥ崟鍐呭 -->
+ <view class="modal-content">
+ <up-form :model="form"
+ ref="formRef"
+ :rules="rules"
+ labelWidth="120">
+ <!-- 椤圭洰鍩烘湰淇℃伅 -->
+ <view class="form-section">
+ <text class="section-title">椤圭洰淇℃伅</text>
+ <up-form-item label="椤圭洰鍚嶇О"
+ prop="projectName">
+ <up-input v-model="form.projectName"
+ disabled
+ placeholder="椤圭洰鍚嶇О" />
+ </up-form-item>
+ <up-form-item label="浜у搧澶х被"
+ prop="productCategory">
+ <up-input v-model="form.productCategory"
+ disabled
+ placeholder="浜у搧澶х被" />
+ </up-form-item>
+ </view>
+ <!-- 鏁伴噺淇℃伅 -->
+ <view class="form-section">
+ <text class="section-title">鏁伴噺淇℃伅</text>
+ <up-form-item label="鎬绘暟閲�"
+ prop="quantity">
+ <up-input v-model="form.quantity"
+ disabled
+ placeholder="鎬绘暟閲�" />
+ </up-form-item>
+ <up-form-item label="寰呮帓浜ф暟閲�"
+ prop="pendingQuantity">
+ <up-input v-model="form.pendingQuantity"
+ disabled
+ placeholder="寰呮帓浜ф暟閲�" />
+ </up-form-item>
+ <up-form-item label="鏈鎺掍骇鏁伴噺"
+ prop="schedulingNum"
+ required>
+ <up-number-box v-model="form.schedulingNum"
+ :min="0"
+ :max="form.pendingQuantity"
+ :step="0.1"
+ :precision="2"
+ @change="handleNumChange" />
+ </up-form-item>
+ </view>
+ <!-- 娲惧伐淇℃伅 -->
+ <view class="form-section">
+ <text class="section-title">娲惧伐淇℃伅</text>
+ <up-form-item label="娲惧伐浜�"
+ prop="schedulingUserId"
+ required>
+ <up-input v-model="selectedUserName"
+ placeholder="璇烽�夋嫨娲惧伐浜�"
+ readonly
+ @click="showUserPicker = true"
+ suffixIcon="arrow-down" />
+ </up-form-item>
+ <up-form-item label="娲惧伐鏃ユ湡"
+ prop="schedulingDate"
+ required>
+ <up-input v-model="form.schedulingDate"
+ placeholder="璇烽�夋嫨娲惧伐鏃ユ湡"
+ readonly
+ @click="showDatePicker = true"
+ suffixIcon="calendar" />
+ </up-form-item>
+ </view>
+ </up-form>
+ </view>
+ <!-- 搴曢儴鎸夐挳 -->
+ <view class="modal-footer">
+ <up-button @click="handleClose"
+ text="鍙栨秷"
+ type="info"
+ plain
+ :customStyle="{ marginRight: '12px', flex: 1 }" />
+ <up-button @click="handleConfirm"
+ text="纭娲惧伐"
+ type="primary"
+ :customStyle="{ flex: 1 }"
+ :loading="submitting" />
+ </view>
+ </view>
+ <!-- 浜哄憳閫夋嫨鍣� -->
+ <up-picker v-model="showUserPicker"
+ :columns="userColumns"
+ @confirm="handleUserSelect"
+ @cancel="showUserPicker = false" />
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-datetime-picker v-model="showDatePicker"
+ mode="date"
+ @confirm="handleDateSelect"
+ @cancel="showDatePicker = false" />
+ </up-popup>
</template>
<script setup>
-import { ref, reactive, computed, getCurrentInstance } from 'vue';
-import { userListNoPageByTenantId } from "@/api/system/user.js";
-import { productionDispatch } from "@/api/productionManagement/productionOrder.js";
-import useUserStore from "@/store/modules/user";
-import dayjs from "dayjs";
+ import { ref, reactive, computed, getCurrentInstance } from "vue";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ // import { productionDispatch } from "@/api/productionManagement/productionOrder.js";
+ import useUserStore from "@/store/modules/user";
+ import dayjs from "dayjs";
-const { proxy } = getCurrentInstance();
-const userStore = useUserStore();
-const emit = defineEmits(['confirm']);
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ const emit = defineEmits(["confirm"]);
-// 寮圭獥鏄剧ず鐘舵��
-const show = ref(false);
-const submitting = ref(false);
+ // 寮圭獥鏄剧ず鐘舵��
+ const show = ref(false);
+ const submitting = ref(false);
-// 閫夋嫨鍣ㄦ樉绀虹姸鎬�
-const showUserPicker = ref(false);
-const showDatePicker = ref(false);
+ // 閫夋嫨鍣ㄦ樉绀虹姸鎬�
+ const showUserPicker = ref(false);
+ const showDatePicker = ref(false);
-// 鐢ㄦ埛鍒楄〃
-const userList = ref([]);
-const userColumns = computed(() => [
- userList.value.map(user => ({
- label: user.nickName,
- value: user.userId
- }))
-]);
+ // 鐢ㄦ埛鍒楄〃
+ const userList = ref([]);
+ const userColumns = computed(() => [
+ userList.value.map(user => ({
+ label: user.nickName,
+ value: user.userId,
+ })),
+ ]);
-// 閫変腑鐨勭敤鎴峰悕绉帮紙鐢ㄤ簬鏄剧ず锛�
-const selectedUserName = computed(() => {
- const user = userList.value.find(u => u.userId === form.schedulingUserId);
- return user ? user.nickName : '';
-});
+ // 閫変腑鐨勭敤鎴峰悕绉帮紙鐢ㄤ簬鏄剧ず锛�
+ const selectedUserName = computed(() => {
+ const user = userList.value.find(u => u.userId === form.schedulingUserId);
+ return user ? user.nickName : "";
+ });
-// 琛ㄥ崟鏁版嵁
-const form = reactive({
- projectName: "",
- productCategory: "",
- quantity: "",
- schedulingNum: 0,
- schedulingUserId: "",
- schedulingDate: "",
- pendingQuantity: 0,
- id: "" // 鍘熷璁板綍ID
-});
+ // 琛ㄥ崟鏁版嵁
+ const form = reactive({
+ projectName: "",
+ productCategory: "",
+ quantity: "",
+ schedulingNum: 0,
+ schedulingUserId: "",
+ schedulingDate: "",
+ pendingQuantity: 0,
+ id: "", // 鍘熷璁板綍ID
+ });
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const rules = reactive({
- schedulingNum: [
- { required: true, message: "璇疯緭鍏ユ帓浜ф暟閲�", trigger: "blur" }
- ],
- schedulingUserId: [
- { required: true, message: "璇烽�夋嫨娲惧伐浜�", trigger: "change" }
- ],
- schedulingDate: [
- { required: true, message: "璇烽�夋嫨娲惧伐鏃ユ湡", trigger: "change" }
- ]
-});
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = reactive({
+ schedulingNum: [
+ { required: true, message: "璇疯緭鍏ユ帓浜ф暟閲�", trigger: "blur" },
+ ],
+ schedulingUserId: [
+ { required: true, message: "璇烽�夋嫨娲惧伐浜�", trigger: "change" },
+ ],
+ schedulingDate: [
+ { required: true, message: "璇烽�夋嫨娲惧伐鏃ユ湡", trigger: "change" },
+ ],
+ });
-// 琛ㄥ崟寮曠敤
-const formRef = ref();
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref();
-// 鎵撳紑寮圭獥
-const open = async (rowData) => {
- try {
- // 鍔犺浇鐢ㄦ埛鍒楄〃
- const res = await userListNoPageByTenantId();
- userList.value = res.data || [];
-
- // 濉厖琛ㄥ崟鏁版嵁
- Object.assign(form, {
- ...rowData,
- schedulingNum: 0,
- schedulingUserId: userStore.id,
- schedulingDate: dayjs().format("YYYY-MM-DD")
- });
-
- show.value = true;
- } catch (error) {
- uni.showToast({
- title: '鍔犺浇鐢ㄦ埛鍒楄〃澶辫触',
- icon: 'error'
- });
- }
-};
+ // 鎵撳紑寮圭獥
+ const open = async rowData => {
+ try {
+ // 鍔犺浇鐢ㄦ埛鍒楄〃
+ const res = await userListNoPageByTenantId();
+ userList.value = res.data || [];
-// 澶勭悊鏁伴噺鍙樺寲
-const handleNumChange = (value) => {
- if (value > form.pendingQuantity) {
- form.schedulingNum = form.pendingQuantity;
- uni.showToast({
- title: '鎺掍骇鏁伴噺涓嶅彲澶т簬寰呮帓浜ф暟閲�',
- icon: 'none'
- });
- }
-};
+ // 濉厖琛ㄥ崟鏁版嵁
+ Object.assign(form, {
+ ...rowData,
+ schedulingNum: 0,
+ schedulingUserId: userStore.id,
+ schedulingDate: dayjs().format("YYYY-MM-DD"),
+ });
-// 澶勭悊鐢ㄦ埛閫夋嫨
-const handleUserSelect = (params) => {
- if (params.value && params.value.length > 0) {
- form.schedulingUserId = params.value[0];
- }
- showUserPicker.value = false;
-};
+ show.value = true;
+ } catch (error) {
+ uni.showToast({
+ title: "鍔犺浇鐢ㄦ埛鍒楄〃澶辫触",
+ icon: "error",
+ });
+ }
+ };
-// 澶勭悊鏃ユ湡閫夋嫨
-const handleDateSelect = (params) => {
- if (params.value) {
- form.schedulingDate = dayjs(params.value).format("YYYY-MM-DD");
- }
- showDatePicker.value = false;
-};
+ // 澶勭悊鏁伴噺鍙樺寲
+ const handleNumChange = value => {
+ if (value > form.pendingQuantity) {
+ form.schedulingNum = form.pendingQuantity;
+ uni.showToast({
+ title: "鎺掍骇鏁伴噺涓嶅彲澶т簬寰呮帓浜ф暟閲�",
+ icon: "none",
+ });
+ }
+ };
-// 纭娲惧伐
-const handleConfirm = async () => {
- try {
- // 琛ㄥ崟楠岃瘉
- const valid = await formRef.value?.validate();
- if (!valid) return;
-
- if (form.schedulingNum <= 0) {
- uni.showToast({
- title: '鎺掍骇鏁伴噺蹇呴』澶т簬0',
- icon: 'none'
- });
- return;
- }
-
- submitting.value = true;
-
- // 鎻愪氦娲惧伐鏁版嵁
- await productionDispatch(form);
-
- uni.showToast({
- title: '娲惧伐鎴愬姛',
- icon: 'success'
- });
-
- handleClose();
- emit('confirm');
-
- } catch (error) {
- uni.showToast({
- title: '娲惧伐澶辫触',
- icon: 'error'
- });
- } finally {
- submitting.value = false;
- }
-};
+ // 澶勭悊鐢ㄦ埛閫夋嫨
+ const handleUserSelect = params => {
+ if (params.value && params.value.length > 0) {
+ form.schedulingUserId = params.value[0];
+ }
+ showUserPicker.value = false;
+ };
-// 寮圭獥鎵撳紑浜嬩欢
-const handleOpen = () => {
- // 寮圭獥鎵撳紑鏃剁殑澶勭悊
-};
+ // 澶勭悊鏃ユ湡閫夋嫨
+ const handleDateSelect = params => {
+ if (params.value) {
+ form.schedulingDate = dayjs(params.value).format("YYYY-MM-DD");
+ }
+ showDatePicker.value = false;
+ };
-// 鍏抽棴寮圭獥
-const handleClose = () => {
- show.value = false;
- showUserPicker.value = false;
- showDatePicker.value = false;
-
- // 閲嶇疆琛ㄥ崟
- Object.assign(form, {
- projectName: "",
- productCategory: "",
- quantity: "",
- schedulingNum: 0,
- schedulingUserId: "",
- schedulingDate: "",
- pendingQuantity: 0,
- id: ""
- });
-};
+ // 纭娲惧伐
+ const handleConfirm = async () => {
+ try {
+ // 琛ㄥ崟楠岃瘉
+ const valid = await formRef.value?.validate();
+ if (!valid) return;
-// 鏆撮湶鏂规硶
-defineExpose({
- open
-});
+ if (form.schedulingNum <= 0) {
+ uni.showToast({
+ title: "鎺掍骇鏁伴噺蹇呴』澶т簬0",
+ icon: "none",
+ });
+ return;
+ }
+
+ submitting.value = true;
+
+ // 鎻愪氦娲惧伐鏁版嵁
+ // await productionDispatch(form);
+
+ uni.showToast({
+ title: "娲惧伐鎴愬姛",
+ icon: "success",
+ });
+
+ handleClose();
+ emit("confirm");
+ } catch (error) {
+ uni.showToast({
+ title: "娲惧伐澶辫触",
+ icon: "error",
+ });
+ } finally {
+ submitting.value = false;
+ }
+ };
+
+ // 寮圭獥鎵撳紑浜嬩欢
+ const handleOpen = () => {
+ // 寮圭獥鎵撳紑鏃剁殑澶勭悊
+ };
+
+ // 鍏抽棴寮圭獥
+ const handleClose = () => {
+ show.value = false;
+ showUserPicker.value = false;
+ showDatePicker.value = false;
+
+ // 閲嶇疆琛ㄥ崟
+ Object.assign(form, {
+ projectName: "",
+ productCategory: "",
+ quantity: "",
+ schedulingNum: 0,
+ schedulingUserId: "",
+ schedulingDate: "",
+ pendingQuantity: 0,
+ id: "",
+ });
+ };
+
+ // 鏆撮湶鏂规硶
+ defineExpose({
+ open,
+ });
</script>
<style scoped lang="scss">
-.dispatch-modal {
- background: #ffffff;
- border-radius: 20px 20px 0 0;
- max-height: 80vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
-}
+ .dispatch-modal {
+ background: #ffffff;
+ border-radius: 20px 20px 0 0;
+ max-height: 80vh;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ }
-.modal-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 20px 20px 0 20px;
- border-bottom: 1px solid #f0f0f0;
- padding-bottom: 16px;
- margin-bottom: 20px;
-}
+ .modal-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 20px 20px 0 20px;
+ border-bottom: 1px solid #f0f0f0;
+ padding-bottom: 16px;
+ margin-bottom: 20px;
+ }
-.modal-title {
- font-size: 18px;
- font-weight: 600;
- color: #333;
-}
+ .modal-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #333;
+ }
-.close-btn {
- padding: 4px;
-
- &:active {
- opacity: 0.7;
- }
-}
+ .close-btn {
+ padding: 4px;
-.modal-content {
- flex: 1;
- padding: 0 20px;
- overflow-y: auto;
-}
+ &:active {
+ opacity: 0.7;
+ }
+ }
-.form-section {
- margin-bottom: 24px;
-}
+ .modal-content {
+ flex: 1;
+ padding: 0 20px;
+ overflow-y: auto;
+ }
-.section-title {
- display: block;
- font-size: 16px;
- font-weight: 600;
- color: #333;
- margin-bottom: 16px;
- padding-left: 8px;
- border-left: 3px solid #2979ff;
-}
+ .form-section {
+ margin-bottom: 24px;
+ }
-.modal-footer {
- display: flex;
- gap: 12px;
- padding: 20px;
- border-top: 1px solid #f0f0f0;
- background: #fafafa;
-}
+ .section-title {
+ display: block;
+ font-size: 16px;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 16px;
+ padding-left: 8px;
+ border-left: 3px solid #2979ff;
+ }
-// uView 缁勪欢鏍峰紡璋冩暣
-:deep(.up-form-item) {
- margin-bottom: 20px;
-}
+ .modal-footer {
+ display: flex;
+ gap: 12px;
+ padding: 20px;
+ border-top: 1px solid #f0f0f0;
+ background: #fafafa;
+ }
-:deep(.up-input) {
- background: #f8f9fa;
- border-radius: 8px;
-}
+ // uView 缁勪欢鏍峰紡璋冩暣
+ :deep(.up-form-item) {
+ margin-bottom: 20px;
+ }
-:deep(.up-input--disabled) {
- background: #f0f0f0;
- color: #999;
-}
+ :deep(.up-input) {
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
-:deep(.up-number-box) {
- background: #f8f9fa;
- border-radius: 8px;
-}
+ :deep(.up-input--disabled) {
+ background: #f0f0f0;
+ color: #999;
+ }
+
+ :deep(.up-number-box) {
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
</style>
--
Gitblit v1.9.3