From 46964bace341e98f238a0a3fd29f6adc643312c7 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 24 十一月 2025 13:14:32 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/northglass-erp/src/components/sd/order/OrderProcessCollect.vue | 284 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 284 insertions(+), 0 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/OrderProcessCollect.vue b/north-glass-erp/northglass-erp/src/components/sd/order/OrderProcessCollect.vue
new file mode 100644
index 0000000..2ed87c4
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/OrderProcessCollect.vue
@@ -0,0 +1,284 @@
+<script setup>
+import {computed, onMounted, reactive, ref, watch} from "vue";
+import {changeFilterEvent, filterChanged} from "@/hook"
+import {useI18n} from "vue-i18n"
+import request from "@/utils/request"
+import {ElMessage} from "element-plus"
+import {copyTableCellValue} from "@/hook/copyTableCellValue";
+const { t } = useI18n()
+const xGrid = ref()
+const gridOptions = reactive({
+ loading:false,
+ border: "full",//琛ㄦ牸鍔犺竟妗�
+ keepSource: true,//淇濇寔婧愭暟鎹�
+ align: 'center',//鏂囧瓧灞呬腑
+ stripe:true,//鏂戦┈绾�
+ showOverflow:true,
+ showFooter: true,//鏄剧ず鑴�
+ rowConfig: {isCurrent: true, isHover: true,height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+ virtualScroll: true, // 寮�鍚櫄鎷熸粴鍔ㄥ姛鑳�
+ id: 'order_process_collect',
+ printConfig: {},
+ importConfig: {},
+ exportConfig: {},
+ // scrollY:{ enabled: true,gt:13 },//寮�鍚櫄鎷熸粴鍔�
+ // scrollX:{ enabled: true,gt:15 },//寮�鍚櫄鎷熸粴鍔�
+ filterConfig: { //绛涢�夐厤缃」
+ // remote: true
+ },
+ columnConfig: {
+ resizable: true,
+ useKey: true
+ },
+
+ customConfig: {
+ storage: true
+ },
+
+
+ columns:[
+
+ ],
+ toolbarConfig: {
+ slots:{
+ buttons: "title"
+ },
+ zoom: true,
+ custom: true
+ },
+ spanMethod ({ row, rowIndex,column, columnIndex}) {
+ const field = column.field
+ if (xGrid.value.isFilter() ) {
+ return { rowspan: 1, colspan: 1 }
+ }
+ if(mergeCells.value!==undefined){
+ if(mergeCells.value[field] !== undefined && mergeCells.value[field][rowIndex+"_"+field] !== undefined){
+ return mergeCells.value[field][rowIndex+"_"+field]
+ }
+ }
+
+ return { rowspan: 1, colspan: 1 }
+ },
+ cellClassName ({ row, column,columnIndex}) {
+ if(column.field === undefined){
+ return null
+ }
+ if (column?.field.indexOf('reportWorkQuantity.')>-1 && row.thisQuantity*1 === row.reportWorkQuantity[column.title]*1){
+ return 'row-green'
+ }
+ return null
+ },
+ footerMethod ({ columns, data }) {//椤佃剼鍑芥暟
+ return[
+ columns.map((column, columnIndex) => {
+ if (columnIndex === 0) {
+ return t('basicData.total')
+ }
+ if (list.value.includes(column.field)) {
+ return footSum(data, column.field)
+ }
+ return ''
+ })
+ ]
+ }
+})
+const list = ref([])
+
+let props = defineProps({
+ orderId:null,
+ row: {},
+ processId:null//鐢ㄤ簬鍚庣鏁版嵁杩斿洖锛岀粨鏋滅瓫閫�
+})
+const columns = [
+ {field: 'product_name', width: 150, title: t('order.product'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+ {field: 'glass_child',width: 130, title: t('reportingWorks.glassChild') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+ {field: 'order_type', width: 120,title: t('order.orderType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+ {field: 'process_id',width: 110, title: t('processCard.processId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+ {field: 'technology_number', width: 90,title: t('processCard.technologyNumber'),showOverflow:"ellipsis",filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
+ {field: 'quantity',slots: { default: 'show'}, width: 90,title: t('order.quantity')},
+ {field: 'thisQuantity', width: 90,title: t('order.glassQuantity')},
+ {field: 'gross_area',slots: { default: 'show'}, width: 90,title: t('order.area')},
+ {field: 'inventory',slots: { default: 'show'},width: 120, title: t('report.inventoryNum')},
+ {field: 'inventoryArea',slots: { default: 'show'},width: 120, title: t('report.StorageArea')},
+ {field: 'broken_num',width: 90, title: t('reportingWorks.quantityBroken')},
+]
+//let column = [0,2,3,5,7,8,9]
+let column = ['product_name','order_type','process_id','quantity','gross_area','inventory','inventoryArea']
+
+
+onMounted(()=>{
+ getWorkOrder()
+})
+
+watch(()=>props.orderId,(newValue)=>{
+ getWorkOrder()
+})
+const show = (row,column ) =>{
+ return row[column.field+'Show']
+}
+
+let mergeCells = ref()
+const getWorkOrder = () => {
+ gridOptions.loading = true
+ request.post(`/report/processCardProgressCollect/${props.orderId}`,column).then(async (res) => {
+ if (res.code == 200) {
+ gridOptions.columns = JSON.parse(JSON.stringify(columns))
+ gridOptions.columns.forEach(item =>{
+ item.filterMethod = filterChanged
+ })
+
+ list.value = ['quantity','thisQuantity','inventory','inventoryArea','gross_area','glassQuantity','broken_num']
+
+ const processList = {
+ title:t('report.workingProcedure'),
+ field:'process',
+ children:[]
+ }
+ res.data.title.forEach((item,index) =>{
+ list.value.push('reportWorkQuantity.'+item.process)
+ let column = {slots: { default: 'quantitySum'},
+ width: 90,
+ title: item.process,
+ field:'reportWorkQuantity.'+item.process}
+ processList.children.push(column)
+
+ })
+ gridOptions.columns.push(processList)
+ res.data.data.forEach(item => {
+ item.reportWorkQuantity=JSON.parse(item.reportWorkQuantity)
+ item.reportWorkQuantityCount=JSON.parse(item.reportWorkQuantityCount)
+ item.reportWorkQuantityShow=JSON.parse(item.reportWorkQuantityShow)
+ })
+ console.log(res.data.data)
+ if (props.processId!=null && props.processId!=""){
+ const processIdData = res.data.data.filter(item => item.process_id === props.processId)
+ await xGrid.value.loadData(processIdData)
+ }else {
+ await xGrid.value.loadData(res.data.data)
+ }
+ mergeCells.value = res.data.mergeCells
+ gridOptions.loading = false
+
+ } else {
+ ElMessage.warning(res.msg)
+ }
+ })
+}
+
+const filterChange = () =>{
+ if(xGrid.value.isFilter()){
+ xGrid.value.clearMergeFooterItems()
+ }else{
+ xGrid.value.updateFooter()
+ }
+
+
+}
+const footSum =(list, field) => {
+ let count = 0
+ list.forEach(item => {
+ if(field.indexOf('.')>-1){
+ let array = field.split('.')
+ //鍒ゆ柇鏄惁涓虹瓫閫夌姸鎬佸拰闈炶鍗曞悎骞剁姸鎬�
+ if(xGrid.value.isFilter() ){
+ count += Number(item[array[0]+'Show'][array[1]]) || 0
+ }else{
+ count += Number(item[array[0]][array[1]]) || 0
+ }
+
+ }else {
+ if(xGrid.value.isFilter() ) {
+ count += Number(item[field+'Show']) || Number(item[field]) || 0
+ } else {
+ count += Number(item[field]) || 0
+ }
+ }
+ })
+ return count.toFixed(2).replace(/\.?0+$/, '');
+}
+
+const quantitySum = ( row,column )=>{
+ const reportWorkQuantityCount = row.reportWorkQuantityCount[column.title] || ''
+ const reportWorkQuantityShow = row.reportWorkQuantityShow[column.title] || ''
+ if(reportWorkQuantityShow===reportWorkQuantityCount){
+ return reportWorkQuantityShow
+ }
+
+ return (reportWorkQuantityShow
+ +'('
+ +reportWorkQuantityCount
+ +')' )
+ //return
+}
+
+const gridEvents = {
+ cellDblclick ({row,column}) {
+ copyTableCellValue(row,column)
+ }
+}
+
+let showTitle = ref(false)
+const changeZoom = ()=> {
+ showTitle.value = !showTitle.value
+}
+</script>
+
+<template>
+ <div style="width: 100%;height: 100%">
+ <vxe-grid
+ @filter-change ='filterChange'
+ height="100%"
+ size="mini"
+ class="mytable-scrollbar"
+ ref="xGrid"
+ @zoom="changeZoom"
+ v-bind="gridOptions"
+ v-on="gridEvents"
+ >
+ <template #num1_filter="{ column, $panel }">
+ <div>
+ <div v-for="(option, index) in column.filters" :key="index">
+ <input
+ type="type"
+ v-model="option.data"
+ @keyup.enter.native="$panel.confirmFilter()"
+ @input="changeFilterEvent($event, option, $panel)"/>
+ </div>
+ </div>
+ </template>
+
+ <template #quantitySum="{ row,column }">
+ <span>{{ quantitySum(row,column) }} </span>
+ </template>
+ <template #show="{ row,column }">
+ <span>{{ show(row,column) }} </span>
+ </template>
+
+ <template #title>
+ <span style="font-weight: bold" v-show="showTitle">
+ {{ row.orderId }}
+ {{ row.project?'--':'' }}
+ {{row.project}}
+ {{ row.batch?'--':'' }}
+ {{row.batch}}
+ </span>
+ </template>
+
+
+ </vxe-grid>
+ </div>
+</template>
+
+<style scoped>
+::v-deep(.vxe-grid .vxe-body--column.row-green) {
+ background-color: #D5EAFF;
+}
+.vxe-grid {
+ /* 绂佺敤娴忚鍣ㄩ粯璁ら�変腑 */
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ transform: translateZ(0);
+}
+</style>
\ No newline at end of file
--
Gitblit v1.8.0