PartWorking.vue 8.51 KB
<script src="../../permission.js"></script>
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form  layout="inline" @keyup.enter.native="query">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="项目名称">
              <j-popup  v-model="queryParam.workOrder" code="find_projectc"
                        field="field0056"
                        orgFields="field0056,field0054,field0055,field0057"
                        destFields="field0056,field0054,field0055,field0057" :trigger-change="true" @callback="findCarNumberClick" :multi="false"/>
            </a-form-item>
          </a-col>


          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="query" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <span style="font-size: 18px;color: red">{{total}}</span>
    <!-- table区域-begin -->
    <div>

      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{
          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

         <span slot="findPerson" slot-scope="text, record">
            <a @click="findPerson(record)">{{record.nums}}</a>
        </span>

        <span slot="departWorking" slot-scope="text, record">
            <a @click="departWorking(record)">{{record.hours}}</a>
        </span>
      </a-table>

    </div>
    <j-popup
      v-show="showRentPrise"
      ref="person_details"
      code="workingPerson"
      :param="materialParam"
      org-fields="username"
      dest-fields="popup"
      field="popup"/>
    <j-popup
      v-show="showRentPrise"
      ref="depart_details"
      code="departWorking"
      :param="materialParam"
      org-fields="username"
      dest-fields="popup"
      field="popup"/>
    <j-popup
      v-show="showRentPrise"
      ref="inventory_details"
      code="find_inventory"
      :param="inventoryParam"
      org-fields="username"
      dest-fields="popup"
      field="popup"/>
    <materia-item-list ref="materiaFrom"></materia-item-list>
  </a-card>
</template>

<script>
import { getPartWorkList,getProjectSum} from '@api/api'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import { downFile } from '@/api/manage'
import {ajaxGetDictItems} from "../../api/api";
import MateriaItemList from "../system/modules/MateriaItemList";



export default {
  name: 'PartWorking',
  mixins: [JeecgListMixin],
  components: {MateriaItemList},
  data() {
    return {
      materialParam:{code:''},
      shipmentParam:{code:'',moCode:''},
      inventoryParam:{code:''},
      param1:{field0054:'',field0057:''},
      description: '菜单管理页面',
      field0056:'',
      field0054:'',
      field0055:'',
      field0057:'',
      total:'',
      materia_Attr:[],
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        }
        ,
        {
          title: '项目名称',
          align: 'center',
          dataIndex: 'projectName',
          ellipsis: true
        },
        {
          title: '部件名称',
          align: 'center',
          dataIndex: 'partName',
          ellipsis: true
        },
        {
          title: '部件号',
          align: 'center',
          dataIndex: 'partNo',
          ellipsis: true
        },
        {
          title: '进度',
          align: 'center',
          dataIndex: 'progress',
          ellipsis: true
        },
        {
          title: '报工人数',
          align: 'center',
          dataIndex: 'nums',
          ellipsis: true,
          scopedSlots:{
            customRender:'findPerson'
          }
        },
        {
          title: '合格数量',
          align: 'center',
          dataIndex: 'qty'
        },
        {
          title: '总工时(小时)',
          align: 'center',
          dataIndex: 'hours',
          scopedSlots:{
            customRender:'departWorking'
          }
        },
        {
          title: '总工时(分钟)',
          align: 'center',
          dataIndex: 'time'
        },
        {
          title: '生产中',
          align: 'center',
          dataIndex: 'status1'
        },
        {
          title: '完成',
          align: 'center',
          dataIndex: 'status2'
        },
        {
          title: '超时完成',
          align: 'center',
          dataIndex: 'status3'
        }
      ],
      url: {
        list: '/working/working/partWoringList',
        exportXlsUrl: "/config/bom/exportMaterialShortageXls"
      },
      loading: false,
      queryParam: {},
      projectNameList: ['name','workOrder'],
    }
  },
  created() {
    this.loadFrom();
  },
  methods: {
    findCarNumberClick(row){
      this.field0056=row.field0056;
      this.field0054=row.field0054;
      this.field0055=row.field0055;
      this.field0057=row.field0057;
      this.param1['field0057'] =row.field0057;
      this.param1['field0054'] =row.field0054;
    },
    findCarNumberClick2(row){
    },

    loadFrom() {
      getProject().then((res) => {
        if (res.success) {
          this.projectNameList = res.result;
        }
      })
    },

    getProjectSum() {
      let params = {
        "field0056":this.field0056
      }
      let obj = getProjectSum(params);
      obj.then((res) => {
        this.total = res;
      })
    },

    findPerson(data){
      this.materialParam['code'] = "'"+data.headerId+"'";
      this.$refs.person_details.openModal();
    },

    searchReset(){
      this.queryParam.workOrder=''
    },

    departWorking(data){
      this.materialParam['code'] = "'"+data.headerId+"'";
      this.$refs.depart_details.openModal();
    },

    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },

    toExportXls(fileName){
      if(!fileName || typeof fileName != "string"){
        fileName = "导出文件"
      }
      let params = {
        "field0056":this.field0056,
        "field0054":this.field0054,
        "field0055":this.field0055,
        "field0057":this.field0057,
        "cno":this.queryParam.bomCode,
        "attr":this.queryParam.attr,
        "pno":this.queryParam.pno,
        "type":'2'
      }
      downFile(this.url.exportXlsUrl,params).then((data)=>{
        if (!data) {
          this.$message.warning("文件下载失败")
          return
        }
        if (data.size<100){
          this.$message.warning("请先查询出列表,再导出")
          return
        }
        if (typeof window.navigator.msSaveBlob !== 'undefined') {
          window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
        }else{
          let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
          let link = document.createElement('a')
          link.style.display = 'none'
          link.href = url
          link.setAttribute('download', fileName+'.xls')
          document.body.appendChild(link)
          link.click()
          document.body.removeChild(link); //下载完成移除元素
          window.URL.revokeObjectURL(url); //释放掉blob对象
        }
      })
    },



    test(){
     return true;
    },

    query()  {
      this.getProjectSum();
      this.loading=true;
      let params = {
        "field0056":this.field0056
      }
      getPartWorkList(params).then((res) => {
        if (res.success) {
          this.loading=false;
          this.dataSource = res.result;
        }else {
          this.loading=false;
          this.$message.warning(res.message);
        }
      })
    }
  },
}
</script>

<style scoped>

</style>