| | |
| | | customerName: '', |
| | | //项目名称 |
| | | project: '', |
| | | //批次 |
| | | batch:'', |
| | | }, |
| | | flowCard: { |
| | | //可报工数量 |
| | |
| | | done() |
| | | } |
| | | |
| | | const parseProcessData = (rawData) => { |
| | | if (!rawData) return [] // 空值返回空数组 |
| | | |
| | | // 步骤1:先转为字符串并去除首尾多余的引号(处理后端返回的 "\"[\"磨边\",\"打孔\"]\"" 情况) |
| | | let str = String(rawData).trim() |
| | | if (str.startsWith('"') && str.endsWith('"')) { |
| | | str = str.slice(1, -1) // 去掉首尾的引号 |
| | | } |
| | | |
| | | // 步骤2:解析JSON字符串为数组 |
| | | try { |
| | | const arr = JSON.parse(str) |
| | | // 确保解析后是数组,且元素去空格 |
| | | return Array.isArray(arr) ? arr.map(item => item.trim()) : [] |
| | | } catch (e) { |
| | | // 解析失败时,降级处理(按逗号分割) |
| | | console.warn('工序数据解析失败,降级处理:', e) |
| | | return str.split(',').filter(item => item.trim()) |
| | | } |
| | | } |
| | | |
| | | const currentProcessOptions = ref([]) |
| | | //第一次加载数据 |
| | | let groupChangeProcess = ref(false)//用于本班组显示问题 |
| | | const initTiltle = async () => { |
| | |
| | | if (res.code == 200) { |
| | | titleSelectJson.value.processType = res.data.process |
| | | processName = res.data.processNameList |
| | | |
| | | if(user.user.address!==null && user.user.address!==''){ |
| | | titleUploadData.value.thisProcess = user.user.address |
| | | user.user.address=parseProcessData(user.user.address) |
| | | titleUploadData.value.thisProcess = user.user.address[0] // 数组取第一个作为默认值(可选) |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | groupChangeProcess.value = true |
| | | currentProcessOptions.value = user.user.address.map((name, index) => ({ |
| | | id: `user_process_${index}`, |
| | | basic_name: name, |
| | | basic_type: 'process', |
| | | basic_category: index + 1 |
| | | })); |
| | | |
| | | if (user.user.address==='技术部多曲' || user.user.address==='夹胶'){ |
| | | groupChangeProcess.value = false |
| | | currentProcessOptions.value = titleSelectJson.value.processType |
| | | } |
| | | gridOptions.toolbarConfig.buttons[1].visible=false |
| | | }else { |
| | | currentProcessOptions.value = titleSelectJson.value.processType // 无默认值显示全部 |
| | | } |
| | | |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const filterCurrentProcessOptions = () => { |
| | | // ======== 核心修改开始 ======== |
| | | const userBelongProcess = user.user.address || []; |
| | | // 始终只显示员工所属工序(有值)或全部工序(无值) |
| | | if (userBelongProcess.length > 0) { |
| | | currentProcessOptions.value = user.user.address.map((name, index) => ({ |
| | | id: `user_process_${index}`, |
| | | basic_name: name, |
| | | basic_type: 'process', |
| | | basic_category: index + 1 |
| | | })); |
| | | } else { |
| | | currentProcessOptions.value = titleSelectJson.value.processType; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | titleUploadData.value.processId = processId |
| | | titleUploadData.value.teamsGroupsName = user.user.userName |
| | | titleUploadData.value.laminating = res.data.laminating |
| | | if(titleUploadData.value.order.batch!=null&&titleUploadData.value.order.batch!=""){ |
| | | titleUploadData.value.order.project=titleUploadData.value.order.project+'('+titleUploadData.value.order.batch+')' |
| | | } |
| | | |
| | | //设备下拉框 |
| | | titleSelectJson.value.deviceType = res.data.device |
| | | //班组下拉框 |
| | |
| | | }); |
| | | detail.value = modifiedCollection |
| | | xGrid.value.reloadData(detail.value) |
| | | |
| | | filterCurrentProcessOptions() |
| | | |
| | | hideButton() |
| | | // nextTick(() => { |
| | | // hiddenCompletedOk() |
| | |
| | | style="width: 120px" |
| | | @change="getWork();getQuantity()"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | | v-for="item in currentProcessOptions" |
| | | :key="item.id" |
| | | :label="item.basic_name" |
| | | :value="item.basic_name" |
| | |
| | | <el-text>{{$t('processCard.customerName')}}:</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-text class="customClass"></el-text> |
| | | <el-text class="customClass">{{ titleUploadData.order.customerName }}</el-text> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-text >{{$t('order.project')}}:</el-text> |
| | | <el-text >{{$t('order.project')}}({{$t('order.batch')}}):</el-text> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-input :readonly="true" v-model="titleUploadData.order.project"/> |