廖井涛
2024-07-25 15fa56463061f1e94140e23e98987aa3131714bf
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectPrintFlowCard.vue
@@ -7,19 +7,24 @@
import {Search} from "@element-plus/icons-vue";
import {useI18n} from 'vue-i18n'
import {changeFilterEvent, filterChanged} from "@/hook"
import footSum from "@/hook/footSum"
import TagStyle from "@/components/pp/TagStyle.vue"
import OrderSortDetail from '@/components/pp/OrderSortDetail.vue'
//语言获取
const {t} = useI18n()
let router = useRouter()
const printVisible= ref(false)
//排序
let editRow = ref({
  orderId:null,
})
//定义页面总页数
let pageTotal = ref('')
//定义数据返回结果
let produceList = ref([])
//定义当前页数
let pageNum = $ref(1)
let pageState = null
let titleStyleVisible = ref(false)
const form = reactive({
  date1: '',
@@ -30,6 +35,11 @@
  switch (type) {
    case 'edit' :{
      router.push({path: '/main/processCard/PrintFlowCard', query: { orderId: row.order_id }})
      break
    }
    case 'sort' :{
      editRow.value.orderId = row.order_id
      printVisible.value = true
      break
    }
  }
@@ -56,7 +66,7 @@
//获取七天前到当前时间
function getNowTime() {
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)
  const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 15)
      .toISOString()
      .replace('T', ' ')
      .slice(0, 10) //默认开始时间7天前
@@ -118,7 +128,6 @@
  })
}
//子组件接收参数
const xGrid = ref()
const gridOptions = reactive({
  loading: true,
@@ -127,7 +136,7 @@
  align: 'center',//文字居中
  stripe: true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
  id: 'CustomerList',
  id: 'SelectPrintFlowCard',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
@@ -146,39 +155,43 @@
  },
  editConfig: {
    trigger: 'click',
    trigger: 'dblclick',
    mode: 'row',
    showStatus: true
  },
  //表头参数
  columns: [
    {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
    {title: t('basicData.operate'), width: 80, slots: { default: 'button_slot' },fixed:"left"},
    {type: 'checkbox', fixed: "left", title: t('basicData.check'),width: 78},
    {title: t('basicData.operate'), width: 100, slots: { default: 'button_slot' },fixed:"left"},
    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
    {
      field: 'order_id',
      title: '销售单号',
      title: t('order.orderId'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
    },
    {field: 'customer_name', title: t('processCard.customerName'), filters: [{data: ''}], slots: {filter: 'num1_filter'},
      filterMethod: filterChanged, width: 110},
    {
      field: 'project',
      title: '项目名称',
      title: t('order.project'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
    },
    {
      field: 'quantity',
      title: '数量',
      title: t('order.quantity'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
    },
    {
      field: 'area',
      title: '面积',
      title: t('order.area'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged
@@ -186,24 +199,26 @@
  ],//表头按钮
  toolbarConfig: {
    buttons: [],
    import: false,
    // export: true,
    // print: true,
    buttons: [
      {code: 'editCheckbox', name: t('basicData.edit'), status: 'primary'},
      {'code': 'titleStyle', 'name': t('processCard.labelStyle'),status: 'primary'},
    ],
    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",'area',]
        if (List.includes(column.field)) {
          return footSum(data, column.field)
        }
        return ''
      })
@@ -211,6 +226,40 @@
  }
})
const gridEvents = {
  async toolbarButtonClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'titleStyle':  {
          titleStyleVisible.value = true
          break
        }
        case 'editCheckbox': {
          const selectRecords = $grid.getCheckboxRecords()
          if(selectRecords===null ||selectRecords===''||selectRecords.length===0){
            ElMessage.warning(t('searchOrder.msgList.checkOrder'))
            return
          }
          let orderIdList = ""
          for (let i = 0; i < selectRecords.length; i++) {
            if (i + 1 === selectRecords.length) {
              orderIdList += selectRecords[i].order_id
            } else {
              orderIdList += selectRecords[i].order_id + "|"
            }
          }
          let array = orderIdList.split('|');
          router.push({path: '/main/processCard/PrintFlowCard', query: {printList: JSON.stringify(selectRecords)}})
          return;
        }
      }
    }
  }
}
</script>
@@ -220,9 +269,9 @@
      <el-row :gutter="0">
        <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="开始时间"
            type="daterange"
            value-format="YYYY-MM-DD"
@@ -230,7 +279,7 @@
        &nbsp;&nbsp;
        <el-input v-model="form.orderId" :placeholder="$t('order.orderId')" clearable style="width: 110px"></el-input>
        &nbsp;&nbsp;
        <el-input v-model="form.project" clearable placeholder="项目名称" style="width: 110px"></el-input>
        <el-input v-model="form.project" clearable :placeholder="$t('order.project')" style="width: 110px"></el-input>
        &nbsp;&nbsp;
        <el-button
            id="select"
@@ -242,9 +291,9 @@
    <vxe-grid
        ref="xGrid"
        class="mytable-scrollbar"
        height="100%"
        max-height="100%"
        height="95%"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
      <!--      下拉显示所有信息插槽-->
@@ -260,7 +309,8 @@
      </template>
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{$t('basicData.edit')}}</el-button>
<!--        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{$t('basicData.edit')}}</el-button>-->
        <el-button @click="getTableRow(row,'sort')" link type="primary" size="small">{{$t('processCard.sorting')}}</el-button>
      </template>
      <template #num1_filter="{ column, $panel }">
@@ -273,6 +323,24 @@
    </vxe-grid>
    <el-dialog
        id="titleStyle"
        :title="$t('processCard.labelStyle')"
        style="width: 70%;height:70% "
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        v-model="titleStyleVisible">
      <tag-style style="width: 100%;height: 100%"/>
    </el-dialog>
    <el-dialog
        id="sizeCheck"
        v-model="printVisible"
        :title="$t('processCard.processCardDetails')"
        destroy-on-close
        style="width: 80%;height:75% ">
      <order-sort-detail id="child"  :orderId="editRow.orderId"  />
    </el-dialog>
  </div>
</template>
@@ -284,6 +352,14 @@
#selectForm {
  width: 60%;
}
:deep(#titleStyle .el-dialog__body){
  height: 90%;
  width: 100%;
}
:deep(#sizeCheck .el-dialog__body){
  height: 90%;
  width: 100%;
}
</style>