master
lion 2 months ago
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,127 @@
<template>
<div>
<xy-dialog ref="dialog" :width="50" :is-show.sync="isShow" :type="'form'" :title="$route.meta.title" :form="form"
:rules='rules' @submit="submit">
<template v-slot:url>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>Old web page links
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.url"></el-input>
</div>
</div>
</template>
<template v-slot:new_url>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>New web page links
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.new_url"></el-input>
</div>
</div>
</template>
<template v-slot:remark>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Remark
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.remark"></el-input>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show
} from "@/api/matchurl/index.js"
export default {
data() {
return {
isShow: false,
id: '',
type: 'add',
form: {
url: "",
new_url: 0,
remark: ''
},
rules: {
url: [{
required: true,
message: 'Please Input'
}],
new_url: [{
required: true,
message: 'Please Input'
}]
}
}
},
created() {
},
methods: {
submit() {
if (this.id) {
this.form.id = this.id
} else {
this.form.id = ''
}
// return
save({
...this.form
}).then(res => {
this.$message({
type: 'success',
message: 'Success'
})
this.isShow = false
this.$emit('refresh')
})
},
getDetail() {
show({
id: this.id
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
})
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.form = {
url: "",
new_url: '',
remark: ''
}
this.$refs['dialog'].reset()
}
},
}
}
</script>
<style scoped lang="scss">
::v-deep .name,
::v-deep .sort,
::v-deep .product_phase_id {
flex-basis: 100%;
}
</style>

@ -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>

@ -120,8 +120,7 @@
</div>
<div class="xy-table-item-content">
<el-select :remote-method="remoteMethod" v-loadmore="loadMore"
style="width:100%" v-model="form.product_numbers" multiple
style="width:100%" v-model="form.product_numbers" multiple
placeholder="Please Select">
<div style="display: flex;align-items: center;padding:10px">
<el-input size="small" v-model="number_keyword" placeholder="Please Input Part Number"></el-input>
@ -137,7 +136,6 @@
<div v-if="productPage>=lastPage" style="text-align: center;">There is no more data</div>
<div v-else style="text-align: center;">Loading More</div>
</div>
</el-select>
</div>
</div>
@ -317,7 +315,6 @@
console.log("e",e)
},
remoteMethod(query) {
this.productPage =1
this.productList = []
this.getProductList(query)

Loading…
Cancel
Save