Commit 0cf4a039 by 王志慧

fixed

1 parent edf65a00
......@@ -8,7 +8,7 @@
<div class="title-text">喜报列表</div>
<el-button :size="size" type="primary" class="battle-set-btn" @click="handlebattleOn()">新增</el-button>
</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>{{ formatterContent(scope.scope) }}</div>
</div>
......@@ -32,6 +32,7 @@ export default {
merchantName: '',
groupMerchantName: ''
},
tableSearchForm:{},
searchFormData: [
{
label: '4S店',
......@@ -52,8 +53,7 @@ export default {
width: '215px',
optionList: [],
optionId: 'merchantName',
optionLabel: 'merchantName',
optionsName: 'merchantList'
optionLabel: 'merchantName'
}
],
getListApi: this.$apis.clewOrder.getClueReportList,
......@@ -100,11 +100,18 @@ export default {
this.getMerchantList()
},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = JSON.parse(JSON.stringify(this.searchForm))
this.searchForm.groupMerchantName == '全部' ? (this.tableSearchForm.groupMerchantName = '') : ''
resolve()
})
},
getMerchantList() {
this.$apis.battle.getMerchantList({}).then(res => {
this.baseData.merchantList = res
this.merchantList = res
this.getOptionsList('searchFormData')
this.searchFormData[2].optionList = [{ merchantId: '全部', merchantName: '全部' }].concat(this.merchantList)
})
},
formatterContent(cellValue) {
......@@ -114,37 +121,17 @@ export default {
})
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() {
this.searchForm = {
merchantId: '',
merchantName: '',
groupMerchantName: ''
}
this.tableSearchForm={
merchantId: '',
merchantName: '',
groupMerchantName: ''
}
this.handleSearch()
},
handlebattleOn(id) {
......@@ -167,7 +154,6 @@ export default {
},
handleSearch() {
this.searchForm.groupMerchantName =''
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!