From a9d97b150701e634bdb751eab277696abd136cca Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 六月 2026 14:39:47 +0800
Subject: [PATCH] 君歌app 1.依照web端功能修改
---
src/pages/productionDesign/processManagement/edit.vue | 287 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 287 insertions(+), 0 deletions(-)
diff --git a/src/pages/productionDesign/processManagement/edit.vue b/src/pages/productionDesign/processManagement/edit.vue
new file mode 100644
index 0000000..c3eaac4
--- /dev/null
+++ b/src/pages/productionDesign/processManagement/edit.vue
@@ -0,0 +1,287 @@
+<template>
+ <view class="process-edit">
+ <PageHeader :title="pageTitle"
+ @back="goBack" />
+ <up-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ :errorType="['none']"
+ label-width="130">
+ <up-form-item label="閮ㄤ欢"
+ prop="name"
+ required>
+ <up-input v-model="form.name"
+ placeholder="璇疯緭鍏ラ儴浠�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="宸ュ簭缂栧彿"
+ prop="no">
+ <up-input v-model="form.no"
+ placeholder="璇疯緭鍏ュ伐搴忕紪鍙�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="宸ュ簭绫诲瀷"
+ prop="processType"
+ required>
+ <up-input v-model="processTypeText"
+ placeholder="璇烽�夋嫨宸ュ簭绫诲瀷"
+ readonly
+ @click="showProcessTypeSheet = true" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showProcessTypeSheet = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="璁″垝宸ユ椂(灏忔椂)"
+ prop="salaryQuota">
+ <up-input v-model="form.salaryQuota"
+ type="number"
+ placeholder="璇疯緭鍏ヨ鍒掑伐鏃�"
+ clearable />
+ </up-form-item>
+ <up-form-item label="璁″垝浜哄憳"
+ prop="planPerson">
+ <up-input v-model="planPersonText"
+ placeholder="璇烽�夋嫨璁″垝浜哄憳"
+ readonly
+ @click="showPlanPersonSheet = true" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showPlanPersonSheet = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="璁″垝鎵ц浜哄憳"
+ prop="executor">
+ <up-input v-model="executorText"
+ placeholder="璇烽�夋嫨璁″垝鎵ц浜哄憳"
+ readonly
+ @click="showExecutorSheet = true" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showExecutorSheet = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="鏄惁璐ㄦ"
+ prop="isQuality">
+ <view style="display: flex; justify-content: flex-end; width: 100%;">
+ <up-switch v-model="form.isQuality" />
+ </view>
+ </up-form-item>
+ <up-form-item label="鏄惁鍏ュ簱"
+ prop="inbound">
+ <view style="display: flex; justify-content: flex-end; width: 100%;">
+ <up-switch v-model="form.inbound" />
+ </view>
+ </up-form-item>
+ <up-form-item label="鏄惁鎶ュ伐"
+ prop="reportWork">
+ <view style="display: flex; justify-content: flex-end; width: 100%;">
+ <up-switch v-model="form.reportWork" />
+ </view>
+ </up-form-item>
+ <up-form-item label="澶囨敞"
+ prop="remark">
+ <up-textarea v-model="form.remark"
+ placeholder="璇疯緭鍏ュ娉�"
+ autoHeight />
+ </up-form-item>
+ </up-form>
+ <FooterButtons :loading="loading"
+ :confirmText="processId ? '淇濆瓨' : '鏂板'"
+ @cancel="goBack"
+ @confirm="handleSubmit" />
+ <!-- 宸ュ簭绫诲瀷閫夋嫨 -->
+ <up-action-sheet :show="showProcessTypeSheet"
+ title="閫夋嫨宸ュ簭绫诲瀷"
+ :actions="processTypeActions"
+ @select="onSelectProcessType"
+ @close="showProcessTypeSheet = false" />
+ <!-- 璁″垝浜哄憳閫夋嫨 -->
+ <up-action-sheet :show="showPlanPersonSheet"
+ title="閫夋嫨璁″垝浜哄憳"
+ :actions="employeeActions"
+ @select="onSelectPlanPerson"
+ @close="showPlanPersonSheet = false" />
+ <!-- 璁″垝鎵ц浜哄憳閫夋嫨 -->
+ <up-action-sheet :show="showExecutorSheet"
+ title="閫夋嫨璁″垝鎵ц浜哄憳"
+ :actions="employeeActions"
+ @select="onSelectExecutor"
+ @close="showExecutorSheet = false" />
+ </view>
+</template>
+
+<script setup>
+ import { reactive, ref, computed, onMounted } from "vue";
+ import { onLoad, onReady } from "@dcloudio/uni-app";
+ import FooterButtons from "@/components/FooterButtons.vue";
+ import { add, update } from "@/api/productionManagement/processManagement";
+ import { staffOnJobListPage } from "@/api/personnelManagement/onboarding";
+
+ const formRef = ref(null);
+ const loading = ref(false);
+ const processId = ref(null);
+ const pageTitle = computed(() => (processId.value ? "缂栬緫宸ュ簭" : "鏂板宸ュ簭"));
+
+ const processTypeOptions = [
+ "鏈哄姞宸�",
+ "鍒澘鍐疯姱鍒朵綔",
+ "绠¤矾缁勫",
+ "缃愪綋杩炴帴鍙婅皟璇�",
+ "娴嬭瘯鎵撳帇",
+ "鍏朵粬",
+ ];
+
+ const employeeList = ref([]);
+
+ const form = ref({
+ no: "",
+ name: "",
+ processType: "",
+ salaryQuota: "",
+ planPerson: null,
+ executor: null,
+ isQuality: false,
+ inbound: false,
+ reportWork: false,
+ remark: "",
+ });
+
+ const rules = {
+ name: [
+ { required: true, message: "璇疯緭鍏ラ儴浠�" },
+ { max: 100, message: "鏈�澶�100涓瓧绗�" },
+ ],
+ processType: [{ required: true, message: "璇烽�夋嫨宸ュ簭绫诲瀷" }],
+ salaryQuota: [
+ {
+ validator: (rule, value, callback) => {
+ if (value !== "" && value !== null && (isNaN(value) || value < 0)) {
+ callback(new Error("璁″垝宸ユ椂蹇呴』鏄潪璐熸暟瀛�"));
+ } else {
+ callback();
+ }
+ },
+ },
+ ],
+ };
+
+ const showProcessTypeSheet = ref(false);
+ const processTypeActions = processTypeOptions.map(item => ({ name: item, value: item }));
+ const processTypeText = ref("");
+
+ const showPlanPersonSheet = ref(false);
+ const showExecutorSheet = ref(false);
+ const planPersonText = ref("");
+ const executorText = ref("");
+
+ const employeeActions = computed(() =>
+ employeeList.value.map(item => ({
+ name: item.staffName,
+ id: item.id,
+ }))
+ );
+
+ const onSelectProcessType = e => {
+ form.value.processType = e.value;
+ processTypeText.value = e.name;
+ showProcessTypeSheet.value = false;
+ };
+
+ const onSelectPlanPerson = e => {
+ form.value.planPerson = e.id;
+ planPersonText.value = e.name;
+ showPlanPersonSheet.value = false;
+ };
+
+ const onSelectExecutor = e => {
+ form.value.executor = e.id;
+ executorText.value = e.name;
+ showExecutorSheet.value = false;
+ };
+
+ const loadEmployees = async () => {
+ try {
+ const res = await staffOnJobListPage({ current: -1, size: -1, staffState: 1 });
+ employeeList.value = res.data?.records || [];
+ } catch (error) {
+ console.error("鍔犺浇鍛樺伐鍒楄〃澶辫触", error);
+ }
+ };
+
+ const resolveDisplayTexts = () => {
+ if (form.value.processType) {
+ processTypeText.value = form.value.processType;
+ }
+ if (form.value.planPerson) {
+ const emp = employeeList.value.find(e => e.id === form.value.planPerson);
+ if (emp) planPersonText.value = emp.staffName;
+ }
+ if (form.value.executor) {
+ const emp = employeeList.value.find(e => e.id === form.value.executor);
+ if (emp) executorText.value = emp.staffName;
+ }
+ };
+
+ const goBack = () => {
+ uni.navigateBack();
+ };
+
+ const handleSubmit = () => {
+ formRef.value
+ .validate()
+ .then(() => {
+ loading.value = true;
+ const promise = processId.value ? update(form.value) : add(form.value);
+ promise
+ .then(() => {
+ uni.showToast({ title: processId.value ? "淇濆瓨鎴愬姛" : "鏂板鎴愬姛" });
+ setTimeout(() => {
+ goBack();
+ }, 1500);
+ })
+ .catch(err => {
+ uni.showToast({ title: err.msg || "鎻愪氦澶辫触", icon: "error" });
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+ })
+ .catch(errors => {
+ if (errors && errors.length > 0) {
+ uni.showToast({
+ title: errors[0].message,
+ icon: "none",
+ });
+ }
+ });
+ };
+
+ onLoad(option => {
+ if (option.item) {
+ const item = JSON.parse(decodeURIComponent(option.item));
+ processId.value = item.id;
+ Object.assign(form.value, item);
+ form.value.isQuality = !!form.value.isQuality;
+ form.value.inbound = !!form.value.inbound;
+ form.value.reportWork = !!form.value.reportWork;
+ }
+ });
+
+ onReady(() => {
+ formRef.value.setRules(rules);
+ });
+
+ onMounted(() => {
+ loadEmployees().then(() => resolveDisplayTexts());
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/static/scss/form-common.scss";
+
+ .process-edit {
+ min-height: 100vh;
+ background: #f5f5f5;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3