| | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import {ElDatePicker, ElMessage} from "element-plus"; |
| | | import {useI18n} from 'vue-i18n' |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import footSum from "@/hook/footSum" |
| | | import {VxeUI} from "vxe-pc-ui"; |
| | | import {addListener} from "@/hook/mouseMove"; |
| | | //语言获取 |
| | | const {t} = useI18n() |
| | | let router = useRouter() |
| | |
| | | }) |
| | | |
| | | //工序 |
| | | const value = ref('磨边') |
| | | const value = ref() |
| | | |
| | | //表尾求和 |
| | | const sumNum = (list, field) => { |
| | |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7) |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 3) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime() + 3600 * 1000 * 24) |
| | | const end = new Date(new Date().getTime()) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | onMounted(() => { |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value, gridOptions) |
| | | }) |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1 = getNowTime() |
| | |
| | | const titleSelectJson = ref({ |
| | | processType: [], |
| | | }) |
| | | let date = new Date(endTime); // 将日期字符串转为 Date 对象 |
| | | // 使用 setDate 方法加一天 |
| | | date.setDate(date.getDate() + 1); |
| | | let newEndTime = date.toISOString().split('T')[0]; // 获取 YYYY-MM-DD 格式的字符串 |
| | | //第一次加载数据 |
| | | request.post(`/report/selectProcessToBeCompleted/${startTime}/${endTime}/${inputVal}/${inputProject}/${selectProcesses}`, filterData.value).then((res) => { |
| | | request.post(`/report/selectProcessToBeCompleted/${startTime}/${newEndTime}/${inputVal}/${inputProject}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | // total.dataTotal = res.data.total.total*1 |
| | | // total.pageTotal= res.data.total.pageTotal |
| | | // pageTotal.value = res.data.total |
| | | //total.value = res.data.footSum |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | titleSelectJson.value.processType = res.data.process |
| | | xGrid.value.reloadData(produceList) |
| | |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | |
| | | request.post(`/report/selectProcessToBeCompleted/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}/${inputVal}`, filterData.value).then((res) => { |
| | | gridOptions.loading = true |
| | | let date = new Date(endTime); // 将日期字符串转为 Date 对象 |
| | | // 使用 setDate 方法加一天 |
| | | date.setDate(date.getDate() + 1); |
| | | let newEndTime = date.toISOString().split('T')[0]; // 获取 YYYY-MM-DD 格式的字符串 |
| | | request.post(`/report/selectProcessToBeCompleted/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${inputVal}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | |
| | | //total.value = res.data.footSum |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | |
| | | //点击查询 |
| | | const getWorkOrder = () => { |
| | | |
| | | gridOptions.loading = true |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectProcesses = value.value |
| | |
| | | if (inputProject == '') { |
| | | inputProject = null |
| | | } |
| | | request.post(`/report/selectProcessToBeCompleted/${startTime}/${endTime}/${inputVal}/${inputProject}/${selectProcesses}`, filterData.value).then((res) => { |
| | | let date = new Date(endTime); // 将日期字符串转为 Date 对象 |
| | | // 使用 setDate 方法加一天 |
| | | date.setDate(date.getDate() + 1); |
| | | let newEndTime = date.toISOString().split('T')[0]; // 获取 YYYY-MM-DD 格式的字符串 |
| | | request.post(`/report/selectProcessToBeCompleted/${startTime}/${newEndTime}/${inputVal}/${inputProject}/${selectProcesses}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | // total.dataTotal = res.data.total.total*1 |
| | | // total.pageTotal= res.data.total.pageTotal |
| | | // pageTotal.value = res.data.total |
| | | //total.value = res.data.footSum |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 50},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮 |
| | | id: 'ProcessToBeCompleted', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | |
| | | },//表头参数 |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {type: 'seq', fixed: "left", title: '自序', width: 50}, |
| | | {field: 'create_time', width: 120, title: '下单时间'}, |
| | | {field: 'delivery_date', width: 120, title: '交货日期'}, |
| | | {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50}, |
| | | {field: 'create_time', width: 120, title: t('report.orderTime')}, |
| | | {field: 'delivery_date', width: 120, title: t('report.deliveryDate')}, |
| | | { |
| | | field: 'order_id', width: 120, title: '销售单号', filters: [{data: ''}], |
| | | field: 'order_id', width: 120, title: t('order.orderId'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'process_id', |
| | | width: 120, |
| | | title: '流程卡号', |
| | | title: t('processCard.processId'), |
| | | showOverflow: "ellipsis", |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'customer_name', width: 130, title: '客户名称', filters: [{data: ''}], |
| | | field: 'customer_name', width: 130, title: t('customer.customerName'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'project', width: 120, title: '项目名称', filters: [{data: ''}], |
| | | field: 'project', width: 120, title: t('order.project'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'batch', width: 100, title: '批次', filters: [{data: ''}], |
| | | field: 'batch', width: 100, title: t('order.batch'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | {field: 'order_number', width: 100, title: '序号'}, |
| | | {field: 'technology_number', width: 120, title: '小片顺序', showOverflow: "ellipsis"}, |
| | | {field: 'glass_child', width: 100, title: '单片名称'}, |
| | | {field: 'child_width', width: 120, title: '宽'}, |
| | | {field: 'child_height', width: 120, title: '高'}, |
| | | {field: 'quantity', width: 120, title: '订单数量'}, |
| | | {field: 'childArea', width: 120, title: '单片面积'}, |
| | | {field: 'actualArea', width: 120, title: '实际面积'}, |
| | | {field: 'completeNum', width: 120, title: '已完成数量'}, |
| | | {field: 'completeArea', width: 120, title: '已完成面积'}, |
| | | {field: 'incompleteNum', width: 120, title: '未完成数量'}, |
| | | {field: 'incompleteArea', width: 120, title: '未完成面积'}, |
| | | {field: 'product_name', width: 120, title: '成品名称'}, |
| | | {field: 'order_number', width: 100, title: t('order.OrderNum')}, |
| | | {field: 'technology_number', width: 120, title: t('processCard.technologyNumber'), showOverflow: "ellipsis"}, |
| | | {field: 'glass_child', width: 100, title: t('reportingWorks.glassChild'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'child_width', width: 120, title: t('order.width'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'child_height', width: 120, title: t('order.height'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'thickness',filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged, |
| | | width: 90, title: t('order.totalThickness')}, |
| | | |
| | | {field: 'quantity', width: 120, title: t('order.quantity'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'childArea', width: 130, title: t('order.trueArea'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'actualArea', width: 130, title: t('order.trueGrossArea'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'completeNum', width: 120, title: t('report.completedQuantity'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'completeArea', width: 120, title: t('report.completedArea'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'incompleteNum', width: 120, title: t('report.unfinishedQuantity'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'incompleteArea', width: 120, title: t('report.unfinishedArea'),filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'product_name', width: 120, title: t('order.product'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | // buttons: [{ |
| | | // |
| | | // }], |
| | | import: false, |
| | | export: true, |
| | | print: true, |
| | | slots: { |
| | | tools: 'toolbar_buttons' |
| | | }, |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod({columns, data}) {//页脚函数 |
| | | let footList = [''] |
| | | return [ |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return '合计:' |
| | | return t('basicData.total') |
| | | } |
| | | if (footList.includes(column.field)) { |
| | | return sumNum(data, column.field) |
| | | const List = ["quantity",'childArea','actualArea','completeNum','completeArea','incompleteNum','incompleteArea'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | | return '' |
| | | }) |
| | |
| | | } |
| | | |
| | | }) |
| | | function exportExcel(url, fileName,date) { |
| | | let processes = value.value |
| | | let inputVal = form.orderId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | let inputProject = form.project |
| | | if (inputProject == '') { |
| | | inputProject = null |
| | | } |
| | | if(date===null){ |
| | | ElMessage.warning(t('report.pleaseSelectADateFirst')) |
| | | return |
| | | } |
| | | |
| | | if(processes===null){ |
| | | ElMessage.warning(t('report.pleaseSelectAProcessFirst')) |
| | | return |
| | | } |
| | | gridOptions.loading = true |
| | | const date1 = new Date(date[0]); |
| | | const date2 = new Date(date[1]); |
| | | const timeDiff = Math.abs(date2.getTime() - date1.getTime()); |
| | | const daysDiff = timeDiff / (1000 * 3600 * 24); |
| | | if(Math.floor(daysDiff)>180){ |
| | | ElMessage.warning(t('report.theFilteringTimeForExportCannotExceed180Days')) |
| | | return |
| | | } |
| | | let dataMp = ref({ |
| | | date: date, |
| | | processes: processes, |
| | | orderId: inputVal, |
| | | project: inputProject |
| | | }) |
| | | request.post(url,dataMp.value,{responseType :'blob'}).then(res => { |
| | | const blob = new Blob([res]) |
| | | if ('download' in document.createElement('a')) { // 非IE下载 |
| | | const elink = document.createElement('a') |
| | | elink.download = `${fileName}.xlsx` |
| | | elink.style.display = 'none' |
| | | elink.href = URL.createObjectURL(blob) |
| | | document.body.appendChild(elink) |
| | | elink.click() |
| | | URL.revokeObjectURL(elink.href) // 释放URL 对象 |
| | | document.body.removeChild(elink) |
| | | gridOptions.loading = false |
| | | } else { // IE10+下载 |
| | | navigator.msSaveBlob(blob, fileName) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | const handleCellDblClick = ({ row, column, cell, $event }) => { |
| | | VxeUI.clipboard.copy(row[column.property]) |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div class="main-div-customer"> |
| | | <div id="selectForm"> |
| | | <el-row :gutter="0"> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head"> |
| | | <!-- <el-input placeholder="销售单号" v-model="form.name" style="width: 150px"/>--> |
| | | <!-- <el-input placeholder="项目名称" v-model="form.name" style="width: 150px"/>--> |
| | | |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | end-placeholder="结束时间" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY/MM/DD" |
| | | start-placeholder="开始时间" |
| | | style="width: 100px" |
| | | type="daterange" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | |
| | | <el-input v-model="form.orderId" :placeholder="$t('order.orderId')" clearable style="width: 130px"></el-input> |
| | | |
| | | <el-input v-model="form.project" clearable placeholder="项目名称" style="width: 130px"></el-input> |
| | | <el-input v-model="form.project" clearable :placeholder="$t('order.project')" style="width: 130px"></el-input> |
| | | |
| | | <el-select v-model="value" clearable default-value="default_city" style="width: 120px"> |
| | | <el-select v-model="value" clearable :placeholder="$t('reportingWorks.selectProcess')" default-value="default_city" style="width: 120px"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | | :key="item.id" |
| | |
| | | :value="item.basic_name" |
| | | /> |
| | | </el-select> |
| | | <el-button type="primary" @click="getWorkOrder">查询</el-button> |
| | | </el-row> |
| | | <el-button type="primary" @click="getWorkOrder">{{$t('basicData.search')}}</el-button> |
| | | |
| | | </div> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | max-height="100%" |
| | | v-bind="gridOptions" |
| | | <div class="main-table"> |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | height="100%" |
| | | v-bind="gridOptions" |
| | | @cell-dblclick="handleCellDblClick" |
| | | |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |
| | | <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> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row }"> |
| | | <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> |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'edit')">编辑</el-button> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'setType')">反审</el-button> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'delete')">删除</el-button> |
| | | </template> |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'edit')">{{$t('basicData.edit')}}</el-button> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'setType')">{{$t('basicData.cancelReview')}}</el-button> |
| | | <el-button link size="small" type="primary" @click="getTableRow(row,'delete')">{{$t('basicData.delete')}}</el-button> |
| | | </template> |
| | | |
| | | <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)"/> |
| | | <template #toolbar_buttons> |
| | | <vxe-button style="margin-right: 0.5rem" |
| | | @click="exportExcel('/report/exportProcessToBeCompleted', |
| | | t('report.processToBeCompleted'), |
| | | form.date1)"> |
| | | {{t('basicData.export')}}</vxe-button> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input v-model="option.data" type="type" |
| | | @keyup.enter.native="$panel.confirmFilter()" |
| | | @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </vxe-grid> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .main-div-customer { |
| | | width: 99%; |
| | | height: 100%; |
| | | .head{ |
| | | width: 100%; |
| | | height: 35px; |
| | | } |
| | | |
| | | #selectForm { |
| | | width: 60%; |
| | | text-align: center; |
| | | .main-table{ |
| | | width: 100%; |
| | | height: calc(100% - 35px); |
| | | } |
| | | |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | </style> |