From 583b80a582f9280a262ee72506d31d1bfa46f734 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 10 十二月 2025 11:29:57 +0800
Subject: [PATCH] 补交
---
north-glass-erp/northglass-erp/src/components/sd/order/ProcessAttribute.vue | 213 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 213 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/ProcessAttribute.vue b/north-glass-erp/northglass-erp/src/components/sd/order/ProcessAttribute.vue
new file mode 100644
index 0000000..c8402bf
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/ProcessAttribute.vue
@@ -0,0 +1,213 @@
+<template>
+
+ <div style="width: 100%">
+ <template v-for="(itme, index) in dataCollection" :key="index">
+ <el-card style="width: 95%;height: 120px;margin: auto">
+
+ <div style="width: 200px;font-size: 18px;text-align: left;">{{itme.process_name}}</div>
+ <div style="display: flex;margin-top: 10px">
+ <template v-for="(itme1, index) in itme.detail" :key="index">
+ <div v-if="itme1.input_type=='select'"
+ style="width: 200px;display: flex;height: 30px;line-height: 30px;">
+ {{itme1.process_name}}锛�
+ <el-select
+ v-model="dataList[itme.process_type][itme1.process_type]"
+ placeholder=""
+ clearable
+ filterable
+ style="width: 120px"
+ >
+ <el-option
+ v-for="item in edgingTypeList[itme1.process_type]"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </div>
+ <div v-else-if="itme1.input_type=='checkbox'"
+ style="width: 100px;height: 30px;line-height: 30px;">
+ {{itme1.process_name}}锛�<el-checkbox v-model="dataList.edgingProcess[itme1.process_type]"></el-checkbox>
+ </div>
+ <div v-else-if="itme1.input_type=='input'"
+ style="width: 200px;display: flex;height: 30px;line-height: 30px;">
+ {{itme1.process_name}}锛�<el-input style="width:100px" v-model.trim="dataList.edgingProcess[itme1.process_type]"></el-input>
+ </div>
+ </template>
+ </div>
+ </el-card>
+ <br>
+ </template>
+
+
+ <div style="margin-top: 10px">
+ <el-button @click="emitParent()" style="width: 80px;height: 30px" type="primary" size="small">淇濆瓨</el-button>
+ </div>
+
+ </div>
+
+
+</template>
+
+<script lang="ts" setup>
+
+import { useI18n } from 'vue-i18n'
+import { ref, reactive, onMounted } from 'vue'
+import {ElMessage} from "element-plus";
+import request from "@/utils/request"
+
+const { t } = useI18n()
+
+
+let props = defineProps({
+ rowIndex:{},
+ edgingTypeList: null
+})
+
+let dataCollection=ref()
+const edgingTypeList = ref({
+
+})
+
+const initOrder = async () => {
+ try {
+ // 鍏抽敭锛歛wait 鐪熸绛夊緟鎺ュ彛鍝嶅簲锛屽搷搴斿畬鎴愬悗鍐嶅線涓嬫墽琛�
+ const res = await request.post("/order/processAttributeConfig");
+ if (res.code === "200") {
+ dataCollection.value = res.data.data || [];
+
+ // 閬嶅巻 dataCollection 鍒濆鍖� dataList 鍜� edgingTypeList
+ dataCollection.value.forEach(items => {
+ if (!items || !Array.isArray(items.detail) || items.detail.length === 0) {
+ return;
+ }
+
+ // 淇2锛歞ataList 鏄璞★紝鍒濆鍖栧伐鑹虹被鍨嬪搴旂殑瀛楁锛堣嫢闇�瑕佸祵濂楃粨鏋勫彲璋冩暣锛�
+ // 鑻ラ渶 dataList.value[items.process_type] 鏄璞★紙瀛樺偍璇ュ伐鑹虹被鍨嬬殑鎵�鏈夊睘鎬э級
+ console.log(dataList.value[items.process_type])
+ console.log(items.process_type)
+ if (!dataList.value[items.process_type]) {
+ dataList.value[items.process_type] = {}; // 鍒濆鍖栧璞★紝鑰岄潪鏁扮粍
+ }
+
+
+
+ // 閬嶅巻宸ヨ壓璇︽儏
+ items.detail.forEach(item1 => {
+ // 鍒濆鍖栬宸ヨ壓椤圭殑榛樿鍊硷紙鏍规嵁 input_type 璋冩暣锛岃繖閲屼繚鎸佺敤鎴峰師閫昏緫璁句负 null锛�
+ dataList.value[items.process_type][item1.process_type] = null;
+
+ // 澶勭悊 select 绫诲瀷锛屾瀯寤轰笅鎷夐�夐」
+ if (item1.input_type === 'select') {
+ const baseOptions = props.edgingTypeList[item1.process_type];
+ if (!Array.isArray(baseOptions) || baseOptions.length === 0) {
+ console.warn(`宸ヨ壓绫诲瀷 ${item1.process_type} 鏃犲熀纭�鏁版嵁锛岃烦杩嘸);
+ return;
+ }
+
+ // 鍒濆鍖� edgingTypeList 瀵瑰簲瀛楁涓烘暟缁�
+ if (!Array.isArray(edgingTypeList.value[item1.process_type])) {
+ edgingTypeList.value[item1.process_type] = [];
+ }
+
+ // 涓嬫媺閫夐」鍘婚噸骞舵坊鍔�
+ baseOptions.forEach(item => {
+ const newOption = { label: item.basicName, value: item.basicName };
+ const isAlreadyExist = edgingTypeList.value[item1.process_type].some(
+ opt => opt.value === newOption.value
+ );
+ if (!isAlreadyExist) {
+ edgingTypeList.value[item1.process_type].push(newOption);
+ }
+ });
+ }
+ });
+ });
+
+
+ } else {
+ ElMessage.warning(t('basicData.msg.getDataFailed'));
+ dataCollection.value = [];
+ }
+ } catch (err) {
+ ElMessage.error(t('basicData.msg.ServerConnectionError'));
+ router.push("/login");
+ throw err; // 鎶涘嚭閿欒锛岃 onMounted 鐭ラ亾鎵ц澶辫触
+ }
+};
+
+onMounted(async () => {
+
+ await initOrder();
+
+
+ const { processAttribute } = props.rowIndex; // 瑙f瀯璧嬪�硷紝鏇寸畝娲�
+ if (!processAttribute || processAttribute === "") {
+ console.log('processAttribute 涓虹┖锛岃烦杩囪祴鍊�');
+ return;
+ }
+
+ // 瑙f瀽 processAttribute锛堝鐢ㄧ敤鎴峰師閫昏緫锛屼紭鍖栧彉閲忓悕鍜屼唬鐮侊級
+ let newProcessAttr;
+ if (processAttribute === null || processAttribute === undefined) {
+ newProcessAttr = {};
+ } else if (typeof processAttribute === 'object') {
+ newProcessAttr = processAttribute;
+ } else if (typeof processAttribute === 'string') {
+ try {
+ newProcessAttr = JSON.parse(processAttribute);
+ } catch (error) {
+ console.warn('processAttribute 鏄瓧绗︿覆浣嗛潪鍚堟硶 JSON锛屽凡浣跨敤榛樿鍊硷細', error.message);
+ newProcessAttr = {};
+ }
+ } else {
+ console.warn('processAttribute 绫诲瀷涓嶅悎娉曪紝宸蹭娇鐢ㄩ粯璁ゅ�硷細', typeof processAttribute);
+ newProcessAttr = {};
+ }
+
+ // 閬嶅巻瑙f瀽鍚庣殑鏁版嵁锛岀粰 dataList 璧嬪�硷紙閫傞厤 dataList 鐨勫璞$粨鏋勶級
+ Object.entries(newProcessAttr).forEach(([key, value]) => {
+ dataList.value[key] = {};
+ if (typeof value === "object" && value !== null) {
+ Object.entries(value).forEach(([innerKey, innerValue]) => {
+ if (dataList.value[key]) {
+ dataList.value[key][innerKey] = innerValue;
+ }
+ });
+ }
+ });
+ console.log(dataList.value)
+
+});
+
+let dataList=ref({})
+
+
+let emit = defineEmits([
+ 'changePage'
+])
+const emitParent = () => {
+ if(dataList.value.edgingProcess.edgingType!=null){
+ emit('getEdgingProcess', dataList.value,dataList.value.edgingProcess.edgingType)
+ }else{
+ ElMessage.error(t('璇烽�夋嫨纾ㄨ竟绫诲瀷'))
+ }
+
+}
+
+</script>
+
+<style scoped>
+:deep(.el-select .el-input__wrapper) {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+:deep(.el-dialog__body) {
+ padding: 20px;
+}
+
+:deep(.el-dialog__footer) {
+ padding: 10px 20px 20px;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.8.0