application

master
lion 7 months ago
parent 674d8b3d82
commit be91a66c28

@ -0,0 +1,60 @@
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/application-reviews/index",
params,
paramsSerializer: customParamsSerializer,
isLoading
})
}
export function show(params, isLoading = true) {
return request({
method: "get",
url: "/api/admin/application-reviews/show",
params,
isLoading
})
}
export function save(data) {
return request({
method: "post",
url: "/api/admin/application-reviews/save",
data
})
}
export function destroy(params) {
return request({
method: "get",
url: "/api/admin/application-reviews/destroy",
params
})
}

@ -0,0 +1,457 @@
<template>
<div>
<xy-dialog ref="dialog" :width="60" :is-show.sync="isShow" :type="'form'" :title="$route.meta.title" :form="form"
:rules='rules' @submit="submit">
<template v-slot:application_type_id>
<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>Application Samples
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" filterable multiple collapse-tags v-model="form.application_type_id" placeholder="Please Select">
<el-option v-for="item in appCategoryList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:category_id>
<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>Product Phase
</div>
<div class="xy-table-item-content">
<el-select multiple filterable collapse-tags style="width:100%" v-model="form.category_id" placeholder="Please Select">
<el-option v-for="(item,index) in productCategoryList" :key="index" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:number>
<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>Application Id
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.number"></el-input>
</div>
</div>
</template>
<template v-slot:title>
<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>Title
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.title"></el-input>
</div>
</div>
</template>
<template v-slot:is_top>
<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>Top
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_top"
placeholder="Please Select">
<el-option v-for="item in [{id:0,value:'No'},{id:1,value:'Yes'}]" :key="item.id" :label="item.value"
:value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:is_visible>
<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>Visible
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_visible" placeholder="Please Select">
<el-option v-for="item in visibelList" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:time>
<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>Sort Time
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.time" style="width:100%" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="Please Select">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:keywords>
<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>Keywords
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" type="textarea" style="width:100%" v-model="form.keywords"></el-input>
</div>
</div>
</template>
<template v-slot:separation>
<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>Separation Mode
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.separation"
placeholder="Please Select">
<el-option v-for="item in separationModeList" :key="item.id" :label="item.value"
:value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:branch>
<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>Brand
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.branch"
placeholder="Please Select">
<el-option v-for="item in brandList" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:topic>
<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>Topic
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.topic"
placeholder="Please Select">
<el-option v-for="item in topicList" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:equipment>
<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>Equipment
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.equipment"
placeholder="Please Select">
<el-option v-for="item in equipmentList" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<!-- <template v-slot:tag_ids>
<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>Tags
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" multiple filterable collapse-tags v-model="form.tag_ids"
placeholder="Please Select">
<el-option v-for="item in tagsList" :key="item.id" :label="item.value" :value="item.id"></el-option>
</el-select>
</div>
</div>
</template> -->
<template v-slot:file_ids>
<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>Files
</div>
<div class="xy-table-item-content">
<el-upload :action="action" :limit="1" class='upload-demo' multiple :file-list="filesList"
ref="pictureUpload" :auto-upload="true" :data="uploadOther" :on-success="handlesuccess"
:on-remove="handleRemove" :on-progress="handleProgress">
<el-button size="small" type="primary">upload</el-button>
</el-upload>
<el-progress v-if="showProgress" :percentage="uploadProgress"></el-progress>
</div>
</div>
</template>
<template v-slot:application_details>
<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>Column
</div>
<div class="xy-table-item-content">
<el-button type="primary" style="margin-bottom:10px" size="small" @click="addRow">Add Row</el-button>
<xy-table style="width:850px" :list="form.application_details" :isPage="false" :height="350"
:table-item="detail_item">
<template v-slot:key>
<el-table-column align='left' label="key" width="340">
<template slot-scope="scope">
<el-input placeholder="Please Input" style="width:100%" v-model="scope.row.key"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:value>
<el-table-column align='left' label="value" width="340">
<template slot-scope="scope">
<el-input placeholder="Please Input" style="width:100%" v-model="scope.row.value"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='left' fixed="right" label="operate" width="120" header-align="center">
<template slot-scope="scope">
<el-popconfirm confirm-button-text="confirm" cancel-button-text="cancel" style="margin:0 10px"
@confirm="delRow(scope.row,scope.$index)" 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>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show
} from "@/api/application/reviews.js"
import {
getToken
} from '@/utils/auth'
import
applicationMixin
from "@/mixin/application.js"
import {
index as getCategory
} from "@/api/product/category.js"
export default {
mixins: [applicationMixin],
data() {
return {
isShow: false,
id: '',
type: 'add',
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_UPLOAD_API}`,
filesList: [],
showProgress:false,
uploadProgress:0,
appCategoryList: [],
productCategoryList: [],
detail_item: [{
type: 'index',
width: 50
}, {
prop: 'key',
label: 'key',
width: 340
}, {
prop: 'value',
label: 'value',
width: 340
}],
visibelList: [{
id: 1,
value: 'Yes'
}, {
id: 0,
value: 'No'
}],
form: {
application_type_id: [],
category_id: [],
number: '',
title: "",
is_top:0,
is_visible:1,
time:'',
keywords:'',
separation: [],
branch: [],
topic: [],
equipment: [],
tag_ids: [],
file_ids: '',
application_details: [],
},
rules: {
title: [{
required: true,
message: 'Please Input'
}],
number: [{
required: true,
message: 'Please Input'
}],
application_type_id: [{
required: true,
message: 'Please Input'
}]
}
}
},
created() {
this.uploadOther.token = getToken();
this.getCategoryList()
},
methods: {
handleRemove(file, fileList) {
this.filesList = fileList
},
handlesuccess(response, file, fileList) {
if (response && response.hasOwnProperty('errcode')) {
this.$Message.warning(response.errmsg || '')
this.filesList = []
return
}
this.filesList = fileList
},
handleProgress(event, file, fileList) {
this.showProgress = true;
this.uploadProgress = event.percent;
},
addRow() {
var len = this.form.application_details.length;
this.form.application_details.push({
key: '',
value: ''
})
},
delRow(obj, index) {
this.form.application_details.splice(index, 1);
},
async getCategoryList() {
const res = await getCategory({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
type: 2
})
this.productCategoryList = res.data
},
submit() {
if (this.id) {
this.form.id = this.id
} else {
this.form.id = ''
}
let _files = []
if (this.filesList.length > 0) {
for (var h of this.filesList) {
if (h.response) {
_files.push(h.response.id)
} else {
_files.push(h.id)
}
}
this.form.file_ids = _files
} else {
this.form.file_ids = []
}
console.log("this.form", this.form)
// return
save({
...this.form
}).then(res => {
this.$message({
type: 'success',
message: 'Success'
})
this.isShow = false
this.$emit('refresh')
})
},
getDetail() {
show({
id: this.id,
show_relation: ['applicationDetails']
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
this.form.application_details = res.application_details ? res.application_details : [],
this.form.tag_ids = res.tag_ids?res.tag_ids:[],
this.form.category_id = res.category_id?res.category_id:[],
this.form.application_type_id = res.application_type_id?res.application_type_id:[],
// this.form.is_top = res.is_top?res.is_top:0
this.form.separation = res.separation?res.separation:[]
this.form.branch = res.branch?res.branch:[]
this.form.topic = res.topic?res.topic:[]
this.form.is_visible = res.is_visible?res.is_visible:0
this.form.is_top = res.is_top?res.is_top:0
this.form.equipment = res.equipment?res.equipment:[],
this.form.time = res.time ? res.time : this.$moment().format('YYYY-MM-DD HH:mm:ss')
if (res.files && res.files.length > 0) {
this.filesList = []
res.files.map(item => {
this.filesList.push({
name: item.original_name,
id: item.id,
url: item.url
})
})
}
})
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}else{
this.form.time = this.$moment().format('YYYY-MM-DD HH:mm:ss')
}
} else {
this.id = ''
this.filesList = []
this.uploadProgress = 0
this.showProgress = false
this.form = {
application_type_id: [],
category_id: [],
number: '',
title: "",
is_visible:1,
time:'',
is_top:0,
keywords:'',
separation: [],
branch: [],
topic: [],
equipment: [],
tag_ids: [],
file_ids: '',
application_details: [],
}
this.$refs['dialog'].reset()
}
},
}
}
</script>
<style scoped lang="scss">
::v-deep .file_ids,
::v-deep .application_details {
flex-basis: 100%;
}
</style>

@ -13,7 +13,7 @@
<el-input v-model="select.number" placeholder="Application Id"></el-input>
</div>
<div>
<el-select style="width:100%" clearable v-model="select.is_top" placeholder="Visible">
<el-select style="width:100%" clearable v-model="select.is_top" placeholder="Top">
<el-option v-for="(item,index) in [{id: 1,value: 'Yes'}, {id: 0,value: 'No'}]" :key="index"
:label="item.value" :value="item.id">
</el-option>

@ -0,0 +1,212 @@
<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.title" placeholder="Title"></el-input>
</div>
<div>
<el-input v-model="select.number" placeholder="Application Id"></el-input>
</div>
<div>
<el-select style="width:100%" clearable v-model="select.is_top" placeholder="Top">
<el-option v-for="(item,index) in [{id: 1,value: 'Yes'}, {id: 0,value: 'No'}]" :key="index"
:label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
<div>
<el-select style="width:100%" clearable v-model="select.is_visible" placeholder="Visible">
<el-option v-for="(item,index) in [{id: 1,value: 'Yes'}, {id: 0,value: 'No'}]" :key="index"
:label="item.value" :value="item.id">
</el-option>
</el-select>
</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="editNote('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="editNote('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>
<addLr ref="addLr" @refresh="getList"></addLr>
</div>
</template>
<script>
import addLr from './components/addLr.vue';
import {
index,
destroy
} from "@/api/application/reviews.js"
import {
index as getCategory
} from "@/api/application/category.js"
export default {
components: {
addLr
},
data() {
return {
select: {
title: '',
number: '',
is_top:'',
is_visible: '',
page: 1,
page_size: 10,
},
appCategoryList: [],
total: 0,
list: [],
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
}, {
prop: 'number',
label: 'Application Id',
align: 'left',
width: 360
}, {
prop: 'title',
label: 'Title',
align: 'left',
}, {
prop: 'is_top',
label: 'Top',
align: 'center',
width: 120,
is_text: true,
text_prop: 'is_top_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
}, {
prop: 'is_visible',
label: 'Visible',
align: 'center',
width: 120,
is_text: true,
text_prop: 'is_visible_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
}, {
prop: 'time',
label: 'Sort Time',
align: 'center',
width: 180,
}]
}
},
created() {
this.getCategoryList()
this.getList()
},
methods: {
editNote(type, id) {
if (type == 'editor') {
this.$refs.addLr.id = id
}
this.$refs.addLr.appCategoryList = this.appCategoryList
this.$refs.addLr.type = type
this.$refs.addLr.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.title = ''
this.select.number = ''
this.select.is_visible = ''
this.select.is_top = ''
this.getList()
},
async getList() {
const res = await index({
...this.select,
sort_name: 'time',
sort_type: 'desc',
filter: [{
key: 'title',
op: 'like',
value: this.select.title
}, {
key: 'number',
op: 'like',
value: this.select.number
}, {
key: 'is_visible',
op: 'eq',
value: this.select.is_visible
}, {
key: 'is_top',
op: 'eq',
value: this.select.is_top
}]
})
this.list = res.data
this.total = res.total
},
async getCategoryList() {
const res = await getCategory({
page: 1,
page_size: 999
})
this.appCategoryList = res.data
},
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>

@ -33,7 +33,8 @@
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_top" placeholder="Please Select">
<el-option v-for="(item,index) in [{name:'No',id:0},{name:'Yes',id:1}]" :key="index" :label="item.name" :value="item.id">
<el-option v-for="(item,index) in [{name:'No',id:0},{name:'Yes',id:1}]" :key="index" :label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
@ -46,12 +47,13 @@
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.is_visible" placeholder="Please Select">
<el-option v-for="item in [{id: 1,value: 'Yes'}, {id: 0,value: 'No'}]" :key="item.id" :label="item.value" :value="item.id"></el-option>
<el-option v-for="item in [{id: 1,value: 'Yes'}, {id: 0,value: 'No'}]" :key="item.id" :label="item.value"
:value="item.id"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:date>
<!-- <template v-slot:date>
<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>Sort Time
@ -62,8 +64,17 @@
</el-date-picker>
</div>
</div>
</template> -->
<template v-slot:sort>
<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>Sort
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.sort"></el-input>
</div>
</div>
</template>
<template v-slot:files>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
@ -71,7 +82,8 @@
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' :limit="1" :file-list="filesList" ref="pictureUpload"
:auto-upload="true" :data="uploadOther" :on-progress="handleProgress" :on-success="handlesuccess" :on-remove="handleRemove">
:auto-upload="true" :data="uploadOther" :on-progress="handleProgress" :on-success="handlesuccess"
:on-remove="handleRemove">
<el-button size="small" type="primary">upload</el-button>
</el-upload>
<el-progress v-if="showProgress" :percentage="uploadProgress"></el-progress>
@ -104,16 +116,17 @@
token: ""
},
action: `${process.env.VUE_APP_UPLOAD_API}`,
showProgress:false,
uploadProgress:0,
showProgress: false,
uploadProgress: 0,
filesList: [],
categoryList:[],
categoryList: [],
form: {
category_ids: [],
name: "",
is_top:0,
is_visible:1,
date:'',
is_top: 0,
is_visible: 1,
// date:'',
sort: 0,
// product_ids:[],
files: []
},
@ -187,11 +200,11 @@
json_data_fields: ['files']
}).then(res => {
this.form = this.base.requestToForm(res, this.form)
this.form.date = res.date?res.date:this.$moment().format('YYYY-MM-DD HH:mm:ss')
this.form.is_top = res.is_top?res.is_top:0
this.form.is_visible = res.is_visible?res.is_visible:0
this.form.category_ids = res.category_ids?res.category_ids:[]
// this.form.date = res.date ? res.date : this.$moment().format('YYYY-MM-DD HH:mm:ss')
this.form.is_top = res.is_top ? res.is_top : 0
this.form.is_visible = res.is_visible ? res.is_visible : 0
this.form.sort = res.sort ? res.sort : 0
this.form.category_ids = res.category_ids ? res.category_ids : []
if (res.files_details && res.files_details.length > 0) {
this.filesList = []
res.files_details.map(item => {
@ -210,8 +223,8 @@
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}else{
this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss')
} else {
// this.form.date = this.$moment().format('YYYY-MM-DD HH:mm:ss')
}
} else {
@ -222,9 +235,10 @@
this.form = {
category_ids: [],
name: "",
is_top:0,
is_visible:1,
date:'',
is_top: 0,
is_visible: 1,
sort:0,
// date: '',
// product_ids: [],
files: []
}

@ -86,8 +86,8 @@
page_size: 10,
sort_name: "is_top",
sort_type: "DESC",
sort_name2: "date",
sort_type2: "DESC",
sort_name2: "sort",
sort_type2: "asc",
},
categoryList: [],
total: 0,
@ -118,12 +118,20 @@
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
}
}, {
prop: 'date',
label: 'Sort Time',
},
// {
// prop: 'date',
// label: 'Sort Time',
// align: 'left',
// width: 180
// },
{
prop: 'sort',
label: 'Sort',
align: 'left',
width: 180
}, {
},
{
prop: 'admin.name',
label: 'Creator',
align: 'left',

Loading…
Cancel
Save