| | |
| | | <script setup> |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {nextTick, onMounted, reactive, ref, watch} from "vue"; |
| | | import {useI18n} from "vue-i18n"; |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElMessage} from "element-plus"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {changeFilterEvent, filterChanged} from "@/hook"; |
| | | |
| | | const {t} = useI18n() |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const username = userStore.user.userId |
| | | let rowClickIndex = ref(null) |
| | | |
| | | let props = defineProps({ |
| | |
| | | |
| | | |
| | | onMounted(() => { |
| | | console.log(userStore.user); |
| | | getProjectId(); |
| | | selectGlassType(); |
| | | |
| | | }) |
| | | |
| | | const xGrid = ref() |
| | | |
| | | // 添加监听器 - 监听膜系选择变化 |
| | | watch(optionVal, (newVal, oldVal) => { |
| | | if (oldVal !== undefined && newVal !== oldVal) { |
| | | // 当膜系改变时,自动刷新数据 |
| | | if (newVal) { |
| | | selectFlowCardList(); |
| | | } |
| | | } |
| | | }, { flush: 'post' }); |
| | | |
| | | |
| | | const gridOptions = reactive({ |
| | | |
| | | height: '100%', |
| | |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | //remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | |
| | | }, |
| | | columns: [ |
| | | |
| | | {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80}, |
| | | {field: 'select',type:'checkbox',title: t('basicData.check'), width: 80,fixed:"left"}, |
| | | { |
| | | field: 'process_id', |
| | | width: 150, |
| | | title: t('processCard.processId'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'technology_number', |
| | |
| | | title: '层', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'TotalFloors', |
| | |
| | | title: '总层数', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'TotalNumber', |
| | |
| | | title: '规格', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'quantity', |
| | |
| | | title: t('order.quantity'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'shape', |
| | |
| | | title: t('order.shape'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | { |
| | | field: 'glass_child', |
| | |
| | | title: t('order.product'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | }, |
| | | {field: 'project', width: 150, title: t('order.project'), showOverflow: "ellipsis"}, |
| | | {field: 'project', width: 150, title: t('order.project'), showOverflow: "ellipsis",filterMethod:filterChanged}, |
| | | { |
| | | field: 'area', |
| | | width: 150, |
| | | title: t('order.area'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | sortable: true |
| | | sortable: true, |
| | | filterMethod:filterChanged |
| | | },{ |
| | | field: 'patch_state', |
| | | width: 100, |
| | | title: '补片状态' |
| | | }, |
| | | |
| | | |
| | |
| | | emit('updateTechnologyNumber', rowClickIndex.value.technology_number); |
| | | } |
| | | } |
| | | const emit = defineEmits(['updateProcessId', 'updateTechnologyNumber']); |
| | | const emit = defineEmits(['updateProcessId', 'updateTechnologyNumber', 'updateState']); |
| | | |
| | | |
| | | //小圆点单选框 |
| | | let radio = ref(1); |
| | | let isButtonDisabledAdd = ref(false); |
| | | let isButtonDisabledUpdate = ref(true); |
| | | |
| | | const selectFlowCardList = () => { |
| | | const selectFlowCardList = async () => { |
| | | request.post(`/glassOptimize/getFlowCardList/${optionVal.value}/${radio.value}`).then((res) => { |
| | | if (res.code == 200) { |
| | | getProjectId() |
| | | isButtonDisabledAdd.value=false |
| | | isButtonDisabledUpdate.value = true |
| | | xGrid.value.loadData(res.data.data) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | |
| | | }) |
| | | } |
| | | |
| | | const getUpdateFlowCardList = async (projectNumber, type, thickness) => { |
| | | // 重置状态 |
| | | radio.value = 1; |
| | | isButtonDisabledAdd.value = true; |
| | | isButtonDisabledUpdate.value = false; |
| | | |
| | | // 清空现有数据 |
| | | if (xGrid.value) { |
| | | xGrid.value.loadData([]); |
| | | } |
| | | |
| | | // 强制更新表单字段 |
| | | oddNumbers.value = projectNumber; |
| | | projectNmae.value = ''; // 先清空工程名称 |
| | | |
| | | // 构造正确的膜系值 |
| | | const glassTypeValue = `${thickness}mm${type}`; |
| | | optionVal.value = glassTypeValue; |
| | | |
| | | request.post(`/glassOptimize/getUpdateFlowCardList/${type}/${thickness}/${radio.value}/${projectNumber}`).then((res) => { |
| | | if (res.code == 200) { |
| | | // 更新工程编号 |
| | | oddNumbers.value = projectNumber; |
| | | |
| | | // 更新工程名称(如果后端返回) |
| | | if (res.data.projectName) { |
| | | projectNmae.value = res.data.projectName; |
| | | } |
| | | |
| | | // 确保膜系选择正确 |
| | | optionVal.value = glassTypeValue; |
| | | |
| | | isButtonDisabledAdd.value = true; |
| | | isButtonDisabledUpdate.value = false; |
| | | |
| | | // 使用 $nextTick 确保DOM更新后再加载数据 |
| | | nextTick(() => { |
| | | if (xGrid.value) { |
| | | xGrid.value.loadData(deepClone(res.data.data)); |
| | | // 设置选中状态 |
| | | nextTick(() => { |
| | | const tableData = xGrid.value.getTableData().fullData; |
| | | tableData.forEach(item => { |
| | | if(item.occupyState === 0){ |
| | | xGrid.value.setCheckboxRow(item, true); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | } |
| | | }).catch(error => { |
| | | ElMessage.error('获取流程卡数据失败'); |
| | | console.error(error); |
| | | }); |
| | | }; |
| | | |
| | | //创建工程 |
| | | const addProject = () => { |
| | | const addProject = (type) => { |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | if (selectRecords.length == 0) { |
| | | ElMessage.warning(t('reportingWorks.selectProcessCardData')) |
| | | return; |
| | | if($table.getCheckedFilters().length!==0){ |
| | | ElMessage.error(t('order.msg.pleaseCancelTheFilteringFirst')) |
| | | return |
| | | } |
| | | // if (selectRecords.length == 0) { |
| | | // ElMessage.warning(t('reportingWorks.selectProcessCardData')) |
| | | // return; |
| | | // } |
| | | |
| | | let projectData = ref({ |
| | | projectdetail: selectRecords, |
| | | userName : username |
| | | userName : username, |
| | | projectType: type |
| | | }) |
| | | request.post(`/glassOptimize/addProject/${optionVal.value}/${oddNumbers.value}/${projectNmae.value}`, projectData.value).then((res) => { |
| | | if (res.code == 200 && res.data === true) { |
| | | let inputProject = projectNmae.value |
| | | if (inputProject == undefined) { |
| | | inputProject = null |
| | | } |
| | | request.post(`/glassOptimize/addProject/${optionVal.value}/${oddNumbers.value}/${inputProject}`, projectData.value).then((res) => { |
| | | if (res.code == 200 && res.data === "true") { |
| | | emit('updateState', 1); |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | selectFlowCardList() |
| | | getProjectId(); |
| | | }else if(res.data === "false1") { |
| | | ElMessage.warning("工程号已存在请重新刷新界面") |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | watch(optionVal, (newVal, oldVal) => { |
| | | if (newVal) { |
| | | // 当膜系改变时,更新工程名称为当前膜系值 |
| | | projectNmae.value = newVal; |
| | | |
| | | // 当膜系改变时,自动刷新数据 |
| | | selectFlowCardList(); |
| | | } |
| | | }, { flush: 'post' }); |
| | | |
| | | const handleRowClassName = ({ row, rowIndex }) => { |
| | | if (row.patch_state === 1) { |
| | | return 'high-score'; |
| | | } |
| | | if (row.occupyState === 0) { |
| | | return 'high-score2'; |
| | | } |
| | | } |
| | | |
| | | //抛出方法到父界面 |
| | | defineExpose({getProjectId,selectFlowCardList,selectGlassType,getUpdateFlowCardList}) |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 110%; margin-top: -36px"> |
| | | <h1>流程卡列表 |
| | | <div> |
| | | 流程卡列表 |
| | | <span style="margin-left: 140px;font-size: 14px">工程编号:</span> |
| | | <!-- <span>{{oddNumbers}}</span>--> |
| | | <el-input disabled v-model="oddNumbers" style="width: 100px"></el-input> |
| | | <!-- <vxe-input :disabled="isDisabled" placeholder="" v-model="oddNumbers" size="small" style="color:black;"></vxe-input> --> |
| | | <span style="font-size: 14px">工程名称:</span> |
| | | <vxe-input placeholder="" v-model="projectNmae" size="small"></vxe-input> |
| | | <el-button style="margin-left: 20px" type="primary" @click="addProject">创建</el-button> |
| | | </h1> |
| | | <el-input style="width: 150px" placeholder="" v-model="projectNmae" size="small"></el-input> |
| | | <el-button style="margin-left: 20px" type="primary" :disabled="isButtonDisabledAdd" @click="addProject(1)">创建</el-button> |
| | | <el-button style="margin-left: 20px;" type="primary" :disabled="isButtonDisabledUpdate" @click="addProject(2)">修改</el-button> |
| | | </div> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | |
| | | size="small" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @filter-change="filterChanged" |
| | | :row-class-name="handleRowClassName" |
| | | > |
| | | <template #num2_filter="{ column, $panel }"> |
| | | <div> |
| | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input |
| | | |
| | | v-model="option.data" |
| | | type="type" |
| | | @input="changeFilterEvent($event, option, $panel)" |
| | | @keyup.enter.native="$panel.confirmFilter()"/> |
| | | <input type="type" v-model="option.data" @keyup.enter.native="$panel.confirmFilter()" @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <template #toolbar_buttons> |
| | | <h1>膜系筛选:</h1> |
| | | <h2>膜系筛选:</h2> |
| | | <el-select v-model="optionVal" clearable default-value="default_city" placeholder="选择膜系" |
| | | style="width: 120px"> |
| | | <el-option |
| | |
| | | <vxe-radio content="补单" label="3"></vxe-radio> |
| | | </vxe-radio-group> |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | <style lang="css"> |
| | | .high-score { |
| | | background-color: #d4baba !important; |
| | | } |
| | | .high-score2 { |
| | | background-color: #a5aec9 !important; |
| | | } |
| | | </style> |