| | |
| | | import ComputeCard from "@/views/pp/glassOptimize/page/ComputeCard.vue"; |
| | | import ComputeDetail from "@/views/pp/glassOptimize/page/ComputeDetail.vue"; |
| | | import Compute from "@/views/pp/glassOptimize/page/Compute.vue"; |
| | | import { ref } from 'vue'; |
| | | import {ElMessage} from "element-plus"; |
| | | import request from "@/utils/request"; |
| | | |
| | | |
| | | // 用于存储从后端获取到的数据,初始化为空数组 |
| | | const receivedData = ref([]); |
| | | const handleFetchData = async (projectNumber) => { |
| | | try { |
| | | const res = await request.post(`/glassOptimize/selectProjectCompute/${projectNumber}`); |
| | | if (Number(res.code) === 200 && res.data && res.data.data) { |
| | | receivedData.value = res.data.data; |
| | | } else { |
| | | console.error('请求出现问题,状态码:', res.code, ',错误信息:', res.msg); |
| | | if (res.code === 404) { |
| | | ElMessage.error('未找到对应工程号的数据,请检查输入是否正确'); |
| | | } else if (res.code === 500) { |
| | | ElMessage.error('服务器内部出现错误,请稍后再试'); |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error('请求出错', error); |
| | | ElMessage.error('网络连接出现问题,请检查网络设置'); |
| | | } |
| | | }; |
| | | |
| | | </script> |
| | | |
| | |
| | | <div style="width: 100%; height: 100%;"> |
| | | |
| | | <div id="compute"> |
| | | <compute/> |
| | | <compute @fetch-data="handleFetchData" /> |
| | | </div> |
| | | |
| | | <div id="computeCard"> |
| | | <compute-card/> |
| | | <compute-card :table-data="receivedData" /> |
| | | </div> |
| | | |
| | | <div id="computeDetail"> |
| | |
| | | buttons: "toolbar_buttons" |
| | | }, |
| | | }, |
| | | |
| | | }) |
| | | let emit = defineEmits([ |
| | | 'changeDialog' |
| | | ]) |
| | | |
| | | |
| | | // 进度条颜色和按钮加减 |
| | | const percentage1 = ref(80) |
| | |
| | | }, |
| | | ] |
| | | |
| | | // 定义响应式数据,用于绑定工程号输入框的值 |
| | | const projectNumber = ref(''); |
| | | |
| | | let emit = defineEmits(['changeDialog', 'fetch-data']); |
| | | |
| | | const handleSearchClick = () => { |
| | | // 通过 $emit 触发自定义事件,将工程号传递给父组件,由父组件去调用接口获取数据 |
| | | emit('fetch-data', projectNumber.value); |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | |
| | | <div id="title" style="margin-top: -10px"> |
| | | <span> |
| | | 工程编号 |
| | | <vxe-select size="small" style="margin-left: 20px" clearable></vxe-select> |
| | | <vxe-input size="small" style="margin-left: 20px" clearable v-model="projectNumber"></vxe-input> |
| | | <el-button |
| | | type="primary" |
| | | :icon="Search" |
| | | style="margin-left: 20px" |
| | | @click="">{{$t('basicData.search') }} |
| | | @click="handleSearchClick" |
| | | >{{$t('basicData.search') }} |
| | | </el-button> |
| | | </span> |
| | | <span style="float: right ; margin-right: 120px"> |
| | |
| | | <script setup> |
| | | import {reactive, ref} from "vue"; |
| | | import {nextTick, onMounted, reactive, ref, watch} from "vue"; |
| | | import {useI18n} from "vue-i18n"; |
| | | const { t } = useI18n() |
| | | |
| | | const xGrid = ref() |
| | | |
| | | const checkboxCellRender = reactive({ |
| | | name: 'VxeCheckboxGroup', |
| | | options: [ |
| | | { label: '允许横排', value: '1' }, |
| | | { label: '钢化', value: '2' }, |
| | | ] |
| | | }) |
| | | |
| | | const gridOptions = reactive({ |
| | | |
| | |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | /*formConfig: { |
| | | data: { |
| | | width: '', |
| | | height: '', |
| | | quantity: '' |
| | | }, |
| | | items: [ |
| | | { field: 'width', title: t('order.width')+':', itemRender: { name: 'VxeInput' } }, |
| | | { field: 'height', title: t('order.height')+':', itemRender: { name: 'VxeInput' } }, |
| | | { field: 'quantity', title: t('order.quantity')+':', itemRender: { name: 'VxeInput' } }, |
| | | { |
| | | itemRender: { |
| | | name: 'VxeButtonGroup', |
| | | options: [ |
| | | { type: 'submit', content: t('craft.sure'), status: 'primary' }, |
| | | { type: 'reset', content: t('product.msg.reset') } |
| | | ] |
| | | } |
| | | } |
| | | ] |
| | | },*/ |
| | | |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | {field: 'checkbox', title: '允许横排', width: 100}, |
| | | {field: 'checkbox', title: '钢化', width: 70}, |
| | | {field: 'processId',width: 150, title: t('processCard.processId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'id',width: 70, title: '层',filters:[{ data: '' }], slots: { default: 'state',filter: 'num2_filter' }}, |
| | | {field: 'id',width: 150, title: '总层数',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'id',width: 100, title: '规格',filters:[{ data: '' }], slots: { default: 'state',filter: 'num2_filter' }}, |
| | | {field: 'quantity',width: 150, title: t('order.quantity'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'orderDetail.productName',width: 150, title: t('order.product'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'orderDetail.computeGrossArea',width: 150, title: t('order.area'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: '',width: 70, title: 'merge'} |
| | | {field: 'check', title: '选择', width: 200, cellRender: checkboxCellRender }, |
| | | {field: 'process_id',width: 150, title: t('processCard.processId'), sortable: true}, |
| | | {field: 'technology_number',width: 70, title: '层', sortable: true}, |
| | | {field: 'TotalFloors',width: 150, title: '总层数', sortable: true}, |
| | | {field: 'TotalNumber',width: 150, title: '规格', sortable: true}, |
| | | {field: 'quantity',width: 150, title: t('order.quantity'), sortable: true}, |
| | | {field: 'glass_child',width: 150, title: t('order.product'), sortable: true}, |
| | | {field: 'project', width:150, title: t('order.project'), showOverflow: "ellipsis"}, |
| | | {field: 'area',width: 150, title: t('order.area'), sortable: true}, |
| | | |
| | | |
| | | ],//表头参数 |
| | | data:null,//表格数据 |
| | |
| | | }) |
| | | let emit = defineEmits([ |
| | | 'changeDialog' |
| | | ]) |
| | | let Membrane = ref('选择膜系') |
| | | ]); |
| | | |
| | | const changeOrderType = async ()=>{ |
| | | await emit('changeDialog',Membrane.value) |
| | | Membrane.value = null |
| | | } |
| | | const props = defineProps({ |
| | | tableData: Array |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | if (xGrid.value) { |
| | | const grid = xGrid.value; |
| | | if (typeof grid.setDirty === 'function') { |
| | | grid.setDirty(true); |
| | | } |
| | | } else { |
| | | console.error('vxe-grid 组件实例未获取到,可能挂载出现问题'); |
| | | } |
| | | }); |
| | | |
| | | watch(() => props.tableData, async (newData) => { |
| | | if (Array.isArray(newData)) { |
| | | gridOptions.data = newData; |
| | | await nextTick(); |
| | | if (xGrid.value) { |
| | | const grid = xGrid.value; |
| | | if (typeof grid.refresh === 'function') { |
| | | grid.refresh(); |
| | | } |
| | | } |
| | | } else { |
| | | console.error('传递给表格的数据格式不符合要求,期望是数组格式'); |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | > |
| | | <template #num2_filter="{ column, $panel }"> |
| | | <div> |
| | |
| | | return Result.seccess(glassOptimizeService.deleteProject(projectNumber)); |
| | | } |
| | | |
| | | //模拟计算工程号查询 |
| | | @ApiOperation("模拟计算工程号查询") |
| | | @PostMapping ("/selectProjectCompute/{projectNumber}") |
| | | public Result selectProjectCompute( |
| | | @PathVariable String projectNumber){ |
| | | return Result.seccess(glassOptimizeService.selectProjectComputeSv(projectNumber)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.example.erp.entity.pp.OptimizeProjectMange; |
| | | import com.example.erp.entity.sd.OrderGlassDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.sql.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | //删除工程 |
| | | int deleteProjectMp(String projectNumber); |
| | | |
| | | //模拟计算工程号查询 |
| | | List<Map<String, Object>> selectProjectComputeMp(@Param("projectNo")String projectNumber); |
| | | } |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", glassOptimizeMapper.getProjectListMp()); |
| | | return map; |
| | | }} |
| | | } |
| | | |
| | | //模拟计算工程号查询 |
| | | public Map<String, Object>selectProjectComputeSv(String projectNumber) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", glassOptimizeMapper.selectProjectComputeMp(projectNumber)); |
| | | return map; |
| | | } |
| | | |
| | | } |
| | |
| | | p.project_no |
| | | </select> |
| | | |
| | | <!--模拟计算查询--> |
| | | <select id="selectProjectComputeMp"> |
| | | SELECT |
| | | fc.process_id, |
| | | fc.technology_number, |
| | | fc.project_no, |
| | | fcss.TotalFloors, |
| | | COUNT(fc.order_number) AS TotalNumber, |
| | | SUM(fc.quantity) AS quantity, |
| | | ROUND(SUM(od.width * od.height * fc.quantity / 1000000), 2) AS area, |
| | | o.project, |
| | | ogd.glass_child, |
| | | od.shape |
| | | FROM |
| | | pp.flow_card AS fc |
| | | LEFT JOIN sd.`order` AS o ON fc.order_id = o.order_id |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = fc.order_id AND od.order_number = fc.order_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON ogd.order_id = fc.order_id AND ogd.order_number = fc.order_number AND |
| | | ogd.technology_number = fc.technology_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | fcs.process_id, |
| | | fcs.order_number, |
| | | COUNT(DISTINCT fcs.technology_number) AS TotalFloors |
| | | FROM |
| | | pp.flow_card AS fcs |
| | | GROUP BY |
| | | fcs.process_id, fcs.order_number |
| | | ) AS fcss |
| | | ON fcss.process_id = fc.process_id AND fcss.order_number = fc.order_number |
| | | WHERE |
| | | fc.project_no = #{projectNo} |
| | | GROUP BY |
| | | fc.process_id, fc.technology_number |
| | | ORDER BY |
| | | fc.process_id, fc.technology_number; |
| | | </select> |
| | | |
| | | </mapper> |