| | |
| | | <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 {useI18n} from 'vue-i18n' |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import footSum from "@/hook/footSum" |
| | | |
| | | import dayjs from 'dayjs' |
| | | import {addListener} from "@/hook/mouseMove"; |
| | | import {VxeUI} from "vxe-pc-ui"; |
| | | import companyInfo from "@/stores/sd/companyInfo"; |
| | | import useOrderInfoStore from "@/stores/sd/order/orderInfo"; |
| | | const company = companyInfo() |
| | | const reportTime=company.reportTime |
| | | const orderInfo = useOrderInfoStore() |
| | | //语言获取 |
| | | const {t} = useI18n() |
| | | let router = useRouter() |
| | |
| | | clientHeight.value = row.$event.target.clientHeight |
| | | } |
| | | |
| | | onMounted(()=>{ |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value, gridOptions) |
| | | }) |
| | | |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | |
| | | let pageNum = ref(1) |
| | | let pageState = null |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | 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()) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0, 10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1 = getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | |
| | | let selectProcesses = value.value |
| | | let total = reactive({ |
| | | pageTotal: 0, |
| | |
| | | processType: [], |
| | | }) |
| | | //第一次加载数据 |
| | | request.post(`/report/yield/${startTime}/${endTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | request.post(`/report/yield/${orderInfo.yieldDate}/${selectProcesses}/${reportTime}`, 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 |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | titleSelectJson.value.processType = res.data.process |
| | | orderInfo.yieldDate = res.data.selectDate |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //页脚翻页查询 |
| | | const selectPageList = () => { |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | |
| | | request.post(`/report/yield/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}/${inputVal}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | |
| | | |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //点击查询 |
| | | const getWorkOrder = () => { |
| | | gridOptions.loading = true |
| | | |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectProcesses = value.value |
| | | request.post(`/report/yield/${startTime}/${endTime}/${selectProcesses}`, filterData.value).then((res) => { |
| | | console.log(orderInfo.yieldDate) |
| | | console.log(reportTime) |
| | | request.post(`/report/yield/${orderInfo.yieldDate}/${selectProcesses}/${reportTime}`, 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 |
| | | orderInfo.yieldDate = res.data.selectDate |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | gridOptions.loading = false |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | //页脚跳转 |
| | | const handlePageChange = ({currentPage, pageSize}) => { |
| | | pageNum.value = currentPage |
| | | total.pageTotal = pageSize |
| | | selectPageList() |
| | | } |
| | | |
| | | |
| | |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'order_id', |
| | | width: 120, |
| | | title: t('order.orderId'), |
| | | showOverflow: "ellipsis", |
| | | field: 'reporting_work_time', |
| | | width: 160, |
| | | title: t('reportingWorks.reportingWorkTime'), |
| | | formatter: ({ cellValue }) => { |
| | | if (!cellValue) return '' |
| | | // 用 dayjs 或者 moment 格式化 |
| | | return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | }, |
| | | { |
| | | field: 'process_id', width: 140, title: t('processCard.processId'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'customer_name', title: t('customer.customerName'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | |
| | | { |
| | | field: 'project', |
| | | title: t('order.project'), |
| | |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | |
| | | { |
| | | field: 'batch', width: 90, title: t('order.batch'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'product_name', title: t('order.product'), filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'finishedArea', title: t('reportingWorks.completedArea'), filters: [{data: ''}], |
| | | {field: 'completedQuantity', width: 90, title: t('reportingWorks.completedQuantity')}, |
| | | {field: 'completedArea', width: 100, title: t('reportingWorks.completedArea')}, |
| | | {field: 'breakageQuantity', width: 100, title: t('reportingWorks.quantityBroken')}, |
| | | {field: 'breakageArea', width: 100, title: t('reportingWorks.wornArea')}, |
| | | {field: 'responsibleTeam', width: 100, title: t('reportingWorks.responsibleTeam') |
| | | ,filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'brokenArea', |
| | | title: t('reportingWorks.wornArea'), |
| | | type: 'date', |
| | | attrs: {placeholder: '', type: 'date'}, |
| | | }, |
| | | {field: 'area', width: 120, title: t('productStock.totalArea'), showOverflow: "ellipsis"}, |
| | | filterMethod: filterChanged}, |
| | | {field: 'finished', width: 100, title: t('report.finished')}, |
| | | ],//表头按钮 |
| | | |
| | |
| | | if (columnIndex === 0) { |
| | | return t('basicData.total') |
| | | } |
| | | const List = ["finishedArea",'brokenArea','area',] |
| | | const List = ["completedQuantity",'completedArea','breakageQuantity','breakageArea'] |
| | | if (List.includes(column.field)) { |
| | | return footSum(data, column.field) |
| | | } |
| | |
| | | |
| | | }) |
| | | } |
| | | |
| | | const handleCellDblClick = ({ row, column, cell, $event }) => { |
| | | VxeUI.clipboard.copy(row[column.property]) |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100%"> |
| | | <div class="head"> |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | v-model="orderInfo.yieldDate" |
| | | :start-placeholder="$t('basicData.startDate')" |
| | | :end-placeholder="$t('basicData.endDate')" |
| | | format="YYYY/MM/DD" |
| | | style="width: 350px" |
| | | type="daterange" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY/MM/DD HH:mm" |
| | | value-format="YYYY-MM-DD HH:mm" |
| | | /> |
| | | |
| | | <el-select v-model="value" clearable default-value="default_city" style="width: 120px"> |
| | |
| | | class="mytable-scrollbar" |
| | | height="100%" |
| | | v-bind="gridOptions" |
| | | |
| | | @cell-dblclick="handleCellDblClick" |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | |
| | | width: 100%; |
| | | height: calc(100% - 35px); |
| | | } |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | </style> |