cuijian
2023-11-16 e0cd695c11734348e1e01304bdff0696768c1fda
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementModalList.vue
@@ -7,45 +7,14 @@
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="6"  v-if="isDepartType == 0">
              <a-form-item label="部门" v-if="isDepartType == 0">
                <!--<a-select v-model="queryParam.sectionPid" placeholder="请选择部门" :options="sectionPData" @change="initGroupOptions" />-->
                <a-tree-select
                  v-model="value"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="treeData"
                  placeholder="请选择部门"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
           <a-col :md="8" :sm="8">
             <a-form-item label="时间">
               <a-range-picker @change="dateParamChange" format="YYYYMMDD" v-model="dates"/>
             </a-form-item>
           </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="车间" >
                <!--<a-select v-model="queryParam.sectionId" placeholder="请选择团队" :options="sectionData"/>-->
                <a-tree-select
                  v-model="valueProduct"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="sectionData"
                  placeholder="请选择车间"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="设备编码">
                <a-input placeholder="请输入设备编码检索" v-model="queryParam.equipmentId"></a-input>
              <a-form-item label="统一编码">
                <a-input placeholder="请输入统一编码检索" v-model="queryParam.equipmentId"></a-input>
              </a-form-item>
            </a-col>
@@ -68,6 +37,11 @@
                 :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
                 @change="handleTableChange">
                    <span slot="isDaySpan" slot-scope="text, record">
           <span v-if="text == 'true'">是</span>
           <span v-if="text == 'false'">否</span>
         </span>
        </a-table>
      </div>
      <!-- table区域-end -->
@@ -77,6 +51,7 @@
<script>
  import {mapActions} from 'vuex'
  import { filterObj } from '@/utils/util';
  import {
    ajaxGetSelectItems
  } from '@/api/api'
@@ -98,7 +73,7 @@
  export default {
    name: 'DeviceCalendarListModel',
    mixins: [JeecgListMixin],
    // mixins: [JeecgListMixin],
    components: {
      JDictSelectTag,
      JEllipsis,
@@ -113,7 +88,43 @@
      }
    },
    data() {
      return {
      return{
        /* 查询条件-请不要在queryParam中声明非字符串值的属性 */
        queryParam: {},
        /* 数据源 */
        dataSource:[],
        /* 分页参数 */
        ipagination:{
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " 共" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        /* 排序参数 */
        isorter:{
          column: 'createTime',
          order: 'desc',
        },
        /* 筛选参数 */
        filters: {},
        /* table加载状态 */
        loading:false,
        /* table选中keys*/
        selectedRowKeys: [],
        /* table选中records*/
        selectionRows: [],
        /* 查询折叠 */
        toggleSearchStatus:false,
        /* 高级查询条件生效状态 */
        superQueryFlag:false,
        /* 高级查询条件 */
        superQueryParams: '',
        dates:[],
        isDepartType:'',
        /*readOnly:true,*/
        title:'',
@@ -132,11 +143,15 @@
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },{
            title: '设备编码',
          }, {
            title: '日期',
            align: 'center',
            dataIndex: 'equipmentId',
            dataIndex: 'effectiveDate',
          },
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId'
          },
          {
            title: '设备名称',
@@ -144,20 +159,46 @@
            dataIndex: 'equipmentName',
          },
          {
            title: '驱动类型',
            title: '班制',
            align: 'center',
            dataIndex: 'driveType'
            dataIndex: 'shiftName'
          },
          {
            title: '数控系统',
            title: '班次',
            align: 'center',
            dataIndex: 'controlSystem'
            dataIndex: 'shiftSubName'
          },
          {
            title: '开始时间',
            align: 'center',
            dataIndex: 'startDate'
          },
          {
            title: '结束时间',
            align: 'center',
            dataIndex: 'endDate'
          },
          {
            title: '是否跨天',
            align: 'center',
            dataIndex: 'isDaySpan',
            scopedSlots: { customRender: 'isDaySpan' }
          },
          {
            title: '开始休息时间',
            align: 'center',
            dataIndex: 'sleepStartDate'
          },
          {
            title: '结束休息时间',
            align: 'center',
            dataIndex: 'sleepEndDate'
          }
        ],
        sectionPData: [],
        sectionData: [],
        url: {
          list: '/mdc/mdcEquipment/findEquipmentList',
          list: '/mdc/mdcDeviceCalendar/list',
          loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
          loadProductionOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
        },
@@ -165,8 +206,12 @@
        valueProduct:undefined
      }
    },
    created() {
      this.queryTreeData()
    created(){
      // this.dates = [moment().subtract('days', 0), moment().subtract('days', 0)]
      // this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD')
      // this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD')
      // this.queryTreeData()
      this.loadData()
    },
    watch: {
      value(value) {
@@ -193,6 +238,79 @@
        }).finally(() =>{
        })
      },
      getQueryParams() {
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
        param.field = this.getQueryField();
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        //获取用户定制的参数属性
        if (this.getCustomQueryParams) {
          param = this.getCustomQueryParams(param);
          if(!param){
            return false;
          }
        }
        return filterObj(param);
      },
      getQueryField() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },
      loadData(arg) {
        this.dataSource = [];
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        params.startTime = this.queryParam.startTime;
        params.endTime = this.queryParam.endTime;
        params.orderByName = "ascend";
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      dateParamChange(v1, v2) {
        this.queryParam.startTime = v2[0]
        this.queryParam.endTime = v2[1]
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        // this.SelectedList.push(selectedRowKeys);
        this.selectedRowKeys = selectedRowKeys;
@@ -211,13 +329,17 @@
        this.ipagination = pagination;
        this.loadData();
      },
      onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
      },
      openPage() {
        this.visible = true
        this.onClearSelected()
        this.dataSource = [];
        this.queryParam = {
          status: this.status
        };
        // this.queryParam = {
        //   status: this.status
        // };
        this.loadData();
        this.initOptions();
@@ -273,9 +395,11 @@
        this.onClearSelected()
      },
      searchReset() {
        this.queryParam = {
          status: 1
        };
        // this.queryParam = {
        //   status: 1
        // };
        this.dates = []
        this.queryParam = {}
        this.loadData();
        this.onClearSelected()
      },