lion 10 months ago
parent 4481fa90df
commit 35ae0c7414

@ -2,6 +2,9 @@
ENV='development'
# base api
VUE_APP_BASE_API=http://saifen.ali251.langye.net
VUE_APP_UPLOAD_API=http://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_BASE_API = https://saifen.ali251.langye.net
VUE_APP_UPLOAD_API = https://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=http://view.ali251.langye.net:8012/onlinePreview
#VUE_APP_BASE_API = https://sepax-pdm-test.langye.net
#VUE_APP_UPLOAD_API = https://sepax-pdm-test.langye.net/api/admin/upload-file

@ -2,6 +2,10 @@
ENV = 'production'
# base api
VUE_APP_BASE_API = http://saifen.ali251.langye.net
VUE_APP_UPLOAD_API = http://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_BASE_API = https://saifen.ali251.langye.net
VUE_APP_UPLOAD_API = https://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=http://view.ali251.langye.net:8012/onlinePreview
#VUE_APP_BASE_API = https://sepax-pdm-test.langye.net
#VUE_APP_UPLOAD_API = https://sepax-pdm-test.langye.net/api/admin/upload-file

@ -4,7 +4,10 @@ NODE_ENV = production
ENV = 'staging'
# base api
VUE_APP_BASE_API=http://saifen.ali251.langye.net
VUE_APP_UPLOAD_API=http://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=http://view.ali251.langye.net:8012/onlinePreview
VUE_APP_BASE_API = https://saifen.ali251.langye.net
VUE_APP_UPLOAD_API = https://saifen.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=https://view.ali251.langye.net:8012/onlinePreview
#VUE_APP_BASE_API = https://sepax-pdm-test.langye.net
#VUE_APP_UPLOAD_API = https://sepax-pdm-test.langye.net/api/admin/upload-file

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

@ -0,0 +1,151 @@
<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:name>
<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>Name
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.name"></el-input>
</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:product_phase_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 style="width:100%" filterable v-model="form.product_phase_id" placeholder="Please Select">
<el-option v-for="(item,index) in categoryList" :key="index" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show
} from "@/api/recommend/index.js"
import {
index as getCategory
} from "@/api/product/category.js"
export default {
data() {
return {
isShow: false,
id: '',
type: 'add',
categoryList: [],
form: {
name: "",
sort: 0,
product_phase_id: ''
},
rules: {
name: [{
required: true,
message: 'Please Input'
}],
sort: [{
required: true,
message: 'Please Input'
}],
product_phase_id: [{
required: true,
message: 'Please Select'
}]
}
}
},
created() {
this.getCategoryList()
},
methods: {
async getCategoryList() {
const res = await getCategory({
page: 1,
page_size: 999,
type: 2,
sort_name: 'sort',
sort_type: 'ASC'
})
this.categoryList = res.data
},
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)
this.form.product_phase_id = res.product_phase_id ? res.product_phase_id : ''
this.form.sort = res.sort?res.sort:0
})
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.form = {
name: "",
sort:0,
product_phase_id:''
}
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,138 @@
<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.name" placeholder="Name"></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>
<add-recommend ref="addRecommend" @refresh="getList"></add-recommend>
</div>
</template>
<script>
import addRecommend from './components/addRecommend.vue';
import {
index,
destroy
} from "@/api/recommend/index.js";
export default {
components: {
addRecommend
},
data() {
return {
select: {
name: '',
page: 1,
page_size: 10,
sort_name:'sort',
sort_type:'ASC',
},
total: 0,
list: [],
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
}, {
prop: 'name',
label: 'Name',
align: 'left',
},
{
prop: 'sort',
label: 'Sort',
align: 'left',
width: 120
}
]
}
},
created() {
this.getList()
},
methods: {
editParameter(type, id) {
if (type == 'editor') {
this.$refs.addRecommend.id = id
}
this.$refs.addRecommend.type = type
this.$refs.addRecommend.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.getList()
},
async getList() {
const res = await index({
...this.select,
filter:[{
key:'name',
op:'like',
value:this.select.name
}]
})
this.list = res.data
this.total = res.total
},
deleteList(id) {
var that = this;
destroy({
id:id
}).then(response => {
this.$Message.success('操作成功');
this.getList()
}).catch(error => {
console.log(error)
reject(error)
})
},
}
}
</script>
<style lang="scss" scoped>
</style>

@ -323,7 +323,7 @@
this.form.date = res.date ? res.date : this.$moment().format('YYYY-MM-DD HH:mm:ss')
this.form.category_ids = res.category_ids ? res.category_ids : [],
this.form.product_numbers = res.product_numbers ? res.product_numbers : []
this.form.product_numbers = res.product_numbers ? res.product_numbers : []
this.form.separation_mode = res.separation_mode ? res.separation_mode : []
this.form.broad_sample_type = res.broad_sample_type ? res.broad_sample_type : []
this.form.specific_sample = res.specific_sample ? res.specific_sample : []

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-美国赛分/saifen/public/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-美国赛分/saifen/public/admin_test',
assetsDir: 'static',
css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save