|  | @@ -1,63 +1,32 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  |      <basic-container class="page-crad">
 | 
	
		
			
				|  |  | -      <avue-crud
 | 
	
		
			
				|  |  | -        ref="crud"
 | 
	
		
			
				|  |  | -        :option="option"
 | 
	
		
			
				|  |  | -        :data="dataList"
 | 
	
		
			
				|  |  | -        :page.sync="page"
 | 
	
		
			
				|  |  | -        :search.sync="search"
 | 
	
		
			
				|  |  | -        :cell-style="cellStyle"
 | 
	
		
			
				|  |  | -        @search-change="searchChange"
 | 
	
		
			
				|  |  | -        @current-change="currentChange"
 | 
	
		
			
				|  |  | -        @size-change="sizeChange"
 | 
	
		
			
				|  |  | -        @refresh-change="refreshChange"
 | 
	
		
			
				|  |  | -        @on-load="onLoad"
 | 
	
		
			
				|  |  | -        :table-loading="loading"
 | 
	
		
			
				|  |  | -        @saveColumn="saveColumn"
 | 
	
		
			
				|  |  | -        @resetColumn="resetColumn"
 | 
	
		
			
				|  |  | -        @search-criteria-switch="searchCriteriaSwitch"
 | 
	
		
			
				|  |  | -      >
 | 
	
		
			
				|  |  | +      <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
 | 
	
		
			
				|  |  | +        :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
 | 
	
		
			
				|  |  | +        @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
 | 
	
		
			
				|  |  | +        @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
 | 
	
		
			
				|  |  |          <template slot="menuLeft">
 | 
	
		
			
				|  |  | -          <el-button
 | 
	
		
			
				|  |  | -            type="info"
 | 
	
		
			
				|  |  | -            icon="el-icon-printer"
 | 
	
		
			
				|  |  | -            size="small"
 | 
	
		
			
				|  |  | -            :loading="exportLoading"
 | 
	
		
			
				|  |  | -            @click.stop="statement"
 | 
	
		
			
				|  |  | -          >报表打印
 | 
	
		
			
				|  |  | -          </el-button>
 | 
	
		
			
				|  |  | +          <!-- <el-button type="info" icon="el-icon-printer" size="small" :loading="exportLoading" @click.stop="statement">
 | 
	
		
			
				|  |  | +            报表打印
 | 
	
		
			
				|  |  | +          </el-button> -->
 | 
	
		
			
				|  |  | +          <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  |          <template slot="brandSearch">
 | 
	
		
			
				|  |  | -          <el-select
 | 
	
		
			
				|  |  | -            v-model="search.brand"
 | 
	
		
			
				|  |  | -            filterable
 | 
	
		
			
				|  |  | -            clearable
 | 
	
		
			
				|  |  | -            multiple
 | 
	
		
			
				|  |  | -            collapse-tags
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | -            <el-option
 | 
	
		
			
				|  |  | -              v-for="(item, index) in brandOption"
 | 
	
		
			
				|  |  | -              :key="index"
 | 
	
		
			
				|  |  | -              :label="item.dictValue"
 | 
	
		
			
				|  |  | -              :value="item.dictValue"
 | 
	
		
			
				|  |  | -            />
 | 
	
		
			
				|  |  | +          <el-select v-model="search.brand" filterable clearable>
 | 
	
		
			
				|  |  | +            <el-option v-for="(item, index) in brandOption" :key="index" :label="item.dictValue"
 | 
	
		
			
				|  |  | +              :value="item.dictValue" />
 | 
	
		
			
				|  |  |            </el-select>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  |        </avue-crud>
 | 
	
		
			
				|  |  |      </basic-container>
 | 
	
		
			
				|  |  | -    <report-dialog
 | 
	
		
			
				|  |  | -      :switchDialog="switchDialog"
 | 
	
		
			
				|  |  | -      :searchValue="statementData"
 | 
	
		
			
				|  |  | -      :reportName="'经销商-可用库存表'"
 | 
	
		
			
				|  |  | -      @onClose="onClose()"
 | 
	
		
			
				|  |  | -    />
 | 
	
		
			
				|  |  | +    <report-dialog :switchDialog="switchDialog" :searchValue="statementData" :reportName="'经销商-可用库存表'"
 | 
	
		
			
				|  |  | +      @onClose="onClose()" />
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import { getToken } from "@/util/auth";
 | 
	
		
			
				|  |  | -import { getList, exportExcel } from "@/api/statisticAnalysis/salesReconciliation";
 | 
	
		
			
				|  |  | +import { getList } from "@/api/statisticAnalysis/purchaseReconciliation";
 | 
	
		
			
				|  |  |  import { micrometerFormat } from "@/util/validate";
 | 
	
		
			
				|  |  |  import _ from "lodash";
 | 
	
		
			
				|  |  |  import reportDialog from "@/components/report-dialog/main";
 | 
	
	
		
			
				|  | @@ -69,8 +38,8 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | -      exportLoading:false,
 | 
	
		
			
				|  |  | -      switchDialog:false,
 | 
	
		
			
				|  |  | +      exportLoading: false,
 | 
	
		
			
				|  |  | +      switchDialog: false,
 | 
	
		
			
				|  |  |        statementData: {},
 | 
	
		
			
				|  |  |        form: {},
 | 
	
		
			
				|  |  |        search: {},
 | 
	
	
		
			
				|  | @@ -88,6 +57,7 @@ export default {
 | 
	
		
			
				|  |  |          searchShow: true,
 | 
	
		
			
				|  |  |          align: "center",
 | 
	
		
			
				|  |  |          searchSpan: 8,
 | 
	
		
			
				|  |  | +        searchMenuSpan: 8,
 | 
	
		
			
				|  |  |          border: true,
 | 
	
		
			
				|  |  |          index: true,
 | 
	
		
			
				|  |  |          addBtn: false,
 | 
	
	
		
			
				|  | @@ -119,7 +89,7 @@ export default {
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "制单日期",
 | 
	
		
			
				|  |  | -            prop: "createTime",
 | 
	
		
			
				|  |  | +            prop: "careteTime",
 | 
	
		
			
				|  |  |              search: true,
 | 
	
		
			
				|  |  |              type: 'date',
 | 
	
		
			
				|  |  |              format: "yyyy-MM-dd",
 | 
	
	
		
			
				|  | @@ -130,13 +100,13 @@ export default {
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "数量",
 | 
	
		
			
				|  |  | -            prop: "orderQuantity",
 | 
	
		
			
				|  |  | +            prop: "quantity",
 | 
	
		
			
				|  |  |              search: false,
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "采购金额",
 | 
	
		
			
				|  |  | -            prop: "amount",
 | 
	
		
			
				|  |  | +            prop: "orderAmount",
 | 
	
		
			
				|  |  |              search: false,
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |            },
 | 
	
	
		
			
				|  | @@ -169,15 +139,6 @@ export default {
 | 
	
		
			
				|  |  |      this.getWorkDicts('brand').then(res => {
 | 
	
		
			
				|  |  |        this.brandOption = res.data.data;
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  | -    let i = 0;
 | 
	
		
			
				|  |  | -    this.option.column.forEach(item => {
 | 
	
		
			
				|  |  | -      if (item.search) i++
 | 
	
		
			
				|  |  | -    })
 | 
	
		
			
				|  |  | -    if (i % 3 !== 0){
 | 
	
		
			
				|  |  | -      const num = 3 - Number(i % 3)
 | 
	
		
			
				|  |  | -      this.option.searchMenuSpan = num * 8;
 | 
	
		
			
				|  |  | -      this.option.searchMenuPosition = "right";
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      cellStyle() {
 | 
	
	
		
			
				|  | @@ -197,6 +158,39 @@ export default {
 | 
	
		
			
				|  |  |        this.onLoad(this.page, params);
 | 
	
		
			
				|  |  |        done();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    outExport() {
 | 
	
		
			
				|  |  | +      let params = { ...this.search }
 | 
	
		
			
				|  |  | +      if (!params.brand) this.$set(params, 'brand', '');
 | 
	
		
			
				|  |  | +      if (params.careteTime && params.careteTime.length > 0) {
 | 
	
		
			
				|  |  | +        params = {
 | 
	
		
			
				|  |  | +          ...params,
 | 
	
		
			
				|  |  | +          beginCreateTime: params.careteTime[0] + ' 00:00:00',
 | 
	
		
			
				|  |  | +          endCreateTime: params.careteTime[1] + ' 23:59:59',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        params = {
 | 
	
		
			
				|  |  | +          ...params,
 | 
	
		
			
				|  |  | +          beginCreateTime: '',
 | 
	
		
			
				|  |  | +          endCreateTime: '',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      console.log(params)
 | 
	
		
			
				|  |  | +      this.$confirm('是否导出数据明细?', '提示', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +        type: 'warning'
 | 
	
		
			
				|  |  | +      }).then(() => {
 | 
	
		
			
				|  |  | +        window.open(
 | 
	
		
			
				|  |  | +          `/api/blade-purchase-sales/exportOrder/selPurchaseExport?${this.website.tokenHeader
 | 
	
		
			
				|  |  | +          }=${getToken()}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}`
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +      }).catch(() => {
 | 
	
		
			
				|  |  | +        this.$message({
 | 
	
		
			
				|  |  | +          type: 'info',
 | 
	
		
			
				|  |  | +          message: '已取消' //
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      refreshChange() {
 | 
	
		
			
				|  |  |        delete this.search.corpName;
 | 
	
		
			
				|  |  |        delete this.search.storageName
 | 
	
	
		
			
				|  | @@ -210,30 +204,23 @@ export default {
 | 
	
		
			
				|  |  |        this.page.pageSize = val;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onLoad(page, params) {
 | 
	
		
			
				|  |  | -      this.loading = true;
 | 
	
		
			
				|  |  | -      this.dataList.forEach(item => {
 | 
	
		
			
				|  |  | -        this.$refs.crud.toggleRowExpansion(item, false);
 | 
	
		
			
				|  |  | -      });
 | 
	
		
			
				|  |  | -      let queryParams = Object.assign({}, params);
 | 
	
		
			
				|  |  | -      if (queryParams.businesDate && queryParams.businesDate.length > 0) {
 | 
	
		
			
				|  |  | -        queryParams = {
 | 
	
		
			
				|  |  | -          ...queryParams,
 | 
	
		
			
				|  |  | -          orderStartDate: queryParams.businesDate[0] + ' 00:00:00',
 | 
	
		
			
				|  |  | -          orderEndDate: queryParams.businesDate[1] + ' 23:59:59',
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        delete queryParams.businesDate;
 | 
	
		
			
				|  |  | +      console.log(this.search, params)
 | 
	
		
			
				|  |  | +      if (this.search.careteTime && this.search.careteTime.length > 0) {
 | 
	
		
			
				|  |  | +        params = {
 | 
	
		
			
				|  |  | +          ...params,
 | 
	
		
			
				|  |  | +          beginCreateTime: this.search.careteTime[0],
 | 
	
		
			
				|  |  | +          endCreateTime: this.search.careteTime[1]
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | +      let queryParams = Object.assign({}, params);
 | 
	
		
			
				|  |  | +      delete queryParams.careteTime;
 | 
	
		
			
				|  |  | +      this.loading = true;
 | 
	
		
			
				|  |  |        getList(
 | 
	
		
			
				|  |  |          page.currentPage,
 | 
	
		
			
				|  |  |          page.pageSize,
 | 
	
		
			
				|  |  |          queryParams
 | 
	
		
			
				|  |  |        )
 | 
	
		
			
				|  |  |          .then(res => {
 | 
	
		
			
				|  |  | -          if (res.data.data.records) {
 | 
	
		
			
				|  |  | -            res.data.data.records.forEach(e => {
 | 
	
		
			
				|  |  | -              e.itemLoading = true;
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  |            this.dataList = res.data.data.records ? res.data.data.records : [];
 | 
	
		
			
				|  |  |            this.page.total = res.data.data.total;
 | 
	
		
			
				|  |  |            if (this.page.total) {
 | 
	
	
		
			
				|  | @@ -262,11 +249,11 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      statement() {
 | 
	
		
			
				|  |  | -      this.statementData = {...this.search};
 | 
	
		
			
				|  |  | -      if (this.statementData.createTime && this.statementData.createTime.length > 0) {
 | 
	
		
			
				|  |  | -        this.statementData.createStartTime = this.statementData.createTime[0]+ " " + "00:00:00"
 | 
	
		
			
				|  |  | -        this.statementData.createEndTime = this.statementData.createTime[1]+ " " + "23:59:59"
 | 
	
		
			
				|  |  | -        delete this.statementData.createTime
 | 
	
		
			
				|  |  | +      this.statementData = { ...this.search };
 | 
	
		
			
				|  |  | +      if (this.statementData.careteTime && this.statementData.careteTime.length > 0) {
 | 
	
		
			
				|  |  | +        this.statementData.createStartTime = this.statementData.careteTime[0] + " " + "00:00:00"
 | 
	
		
			
				|  |  | +        this.statementData.createEndTime = this.statementData.careteTime[1] + " " + "23:59:59"
 | 
	
		
			
				|  |  | +        delete this.statementData.careteTime
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        this.switchDialog = !this.switchDialog;
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -308,9 +295,11 @@ export default {
 | 
	
		
			
				|  |  |  .page-crad ::v-deep .basic-container__card {
 | 
	
		
			
				|  |  |    height: 94.2vh;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  ::v-deep .el-table__expanded-cell[class*="cell"] {
 | 
	
		
			
				|  |  |    padding: 0px;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  .itemTable ::v-deep .el-table {
 | 
	
		
			
				|  |  |    width: 100%;
 | 
	
		
			
				|  |  |  }
 |