| | |
| | | <script setup> |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import {ElDatePicker, ElMessage} from "element-plus" |
| | | import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" |
| | | import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue" |
| | | import {Search} from "@element-plus/icons-vue" |
| | | import GlassType from "@/components/sd/product/GlassType.vue" |
| | | import {useRouter} from 'vue-router' |
| | | import Sortable from 'sortablejs' |
| | | import BasicTable from '@/components/basic/BasicTable.vue' |
| | | import {VXETable} from "vxe-table"; |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | let router=useRouter() |
| | | const getTableRow = (row,type) =>{ |
| | | |
| | | let productGlassTypeStore = useProductGlassTypeStore() |
| | | let router = useRouter() |
| | | const getTableRow = (row, type) => { |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | case 'edit' : { |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/workOrder/addWorkOrder', query: { id: row.id }}) |
| | | router.push({path: '/main/workOrder/addWorkOrder', query: {id: row.id}}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | case 'delete': { |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | function padLeftZero(str) { |
| | | return ('00' + str).substr(str.length) |
| | | } |
| | | |
| | | //定义时间 |
| | | const form = reactive({ |
| | | date1: '', |
| | | }) |
| | | |
| | | |
| | | //定义转单状态 |
| | | const optionVal = ref('0') |
| | | const options = [ |
| | | { |
| | | value: '0', |
| | | label: '已转', |
| | | }, |
| | | { |
| | | value: '1', |
| | | label: '未转', |
| | | }, |
| | | ] |
| | | |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | //定义滚动条高度 |
| | | let scrollTop = ref(null) |
| | | let scrollHeight = ref(null) |
| | | let clientHeight = ref(null) |
| | | const scrollEvnt = (row) => { |
| | | // 内容高度 |
| | | scrollTop.value = row.$event.target.scrollTop |
| | | scrollHeight.value = row.$event.target.scrollHeight |
| | | clientHeight.value = row.$event.target.clientHeight |
| | | } |
| | | //筛选条件,有外键需要先定义明细里面的数据 |
| | | let filterData = ref({ |
| | | order: { |
| | | batch: '' |
| | | }, |
| | | orderDetail: { |
| | | productName: '', |
| | | computeArea: '', |
| | | quantity: '', |
| | | computeGrossArea: '', |
| | | perimeter: '', |
| | | bendRadius: '', |
| | | processingNote: '' |
| | | } |
| | | |
| | | }) |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | | //定义数据返回结果 |
| | | let produceList = ref([]) |
| | | //定义当前页数 |
| | | let pageNum = $ref(1) |
| | | let pageState = null |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime()- 3600 * 1000 * 24 * 7) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime()) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1=getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let state = optionVal.value |
| | | |
| | | //第一次加载数据 |
| | | |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${state}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | console.log(res.data.data) |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //点击查询 |
| | | const getWorkOrder = () => { |
| | | |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectState=optionVal.value |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${selectState}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /*使用筛选,后端获取数据*/ |
| | | const changeFilterEvent = (event, option, $panel,) => { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | |
| | | function filterChanged(column) { |
| | | gridOptions.loading = true |
| | | //筛选条件发生变化条件发生变化 |
| | | let value = column.datas[0] != undefined ? column.datas[0] : '' |
| | | value = value.trim() |
| | | //判断是否存在外键 |
| | | if (column.property.indexOf('.') > -1) { |
| | | const columnArr = column.property.split('.') |
| | | filterData.value[columnArr[0]] = { |
| | | [columnArr[1]]: value |
| | | } |
| | | } else { |
| | | filterData.value[column.property] = value |
| | | } |
| | | |
| | | //获取选中时间和是否转单状态 |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectState=optionVal.value |
| | | |
| | | request.post(`/workOrder/orderGlassDetail/${startTime}/${endTime}/${selectState}`, filterData.value).then((res) => { |
| | | if(res.code==200){ |
| | | pageTotal.value=res.data.total |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /*后端返回结果多层嵌套展示*/ |
| | | const hasDecimal = (value) => { |
| | | const regex = /\./; // 定义正则表达式,查找小数点 |
| | | return regex.test(value); // 返回true/false |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | loading: true, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 60, useKey: true},//鼠标移动或选择高亮 |
| | | id: 'demo_1', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | scrollX: {enabled: true}, |
| | | scrollY: {enabled: true, gt: 0},//开启虚拟滚动 |
| | | showOverflow: true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left"}, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {field: 'salesOrderNo', title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true, }, |
| | | {field: 'productionOrderNo', title: '生产订单号', sortable: true,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'batch', title: '批次', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'productName', title: '产品名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}, |
| | | {field: 'monolithicTotalArea', title: '单片总面积', sortable: true,showOverflow:"ellipsis"}, |
| | | {field: 'total', title: '总数量', sortable: true}, |
| | | {field: 'productTotalArea', title: '成品总面积', sortable: true}, |
| | | {field: 'perimeter', title: '周长', sortable: true,showOverflow:"ellipsis"}, |
| | | {field: 'radius', title: '半径', sortable: true}, |
| | | {field: 'createTime', title: '加工要求', sortable: true} |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {title: '操作', width: 110, slots: {default: 'button_slot'}, fixed: "left"}, |
| | | {type: 'seq', fixed: "left", title: '自序', width: 50}, |
| | | {field: 'orderId', title: '销售单号', filters: [{data: ''}], slots: {filter: 'num1_filter'},}, |
| | | { |
| | | field: 'productionId', |
| | | title: '生产订单号', |
| | | showOverflow: "ellipsis", |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'} |
| | | }, |
| | | {field: 'order.batch', title: '批次', filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'orderDetail.productName', title: '产品名称', filters: [{data: ''}], slots: {filter: 'num1_filter'},}, |
| | | {field: 'orderDetail.computeArea', title: '单片总面积', showOverflow: "ellipsis"}, |
| | | {field: 'orderDetail.quantity', title: '总数量',}, |
| | | {field: 'orderDetail.computeGrossArea', title: '成品总面积',}, |
| | | {field: 'orderDetail.perimeter', title: '周长', showOverflow: "ellipsis"}, |
| | | {field: 'orderDetail.bendRadius', title: '半径',}, |
| | | {field: 'orderDetail.processingNote', title: '加工要求',} |
| | | ],//表头按钮 |
| | | |
| | | data: null,//表格数据 |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productionOrderNo: 'NG231201A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231201', |
| | | productionOrderNo: 'NG231201B', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231202', |
| | | productionOrderNo: 'NG231202A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231203', |
| | | productionOrderNo: 'NG231203A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231204', |
| | | productionOrderNo: 'NG231204A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231205', |
| | | productionOrderNo: 'NG231205A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | { |
| | | salesOrderNo: 'NG231206', |
| | | productionOrderNo: 'NG231206A', |
| | | entryName: '信合春天里', |
| | | batch: '23批', |
| | | productName: '5mm白玻平钢(外)+0.76PVB透明+5mm白玻平钢(内)', |
| | | monolithicTotalArea: '509.78', |
| | | total: '169', |
| | | productTotalArea: '175.31', |
| | | perimeter: '99.84', |
| | | radius: '0', |
| | | createTime: '1)按企标2)每片玻璃标签贴室外面。内片玻璃打“3C商标”,统一打在玻璃“宽度”方向右下角4)按批次单独落架。', |
| | | }, |
| | | ],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['total','monolithicTotalArea','productTotalArea'] |
| | | return[ |
| | | footerMethod({columns, data}) {//页脚函数 |
| | | let footList = ['', '', ''] |
| | | return [ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return '合计:' |
| | |
| | | |
| | | }) |
| | | |
| | | const form = reactive({ |
| | | name: '', |
| | | region: '', |
| | | date1: '', |
| | | date2: '', |
| | | delivery: false, |
| | | type: [], |
| | | resource: '', |
| | | desc: '', |
| | | }) |
| | | |
| | | const value = ref('') |
| | | const options = [ |
| | | { |
| | | value: 'Option1', |
| | | label: 'Option1', |
| | | }, |
| | | { |
| | | value: 'Option2', |
| | | label: 'Option2', |
| | | }, |
| | | { |
| | | value: 'Option3', |
| | | label: 'Option3', |
| | | }, |
| | | ] |
| | | |
| | | </script> |
| | | |
| | |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | type="daterange" |
| | | format="YYYY/MM/DD" |
| | | value-format="YYYY-MM-DD" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | :default-time="defaultTime" |
| | | |
| | | /> |
| | | |
| | | <el-select v-model="value" class="m-2" placeholder="是否转工单"> |
| | | <el-select :default-first-option="true" ref="getSelect" style="width: 120px" v-model="optionVal" class="m-2" placeholder="是否转工单"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | |
| | | /> |
| | | </el-select> |
| | | |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button |
| | | @click="getWorkOrder" |
| | | id="select" |
| | | type="primary" :icon="Search">查询 |
| | | </el-button> |
| | | </el-row> |
| | | |
| | | </div> |
| | |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{item.title+': '}}</span> |
| | | <span>{{ row[item.field] }}</span> |
| | | <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span> |
| | | <span v-else>{{ row[item.field] }}</span> |
| | | |
| | | </li> |
| | | </ul> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .main-div-customer{ |
| | | .main-div-customer { |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | |
| | | #selectForm { |
| | | width: 50%; |
| | | text-align: center; |