廖井涛
2024-07-25 15fa56463061f1e94140e23e98987aa3131714bf
north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCard.vue
@@ -11,7 +11,8 @@
import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
import PrintProcess from '@/components/pp/PrintProcess.vue'
import PrintLabel from '@/views/pp/processCard/PrintLabel.vue'
import PrintCustomLabel from '@/views/pp/processCard/PrintCustomLabel.vue'
import PrintCustomLabel from '@/components/pp/PrintCustomLabel.vue'
import PrintCustomLabelSemi from '@/components/pp/PrintCustomLabelSemi.vue'
import SortDetail from '@/components/pp/SelectSortDetailProcessCard.vue'
import footSum from "@/hook/footSum"
import companyInfo from "@/stores/sd/companyInfo"
@@ -29,6 +30,10 @@
const printVisible= ref(false)
let selectRecords = ref(null)
const selectRecordsData = ref({
  printList: []
})
const xGrid = ref(null)
const xGridDetail =ref(null)
@@ -41,8 +46,19 @@
//打印
let  printRow = ref({
  list:null,
  printMergeVal:null
  printMergeVal:null,
  like:null
})
//标签
let  labelRow = ref({
  list:null,//勾选的数据
  faceOrientation:null,//内外面
  type:null,//标签模板
  lableType:null//标签类型
})
const getTableRow = (row,type) => {
  switch (type) {
@@ -132,6 +148,16 @@
})
const printContentLabel = ref({
  id: 'childLabel',
})
const printContentLabelSemi = ref({
  id: 'childLabelSemi',
})
//打印类型
const printType = ref()
@@ -140,26 +166,30 @@
  dataType: [],
})
const data = ref({
  printList: []
})
const {currentRoute} = useRouter()
const route = currentRoute.value
let orderId = route.query.orderId
data.value.printList=JSON.parse(route.query.printList)
// 第一次加载查询
request.post(`/processCard/selectPrint/${orderId}`, filterData.value).then((res) => {
request.post(`/processCard/selectPrint`, data.value).then((res) => {
  if (res.code == 200) {
    produceList = produceList.value.concat(deepClone(res.data.data))
    let newDataCollection = [];
    for (let i = 0; i <res.data.data.length ; i++) {
      res.data.data[i].detail.forEach((item) =>{
        newDataCollection.push(item);
      })
    }
    titleSelectJson.value.dataType = res.data.type
    produceList.forEach(item => {
      if(item.print_status == 1){
        item.print_status='已打印'
      }
      else if (item.print_status == 0){
        item.print_status='未打印'
      }
    });
    xGrid.value.reloadData(produceList)
    xGrid.value.reloadData(newDataCollection)
    gridOptions.loading = false
    hideButton()
  } else {
@@ -224,7 +254,7 @@
      title: t('order.orderId'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
      filterMethod: filterChanged,width: 120
    },
    {
      field: 'process_id',
@@ -232,36 +262,39 @@
      showOverflow: "ellipsis",
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
      filterMethod: filterChanged,width: 140
    },
    {
      field: 'customer_name',
      title: t('customer.customerName'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
      filterMethod: filterChanged,width: 120
    },
    {
      field: 'project',
      title:  t('order.project'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
      filterMethod: filterChanged,width: 120
    },
    {field: 'technology_number', title: t('processCard.technologyNumber'), showOverflow: "ellipsis"},
    {field: 'glass_address', title: t('processCard.glassAddress'),},
    {field: 'quantity', title:  t('order.quantity'),},
    {field: 'total_area', title:  t('order.area'),},
    {field: 'product_name', title: t('order.product'),},
    {field: 'glass_child', title: t('reportingWorks.glassChild'),filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod: filterChanged},
    {field: 'founder', title: t('processCard.founder'),},
    {field: 'splitFrame_time', title: t('processCard.splitFrameTime'),},
    {field: 'technology_number', title: t('processCard.technologyNumber'), showOverflow: "ellipsis",width: 90},
    {field: 'glass_address', title: t('processCard.glassAddress'),width: 90},
    {field: 'quantity', title:  t('order.quantity'),width: 90},
    {field: 'total_area', title:  t('order.area'),width: 90},
    {field: 'product_name', title: t('order.product'),width: 120},
    {field: 'glass_child', title: t('reportingWorks.glassChild'),width: 120,filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod: filterChanged},
    {field: 'founder', title: t('processCard.founder'),width: 120},
    {field: 'splitFrame_time', title: t('processCard.splitFrameTime'),width: 120},
    {field: 'process', title: t('craft.process'),filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 160},
    {
      field: 'print_status',
      title: t('processCard.printStatus'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
      filterMethod: filterChanged,width: 120
    },
  ],//表头按钮
@@ -271,6 +304,7 @@
      {code: 'customLabel', name: t('processCard.customLabelPrinting'), status: 'primary'},
      {code: 'printLabel', name: t('processCard.labelPrinting'), status: 'primary'},
      {code: 'printLabel2', name: t('processCard.labelPrinting2'), status: 'primary'},
      {code: 'printLike', name: "同配置打印", status: 'primary'},
    ],
    // import: false,
    // export: true,
@@ -302,9 +336,9 @@
  toolbarButtonClick ({ code}) {
    const $grid = xGrid.value
    selectRecords = $grid.getCheckboxRecords()
    selectRecords.forEach(obj => {
      delete obj.print_status;
    });
    // selectRecords.forEach(obj => {
    //   delete obj.print_status;
    // });
    let type=printType.value
    let faceOrientation=stateValue.value
    let lableTypes=lableType.value
@@ -327,6 +361,7 @@
          }
          printRow.value.list = JSON.stringify(selectRecords)
          printRow.value.printMergeVal=printMerge.value
          printRow.value.like=null
        // router.push({path: '/main/processCard/printProcess', query: {printList: JSON.stringify(selectRecords),printMerge:printMergeVal}})
          dialogTableVisible.value=true
          break
@@ -416,18 +451,55 @@
          }
          if (lableTypes==1){
            router.push({path: '/main/processCard/PrintCustomLabel', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
            labelRow.value.list=JSON.stringify(selectRecords)
            labelRow.value.faceOrientation=faceOrientation
            labelRow.value.type=type
            labelRow.value.lableType= lableTypes
            dialogTableVisibleLabel.value=true
            //router.push({path: '/main/processCard/PrintCustomLabel', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }
          else if (lableTypes==2) {
            router.push({path: '/main/processCard/PrintCustomLabelSemi', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
            labelRow.value.list=JSON.stringify(selectRecords)
            labelRow.value.faceOrientation=faceOrientation
            labelRow.value.type=type
            labelRow.value.lableType= lableTypes
            dialogTableVisibleCustomLabel.value=true
            //router.push({path: '/main/processCard/PrintCustomLabelSemi', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }else if (lableTypes==3) {
          }else
            if (lableTypes==3) {
            router.push({path: '/main/processCard/PrintLabel1', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }
          break
        }
        case 'printLike': {
          if(selectRecords===null ||selectRecords===''||selectRecords.length===0){
            ElMessage.warning(t('searchOrder.msgList.checkOrder'))
            return
          }
          if(printMerge.value===null ||printMerge.value===''){
            ElMessage.warning('请填入需要合并的层')
            return
          }
          let id = ""
          for (let i = 0; i < selectRecords.length; i++) {
            if (i + 1 === selectRecords.length) {
              id += selectRecords[i].id
            } else {
              id += selectRecords[i].id + "|"
            }
          }
          printRow.value.list = JSON.stringify(selectRecords)
          printRow.value.printMergeVal=printMerge.value
          printRow.value.like="1"
          // router.push({path: '/main/processCard/printProcess', query: {printList: JSON.stringify(selectRecords),printMerge:printMergeVal}})
          dialogTableVisible.value=true
          break
        }
      }
@@ -447,9 +519,25 @@
  gridOptions.toolbarConfig.buttons = gridOptions.toolbarConfig.buttons.filter(button => {
    // 这里根据 hidePrintLabels 的值决定是否隐藏 printLabel 和 printLabel2
    if (hidePrintLabels=='true') {
      return button.code !== 'printLabel' && button.code !== 'printLabel2';
      return button.code !== 'printLabel' && button.code !== 'printLabel2' ;
    } else {
      return true; // 不隐藏任何按钮
      return true && button.code !=='printLike'; // 显示该按钮
    }
  })
}
// 监听打印完成事件
const printNumber = () =>{
  selectRecordsData.value.printList=selectRecords
  let printState=0
  request.post(`/processCard/updatePrintState/${printState}`, selectRecordsData.value).then((res) => {
    if (res.code == 200 && res.data === true) {
    } else {
      ElMessage.warning(t('basicData.msg.saveFail'))
    }
  })
}
@@ -490,8 +578,7 @@
    <vxe-grid
        ref="xGrid"
        class="mytable-scrollbar"
        height="600px"
        max-height="100%"
        height="100%"
        v-bind="gridOptions"
        v-on="gridEvents"
@@ -534,6 +621,7 @@
    </vxe-grid>
<!--  流程卡打印  -->
    <el-dialog
        id="sizePrintCalrd"
        v-model="dialogTableVisible"
@@ -541,30 +629,53 @@
        destroy-on-close
        style="width: 75%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContent"  :icon="Printer" circle />
        <el-button v-print="printContent" @click="printNumber"  :icon="Printer" circle />
      </template>
      <print-process id="child" :printList="printRow.list" :printMerge="printRow.printMergeVal"
                    style="width: 100%;height: 100%" />
      <print-process
          id="child"
          :printList="printRow.list"
          :printMerge="printRow.printMergeVal"
          :printLike="printRow.like"
          style="width: 100%;height: 100%" />
    </el-dialog>
<!--    成品标签-->
    <el-dialog
        id="sizeCustom"
        v-model="dialogTableVisibleLabel"
        destroy-on-close
        :title="$t('processCard.printLabel')"
        style="width: 80%;height:75% ">
      <PrintLabel :printList="selectRecords"
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContentLabel"   :icon="Printer" circle />
      </template>
      <print-custom-label id="childLabel"
                          :list="labelRow.list"
                          :faceOrientation="labelRow.faceOrientation"
                          :type="labelRow.type"
                          :lableType="labelRow.lableType"
                  style="width: 100%;height: 100%" />
    </el-dialog>
<!--   小片标签 -->
    <el-dialog
        id="sizeCustomSemi"
        v-model="dialogTableVisibleCustomLabel"
        destroy-on-close
        :title="$t('processCard.labelStyle')"
        style="width: 80%;height:75% ">
      <PrintLabel :printList="selectRecords"
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContentLabelSemi"   :icon="Printer" circle />
      </template>
      <print-custom-label-semi id="childLabelSemi"
                               :list="labelRow.list"
                               :faceOrientation="labelRow.faceOrientation"
                               :type="labelRow.type"
                               :lableType="labelRow.lableType"
                  style="width: 100%;height: 100%" />
    </el-dialog>
<!--    排序-->
    <el-dialog
        id="sizeCheck"
        v-model="printVisible"
@@ -596,4 +707,16 @@
  overflow-y: auto;
}
:deep(#sizeCustom .el-dialog__body){
  height: 85%;
  width: 100%;
  overflow-y: auto;
}
:deep(#sizeCustomSemi .el-dialog__body){
  height: 85%;
  width: 100%;
  overflow-y: auto;
}
</style>