Commit f39c491e by 张立顺

fix 路由传参修改

1 parent 2b42564c
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
components: {}, components: {},
computed: {}, computed: {},
created() { created() {
this.recordInfo = this.$route.params.info this.recordInfo = JSON.parse(this.$route.query.info)
}, },
mounted() { mounted() {
this.getHistoryRecord() this.getHistoryRecord()
......
<!-- 设备管理 --> <!-- 设备管理 -->
<template> <template>
<d2-container class="service-manage"> <d2-container class="service-manage">
<div class="header" <div class="header" slot="header">
slot="header"> <d2-search
<d2-search ref="showSearch" ref="showSearch"
class="show-search" class="show-search"
:search-form="searchForm" :search-form="searchForm"
:form-data="showFormData" /> :form-data="showFormData"
/>
<div class="up-btns"> <div class="up-btns">
<el-button :id="tableParams.btnId" <el-button :id="tableParams.btnId" size="small" type="primary">
size="small"
type="primary">
查询 查询
</el-button> </el-button>
<el-button size="small" <el-button size="small" @click="handleReset"> 重置 </el-button>
@click="handleReset">
重置
</el-button>
</div> </div>
</div> </div>
<div class="d2-container-content"> <div class="d2-container-content">
<d2-table-header> <d2-table-header>
<span slot="left"> <span slot="left"> <auth-button category="Button" /></span>
<auth-button category="Button" /></span>
</d2-table-header> </d2-table-header>
<d2-table ref="deviceTable" <d2-table
:search-form="searchForm" ref="deviceTable"
:table-params="tableParams" :search-form="searchForm"
:get-list-api="getListApi" :table-params="tableParams"
:before-search-fn="beforeSearchFn"> :get-list-api="getListApi"
<auth-button slot="auth-button" :before-search-fn="beforeSearchFn"
slot-scope="scope" >
:data="scope.scope" /> <auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
/>
</d2-table> </d2-table>
</div> </div>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { Util, deepClone } from '@/common/util' import { Util, deepClone } from "@/common/util"
import { trmList, trmDelete } from '@api/deviceManage' import { trmList, trmDelete } from "@api/deviceManage"
import { mapActions } from 'vuex' import { mapActions } from "vuex"
import { BaseData } from '@/common/constants.js' import { BaseData } from "@/common/constants.js"
export default { export default {
name: 'DviceList', name: "DviceList",
data() { data() {
return { return {
searchForm: { searchForm: {
posTrmNo: '', posTrmNo: "",
searchMerchantName: '', searchMerchantName: "",
searchMerchantId: '' searchMerchantId: ""
}, },
showFormData: [{ showFormData: [
label: '终端编码', {
name: 'posTrmNo', label: "终端编码",
type: 'input', name: "posTrmNo",
placeholder: '请输入POS机的终端编码', type: "input",
maxlength: '20', placeholder: "请输入POS机的终端编码",
isClear: true, maxlength: "20",
keyFn: this.keyDowmGetList isClear: true,
}, { keyFn: this.keyDowmGetList
label: '商户名称', },
name: 'searchMerchantName', {
type: 'input', label: "商户名称",
placeholder: '请输入流量方/园区店名称', name: "searchMerchantName",
maxlength: '20', type: "input",
isClear: true, placeholder: "请输入流量方/园区店名称",
keyFn: this.keyDowmGetList maxlength: "20",
}, { isClear: true,
label: '商户号', keyFn: this.keyDowmGetList
name: 'searchMerchantId', },
type: 'input', {
inputType: 'number', label: "商户号",
maxlength: '20', name: "searchMerchantId",
placeholder: '请输入流量方/园区店商户号', type: "input",
isClear: true, inputType: "number",
keyFn: this.keyDowmGetList maxlength: "20",
}], placeholder: "请输入流量方/园区店商户号",
isClear: true,
keyFn: this.keyDowmGetList
}
],
maxLength: 10, maxLength: 10,
getListApi: trmList, getListApi: trmList,
// 表格参数 // 表格参数
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: "list",
tableOption: true, tableOption: true,
tableColumns: [{ tableColumns: [
label: '终端编码', {
prop: 'posTrmNo' label: "终端编码",
}, { prop: "posTrmNo"
label: '关联园区店', },
prop: 'yqMerchantName' {
}, { label: "关联园区店",
label: '园区店商户号', prop: "yqMerchantName"
prop: 'yqMerchantId', },
width: '120' {
}, { label: "园区店商户号",
label: '关联流量方', prop: "yqMerchantId",
prop: 'merchantName' width: "120"
}, { },
label: '流量方商户号', {
prop: 'merchantId', label: "关联流量方",
width: '120' prop: "merchantName"
}, { },
label: '最近更新时间', {
prop: 'updatedDate', label: "流量方商户号",
width: '160', prop: "merchantId",
formatter: (cellValue) => { width: "120"
return Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') },
{
label: "最近更新时间",
prop: "updatedDate",
width: "160",
formatter: (cellValue) => {
return Util.dateFormate(
cellValue.updatedDate,
"YYYY-MM-DD HH:mm:ss"
)
}
} }
}] ]
}, },
baseData: { baseData: {}
}
} }
}, },
components: { components: {},
},
mounted() { mounted() {
this.getBaseData() this.getBaseData()
...@@ -127,13 +137,13 @@ export default { ...@@ -127,13 +137,13 @@ export default {
}, },
methods: { methods: {
...mapActions({ close: 'd2admin/page/close' }), ...mapActions({ close: "d2admin/page/close" }),
async getBaseData() { async getBaseData() {
this.getOptionsList() this.getOptionsList()
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise((resolve) => {
resolve() resolve()
}) })
}, },
...@@ -142,26 +152,29 @@ export default { ...@@ -142,26 +152,29 @@ export default {
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
posTrmNo: '', posTrmNo: "",
searchMerchantName: '', searchMerchantName: "",
searchMerchantId: '' searchMerchantId: ""
} }
this.$refs.deviceTable.refreshTable() this.$refs.deviceTable.refreshTable()
}, },
getOptionsList() { getOptionsList() {
this.showFormData.forEach((item, index) => { this.showFormData.forEach((item, index) => {
if (item.type === 'select') { if (item.type === "select") {
if ( if (
this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部' this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== "全部"
) { ) {
const temp = {} const temp = {}
temp[this.showFormData[index].optionId] = '' temp[this.showFormData[index].optionId] = ""
temp[this.showFormData[index].optionLabel] = '全部' temp[this.showFormData[index].optionLabel] = "全部"
this.baseData[item.optionsName].unshift(temp) this.baseData[item.optionsName].unshift(temp)
} }
this.$set( this.$set(
this.showFormData[index], this.showFormData[index],
'optionList', "optionList",
this.baseData[item.optionsName] this.baseData[item.optionsName]
) )
} }
...@@ -169,21 +182,21 @@ export default { ...@@ -169,21 +182,21 @@ export default {
}, },
handleAdd() { handleAdd() {
this.close({ tagName: '/editDevice' }) this.close({ tagName: "/editDevice" })
this.$router.push({ this.$router.push({
name: 'editDevice', name: "editDevice",
params: { params: {
addOrEdit: 'add' addOrEdit: "add"
} }
}) })
}, },
handleEdit(row) { handleEdit(row) {
this.close({ tagName: '/editDevice' }) this.close({ tagName: "/editDevice" })
this.$router.push({ this.$router.push({
name: 'editDevice', name: "editDevice",
params: { params: {
addOrEdit: 'edit', addOrEdit: "edit",
info: row info: row
} }
}) })
...@@ -208,17 +221,16 @@ export default { ...@@ -208,17 +221,16 @@ export default {
}, },
handleHistory(row) { handleHistory(row) {
this.close({ tagName: '/deviceHistory' }) this.close({ tagName: "/deviceHistory" })
this.$router.push({ this.$router.push({
name: 'deviceHistory', name: "deviceHistory",
params: { query: {
info: row info: JSON.stringify(row)
} }
}) })
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!