chenrui пре 3 година
родитељ
комит
a922337a44

+ 40 - 0
src/api/allocateReport.js

@@ -0,0 +1,40 @@
+import { axios } from '@/utils/request'
+
+//  调拨开单统计  列表  有分页
+export const allocateReportList = (params) => {
+  const url = `/report/allocateReport/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  调拨开单统计  列表  合计
+export const allocateReportCount = (params) => {
+  return axios({
+    url: '/report/allocateReport/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  调拨明细  列表  有分页
+export const allocateReportDetailList = (params) => {
+  const url = `/report/allocateReport/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  调拨明细  列表  合计
+export const allocateReportDetailCount = (params) => {
+  return axios({
+    url: '/report/allocateReport/detail/queryCount',
+    data: params,
+    method: 'post'
+  })
+}

+ 10 - 7
src/components/Table/index.js

@@ -145,6 +145,13 @@ export default {
       }))
       this.loadData()
     },
+    // 重置表格为空
+    clearTable(){
+      this.localDataSource = []
+      this.localPagination = Object.assign({}, {
+        current: 1, pageSize: this.pageSize, total: 0
+      })
+    },
     /**
      * 加载数据方法
      * @param {Object} pagination 分页选项器
@@ -157,7 +164,9 @@ export default {
         pageNo: (pagination && pagination.current) ||
           this.showPagination && this.localPagination.current || this.pageNum,
         pageSize: (pagination && pagination.pageSize) ||
-          this.showPagination && this.localPagination.pageSize || this.pageSize
+          this.showPagination && this.localPagination.pageSize || this.pageSize,
+        tableId: this.tableId,
+        index: this.index
       },
       (sorter && sorter.field && {
         sortField: sorter.field
@@ -168,12 +177,6 @@ export default {
         ...filters
       }
       )
-      if (this.tableId != '') {
-        parameter.tableId = this.tableId
-      }
-      if (this.index != '') {
-        parameter.index = this.index
-      }
       // console.log('parameter', parameter)
       const result = this.data(parameter)
       // 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.count, r.data

+ 1 - 0
src/views/common/rangeDate.vue

@@ -55,6 +55,7 @@ export default {
     },
     resetDate (val) {
       this.date = val || []
+      this.$emit('change', this.date)
     }
   }
 }

+ 266 - 199
src/views/reportData/allocationDetails/list.vue

@@ -1,200 +1,218 @@
 <template>
-  <a-card size="small" :bordered="false" class="provinceTypeSalesDetailsList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="调拨开单日期">
-              <rangeDate ref="rangeDate" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="调拨单号">
-              <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="产品编码">
-              <a-input id="productPricingList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码"/>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
-            <a-col :md="6" :sm="24">
-              <a-form-item label="所在区域">
-                <a-select id="provinceTypeSalesDetailsList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
-                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-item>
+  <a-card size="small" :bordered="false" class="allocationDetailsList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="allocationDetailsList-form"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          @keyup.enter.native="handleSearch" >
+          <a-row :gutter="15">
+            <a-col :md="7" :sm="24">
+              <a-form-model-item label="调拨开单日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="省份">
-                <a-select id="provinceTypeSalesDetailsList-state" v-model="queryParam.state" placeholder="请选择省份" allowClear >
-                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-item>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="调拨单号">
+                <a-input id="allocationDetailsList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
+              </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="排序">
-                <a-select id="provinceTypeSalesDetailsList-state" v-model="queryParam.state" placeholder="请选择排序" allowClear >
-                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-item>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="产品编码">
+                <a-input id="allocationDetailsList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码"/>
+              </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="操作员">
-                <a-select id="provinceTypeSalesDetailsList-state" v-model="queryParam.state" placeholder="请选择操作员" allowClear >
-                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </a-form-item>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <!-- <a-select id="allocationDetailsList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
+                    <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+                  </a-select> -->
+                  <subarea id="allocationDetailsList-subarea" v-model="queryParam.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="省份">
+                  <a-select id="allocationDetailsList-state" v-model="queryParam.state" placeholder="请选择省份" allowClear >
+                    <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="排序">
+                  <a-select id="allocationDetailsList-state" v-model="queryParam.state" placeholder="请选择排序" allowClear >
+                    <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="操作员">
+                  <a-select id="allocationDetailsList-state" v-model="queryParam.state" placeholder="请选择操作员" allowClear >
+                    <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品名称">
+                  <a-input id="allocationDetailsList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客户名称">
+                  <a-input id="allocationDetailsList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入客户名称"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品品牌">
+                  <a-select
+                    placeholder="请选择"
+                    id="allocationDetailsList-productBrandSn"
+                    allowClear
+                    v-model="queryParam.productBrandSn"
+                    :showSearch="true"
+                    option-filter-prop="children"
+                    :filter-option="filterOption">
+                    <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客户级别">
+                  <a-select
+                    placeholder="请选择"
+                    id="allocationDetailsList-productBrandSn"
+                    allowClear
+                    v-model="queryParam.productBrandSn"
+                    :showSearch="true"
+                    option-filter-prop="children"
+                    :filter-option="filterOption">
+                    <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="品牌">
+                  <a-select
+                    placeholder="请选择"
+                    id="allocationDetailsList-productBrandSn"
+                    allowClear
+                    v-model="queryParam.productBrandSn"
+                    :showSearch="true"
+                    option-filter-prop="children"
+                    :filter-option="filterOption">
+                    <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品分类">
+                  <a-cascader
+                    @change="changeProductType"
+                    expand-trigger="hover"
+                    change-on-select
+                    :options="productTypeList"
+                    :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                    id="allocationDetailsList-productType"
+                    placeholder="请选择产品分类"
+                    allowClear
+                    v-model="productType" />
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="7" :sm="24" style="margin-top: 3px;">
+              <a-button
+                style="margin-bottom: 18px;"
+                type="primary"
+                class="button-warning"
+                size="small"
+                @click="handleStock"
+                id="allocationDetailsList-stockDate">盘点区间日期</a-button>
+              <a-button style="margin: 0 0 18px 8px" type="primary" @click="handleSearch" :disabled="disabled" id="allocationDetailsList-refresh">查询</a-button>
+              <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="allocationDetailsList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="产品名称">
-                <a-input id="productPricingList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
-              </a-form-item>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :defaultLoadData="false"
+        :scroll="{ x: 2960 }"
+        bordered>
+        <template slot="footer" slot-scope="currentPageData">
+          <a-row :gutter="15">
+            <a-col :md="4" :sm="24">
+              总数量:263320
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="客户名称">
-                <a-input id="productPricingList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入客户名称"/>
-              </a-form-item>
+            <a-col :md="4" :sm="24">
+              总进价:1,827,311.38
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="产品品牌">
-                <a-select
-                  placeholder="请选择"
-                  id="productPricingList-productBrandSn"
-                  allowClear
-                  v-model="queryParam.productBrandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                </a-select>
-              </a-form-item>
+            <a-col :md="4" :sm="24">
+              总毛利:1187.11
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="客户级别">
-                <a-select
-                  placeholder="请选择"
-                  id="productPricingList-productBrandSn"
-                  allowClear
-                  v-model="queryParam.productBrandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                </a-select>
-              </a-form-item>
+            <a-col :md="4" :sm="24">
+              总售价:2,233,739.75
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="品牌类别">
-                <v-select code="BRAND_TYPE" id="productBrandList-brandType" v-model="queryParam.brandType" allowClear placeholder="请选择品牌分类"></v-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="二级分类">
-                <a-select
-                  placeholder="请选择"
-                  id="productPricingList-productBrandSn"
-                  allowClear
-                  v-model="queryParam.productBrandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="三级分类">
-                <a-select
-                  placeholder="请选择"
-                  id="productPricingList-productBrandSn"
-                  allowClear
-                  v-model="queryParam.productBrandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="盘点区间日期">
-                <a-checkbox @change="onChange"></a-checkbox>
-              </a-form-item>
-            </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productPricingList-refresh">查询</a-button>
-            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productPricingList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 2960 }"
-      bordered>
-      <template slot="footer" slot-scope="currentPageData">
-        <a-row :gutter="15">
-          <a-col :md="4" :sm="24">
-            总数量:263320
-          </a-col>
-          <a-col :md="4" :sm="24">
-            总进价:1,827,311.38
-          </a-col>
-          <a-col :md="4" :sm="24">
-            总毛利:1187.11
-          </a-col>
-          <a-col :md="4" :sm="24">
-            总售价:2,233,739.75
-          </a-col>
-        </a-row>
-      </template>
-    </s-table>
+          </a-row>
+        </template>
+      </s-table>
+    </a-spin>
   </a-card>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import reportData from '@/libs/reportData'
 import rangeDate from '@/views/common/rangeDate.vue'
-// import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
-// import { allocateTypeAllList } from '@/api/allocateType'
+import subarea from '@/views/common/subarea.js'
+import { productBrandQuery } from '@/api/productBrand'
+import { productTypeQuery } from '@/api/productType'
+import { allocateReportDetailList, allocateReportDetailCount } from '@/api/allocateReport'
 export default {
-  components: { STable, VSelect, rangeDate },
+  components: { STable, VSelect, rangeDate, subarea },
   data () {
     return {
+      spinning: false,
       advanced: false, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
+        time: [],
         beginDate: '',
         endDate: '',
         targetName: '', //  调往对象
         allocateTypeSn: undefined, //  调拨类型
         state: undefined, //  业务状态
-        allocateNo: '' //  调拨单号
+        allocateNo: '', //  调拨单号
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      },
+      productType: [],
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      rules: {
+        'time': [{ required: true, message: '请选择调拨开单日期', trigger: 'change' }]
       },
       disabled: false, //  查询、重置按钮是否可操作
-      exportLoading: false,
-      checkVal: '',
-      reportData: reportData.reportDataList,
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '区域', dataIndex: 'data1', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调拨单号', dataIndex: 'data2', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '调拨开单日期', dataIndex: 'data3', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域', dataIndex: 'subareaNames', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨单号', dataIndex: 'allocateNo', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
+        { title: '调拨开单日期', dataIndex: 'allocateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '省份', dataIndex: 'data4', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '客户名称', dataIndex: 'data5', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, ellipsis: true },
         { title: '客户类型', dataIndex: 'data6', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -216,63 +234,112 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: reportData.allocationDetailsList,
-            count: 10
-          }
+        const params = Object.assign(parameter, this.queryParam)
+        delete params.time
+        this.spinning = true
+        return allocateReportDetailList(params).then(res => {
+          // 总计
+          this.getCount(params)
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
+            data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.spinning = false
+          return data
         })
       },
       allocateTypeList: [], //  调拨类型
-      openModal: false //  新增编辑  弹框
+      productBrandList: [], //  品牌下拉数据
+      productTypeList: [], //  分类下拉数据
+      totalData: null //  合计
     }
   },
   methods: {
-    handleFooterShow (currentPageData) {
-      console.log(currentPageData, '[=currentPageData]')
+    // 盘点库存日期
+    handleStock () {
+
     },
     //  创建时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
     },
-    // 选择盘点日期
-    onChange (e) {
-      console.log(e)
-      // this.checkVal
+    // 合计
+    getCount (params) {
+      allocateReportDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  查询
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
-
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
       this.queryParam.targetName = ''
       this.queryParam.allocateTypeSn = undefined
       this.queryParam.state = undefined
       this.queryParam.allocateNo = ''
-      this.$refs.table.refresh(true)
+      this.$refs.ruleForm.resetFields()
+      this.totalData = null
+      this.$refs.table.clearTable()
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      productBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      vm.getProductBrand()
+      vm.getProductType()
+    })
   }
 }
 </script>

+ 152 - 120
src/views/reportData/allocationOrderTotal/list.vue

@@ -1,98 +1,103 @@
 <template>
-  <a-card size="small" :bordered="false" class="provinceTypeSalesDetailsList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="调拨开单日期">
-              <rangeDate ref="rangeDate" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="调拨单号">
-              <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="操作员">
-              <a-select id="provinceTypeSalesDetailsList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
-                <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
-            <a-col :md="6" :sm="24">
-              <a-form-item label="调拨类型">
-                <a-select
-                  placeholder="请选择"
-                  id="productPricingList-productBrandSn"
-                  allowClear
-                  v-model="queryParam.productBrandSn"
-                  :showSearch="true"
-                  option-filter-prop="children"
-                  :filter-option="filterOption">
-                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+  <a-card size="small" :bordered="false" class="allocationOrderTotalList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="allocationOrderTotalList-form"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          @keyup.enter.native="handleSearch" >
+          <a-row :gutter="15">
+            <a-col :md="7" :sm="24">
+              <a-form-model-item label="调拨开单日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="调拨单号">
+                <a-input id="allocationOrderTotalList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="操作员">
+                <a-select id="allocationOrderTotalList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
+                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
                 </a-select>
-              </a-form-item>
+              </a-form-model-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="调拨类型">
+                  <a-select id="allocationOrderTotalList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择调拨类型" allowClear >
+                    <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="7" :sm="24" style="margin-top: 3px;">
+              <a-button
+                style="margin-bottom: 18px;"
+                type="primary"
+                class="button-warning"
+                size="small"
+                @click="handleStock"
+                id="allocationOrderTotalList-stockDate">盘点区间日期</a-button>
+              <a-button style="margin: 0 0 18px 8px" type="primary" @click="handleSearch" :disabled="disabled" id="allocationOrderTotalList-refresh">查询</a-button>
+              <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="allocationOrderTotalList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="盘点区间日期">
-                <a-checkbox @change="onChange"></a-checkbox>
-              </a-form-item>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :defaultLoadData="false"
+        :scroll="{ x: 1140 }"
+        bordered>
+        <template slot="footer" slot-scope="currentPageData">
+          <a-row :gutter="15">
+            <a-col :md="4" :sm="24">
+              总数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productPricingList-refresh">查询</a-button>
-            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productPricingList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 1140 }"
-      bordered>
-      <template slot="footer" slot-scope="currentPageData">
-        <a-row :gutter="15">
-          <a-col :md="4" :sm="24">
-            总数量:752325
-          </a-col>
-          <a-col :md="4" :sm="24">
-            总进价:4,405,812.22
-          </a-col>
-          <a-col :md="4" :sm="24">
-            总毛利:-4,405,812.22
-          </a-col>
-        </a-row>
-      </template>
-    </s-table>
+            <a-col :md="4" :sm="24">
+              总成本价:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? totalData.totalCost : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              总毛利:{{ (totalData && totalData.totalCost!=0) ? '-'+totalData.totalCost : (totalData && totalData.totalCost==0) ? 0 : '--' }}
+            </a-col>
+          </a-row>
+        </template>
+      </s-table>
+    </a-spin>
   </a-card>
 </template>
 
 <script>
 import { STable, VSelect } from '@/components'
-import reportData from '@/libs/reportData'
 import rangeDate from '@/views/common/rangeDate.vue'
-// import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
-// import { allocateTypeAllList } from '@/api/allocateType'
+import { allocateTypeAllList } from '@/api/allocateType'
+import { allocateReportList, allocateReportCount } from '@/api/allocateReport'
 export default {
   components: { STable, VSelect, rangeDate },
   data () {
     return {
+      spinning: false,
       advanced: false, // 高级搜索 展开/关闭
-      tableHeight: 0,
       queryParam: { //  查询条件
+        time: [],
         beginDate: '',
         endDate: '',
         targetName: '', //  调往对象
@@ -100,80 +105,107 @@ export default {
         state: undefined, //  业务状态
         allocateNo: '' //  调拨单号
       },
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      rules: {
+        'time': [{ required: true, message: '请选择调拨开单日期', trigger: 'change' }]
+      },
       disabled: false, //  查询、重置按钮是否可操作
-      exportLoading: false,
-      checkVal: '',
-      reportData: reportData.reportDataList,
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '调拨单号', dataIndex: 'data1', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调拨开单日期', dataIndex: 'data2', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'data3', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '调拨数量', dataIndex: 'data4', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '进价', dataIndex: 'data5', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '调拨单号', dataIndex: 'allocateNo', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨开单日期', dataIndex: 'allocateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'targetName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '调拨数量', dataIndex: 'totalQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本价', dataIndex: 'totalCost', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '毛利', dataIndex: 'data6', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '操作员', dataIndex: 'data7', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '操作员', dataIndex: 'creatorName', width: 120, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: reportData.allocationOrderTotalList,
-            count: 10
-          }
+        const params = Object.assign(parameter, this.queryParam)
+        delete params.time
+        this.spinning = true
+        return allocateReportList(params).then(res => {
+          // 总计
+          this.getCount(params)
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
+            data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.spinning = false
+          return data
         })
       },
       allocateTypeList: [], //  调拨类型
-      openModal: false //  新增编辑  弹框
+      totalData: null //  合计
     }
   },
   methods: {
-    handleFooterShow (currentPageData) {
-      console.log(currentPageData, '[=currentPageData]')
+    // 盘点库存日期
+    handleStock () {
+
     },
     //  创建时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
     },
-    // 选择盘点日期
-    onChange (e) {
-      console.log(e)
-      // this.checkVal
+    // 合计
+    getCount (params) {
+      allocateReportCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  查询
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
     },
-
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
       this.queryParam.targetName = ''
       this.queryParam.allocateTypeSn = undefined
       this.queryParam.state = undefined
       this.queryParam.allocateNo = ''
-      this.$refs.table.refresh(true)
+      this.$refs.ruleForm.resetFields()
+      this.totalData = null
+      this.$refs.table.clearTable()
+    },
+    //  调拨类型
+    getAllocateTypeAllList () {
+      allocateTypeAllList().then(res => {
+        if (res.status == 200) {
+          this.allocateTypeList = res.data
+        } else {
+          this.allocateTypeList = []
+        }
+      })
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      vm.getAllocateTypeAllList()
+    })
   }
 }
 </script>