Просмотр исходного кода

Merge branch 'develop_yh21' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh21

chenrui 2 лет назад
Родитель
Сommit
8f9ec38f85

+ 10 - 0
src/api/dealer.js

@@ -147,3 +147,13 @@ export const dealerUserSave = (params) => {
     method: 'post'
   })
 }
+
+// 根据经销商sn查询经销商信息   选择列表回显可用
+
+export const getDealerListInfo = (params) => {
+  return axios({
+    url: `/dealer/queryBySns`,
+    data: params,
+    method: 'post'
+  })
+}

+ 13 - 10
src/components/UploadFile/index.vue

@@ -58,7 +58,7 @@ export default {
     },
     upText: {
       type: String,
-      default: ''
+      default: '上传文件'
     },
     value: {
       type: String
@@ -139,10 +139,10 @@ export default {
       this.previewVisible = false
     },
     handlePreview (file) {
-      if (this.listType == 'text') {
-        return
-      }
-      console.log(file)
+      // if (this.listType == 'text') {
+      //   return
+      // }
+      // console.log(file)
       if (file.response.status == 200) {
         this.previewImage = file.response.data
       } else {
@@ -252,19 +252,16 @@ export default {
   }
 }
 </script>
-<style lang="less">
+<style lang="less" scoped>
   .upload-file{
     float: left;
     overflow: hidden;
-    height: 80px;
     /* you can make up upload button and sample style by using stylesheets */
     .ant-upload-select-picture-card i {
       font-size: 32px;
       color: #999;
-      margin-top: 9px;
     }
     .ant-upload-select-picture-card .ant-upload-text {
-      margin-top: 8px;
       color: #666;
     }
     .ant-upload-btn{
@@ -295,5 +292,11 @@ export default {
       white-space: normal;
     }
   }
-
+/deep/.ant-modal-body{
+      max-height:860px;
+      text-align:center;
+  }
+ /deep/.ant-modal-body video{
+    width: 90% !important;
+  }
 </style>

+ 42 - 6
src/views/power/role/menuModal.vue

@@ -90,6 +90,7 @@ export default {
       authAllPrice: [],
       leafNode:[],
       checkLeafNode:[],
+      priceCheckNode:[],
       form: {},
       rules: {},
       authType: '1',
@@ -165,9 +166,18 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          const arr = [...this.checkedKeys, ...this.halfCheckedKeys, ...this.checkedData].filter((x, index,self)=>self.indexOf(x)===index) 
-          console.log(this.checkedData)
-
+          // 功能权限时的已选价格菜单或价格权限时的已选功能菜单
+          const checkData = this.authType == 1 ? this.priceCheckNode : this.checkedData.filter(item => !this.priceCheckNode.includes(item))
+          // 功能权限时,首次半选节点拿不到值(this.halfCheckedKeys为空时),
+          // 此时通过从所有已选checkedData数据中过滤当前选择的功能菜单和已选的价格菜单,剩下的就是半选节点
+          let halfCheckedKeys = this.halfCheckedKeys.length ? this.halfCheckedKeys : this.checkedData.filter(item => ![...this.checkedKeys,...checkData].includes(item))
+          // 功能权限没有选择任何菜单或价格权限时,halfCheckedKeys 半选节点为空
+          if(this.checkedKeys.length==0 || this.authType == 0){
+            halfCheckedKeys = []
+          }
+          // 最终保存的节点,包括当前已选的和半选的节点
+          const arr = [...this.checkedKeys, ...halfCheckedKeys, ...checkData].filter((x, index,self)=>self.indexOf(x)===index) 
+          console.log(arr, '--444--')
           _this.spinning = true
           addMenuPower({ id: this.id, menuIds: arr.join(',') }).then(res => {
             if (res.status == 200) {
@@ -257,6 +267,25 @@ export default {
         }
       }
     },
+    // 根据id查找是否价格菜单
+    getPriceTreeNode(data, arr){
+      const _this = this
+      for (let i = 0; i < data.length; i++) {
+        const node = data[i]
+        if(_this.isPriceNode(node)){
+           // 默认回显已选节点
+          const hasCheck = _this.priceCheckNode.find(item => item == node.id)
+          // 已选节点勾选
+          const hasNode = arr.find(item => item == node.id)
+          if (hasNode && !hasCheck) {
+            _this.priceCheckNode.push(node.id)
+          }
+        }
+        if (node.children && node.children.length) {
+          _this.getPriceTreeNode(node.children, arr)
+        }
+      }
+    },
     pageInit(){
       this.id = this.nowData.role.id
       this.titleText = (this.nowData.type == 1 ? '功能权限分配': '价格权限分配') + '(' + this.nowData.role.name + ')'
@@ -265,20 +294,26 @@ export default {
       // 权限类型, 1功能权限设置,0 价格权限设置
       this.authType = this.nowData.type
       this.checkedData = arr ? arr.split(',') : []
+
       // 找出叶子节点
       const treeData = this.nowData.allMenuList
-      
       this.expandedKeys.push(treeData.id)
+
+      // 获取已选的价格菜单
+      this.getPriceTreeNode(treeData, this.checkedData)
+
+      // 功能权限设置
       if(this.authType == 1){
         this.findLeaf(treeData, this.checkedData)
       }
+      // 价格权限设置
       if(this.authType == 0){
         this.findPrice(treeData, this.checkedData)
         this.hasAllSelect()
       }
-      this.checkedData = this.checkedData.filter(item => !this.checkedKeys.includes(item))
-      // console.log(this.checkedData)
       // console.log(this.checkedKeys)
+      // console.log(this.checkedData)
+      
       this.treeData = treeData
 
       if(this.authType == 0){
@@ -308,6 +343,7 @@ export default {
         this.id = ''
         this.authAllPrice = []
         this.checkLeafNode = []
+        this.priceCheckNode = []
         this.leafNode = []
         this.checkedKeys = []
         this.expandedKeys = []

+ 6 - 6
src/views/promotionRulesManagement/promotionManagement/addModal.vue

@@ -175,12 +175,6 @@ export default {
           buyerName: con.dealerName
         }
       })
-      const newArr = list.map(item => {
-        return {
-          buyerSn: item.dealerSn
-        }
-      })
-      this.form.promoBuyerList = newArr
       this.openDealerModal = false
       // 移除表单必填项
       this.$refs.ruleForm.clearValidate('promoBuyerList')
@@ -209,6 +203,12 @@ export default {
     //  保存促销
     handleSave () {
       const _this = this
+      const newArr = this.chooseDealerList.map(item => {
+        return {
+          buyerSn: item.buyerSn
+        }
+      })
+      this.form.promoBuyerList = newArr
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))

+ 74 - 94
src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue

@@ -50,35 +50,17 @@
         </span>
       </div>
     </div>
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.dealerSn"
-      rowKeyName="dealerSn"
-      :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: pageType=='viewDealers'?!!record.subareaAreaSn: !!record.chooseId} }) }"
-      @rowSelection="rowSelectionFun"
-      :columns="columns"
-      :data="loadData"
-      :defaultLoadData="false"
-      :style="{ height: 320+'px' }"
+    <a-table
+      style="height: 320px;"
       :scroll="{ y: 230 }"
-      bordered>
-      <template slot="areas" slot-scope="text, record">
-        <span v-if="record.subareaArea">{{ record.subareaArea.subareaName }}>{{ record.subareaArea.subareaAreaName }}</span>
-        <span v-else>--</span>
-      </template>
-      <template slot="action" slot-scope="text, record">
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          @click="handleAdd(record)"
-          v-if="record.subareaAreaSn != parentData.subareaAreaSn"
-          id="marketingDivisionSetNew-del-btn">添加</a-button>
-        <span style="color:#666" v-else>已添加</span>
-      </template>
-    </s-table>
+      :bordered="true"
+      :pagination="pagination"
+      :row-key="record => record.dealerSn"
+      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+      :columns="columns"
+      :data-source="dealerList"
+      @change="handlePage"
+    ></a-table>
   </a-spin>
 </template>
 
@@ -86,7 +68,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import AreaList from '@/views/common/areaList.js'
-import { dealerQueryList } from '@/api/dealer'
+import { dealerQueryList, getDealerListInfo } from '@/api/dealer'
 import subarea from '@/views/common/subarea.js'
 export default {
   name: 'ChooseDealer',
@@ -120,67 +102,67 @@ export default {
         citySn: undefined,
         districtSn: undefined
       },
+      pagination: {
+        pageSize: 20,
+        showSizeChanger: true
+      },
       pageFlag: false,
       chooseInfo: [],
+      selectedRowKeys: [],
+      columns: [
+        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      dealerList: [],
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
-      loading: false, // 批量添加loading
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.spinning = true
-        return dealerQueryList(Object.assign(parameter, this.queryParam)).then(res => {
-          let data
-          const _this = this
-          if (res.status == 200) {
-            data = res.data
-            const no = 0
-            const chooseData = []
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-              if (!_this.pageType && _this.chooseInfo && _this.chooseInfo.length > 0) {
-                // 回显选中数据
-                const flag = _this.chooseInfo.includes(data.list[i].dealerSn)
-                if (flag) {
-                  chooseData.push(data.list[i])
-                }
-              }
-            }
-            if (!this.pageFlag) {
-              this.pageFlag = true
-              _this.$refs.table.setTableSelected(_this.chooseInfo, chooseData) // 设置表格选中项
-            }
-          }
-          this.spinning = false
-          return data
-        })
-      },
-      rowSelectionInfo: null
+      loading: false // 批量添加loading
     }
   },
   computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
-      ]
-      if (_this.pageType == 'viewDealers') {
-        arr.splice(4, 0, { title: '审核状态', dataIndex: 'auditStateDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
-        arr.splice(5, 0, { title: '当前所属区域', scopedSlots: { customRender: 'areas' }, width: '30%', align: 'center' })
-        arr.splice(6, 0, { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' })
-      } else {
-        arr.splice(4, 0, { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
-        arr.splice(5, 0, { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
-      }
-      return arr
-    },
     selectCount () {
-      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
+      return this.selectedRowKeys && this.selectedRowKeys.length
     }
   },
   methods: {
+    onSelectChange (selectedRowKeys) {
+      this.selectedRowKeys = selectedRowKeys
+    },
+    handlePage (pagination, filters, sorter) {
+      const pager = { ...this.pagination }
+      pager.current = pagination.current
+      pager.pageSize = pagination.pageSize
+      this.pagination = pager
+
+      this.loadData({ pageNo: pagination.current, pageSize: pagination.pageSize })
+    },
+    loadData (pager) {
+      this.spinning = true
+      const params = { pageSize: 20, pageNo: 1, ...pager }
+      dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
+        let data
+        if (res.status == 200) {
+          data = res.data
+          const pagination = { ...this.pagination }
+          pagination.total = data.count
+          const no = 0
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.dealerList = data.list
+          this.pagination = pagination
+          if (this.chooseInfo && !this.pageFlag) {
+            this.pageFlag = true
+            this.selectedRowKeys = this.chooseInfo
+          }
+        }
+        this.spinning = false
+      })
+    },
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
@@ -190,8 +172,8 @@ export default {
       this.queryParam.citySn = val[1] ? val[1] : ''
       this.queryParam.districtSn = val[2] ? val[2] : ''
     },
-    searchForm (flag) {
-      this.$refs.table.refresh(flag)
+    searchForm () {
+      this.loadData()
       this.spinning = false
     },
     subareaChange (val) {
@@ -218,8 +200,13 @@ export default {
       } else {
         this.$refs.areaList.clearData()
       }
-      this.$refs.table.clearSelected()
-      this.$refs.table.refresh(true)
+      this.pagination = {
+        pageSize: 20,
+        showSizeChanger: true,
+        current: 1
+      }
+      this.selectedRowKeys = []
+      this.loadData()
       this.pageFlag = false
     },
     clearTable () {
@@ -227,22 +214,15 @@ export default {
       this.$refs.table.clearTable()
     },
     // 批量添加
-    handleBatchAudit () {
+    async handleBatchAudit () {
       const _this = this
-      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+      if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
-      const dealerSnList = _this.rowSelectionInfo.selectedRows
-      // const newDealerSnList = dealerSnList.map(con => {
-      //   const obj = {
-      //     buyerName: con.dealerName,
-      //     buyerSn: con.dealerSn
-      //   }
-      //   return obj
-      // })
+      const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
       this.spinning = false
-      this.$emit('plAdd', dealerSnList)
+      this.$emit('plAdd', dealerInfoList.data)
     },
     handleAdd (row) {
       if (row.subareaArea) {

+ 4 - 10
src/views/promotionRulesManagement/promotionManagement/editModal.vue

@@ -62,13 +62,7 @@
             <span class="upload-desc">说明:单张大小小于10Mb,最多10张;建议尺寸:宽(420px)*高(230px)</span>
           </a-form-model-item>
           <a-form-model-item label="排序" prop="sort">
-            <a-input
-              id="promotionEdit-sort"
-              type="number"
-              v-model.trim="form.sort"
-              placeholder="请输入排序数字(数字越大越靠后)"
-              :disabled="isDisabled"
-              allowClear />
+              <a-input-number style="width:300px;" id="promotionEdit-sort" :disabled="isDisabled" allowClear placeholder="请输入排序数字(数字越大越靠后)" v-model="form.sort" :min="0" :max="999999"/>
           </a-form-model-item>
           <a-form-model-item label="内容类型" prop="contentType">
             <v-select
@@ -108,7 +102,7 @@
               :fileSize="100"
               :maxNums="1"
               @change="changeVideo"
-              listType="picture-card"></Upload>
+              ></Upload>
             <Upload
               v-else-if="pageType==='edit'&&!isDisabled"
               class="upload"
@@ -119,7 +113,7 @@
               :fileSize="100"
               :maxNums="1"
               @change="changeVideo"
-              listType="picture-card"></Upload>
+              ></Upload>
             <div v-if="pageType==='edit'&&isDisabled">
               <video width="230" height="150" controls loop controlsList="nodownload">
                 <source :src="form.content" type="video/mp4">
@@ -274,11 +268,11 @@ export default {
           this.form.sort = res.data.sort
           this.images = res.data.imageSet
           this.form.imageSet = res.data.images
+          this.form.content = res.data.content
           this.$refs.imageSet.setFileList(res.data.images)
           if (res.data.contentType == 'IMAGE_CONTENT') {
             this.$refs.editor.setHtml(res.data.content)
           } else if (res.data.contentType == 'VIDEO') {
-            this.form.content = res.data.content
             if (res.data.state != 'PUBLISH') {
               this.$refs.videoSet.setFileList(res.data.content)
             }

+ 2 - 1
src/views/salesManagement/stockPrint/list.vue

@@ -300,10 +300,11 @@ export default {
       }
       if (this.$hasPermissions('M_stockPrintList_salesPrice')) { //  售价权限
         const ind = this.isShowWarehouse ? 11 : 10
-		arr.splice(ind, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+		    arr.splice(ind, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(ind+1, 0, { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(ind+2, 0, { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '70px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
         arr.splice(ind+3, 0, { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '70px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(ind+4, 0, { title: '轮胎售价', dataIndex: 'receiveLtTotalAmount', width: '70px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
       return arr
     }