廖井涛
2024-05-23 dd80c84ccb3d2784a016db54c4de6565368a6e97
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectProcessCard.vue
@@ -13,6 +13,7 @@
import {VXETable} from "vxe-table";
import { useI18n } from 'vue-i18n'
import  useUserInfoStore from '@/stores/userInfo'
import {toolbarButtonClickEvent} from "@/hook/mouseMove";
//语言获取
const { t } = useI18n()
const userStore = useUserInfoStore()
@@ -27,35 +28,6 @@
  switch (type) {
    case 'select' : {
      router.push({path: '/main/processCard/SelectDetailProcessCard', query: { processId: row.processId }})
      break
    }
    case 'setType': {
      let state=row.layoutStatus
      if (state=='可排版'){
        request.post(`/processCard/updateLayoutStatus/${row.processId}/2`).then((res) => {
          if (res.code == 200) {
            ElMessage.success(t('processCard.typesettingSuccess')
            )
            router.push({path: '/main/processCard/SelectProcessCard', query: {random:Math.random()}})
          } else {
            ElMessage.warning(res.msg)
          }
        })
      }
      else if(state=='不可排版'){
        request.post(`/processCard/updateLayoutStatus/${row.processId}/1`).then((res) => {
          if (res.code == 200) {
            ElMessage.success(t('processCard.modifySuccessfully'))
            router.push({path: '/main/processCard/SelectProcessCard', query: {random:Math.random()}})
          } else {
            ElMessage.warning(res.msg)
          }
        })
      }
      break
    }
    case 'delete': {
@@ -74,17 +46,15 @@
}
function padLeftZero(str) {
  return ('00' + str).substr(str.length)
}
//定义时间
//定义变量
const form = reactive({
  date1: '',
  getSelect:'不可排版'
})
//表尾求和
@@ -187,7 +157,8 @@
  let endTime = form.date1[1]
  request.post(`/processCard/flowCard/${pageNum.value}/${total.pageSize}/${startTime}/${endTime}`, 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
      xGrid.value.loadData(res.data.data)
      gridOptions.loading = false
@@ -231,11 +202,11 @@
  request.post(`/processCard/flowCard/1/${total.pageSize}/${startTime}/${endTime}`, filterData.value).then((res) => {
    if(res.code==200){
      pageTotal.value=res.data.total
      total.dataTotal = res.data.total.total*1
      total.pageTotal=parseInt(res.data.total)
      pageNum.value=1
      produceList = deepClone(res.data.data)
      xGrid.value.loadData(produceList)
      xGrid.value.reloadData(produceList)
      gridOptions.loading=false
    }else{
      ElMessage.warning(res.msg)
@@ -282,33 +253,51 @@
  },//表头参数
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: 50},
    {title: t('basicData.operate'), width: 160, slots: { default: 'button_slot' },fixed:"left"},
    {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
    {title: t('basicData.operate'), width: 100, slots: {default: 'button_slot'}, fixed: "left"},
    { type: 'seq',fixed:"left", title: t('basicData.Number'), width: 50 },
    {field: 'orderId', title: t('order.orderId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' },width: 110 },
    {field: 'processId', width: 140, title: t('processCard.processId') ,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'orderDetail.productId', title: t('order.productId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },},
    {field: 'orderDetail.productName', title: t('order.product'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 180},
    {
      field: 'processId',
      width: 140,
      title: t('processCard.processId'),
      showOverflow: "ellipsis",
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'}
    },
    {
      field: 'orderDetail.productId',
      title: t('order.productId'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
    },
    {
      field: 'orderDetail.productName',
      title: t('order.product'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      width: 180
    },
    {field: 'order.project', title: t('order.project') ,showOverflow:"ellipsis"},
    {field: 'quantity', title: t('order.quantity'), },
    {field: 'orderDetail.computeGrossArea', title: t('order.area'), },
    {field: 'founder', title: t('processCard.founder'), },
    {field: 'orderDetail.processingNote', title: t('order.processingNote'), },
    {field: 'layoutStatus', title: t('processCard.layoutStatus'), }
    {field: 'layoutStatus',width:100, title: t('processCard.layoutStatus'), filters: [{data: ''}], slots: {filter: 'select_filter'}}
  ],//表头按钮
  toolbarConfig: {
    // buttons: [{
    //
    // }],
    buttons: [
      {code: 'update', name: '排版', status: 'primary'},
    ],
    import: false,
    // export: true,
    // print: true,
    zoom: true,
    custom: true
  },
  data:  [
  ],//table body实际数据
  data: [],//table body实际数据
  //脚部求和
  footerMethod({columns, data}) {//页脚函数
    let footList = ['', '',]
@@ -327,6 +316,66 @@
})
const sexOptions = ref([
  {label: '已排版', value: '已排版'},
  {label: '可排版', value: '可排版'},
  {label: '不可排版', value: '不可排版'}
])
//表格按钮
const gridEvents = {
  async toolbarButtonClick({code}) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'update': {
          const $table = xGrid.value
          if ($table) {
            const selectRecords = $table.getCheckboxRecords()
            if (selectRecords.length == 0) {
              ElMessage.warning("请勾选需要的数据")
              return;
            }
            let composingData = ref({
              composing: selectRecords,
            })
            //修改排版状态
            request.post("/processCard/updateComposing", composingData.value).then((res) => {
              if (res.code == 200 && res.data === true) {
                ElMessage.success("修改成功")
                router.push({
                  path: '/main/processCard/SelectProcessCard',
                  query: {random: Math.random()}
                })
              } else {
                ElMessage.warning('修改失败')
              }
            })
          }
          return;
        }
      }
    }
  }
}
const checkBoxConfig = {
  checkMethod: ({row}) => {
    if (row['layoutStatus'] === '可排版' || row['layoutStatus'] === '已排版') {
      return row.disable
    } else {
      return !row.disable
    }
  },
  reserve: true
}
</script>
@@ -337,30 +386,32 @@
      <el-row :gutter="0">
        <el-date-picker
            v-model="form.date1"
            type="daterange"
            format="YYYY/MM/DD"
            value-format="YYYY-MM-DD"
            :start-placeholder="$t('basicData.startDate')"
            :end-placeholder="$t('basicData.endDate')"
            :default-time="defaultTime"
            :end-placeholder="$t('basicData.endDate')"
            :start-placeholder="$t('basicData.startDate')"
            format="YYYY/MM/DD"
            type="daterange"
            value-format="YYYY-MM-DD"
        />
        &nbsp;&nbsp;
        <el-button
            @click="getWorkOrder"
            id="select"
            type="primary" :icon="Search">{{$t('basicData.search')}}
            :icon="Search"
            type="primary" @click="getWorkOrder">{{ $t('basicData.search') }}
        </el-button>
      </el-row>
    </div>
    <vxe-grid
        max-height="100%"
        @filter-change="filterChanged"
        class="mytable-scrollbar"
        ref="xGrid"
        :checkbox-config="checkBoxConfig"
        class="mytable-scrollbar"
        max-height="100%"
        v-bind="gridOptions"
        v-on="gridEvents"
        @filter-change="filterChanged"
    >
      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
@@ -381,20 +432,20 @@
      <template #button_slot="{ row }" >
<!--        <el-button @click="getTableRow(row,'select')" link type="primary" size="small">{{$t('basicData.edit')}}-->
<!--        </el-button>-->
        <el-button @click="getTableRow(row,'select')"
                   v-if="userStore.user.permissions.indexOf('SelectProcessCard.edit') > -1"
        <el-button v-if="userStore.user.permissions.indexOf('SelectProcessCard.edit') > -1"
                   link
                   size="small"
                   type="primary"
                   size="small">
                   @click="getTableRow(row,'select')">
          {{ $t('basicData.edit') }}
        </el-button>
        <el-button v-if="row.layoutStatus=='可排版'" @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.composing')}}</el-button>
        <el-button v-else-if="row.layoutStatus=='不可排版'" @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.composingOk')}}</el-button>
        <el-button v-else-if="row.layoutStatus=='已排版'" disabled @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.typesetter')}}</el-button>
        <!--        <el-button v-if="row.layoutStatus=='可排版'" @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.composing')}}</el-button>-->
        <!--        <el-button v-else-if="row.layoutStatus=='不可排版'" @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.composingOk')}}</el-button>-->
        <!--        <el-button v-else-if="row.layoutStatus=='已排版'" disabled @click="getTableRow(row,'setType')" link type="primary" size="small">{{$t('processCard.typesetter')}}</el-button>-->
<!--        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">{{$t('basicData.delete')}}</el-button>-->
        <el-popconfirm   @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')">
        <el-popconfirm :title="$t('searchOrder.deleteConfirm')" @confirm="getTableRow(row,'delete')">
          <template #reference>
            <el-button  link type="primary" size="small">{{ $t('basicData.delete') }}</el-button>
            <el-button link size="small" type="primary">{{ $t('basicData.delete') }}</el-button>
          </template>
        </el-popconfirm>
      </template>
@@ -402,7 +453,19 @@
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="text" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/>
            <input v-model="option.data" type="text" @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </div>
      </template>
      <template #select_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <select v-model="option.data" @change="changeFilterEvent($event, option, $panel)" style="width: 100%">
              <option  value="已排版" label="已排版"></option>
              <option  value="可排版" label="可排版"></option>
              <option  value="不可排版" label="不可排版"></option>
            </select>
          </div>
        </div>
      </template>
@@ -410,12 +473,12 @@
        <!--使用 pager 插槽-->
        <!--        'PrevJump','NextJump', -->
        <vxe-pager
            @page-change="handlePageChange"
            :layouts="[  'PrevPage', 'Jump','PageCount', 'NextPage',  'Total']"
            v-model:current-page="pageNum"
            v-model:page-size="total.pageSize"
            v-model:pager-count="total.pageTotal"
            :layouts="[  'PrevPage', 'Jump','PageCount', 'NextPage',  'Total']"
            :total="total.dataTotal"
            @page-change="handlePageChange"
        >
        </vxe-pager>
      </template>
@@ -429,6 +492,7 @@
  width: 99%;
  height: 100%;
}
#selectForm {
  width: 40%;
  text-align: center;