parent
f245868fb0
commit
9097fb73d8
@ -0,0 +1,62 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if(item.key){
|
||||
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
|
||||
}else{
|
||||
result +=`${key}[${index}]=${item}&`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
|
||||
export function index(params,isLoading = false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/match-url/index",
|
||||
params,
|
||||
paramsSerializer: customParamsSerializer,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params, isLoading = true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/match-url/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/match-url/save",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/match-url/destroy",
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-input v-model="select.url" placeholder="Old web page links"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="select.new_url" placeholder="New web page links"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editParameter('add')">add</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange"
|
||||
@pageSizeChange="pageSizeChange" :table-item="table_item">
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' fixed="right" label="Operate" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editParameter('editor',scope.row.id)">edit</el-button>
|
||||
<el-popconfirm confirm-button-text="confirm" cancel-button-text="cancel" style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="Are you sure to delete it?">
|
||||
<el-button type="danger" size="small" slot="reference">delete</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
<addMatchurl ref="addMatchurl" @refresh="getList"></addMatchurl>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addMatchurl from './components/addMatchurl.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/matchurl/index.js";
|
||||
export default {
|
||||
components: {
|
||||
addMatchurl
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
url: '',
|
||||
new_url: '',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
},
|
||||
total: 0,
|
||||
list: [],
|
||||
table_item: [{
|
||||
type: 'index',
|
||||
width: 50,
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'url',
|
||||
label: 'Old web page links',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
prop: 'new_url',
|
||||
label: 'New web page links',
|
||||
align: 'left',
|
||||
},{
|
||||
prop: 'remark',
|
||||
label: 'Remark',
|
||||
align: 'left',
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
editParameter(type, id) {
|
||||
if (type == 'editor') {
|
||||
this.$refs.addMatchurl.id = id
|
||||
}
|
||||
this.$refs.addMatchurl.type = type
|
||||
this.$refs.addMatchurl.isShow = true
|
||||
},
|
||||
pageIndexChange(e) {
|
||||
this.select.page = e
|
||||
this.getList()
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.select.page_size = e
|
||||
this.select.page = 1
|
||||
this.getList()
|
||||
},
|
||||
resetSearch() {
|
||||
this.select.page = 1
|
||||
this.select.url = ''
|
||||
this.select.new_url = ''
|
||||
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
const res = await index({
|
||||
...this.select,
|
||||
filter:[{
|
||||
key:'url',
|
||||
op:'like',
|
||||
value:this.select.url
|
||||
},{
|
||||
key:'new_url',
|
||||
op:'like',
|
||||
value:this.select.new_url
|
||||
}]
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id:id
|
||||
}).then(response => {
|
||||
this.$Message.success('Success');
|
||||
this.getList()
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
Loading…
Reference in new issue