Kaynağa Gözat

Merge branch 'develop_yh18' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop_yh18

lilei 2 yıl önce
ebeveyn
işleme
dbf58a466d

+ 3 - 3
src/api/data.js

@@ -32,7 +32,7 @@ export const getAreaAll = () => {
   return axios({
     url: '/area/findAll',
     method: 'get'
-  }).then(res => res.data)
+  }).then(res => res)
 }
 
 /**
@@ -106,7 +106,7 @@ function randomStr (len) {
 
 // 查询省/市/区
 export const getArea = (params) => {
-  if(params.type == '2' || params.parentId){
+  if (params.type == '2' || params.parentId) {
     return axios({
       url: `/area/queryList`,
       data: params,
@@ -117,7 +117,7 @@ export const getArea = (params) => {
 
 // 获取省市区,兼容小程序数据
 export const getAreaCgj = (params) => {
-  if(params.type == '2' || params.parentId){
+  if (params.type == '2' || params.parentId) {
     return axios({
       url: `/areaCgj/queryList`,
       data: params,

+ 42 - 9
src/utils/util.js

@@ -3,7 +3,7 @@ export function timeFix () {
   const hour = time.getHours()
   return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好'
 }
- 
+
 export function welcome () {
   const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了']
   const index = Math.floor(Math.random() * arr.length)
@@ -45,6 +45,40 @@ export function handleScrollHeader (callback) {
   )
 }
 
+/**
+ * 数组转树形结构
+ * @param {array} list 被转换的数组
+ * @param {number|string} root 根节点(最外层节点)的 id
+ * @return array
+ */
+export function arrayToTree (list, root) {
+  const result = [] // 用于存放结果
+  const map = {} // 用于存放 list 下的节点
+
+  // 1. 遍历 list,将 list 下的所有节点以 id 作为索引存入 map
+  for (const item of list) {
+    map[item.id] = { ...item } // 浅拷贝
+  }
+
+  // 2. 再次遍历,将根节点放入最外层,子节点放入父节点
+  for (const item of list) {
+    // 3. 获取节点的 id 和 父 id
+    const { id, parentId } = item // ES6 解构赋值
+    // 4. 如果是根节点,存入 result
+    if (item.parentId == root) {
+      result.push(map[id])
+    } else {
+      // 5. 反之,存入到父节点
+      map[parentId].children
+        ? map[parentId].children.push(map[id])
+        : (map[parentId].children = [map[id]])
+    }
+  }
+
+  // 将结果返回
+  return result
+}
+
 /**
  * Remove loading animate
  * @param id parent element id or class
@@ -73,7 +107,7 @@ export function oneOf (value, validList) {
 }
 
 // 选择文本
-export function onTextSelected($copyText,$message){
+export function onTextSelected ($copyText, $message) {
   const textDiv = document.getElementsByClassName('copy-rect')
   const selection = window.getSelection()
   if (!selection) {
@@ -109,21 +143,21 @@ export function onTextSelected($copyText,$message){
   if (!str) {
     return
   }
-  
+
   let copyNode = textDiv[0]
-  if(!copyNode){
+  if (!copyNode) {
     if (str.length > 0) {
       copyNode = document.createElement('div')
       copyNode.innerHTML = '复制'
       copyNode.className = 'copy-rect'
       copyNode.style.position = 'fixed'
-      copyNode.style.top = rect.top - rect.height - 10  + 'px'
+      copyNode.style.top = rect.top - rect.height - 10 + 'px'
       copyNode.style.left = rect.left + rect.width - 20 + 'px'
       copyNode.style.height = 'auto'
       copyNode.style.width = 'auto'
       document.body.appendChild(copyNode)
 
-      copyNode.addEventListener('mousedown',(event) => {
+      copyNode.addEventListener('mousedown', (event) => {
         console.log(event)
         event.stopPropagation()
         console.log(str)
@@ -136,8 +170,7 @@ export function onTextSelected($copyText,$message){
           $message.error('复制失败')
           document.body.removeChild(copyNode)
         })
-      }) 
+      })
     }
   }
-  
-}
+}

+ 7 - 2
src/views/allocationManagement/warehouseAllocation/edit.vue

@@ -148,13 +148,18 @@
               </a-col>
               <a-col :span="6">
                 <div style="margin-top: 4px;text-align: right;">
-                  <!-- <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button> -->
+                  <a-button
+                    type="danger"
+                    ghost
+                    size="small"
+                    @click="openGuideModal=true"
+                    style="margin-right: 5px"
+                    id="chainTransferOutEdit-import-btn">产品导入</a-button>
                   <a-button
                     size="small"
                     type="danger"
                     style="margin-left: 8px"
                     @click.stop="handleDel('', 'all')"
-                    ghost
                     :disabled="chooseLoadDataSource.length==0"
                     id="warehouseAllocationEdit-del-all-btn">清空列表</a-button>
                 </div>

+ 1 - 0
src/views/chainReportData/chainSalesDetailReport/list.vue

@@ -267,6 +267,7 @@ export default {
         { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '数量', dataIndex: 'productQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '成本', dataIndex: 'productCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 88 - 0
src/views/common/areaList.js

@@ -0,0 +1,88 @@
+import { getAreaAll } from '@/api/data'
+import { arrayToTree } from '@/utils/util'
+const AreaList = {
+  template: `
+     <a-cascader
+          :size="size"
+          :changeOnSelect="changeOnSelect"
+          :show-search="{ filter }"
+          @change="handleChange"
+          :value="defaultVal"
+          expand-trigger="hover"
+          :allowClear="allowClear"
+          :options="list"
+          :field-names="{ label: 'name', value: defValKey, children: 'children' }" 
+          :id="id"
+          :placeholder="placeholder" 
+          style="width: 100%;" />
+    `,
+  props: {
+    value: {
+      type: Array,
+      defatut: function () {
+        return []
+      }
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    defValKey: {
+      type: String,
+      default: 'areaSn'
+    },
+    placeholder: {
+      type: String,
+      default: '请选择省/市/区'
+    },
+    allowClear: {
+      type: Boolean,
+      default: true
+    },
+    size: {
+      type: String,
+      default: 'default'
+    },
+    changeOnSelect: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      defaultVal: this.value,
+      list: []
+    }
+  },
+  watch: {
+    value (newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  mounted () {
+    this.getArea()
+  },
+  methods: {
+    filter (inputValue, path) {
+      return path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
+    },
+    handleChange (value, selectedOptions) {
+      this.defaultVal = value
+      this.$emit('input', this.defaultVal)
+      this.$emit('change', this.defaultVal, selectedOptions)
+    },
+    //  省/市/区
+    getArea () {
+      getAreaAll().then(res => {
+        if (res.status == 200) {
+          this.list = arrayToTree(res.data, 0)
+        }
+      })
+    },
+    clearData () {
+      this.handleChange([], null)
+    }
+  }
+}
+
+export default AreaList

+ 88 - 134
src/views/reportData/customerReport/list.vue

@@ -1,24 +1,39 @@
 <template>
-  <a-card size="small" :bordered="false" class="customerReportList-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
+  <div class="jg-page-wrap customerReportList-wrap">
+    <a-card size="small" :bordered="false" class="table-page-search-wrapper">
       <!-- 搜索条件 -->
-      <div class="table-page-search-wrapper">
-        <a-form-model
-          id="customerReportList-form"
-          ref="ruleForm"
-          class="form-model-con"
-          layout="inline"
-          :model="queryParam"
-          :rules="rules"
-          :labelCol="labelCol"
-          :wrapperCol="wrapperCol"
-          @keyup.enter.native="handleSearch" >
-          <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="添加时间" prop="time">
-                <rangeDate ref="rangeDate" @change="dateChange" />
-              </a-form-model-item>
-            </a-col>
+      <a-form-model
+        id="customerReportList-form"
+        ref="ruleForm"
+        class="form-model-con"
+        layout="inline"
+        :model="queryParam"
+        :rules="rules"
+        :labelCol="labelCol"
+        :wrapperCol="wrapperCol"
+        @keyup.enter.native="handleSearch" >
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-model-item label="添加时间" prop="time">
+              <rangeDate ref="rangeDate" @change="dateChange" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-model-item label="客户名称">
+              <custList id="chainSalesReportList-salesTargetName" ref="custSatelliteList" @change="custSatelliteChange"></custList>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="客户类型">
+              <custType v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;"></custType>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="客户所在区">
+              <AreaList id="chainSalesReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+            </a-form-item>
+          </a-col>
+          <template v-if="advanced">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="产品分类">
                 <a-cascader
@@ -33,87 +48,59 @@
                   allowClear />
               </a-form-model-item>
             </a-col>
-            <template v-if="advanced">
-              <a-col :md="12" :sm="24">
-                <a-row>
-                  <a-form-model-item label="客户所在区" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
-                    <a-col span="7">
-                      <a-form-model-item prop="provinceSn" style="margin: 0!important;">
-                        <a-select v-model="queryParam.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
-                          <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col span="7" offset="1">
-                      <a-form-model-item prop="citySn" style="margin: 0!important;">
-                        <a-select v-model="queryParam.citySn" allowClear @change="getAreaList" placeholder="请选择市">
-                          <a-select-option v-for="item in addrCityList" :value="item.areaSn" :key="item.areaSn + 'b'">{{ item.name }}</a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                    <a-col span="7" offset="1">
-                      <a-form-model-item prop="countySn" style="margin: 0!important;">
-                        <a-select v-model="queryParam.countySn" allowClear placeholder="请选择区/县">
-                          <a-select-option v-for="item in addrDistrictList" :value="item.areaSn" :key="item.areaSn + 'c'">{{ item.name }}</a-select-option>
-                        </a-select>
-                      </a-form-model-item>
-                    </a-col>
-                  </a-form-model-item>
-                </a-row>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="客户类型">
-                  <custType v-model="queryParam.customerTypeSn" allowClear placeholder="请选择客户类型" style="max-width: 240px;"></custType>
-                </a-form-item>
-              </a-col>
-            </template>
-            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="customerReportList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="customerReportList-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-model>
-      </div>
-      <!-- 合计 -->
-      <a-alert type="info" style="margin-bottom:10px">
-        <div class="ftext" slot="message">
-          总交易金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</strong>;
-          <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
-            总毛利:<strong>{{ (totalData && totalData.totalGrossProfit) ? toThousands(totalData.totalGrossProfit) : '--' }}</strong>;
-            总毛利率:<strong>{{ (totalData && totalData.percentage) ? totalData.percentage+'%' : '--' }}</strong>;
+          </template>
+          <a-col :md="24" :sm="24" style="margin-bottom: 10px;text-align:center;">
+            <a-button type="primary" @click="handleSearch" :disabled="disabled" id="customerReportList-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="customerReportList-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-model>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 合计 -->
+        <div class="table-operator">
+          <div class="alert-message">
+            总交易金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</strong>;
+            <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
+              总毛利:<strong>{{ (totalData && totalData.totalGrossProfit) ? toThousands(totalData.totalGrossProfit) : '--' }}</strong>;
+              总毛利率:<strong>{{ (totalData && totalData.percentage) ? totalData.percentage+'%' : '--' }}</strong>;
+            </div>
           </div>
         </div>
-      </a-alert>
-      <!-- 列表 -->
-      <s-table
-        class="sTable"
-        ref="table"
-        size="small"
-        :rowKey="(record) => record.salesTargetSn"
-        :columns="columns"
-        :data="loadData"
-        :defaultLoadData="false"
-        bordered>
-      </s-table>
-    </a-spin>
-  </a-card>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.salesTargetSn"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          bordered>
+        </s-table>
+      </a-spin>
+    </a-card>
+  </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import custList from '@/views/common/custList.vue'
+import AreaList from '@/views/common/areaList.js'
 import custType from '@/views/common/custType.js'
-import { getArea } from '@/api/data'
+// import { getArea } from '@/api/data'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { reportBigCustomerList, reportBigCustomerCount } from '@/api/reportData'
 export default {
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate, custType },
+  components: { STable, VSelect, rangeDate, custType, custList, AreaList },
   data () {
     return {
       spinning: false,
@@ -202,6 +189,11 @@ export default {
     }
   },
   methods: {
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
     // 合计
     getCount (params) {
       reportBigCustomerCount(params).then(res => {
@@ -218,6 +210,15 @@ export default {
       this.queryParam.beginDate = date[0] || ''
       this.queryParam.endDate = date[1] || ''
     },
+    custSatelliteChange (v, row) {
+      if (row && row.customerSn) {
+        this.queryParam.customer.customerSn = row.customerSn
+        this.queryParam.customer.customerNameCurrent = undefined
+      } else {
+        this.queryParam.customer.customerNameCurrent = v
+        this.queryParam.customer.customerSn = undefined
+      }
+    },
     //  查询
     handleSearch () {
       this.$refs.ruleForm.validate(valid => {
@@ -268,54 +269,7 @@ export default {
         }
       })
     },
-    // 获取城市列表
-    getCityList (val) {
-      this.addrCityList = []
-      this.addrDistrictList = []
-      this.queryParam.citySn = undefined
-      this.queryParam.countySn = undefined
-      if (val) {
-        this.getArea('city', val)
-      }
-    },
-    // 获取区县列表
-    getAreaList (val) {
-      this.addrDistrictList = []
-      this.queryParam.countySn = undefined
-      if (val) {
-        this.getArea('district', val)
-      }
-    },
-    //  省/市/区
-    getArea (leve, sn) {
-      let params
-      if (leve == 'province') {
-        params = { type: '2' }
-      } else {
-        params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
-      }
-      getArea(params).then(res => {
-        if (res.status == 200) {
-          if (leve == 'province') {
-            this.addrProvinceList = res.data || []
-          } else if (leve == 'city') {
-            this.addrCityList = res.data || []
-          } else if (leve == 'district') {
-            this.addrDistrictList = res.data || []
-          }
-        } else {
-          if (leve == 'province') {
-            this.addrProvinceList = []
-          } else if (leve == 'city') {
-            this.addrCityList = []
-          } else if (leve == 'district') {
-            this.addrDistrictList = []
-          }
-        }
-      })
-    },
     pageInit () {
-      this.getArea('province')
       this.getProductType()
     }
   },

+ 1 - 0
src/views/reportData/salesDetailReport/list.vue

@@ -273,6 +273,7 @@ export default {
         { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productEntity.name', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '数量', dataIndex: 'productQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '成本', dataIndex: 'productCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },