467 lines
25 KiB
HTML
467 lines
25 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>{$node.node_title}</title>
|
|
{include file="common/header"/}
|
|
|
|
<el-form :inline="true">
|
|
<el-form-item>
|
|
<el-button icon="el-icon-plus" size="small" @click="clickAdd" plain>添加</el-button>
|
|
</el-form-item>
|
|
<div style="float:right">
|
|
<el-form-item style="width:120px;">
|
|
<el-select placeholder="筛选类别" size="small" v-model="search.filter">
|
|
<el-option value="conf_id" label="参数ID">
|
|
</el-option>
|
|
<el-option value="conf_title" label="参数名称">
|
|
</el-option>
|
|
<el-option value="conf_key" label="参数字段">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input placeholder="输入关键词搜索" size="small" v-model="search.keyword"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="getList_search" plain>搜索</el-button>
|
|
</el-form-item>
|
|
</div>
|
|
</el-form>
|
|
<el-table :data="dataList.data" @selection-change="changeSelection" v-loading="loading">
|
|
<el-table-column prop="conf_id" label="ID" width="60">
|
|
</el-table-column>
|
|
<el-table-column prop="conf_type" label="所属分类" width="150">
|
|
<template slot-scope="scope">
|
|
<el-tag size="small" type="success" v-if="scope.row.conf_type==1">店铺设置</el-tag>
|
|
<el-tag size="small" type="warning" v-else-if="scope.row.conf_type==2">上传配置</el-tag>
|
|
<el-tag size="small" type="info" v-else-if="scope.row.conf_type==3">短信配置</el-tag>
|
|
<el-tag size="small" type="danger" v-else-if="scope.row.conf_type==4">其他配置</el-tag>
|
|
<el-tag size="small" type="success" v-else-if="scope.row.conf_type==5">微信支付配置</el-tag>
|
|
<el-tag size="small" type="warning" v-else-if="scope.row.conf_type==6">支付宝支付配置</el-tag>
|
|
<el-tag size="small" type="success" v-else-if="scope.row.conf_type==7">微信小程序配置</el-tag>
|
|
<el-tag size="small" type="danger" v-else-if="scope.row.conf_type==8">微信公众号配置</el-tag>
|
|
<el-tag size="small" type="danger" v-else-if="scope.row.conf_type==9">物流配置</el-tag>
|
|
<el-tag size="small" type="danger" v-else-if="scope.row.conf_type==10">交易设置</el-tag>
|
|
<el-tag size="small" type="danger" v-else-if="scope.row.conf_type==11">售后设置</el-tag>
|
|
<el-tag size="small" v-else>基础设置</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="conf_title" label="参数名称">
|
|
</el-table-column>
|
|
<el-table-column prop="conf_desc" label="参数描述">
|
|
</el-table-column>
|
|
<el-table-column prop="conf_key" label="参数字段">
|
|
<template slot-scope="scope">
|
|
<el-tooltip class="item" effect="dark" :content="scope.row.conf_title" placement="top">
|
|
<el-link>{{scope.row.conf_key}}</el-link>
|
|
</el-tooltip>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="conf_sort" label="排序" width="90">
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="180">
|
|
<template slot-scope="scope">
|
|
<el-link type="primary" @click="clickEdit(scope.row)" :underline="false">编辑</el-link>
|
|
<el-link type="danger" @click="clickDelete(scope.row)" :underline="false" v-if="scope.row.conf_system==0">删除</el-link>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
|
|
<div class="page">
|
|
<el-pagination @size-change="handleSizeChange" :page-sizes="[10, 20, 50, 100,200,500]" :page-size="10"
|
|
layout="total, sizes, prev, pager, next, jumper" background @current-change="changeCurrentPage"
|
|
:current-page="dataList.current_page" :page-count="dataList.last_page" :total="dataList.total">
|
|
</el-pagination>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 添加框 -->
|
|
<el-dialog title="添加配置" :visible.sync="dialogFormAdd" width="800px" :modal-append-to-body='false' append-to-body :close-on-click-modal='false'>
|
|
<el-form :model="formAdd" status-icon :rules="rules" ref="formAdd">
|
|
<el-form-item label="所属分类" :label-width="formLabelWidth" prop="conf_type">
|
|
<el-select v-model="formAdd.conf_type" placeholder="请选择所属分类" size="medium">
|
|
<el-option label="基础设置" value="0"></el-option>
|
|
<el-option label="店铺设置" value="1"></el-option>
|
|
<el-option label="上传配置" value="2"></el-option>
|
|
<el-option label="短信配置" value="3"></el-option>
|
|
<el-option label="其他配置" value="4"></el-option>
|
|
<el-option label="微信支付配置" value="5"></el-option>
|
|
<el-option label="支付宝支付配置" value="6"></el-option>
|
|
<el-option label="微信小程序配置" value="7"></el-option>
|
|
<el-option label="微信公众号配置" value="8"></el-option>
|
|
<el-option label="物流配置" value="9"></el-option>
|
|
<el-option label="交易设置" value="10"></el-option>
|
|
<el-option label="售后设置" value="11"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="参数名称" :label-width="formLabelWidth" prop="conf_title">
|
|
<el-input size="medium" autocomplete="off" v-model="formAdd.conf_title"></el-input>
|
|
<span style="color: #999;">参数名称,如:网站LOGO</span>
|
|
</el-form-item>
|
|
<el-form-item label="参数字段" :label-width="formLabelWidth" prop="conf_key">
|
|
<el-input size="medium" autocomplete="off" v-model="formAdd.conf_key"></el-input>
|
|
<span style="color: #999;">参数字段,如:logo</span>
|
|
</el-form-item>
|
|
<el-form-item label="参数描述" :label-width="formLabelWidth">
|
|
<el-input size="medium" autocomplete="off" v-model="formAdd.conf_desc"></el-input>
|
|
<span style="color: #999;">参数描述,如:建议尺寸: 300*300</span>
|
|
</el-form-item>
|
|
<el-form-item label="字段类型" :label-width="formLabelWidth">
|
|
<el-radio-group v-model="formAdd.conf_spec" size="small">
|
|
<el-radio-button label="0">文本框</el-radio-button>
|
|
<el-radio-button label="1">多行文本框</el-radio-button>
|
|
<el-radio-button label="2">单选框</el-radio-button>
|
|
<el-radio-button label="3">多选框</el-radio-button>
|
|
<el-radio-button label="4">单图</el-radio-button>
|
|
<el-radio-button label="5">多图</el-radio-button>
|
|
<el-radio-button label="6">富文本</el-radio-button>
|
|
</el-radio-group>
|
|
<el-input v-if="formAdd.conf_spec==2 || formAdd.conf_spec==3" type="textarea" v-model="formAdd.conf_content"
|
|
:rows="4" placeholder="参数方式例如: 开启=>1 关闭=>0" style="margin-top: 10px;"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="显示隐藏" :label-width="formLabelWidth">
|
|
<el-switch size="medium" v-model="formAdd.conf_status"></el-switch>
|
|
</el-form-item>
|
|
<el-form-item label="排序" :label-width="formLabelWidth">
|
|
<el-input-number v-model="formAdd.conf_sort" :min="0" :max="999" size="medium" style="width: 120px;" controls-position="right" />
|
|
</el-form-item>
|
|
<el-form-item label="系统参数" :label-width="formLabelWidth">
|
|
<el-switch size="medium" v-model="formAdd.conf_system"></el-switch>
|
|
<div style="color: #999;">开启后,添加的参数将无法删除</div>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="postAdd">确认添加</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<!-- 修改框 -->
|
|
<el-dialog title="修改配置" :visible.sync="dialogFormEdit" width="800px" :modal-append-to-body='false' append-to-body :close-on-click-modal='false'>
|
|
<el-form :model="formEdit" status-icon :rules="rules" ref="formEdit">
|
|
<el-form-item label="所属分类" :label-width="formLabelWidth" prop="conf_type">
|
|
<el-select v-model="formEdit.conf_type" placeholder="请选择所属分类" size="medium">
|
|
<el-option label="基础设置" value="0"></el-option>
|
|
<el-option label="店铺设置" value="1"></el-option>
|
|
<el-option label="上传配置" value="2"></el-option>
|
|
<el-option label="短信配置" value="3"></el-option>
|
|
<el-option label="其他配置" value="4"></el-option>
|
|
<el-option label="微信支付配置" value="5"></el-option>
|
|
<el-option label="支付宝支付配置" value="6"></el-option>
|
|
<el-option label="微信小程序配置" value="7"></el-option>
|
|
<el-option label="微信公众号配置" value="8"></el-option>
|
|
<el-option label="物流配置" value="9"></el-option>
|
|
<el-option label="交易设置" value="10"></el-option>
|
|
<el-option label="售后设置" value="11"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="参数名称" :label-width="formLabelWidth" prop="conf_title">
|
|
<el-input size="medium" autocomplete="off" v-model="formEdit.conf_title"></el-input>
|
|
<span style="color: #999;">参数名称,如:网站LOGO</span>
|
|
</el-form-item>
|
|
<el-form-item label="参数字段" :label-width="formLabelWidth" prop="conf_key">
|
|
<el-input size="medium" autocomplete="off" v-model="formEdit.conf_key"></el-input>
|
|
<span style="color: #6881ec;">参数字段,切勿随意修改</span>
|
|
</el-form-item>
|
|
<el-form-item label="参数描述" :label-width="formLabelWidth">
|
|
<el-input size="medium" autocomplete="off" v-model="formEdit.conf_desc"></el-input>
|
|
<span style="color: #999;">参数描述,如:建议尺寸: 300*300</span>
|
|
</el-form-item>
|
|
<el-form-item label="字段类型" :label-width="formLabelWidth">
|
|
<el-radio-group v-model="formEdit.conf_spec" size="small">
|
|
<el-radio-button label="0">文本框</el-radio-button>
|
|
<el-radio-button label="1">多行文本框</el-radio-button>
|
|
<el-radio-button label="2">单选框</el-radio-button>
|
|
<el-radio-button label="3">多选框</el-radio-button>
|
|
<el-radio-button label="4">单图</el-radio-button>
|
|
<el-radio-button label="5">多图</el-radio-button>
|
|
<el-radio-button label="6">富文本</el-radio-button>
|
|
</el-radio-group>
|
|
<el-input v-if="formEdit.conf_spec==2 || formEdit.conf_spec==3" type="textarea" v-model="formEdit.conf_content" :rows="4" placeholder="参数方式例如: 开启=>1 关闭=>0" style="margin-top: 10px;"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="显示隐藏" :label-width="formLabelWidth">
|
|
<el-switch size="medium" v-model="formEdit.conf_status"></el-switch>
|
|
</el-form-item>
|
|
<el-form-item label="排序" :label-width="formLabelWidth">
|
|
<el-input-number v-model="formEdit.conf_sort" :min="0" :max="999" size="medium" style="width: 120px;"
|
|
controls-position="right" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="postEdit">确认修改</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
{include file="common/footer"/}
|
|
<script>
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
this.getList();
|
|
return {
|
|
search: {
|
|
keyword: "",
|
|
filter: "conf_id"
|
|
},
|
|
formLabelWidth: '80px',
|
|
dialogFormAdd: false,
|
|
dialogFormEdit: false,
|
|
loading: true,
|
|
dataList: [],
|
|
selectList: [],
|
|
form: {
|
|
page: 1,
|
|
per_page: 10
|
|
},
|
|
formAdd: {
|
|
conf_status: true,
|
|
conf_spec: 0,
|
|
conf_sort: 0,
|
|
},
|
|
formEdit: {},
|
|
rules: {
|
|
conf_title: [
|
|
{ required: true, message: '参数名称必须填写', trigger: 'blur' },
|
|
],
|
|
conf_key: [
|
|
{ required: true, message: '参数字段必须填写', trigger: 'blur' },
|
|
],
|
|
conf_type: [
|
|
{ required: true, message: '所属分类必须填写', trigger: 'blur' },
|
|
],
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
getList_search() {
|
|
this.form.page = 1;
|
|
this.getList();
|
|
},
|
|
handleSizeChange(per_page) {
|
|
this.form.per_page = per_page;
|
|
this.getList();
|
|
},
|
|
postMultDelete() {
|
|
var that = this;
|
|
if (that.selectList.length == 0) {
|
|
that.$message.error('未选择任何配置!');
|
|
return;
|
|
}
|
|
this.$confirm('即将删除选中的配置, 是否确认?', '批量删除', {
|
|
confirmButtonText: '删除',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
axios.post('/admin/conf/delete', Object.assign({}, PostBase, {
|
|
conf_id: that.selectList.join(",")
|
|
}))
|
|
.then(function (response) {
|
|
that.getList();
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.$message({
|
|
message: response.data.message,
|
|
type: 'success'
|
|
});
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
changeSelection(list) {
|
|
var that = this;
|
|
that.selectList = [];
|
|
for (var index in list) {
|
|
that.selectList.push(list[index].conf_id);
|
|
}
|
|
},
|
|
postEdit() {
|
|
var that = this;
|
|
that.$refs['formEdit'].validate((valid) => {
|
|
if (!valid) {
|
|
that.$message.error('仔细检查检查,是不是有个地方写得不对?');
|
|
return;
|
|
}
|
|
axios.post('/admin/conf/update', Object.assign({}, PostBase, that.formEdit))
|
|
.then(function (response) {
|
|
that.getList();
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.$message({
|
|
message: response.data.message,
|
|
type: 'success'
|
|
});
|
|
that.dialogFormEdit = false;
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
});
|
|
},
|
|
postAdd() {
|
|
var that = this;
|
|
that.$refs['formAdd'].validate((valid) => {
|
|
if (!valid) {
|
|
that.$message.error('仔细检查检查,是不是有个地方写得不对?');
|
|
return;
|
|
}
|
|
axios.post('/admin/conf/add', Object.assign({}, PostBase, that.formAdd))
|
|
.then(function (response) {
|
|
that.getList();
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.$message({
|
|
message: response.data.message,
|
|
type: 'success'
|
|
});
|
|
that.dialogFormAdd = false;
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
});
|
|
},
|
|
clickAdd() {
|
|
var that = this;
|
|
that.formAdd = {
|
|
conf_status: true,
|
|
conf_spec: 0,
|
|
conf_sort: 0,
|
|
};
|
|
axios.post('/admin/conf/getList', Object.assign({}, PostBase))
|
|
.then(function (response) {
|
|
that.groupList = response.data.data;
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.dialogFormAdd = true;
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
},
|
|
clickDelete(row) {
|
|
var that = this;
|
|
this.$confirm('即将删除这个配置, 是否确认?', '删除提醒', {
|
|
confirmButtonText: '删除',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
axios.post('/admin/conf/delete', Object.assign({}, PostBase, {
|
|
conf_id: row.conf_id
|
|
}))
|
|
.then(function (response) {
|
|
that.getList();
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.$message({
|
|
message: response.data.message,
|
|
type: 'success'
|
|
});
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
clickStatus(row) {
|
|
var that = this;
|
|
axios.post(row.conf_status ? '/admin/conf/enable' : '/admin/conf/disable', Object.assign({}, PostBase, {
|
|
conf_id: row.conf_id
|
|
}))
|
|
.then(function (response) {
|
|
that.getList();
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.$message({
|
|
message: response.data.message,
|
|
type: 'success'
|
|
});
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
},
|
|
clickEdit(row) {
|
|
var that = this;
|
|
that.formEdit = row;
|
|
axios.post('/admin/conf/getList', Object.assign({}, PostBase))
|
|
.then(function (response) {
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.groupList = response.data.data;
|
|
axios.post('/admin/conf/detail', Object.assign({}, PostBase, {
|
|
conf_id: row.conf_id
|
|
}))
|
|
.then(function (response) {
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
response.data.data.conf_status = response.data.data.conf_status?true:false;
|
|
response.data.data.conf_type = response.data.data.conf_type.toString();
|
|
that.formEdit = response.data.data;
|
|
that.dialogFormEdit = true;
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
|
|
},
|
|
changeCurrentPage(page) {
|
|
this.form.page = page;
|
|
this.getList();
|
|
},
|
|
getList() {
|
|
var that = this;
|
|
that.loading = true;
|
|
axios.post('/admin/conf/getList', Object.assign({}, PostBase, that.form, that.search))
|
|
.then(function (response) {
|
|
that.loading = false;
|
|
if (response.data.code == CODE_SUCCESS) {
|
|
that.dataList = response.data.data;
|
|
} else {
|
|
that.$message.error(response.data.message);
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
that.loading = false;
|
|
that.$message.error('服务器内部错误');
|
|
console.log(error);
|
|
});
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
|
|
|
|
</html> |