|
|
|
@ -12,11 +12,11 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<el-table max-height="500" @selection-change="selectionChange" v-loading="loading" ref="table" :data="tableList" |
|
|
|
|
highlight-current-row empty-text="暂无数据" class="mt14"> |
|
|
|
|
<el-table-column type="selection" width="55"> |
|
|
|
|
:row-key="(row) => row.siteId" highlight-current-row empty-text="暂无数据" class="mt14"> |
|
|
|
|
<el-table-column type="selection" reserve-selection width="55"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="油站名称" prop="siteName"> </el-table-column> |
|
|
|
|
<el-table-column label="渠道" prop="channel"> </el-table-column> |
|
|
|
|
<el-table-column label="油站名称" prop="siteName"></el-table-column> |
|
|
|
|
<el-table-column label="渠道" prop="channel"></el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
|
|
|
|
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
|
|
|
@ -24,9 +24,10 @@ |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import productApi from '@/api/product/productAttr.js'; |
|
|
|
|
import productApi from '@/api/product/productAttr.js' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: "OilStationSelection", |
|
|
|
|
name: 'OilStationSelection', |
|
|
|
|
props: { |
|
|
|
|
OilStationSelectionList: { |
|
|
|
|
type: Array, |
|
|
|
@ -34,7 +35,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
selectAttrId: { |
|
|
|
|
type: String, |
|
|
|
|
default: () => "" |
|
|
|
|
default: () => '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
@ -43,24 +44,24 @@ export default { |
|
|
|
|
loading: false, |
|
|
|
|
tableList: [], |
|
|
|
|
page: { |
|
|
|
|
"currentPage": 1, |
|
|
|
|
"pageSize": 10, |
|
|
|
|
"totalCount": 0, |
|
|
|
|
"params": { |
|
|
|
|
"siteName": "" |
|
|
|
|
}, |
|
|
|
|
'currentPage': 1, |
|
|
|
|
'pageSize': 10, |
|
|
|
|
'totalCount': 0, |
|
|
|
|
'params': { |
|
|
|
|
'siteName': '' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
OilStationSelectionList:{ |
|
|
|
|
handler(n,o){ |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
OilStationSelectionList: { |
|
|
|
|
handler(n, o) { |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
n.forEach(element => { |
|
|
|
|
this.$refs.table.toggleRowSelection(element); |
|
|
|
|
}); |
|
|
|
|
this.$refs.table.toggleRowSelection(element) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
deep:true |
|
|
|
|
deep: true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
@ -83,27 +84,28 @@ export default { |
|
|
|
|
return !!value |
|
|
|
|
&& typeof value === 'object' |
|
|
|
|
&& typeof value.then === 'function' |
|
|
|
|
&& typeof value.finally === 'function'; |
|
|
|
|
&& typeof value.finally === 'function' |
|
|
|
|
}, |
|
|
|
|
loadingFn(callback) { |
|
|
|
|
this.loading = true; |
|
|
|
|
this.loading = true |
|
|
|
|
if (this.isStrictPromise(callback)) { |
|
|
|
|
callback.finally(() => { |
|
|
|
|
this.loading = false; |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
getByPage() { |
|
|
|
|
this.loadingFn(productApi.getAllSites(this.page).then(res => { |
|
|
|
|
// ({ |
|
|
|
|
// data: this.tableList = [], |
|
|
|
|
// currentPage: this.page.currentPage, |
|
|
|
|
// pageSize: this.page.pageSize, |
|
|
|
|
// totalCount: this.page.totalCount |
|
|
|
|
// } = res.data); |
|
|
|
|
this.tableList = res.data |
|
|
|
|
console.log(res) |
|
|
|
|
})); |
|
|
|
|
if (res.code === 20000) { |
|
|
|
|
this.tableList = res.data.list |
|
|
|
|
this.page.totalCount = parseInt(res.data.totalCount) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.tableList = [] |
|
|
|
|
this.page.totalCount = 0 |
|
|
|
|
} |
|
|
|
|
})) |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.page.currentPage = val |
|
|
|
@ -117,20 +119,20 @@ export default { |
|
|
|
|
productApi.delete(e).then(res => { |
|
|
|
|
if (res.code == 20000) { |
|
|
|
|
this.$message.success('操作成功') |
|
|
|
|
this.handleCurrentChange(); |
|
|
|
|
this.handleCurrentChange() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
edit(row) { |
|
|
|
|
let data = Object.assign({}, row, { |
|
|
|
|
name: this.selectAttrId.split("/")[1] || "", |
|
|
|
|
name: this.selectAttrId.split('/')[1] || '', |
|
|
|
|
spec: [{ |
|
|
|
|
value: row.attributeName, |
|
|
|
|
detail: row.attributeContent.split(",") |
|
|
|
|
}], |
|
|
|
|
detail: row.attributeContent.split(',') |
|
|
|
|
}] |
|
|
|
|
}) |
|
|
|
|
this.$parent.$parent.selection = [data]; |
|
|
|
|
this.$parent.$parent.addAttr('typeUpdate'); |
|
|
|
|
this.$parent.$parent.selection = [data] |
|
|
|
|
this.$parent.$parent.addAttr('typeUpdate') |
|
|
|
|
}, |
|
|
|
|
init() { |
|
|
|
|
// this.getByPage(); |
|
|
|
|