Commit 0cf4a039 by 王志慧

fixed

1 parent edf65a00
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="title-text">喜报列表</div> <div class="title-text">喜报列表</div>
<el-button :size="size" type="primary" class="battle-set-btn" @click="handlebattleOn()">新增</el-button> <el-button :size="size" type="primary" class="battle-set-btn" @click="handlebattleOn()">新增</el-button>
</div> </div>
<GLTable ref="battleRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"> <GLTable ref="battleRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="content" slot-scope="scope"> <div slot="content" slot-scope="scope">
<div>{{ formatterContent(scope.scope) }}</div> <div>{{ formatterContent(scope.scope) }}</div>
</div> </div>
...@@ -32,6 +32,7 @@ export default { ...@@ -32,6 +32,7 @@ export default {
merchantName: '', merchantName: '',
groupMerchantName: '' groupMerchantName: ''
}, },
tableSearchForm:{},
searchFormData: [ searchFormData: [
{ {
label: '4S店', label: '4S店',
...@@ -52,8 +53,7 @@ export default { ...@@ -52,8 +53,7 @@ export default {
width: '215px', width: '215px',
optionList: [], optionList: [],
optionId: 'merchantName', optionId: 'merchantName',
optionLabel: 'merchantName', optionLabel: 'merchantName'
optionsName: 'merchantList'
} }
], ],
getListApi: this.$apis.clewOrder.getClueReportList, getListApi: this.$apis.clewOrder.getClueReportList,
...@@ -100,11 +100,18 @@ export default { ...@@ -100,11 +100,18 @@ export default {
this.getMerchantList() this.getMerchantList()
}, },
methods: { methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = JSON.parse(JSON.stringify(this.searchForm))
this.searchForm.groupMerchantName == '全部' ? (this.tableSearchForm.groupMerchantName = '') : ''
resolve()
})
},
getMerchantList() { getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => { this.$apis.battle.getMerchantList({}).then(res => {
this.baseData.merchantList = res this.baseData.merchantList = res
this.merchantList = res this.merchantList = res
this.getOptionsList('searchFormData') this.searchFormData[2].optionList = [{ merchantId: '全部', merchantName: '全部' }].concat(this.merchantList)
}) })
}, },
formatterContent(cellValue) { formatterContent(cellValue) {
...@@ -114,37 +121,17 @@ export default { ...@@ -114,37 +121,17 @@ export default {
}) })
return txt return txt
}, },
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName]?.length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
merchantId: '', merchantId: '',
merchantName: '', merchantName: '',
groupMerchantName: '' groupMerchantName: ''
} }
this.tableSearchForm={
merchantId: '',
merchantName: '',
groupMerchantName: ''
}
this.handleSearch() this.handleSearch()
}, },
handlebattleOn(id) { handlebattleOn(id) {
...@@ -167,7 +154,6 @@ export default { ...@@ -167,7 +154,6 @@ export default {
}, },
handleSearch() { handleSearch() {
this.searchForm.groupMerchantName =''
this.$refs.battleRef.refreshTable() this.$refs.battleRef.refreshTable()
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!