mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-05-01 22:41:24 +08:00
12.31开源admin代码更新
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<el-switch v-model="pram.status" :active-value="true" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handlerSubmit('pram')">{{ isCreate===0?'確定':'更新' }}</el-button>
|
||||
<el-button type="primary" @click="handlerSubmit('pram')" v-hasPermi="['admin:system:admin:update','admin:system:admin:save']">{{ isCreate===0?'確定':'更新' }}</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -47,6 +47,7 @@
|
||||
<script>
|
||||
import * as roleApi from '@/api/role.js'
|
||||
import * as systemAdminApi from '@/api/systemadmin.js'
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
// name: "edit"
|
||||
components: { },
|
||||
@@ -97,14 +98,11 @@ export default {
|
||||
roleList: [],
|
||||
rules: {
|
||||
account: [{ required: true, message: '请填管理员账号', trigger: ['blur', 'change'] }],
|
||||
// level: null,
|
||||
pwd: [{ required: true, message: '请填管理员密码', trigger: ['blur', 'change'] }],
|
||||
repwd: [{ required: true, message: '确认密码密码', validator: validatePass, trigger: ['blur', 'change'] }],
|
||||
realName: [{ required: true, message: '管理员姓名', trigger: ['blur', 'change'] }],
|
||||
roles: [{ required: true, message: '管理员身份', type: 'array', trigger: ['blur', 'change'] }],
|
||||
phone: [
|
||||
{ validator: validatePhone, trigger: 'blur' }
|
||||
]
|
||||
roles: [{ required: true, message: '管理员身份', trigger: ['blur', 'change'] }],
|
||||
phone: [ { required: true, message: '请输入手机号', trigger: ['blur', 'change']} ]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -123,7 +121,14 @@ export default {
|
||||
status: 1
|
||||
}
|
||||
roleApi.getRoleList(_pram).then(data => {
|
||||
this.roleList = data
|
||||
this.roleList = data;
|
||||
let arr = [];
|
||||
data.list.forEach(item=>{
|
||||
arr.push(item.id);
|
||||
})
|
||||
if(!arr.includes(Number.parseInt(this.pram.roles))){
|
||||
this.$set(this.pram,'roles',[]);
|
||||
}
|
||||
})
|
||||
},
|
||||
initEditData() {
|
||||
@@ -133,8 +138,10 @@ export default {
|
||||
this.pram.realName = realName
|
||||
const _roles = []
|
||||
if (roles.length > 0 && !roles.includes(',')) {
|
||||
//如果权限id集合有长度并且是只有一个,就将它Push进_roles这个数组
|
||||
_roles.push(Number.parseInt(roles))
|
||||
} else {
|
||||
//否则就将多个id集合解构以后push进roles并且转换为整型
|
||||
_roles.push(...roles.split(',').map(item => Number.parseInt(item)))
|
||||
}
|
||||
this.pram.roles = _roles
|
||||
@@ -144,7 +151,7 @@ export default {
|
||||
this.rules.pwd = []
|
||||
this.rules.repwd = []
|
||||
},
|
||||
handlerSubmit(form) {
|
||||
handlerSubmit:Debounce(function(form) {
|
||||
this.$refs[form].validate(valid => {
|
||||
if (!valid) return
|
||||
if (this.isCreate === 0) {
|
||||
@@ -153,7 +160,7 @@ export default {
|
||||
this.handlerEdit()
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
handlerSave() {
|
||||
systemAdminApi.adminAdd(this.pram).then(data => {
|
||||
this.$message.success('创建管理员成功')
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
</el-form>
|
||||
<el-form inline @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)">添加管理员</el-button>
|
||||
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)" v-hasPermi="['admin:system:admin:save']">添加管理员</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="listData.list" size="mini">
|
||||
<el-table :data="listData.list" size="mini" :header-cell-style=" {fontWeight:'bold'}">
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
@@ -48,8 +48,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="身份" prop="realName" min-width="230">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" type="info" v-for="(item, index) in scope.row.roleNames.split(',')" class="mr5">{{ item }}</el-tag>
|
||||
<template slot-scope="scope" v-if="scope.row.roleNames">
|
||||
<el-tag size="small" type="info" v-for="(item, index) in scope.row.roleNames.split(',')" :key="index" class="mr5">{{ item }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最后登录时间" prop="lastTime" min-width="180">
|
||||
@@ -66,7 +66,7 @@
|
||||
label="状态"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<template slot-scope="scope" v-if="checkPermi(['admin:system:admin:update:status'])">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
:active-value="true"
|
||||
@@ -81,7 +81,7 @@
|
||||
label="是否接收短信"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<template slot-scope="scope" v-if="checkPermi(['admin:system:admin:update:sms'])">
|
||||
<el-switch
|
||||
v-model="scope.row.isSms"
|
||||
:active-value="true"
|
||||
@@ -104,8 +104,8 @@
|
||||
<span>-</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button type="text" size="mini" @click="handlerOpenEdit(1,scope.row)">编辑</el-button>
|
||||
<el-button type="text" size="mini" @click="handlerOpenDel(scope.row)">删除</el-button>
|
||||
<el-button type="text" size="mini" @click="handlerOpenEdit(1,scope.row)" v-hasPermi="['admin:system:admin:info']">编辑</el-button>
|
||||
<el-button type="text" size="mini" @click="handlerOpenDel(scope.row)" v-hasPermi="['admin:system:admin:delete']">删除</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -140,6 +140,7 @@
|
||||
import * as systemAdminApi from '@/api/systemadmin.js'
|
||||
import * as roleApi from '@/api/role.js'
|
||||
import edit from './edit'
|
||||
import { checkPermi } from "@/utils/permission"; // 权限判断函数
|
||||
export default {
|
||||
// name: "index"
|
||||
components: { edit },
|
||||
@@ -174,6 +175,7 @@ export default {
|
||||
this.handleGetRoleList()
|
||||
},
|
||||
methods: {
|
||||
checkPermi,
|
||||
onchangeIsShow(row) {
|
||||
systemAdminApi.updateStatusApi({id: row.id, status: row.status})
|
||||
.then(async () => {
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="pram" :model="pram" label-width="100px" @submit.native.prevent>
|
||||
<el-form-item label="身份名称" prop="roleName" :rules="[{required:true,message:'请填写身份名称', trigger:['blur','change']}]">
|
||||
<el-form-item label="角色名称" prop="roleName" :rules="[{required:true,message:'请填写角色名称', trigger:['blur','change']}]">
|
||||
<el-input v-model="pram.roleName" placeholder="身份名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="pram.status" :active-value="true" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="权限">
|
||||
<category-list
|
||||
:biztype="constants.categoryType[4]"
|
||||
:select-model="true"
|
||||
:row-select="pram.rules"
|
||||
:select-model-keys="editData.rules ? editData.rules.split(',') : []"
|
||||
@rulesSelect="rulesSelect"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单权限">
|
||||
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
||||
<!-- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox> -->
|
||||
<el-checkbox v-model="menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
||||
<el-tree
|
||||
class="tree-border"
|
||||
:data="menuOptions"
|
||||
show-checkbox
|
||||
ref="menu"
|
||||
node-key="id"
|
||||
:check-strictly="!menuCheckStrictly"
|
||||
empty-text="加载中,请稍候"
|
||||
:props="defaultProps"
|
||||
></el-tree>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handlerSubmit('pram')">{{ isCreate===0?'確定':'更新' }}</el-button>
|
||||
<el-button type="primary" @click="handlerSubmit('pram')" v-hasPermi="['admin:system:role:update','admin:system:role:save']">{{ isCreate===0?'確定':'更新' }}</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -25,11 +31,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import categoryList from '@/components/Category/list'
|
||||
import * as roleApi from '@/api/role.js'
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
// name: "edit"
|
||||
components: { categoryList },
|
||||
name: "roleEdit",
|
||||
props: {
|
||||
isCreate: {
|
||||
type: Number,
|
||||
@@ -42,18 +47,27 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
constants:this.$constants,
|
||||
pram: {
|
||||
level: 1,
|
||||
roleName: null,
|
||||
rules: [],
|
||||
rules: '',
|
||||
status: null,
|
||||
id: null
|
||||
}
|
||||
},
|
||||
menuExpand: false,
|
||||
menuNodeAll: false,
|
||||
menuOptions:[],
|
||||
menuCheckStrictly: true,
|
||||
currentNodeId:[],
|
||||
defaultProps: {
|
||||
children: "childList",
|
||||
label: "name",
|
||||
},
|
||||
menuIds:[],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initEditData()
|
||||
this.initEditData();
|
||||
this.getCacheMenu();
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
@@ -61,23 +75,41 @@ export default {
|
||||
},
|
||||
initEditData() {
|
||||
if (this.isCreate !== 1) return
|
||||
const { level, roleName, rules, status, id } = this.editData
|
||||
this.pram.rules = rules.split(',')
|
||||
this.pram.level = level
|
||||
const { roleName, status, id } = this.editData
|
||||
this.pram.roleName = roleName
|
||||
this.pram.status = status
|
||||
this.pram.id = id
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
});
|
||||
roleApi.getInfo(id).then(res=>{
|
||||
this.menuOptions = res.menuList;
|
||||
this.checkDisabled(this.menuOptions);
|
||||
loading.close();
|
||||
this.getTreeId(res.menuList)
|
||||
this.$nextTick(()=>{
|
||||
this.menuIds.forEach((i,n) =>{
|
||||
var node = this.$refs.menu.getNode(i);
|
||||
if(node.isLeaf){
|
||||
this.$refs.menu.setChecked(node, true);
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
handlerSubmit(form) {
|
||||
handlerSubmit:Debounce(function(form) {
|
||||
this.$refs[form].validate(valid => {
|
||||
if (!valid) return
|
||||
let roles = this.getMenuAllCheckedKeys().toString();
|
||||
this.pram.rules = roles;
|
||||
if (this.isCreate === 0) {
|
||||
this.handlerSave()
|
||||
} else {
|
||||
this.handlerEdit()
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
handlerSave() {
|
||||
roleApi.addRole(this.pram).then(data => {
|
||||
this.$message.success('创建身份成功')
|
||||
@@ -92,7 +124,74 @@ export default {
|
||||
},
|
||||
rulesSelect(selectKeys) {
|
||||
this.pram.rules = selectKeys
|
||||
}
|
||||
},
|
||||
// 树权限(展开/折叠)
|
||||
handleCheckedTreeExpand(value, type) {
|
||||
if (type == 'menu') {
|
||||
let treeList = this.menuOptions;
|
||||
for (let i = 0; i < treeList.length; i++) {
|
||||
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 树权限(全选/全不选)
|
||||
handleCheckedTreeNodeAll(value, type) {
|
||||
if (type == 'menu') {
|
||||
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||
}
|
||||
},
|
||||
// 树权限(父子联动)
|
||||
handleCheckedTreeConnect(value, type) {
|
||||
if (type == 'menu') {
|
||||
this.menuCheckStrictly = value ? true: false;
|
||||
}
|
||||
},
|
||||
// 所有菜单节点数据
|
||||
getMenuAllCheckedKeys() {
|
||||
// 目前被选中的菜单节点
|
||||
let checkedKeys = this.$refs.menu.getCheckedKeys();
|
||||
// 半选中的菜单节点
|
||||
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||
return checkedKeys;
|
||||
},
|
||||
getCacheMenu(){
|
||||
if (this.isCreate !== 0) return
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
});
|
||||
roleApi.menuCacheList().then(res=>{
|
||||
this.menuOptions = res;
|
||||
this.checkDisabled(this.menuOptions);
|
||||
loading.close();
|
||||
})
|
||||
},
|
||||
getTreeId(datas) {
|
||||
for(var i in datas){
|
||||
if(datas[i].checked) this.menuIds.push(datas[i].id)
|
||||
if(datas[i].childList){
|
||||
this.getTreeId(datas[i].childList);
|
||||
}
|
||||
}
|
||||
},
|
||||
checkDisabled(data){
|
||||
//设置公共权限默认勾选且不可操作
|
||||
data.forEach(item=>{
|
||||
if(item.id === 280 || item.id === 294 || item.id === 344){
|
||||
item.disabled = true;
|
||||
item.childList.forEach(item1=>{
|
||||
item1.disabled = true;
|
||||
this.$nextTick(()=>{
|
||||
var node = this.$refs.menu.getNode(item1.id);
|
||||
if(node.isLeaf){
|
||||
this.$refs.menu.setChecked(node, true);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -3,46 +3,38 @@
|
||||
<el-card class="box-card">
|
||||
<el-form inline size="small" @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-select v-model="listPram.status" placeholder="状态" clearable class="selWidth">
|
||||
<el-option
|
||||
v-for="item in constants.roleListStatus"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="listPram.roleName" placeholder="请输入身份昵称" clearable class="selWidth"/>
|
||||
<el-input v-model="listPram.roleName" placeholder="请输入角色昵称" clearable class="selWidth"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="mini" type="primary" @click.native="handleGetRoleList">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form inline @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)">添加身份</el-button>
|
||||
<el-button size="mini" type="primary" @click="handlerOpenEdit(0)" v-hasPermi="['admin:system:role:save','admin:system:menu:cache:tree']">添加角色</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="listData.list" size="mini">
|
||||
<el-table-column label="身份昵称" prop="roleName" min-width="130"/>
|
||||
<el-table-column label="权限" show-overflow-tooltip min-width="350">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.rulesView | filterEmpty }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="level" prop="level" />-->
|
||||
<el-table :data="listData.list" size="mini" :header-cell-style=" {fontWeight:'bold',background:'#f8f8f9',color: '#515a6e',height:'40px'}">
|
||||
<el-table-column label="角色编号" prop="id" width="120" ></el-table-column>
|
||||
<el-table-column label="角色昵称" prop="roleName" min-width="130"/>
|
||||
<el-table-column label="状态" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.status | filterShowOrHide }}</span>
|
||||
<template slot-scope="scope" v-if="checkPermi(['admin:system:role:update:status'])">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
style="width:40px;"
|
||||
@change="handleStatusChange(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="150"/>
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="150"/>
|
||||
<el-table-column label="操作" min-width="130" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="small" type="text" @click="handlerOpenEdit(1,scope.row)">编辑</el-button>
|
||||
<el-button size="small" type="text" @click="handlerOpenDel(scope.row)">删除</el-button>
|
||||
<el-button size="small" type="text" @click="handlerOpenEdit(1,scope.row)" v-hasPermi="['admin:system:role:info']">编辑</el-button>
|
||||
<el-button size="small" type="text" @click="handlerOpenDel(scope.row)" v-hasPermi="['admin:system:role:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -60,12 +52,13 @@
|
||||
:title="editDialogConfig.isCreate === 0? '创建身份':'编辑身份'"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
width="500px">
|
||||
<edit
|
||||
v-if="editDialogConfig.visible"
|
||||
:is-create="editDialogConfig.isCreate"
|
||||
:edit-data="editDialogConfig.editData"
|
||||
@hideEditDialog="hideEditDialog"
|
||||
ref="editForm"
|
||||
/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -73,8 +66,8 @@
|
||||
|
||||
<script>
|
||||
import * as roleApi from '@/api/role.js'
|
||||
import * as categroyApi from '@/api/categoryApi.js'
|
||||
import edit from './edit'
|
||||
import { checkPermi } from "@/utils/permission"; // 权限判断函数
|
||||
export default {
|
||||
// name: "index"
|
||||
components: { edit },
|
||||
@@ -104,6 +97,7 @@ export default {
|
||||
this.handleGetRoleList()
|
||||
},
|
||||
methods: {
|
||||
checkPermi,
|
||||
handlerOpenDel(rowData) {
|
||||
this.$confirm('确认删除当前数据').then(() => {
|
||||
roleApi.delRole(rowData).then(data => {
|
||||
@@ -115,7 +109,6 @@ export default {
|
||||
handleGetRoleList() {
|
||||
roleApi.getRoleList(this.listPram).then(data => {
|
||||
this.listData = data
|
||||
this.handlerGetMenuList()
|
||||
})
|
||||
},
|
||||
handlerOpenEdit(isCreate, editDate) {
|
||||
@@ -123,24 +116,6 @@ export default {
|
||||
this.editDialogConfig.isCreate = isCreate
|
||||
this.editDialogConfig.visible = true
|
||||
},
|
||||
handlerGetMenuList() { // 获取菜单全部数据后做menu翻译使用
|
||||
categroyApi.listCategroy({ page: 1, limit: 999, type: 5 }).then(data => {
|
||||
this.menuList = data.list
|
||||
this.listData.list.forEach(item => {
|
||||
const _muneText = []
|
||||
const menuids = item.rules.split(',')
|
||||
menuids.map(muid => {
|
||||
this.menuList.filter(menu => {
|
||||
if (menu.id == muid) {
|
||||
_muneText.push(menu.name)
|
||||
}
|
||||
})
|
||||
})
|
||||
item.rulesView = _muneText.join(',')
|
||||
this.$set(item, 'rulesViews', item.rulesView)
|
||||
})
|
||||
})
|
||||
},
|
||||
hideEditDialog() {
|
||||
this.editDialogConfig.visible = false
|
||||
this.handleGetRoleList()
|
||||
@@ -152,11 +127,22 @@ export default {
|
||||
handleCurrentChange(val) {
|
||||
this.listPram.page = val
|
||||
this.handleGetRoleList(this.listPram)
|
||||
},
|
||||
//修改状态
|
||||
handleStatusChange(row){
|
||||
roleApi.updateRoleStatus(row).then(res=>{
|
||||
this.$message.success('更新状态成功')
|
||||
this.handleGetRoleList()
|
||||
})
|
||||
},
|
||||
resetQuery(){
|
||||
this.listPram.roleName = '';
|
||||
this.handleGetRoleList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,55 +1,427 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<category-list :biztype="constants.categoryType[4]" />
|
||||
<el-card class="box-card">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="菜单名称" prop="menuName">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入菜单名称"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="menuType">
|
||||
<el-select v-model="queryParams.menuType" placeholder="菜单状态" clearable size="small">
|
||||
<el-option
|
||||
v-for="item in statusOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="el-icon-sort"
|
||||
size="mini"
|
||||
@click="toggleExpandAll"
|
||||
>展开/折叠</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-if="refreshTable"
|
||||
v-loading="listLoading"
|
||||
:data="menuList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
:header-cell-style=" {fontWeight:'bold'}"
|
||||
>
|
||||
<el-table-column prop="name" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
||||
<el-table-column prop="icon" label="图标" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<i :class="'el-icon-' + scope.row.icon" style="font-size: 20px;" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" width="60"></el-table-column>
|
||||
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="isShow" label="状态" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isShow ? '' : 'danger'">{{scope.row.isShow ? '显示' : '隐藏'}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="menuType" label="类型" width="80">
|
||||
<template slot-scope="scope">
|
||||
<span class="type_tag one" v-if="scope.row.menuType == 'M'" >目录</span>
|
||||
<span class="type_tag two" v-else-if="scope.row.menuType == 'C'" >菜单</span>
|
||||
<span class="type_tag three" v-else type="info">按钮</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['admin:system:menu:info']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['admin:system:menu:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['admin:system:menu:delete']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改菜单对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上级菜单">
|
||||
<treeselect
|
||||
v-model="form.pid"
|
||||
:options="menuOptions"
|
||||
:normalizer="normalizer"
|
||||
:show-count="true"
|
||||
placeholder="选择上级菜单"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="菜单类型" prop="menuType">
|
||||
<el-radio-group v-model="form.menuType">
|
||||
<el-radio label="M">目录</el-radio>
|
||||
<el-radio label="C">菜单</el-radio>
|
||||
<el-radio label="A">按钮</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item v-if="form.menuType != 'A'" label="菜单图标">
|
||||
<el-form-item>
|
||||
<el-input placeholder="请选择菜单图标" v-model="form.icon">
|
||||
<el-button slot="append" icon="el-icon-circle-plus-outline" @click="addIcon"></el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="菜单名称" prop="menuName">
|
||||
<el-input v-model="form.name" placeholder="请输入菜单名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="显示排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="form.menuType !== 'A'">
|
||||
<!-- v-if="form.menuType == 'C'" -->
|
||||
<el-form-item prop="component">
|
||||
<span slot="label">
|
||||
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
组件路径
|
||||
</span>
|
||||
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.menuType != 'M'">
|
||||
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
||||
<span slot="label">
|
||||
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
权限字符
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item >
|
||||
<!-- v-if="form.menuType != 'A'" -->
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
显示状态
|
||||
</span>
|
||||
<el-radio-group v-model="form.isShow">
|
||||
<el-radio
|
||||
v-for="item in showStatus"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>{{item.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" v-hasPermi="['admin:system:menu:update']">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { asyncRoutes, constantRoutes } from '@/router'
|
||||
import * as categoryApi from '@/api/categoryApi.js'
|
||||
import categoryList from '@/components/Category/list'
|
||||
import { menuListApi,menuInfo,menuUpdate,menuAdd,menuDelete } from '@/api/systemadmin'
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
// name: "index"
|
||||
components: { categoryList },
|
||||
name: "Menu",
|
||||
components: { Treeselect, },
|
||||
data() {
|
||||
return {
|
||||
asyncRoutes,
|
||||
constants: this.$constants
|
||||
}
|
||||
// 遮罩层
|
||||
listLoading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 菜单表格树数据
|
||||
menuList: [],
|
||||
// 菜单树选项
|
||||
menuOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否展开,默认全部折叠
|
||||
isExpandAll: false,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
name: '',
|
||||
menuType:''
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
//请求到的menu数据
|
||||
menuDataList:[],
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "菜单名称不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
statusOptions: [
|
||||
{value: 'M',label: '目录'},
|
||||
{value: 'C',label: '菜单'},
|
||||
{value: 'A',label: '按钮'},
|
||||
],
|
||||
showStatus:[
|
||||
{label:'显示',value:true},
|
||||
{label:'隐藏',value:false},
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
categoryAdd(pram) {
|
||||
const _pram = {
|
||||
extra: pram.extra,
|
||||
name: pram.name,
|
||||
pid: pram.pid,
|
||||
sort: pram.sort,
|
||||
status: pram.status,
|
||||
type: pram.type,
|
||||
url: pram.url
|
||||
}
|
||||
categoryApi.addCategroy(_pram).then(data => {
|
||||
this.$message.success('添加菜单成功')
|
||||
// 点击图标
|
||||
addIcon() {
|
||||
const _this = this
|
||||
_this.$modalIcon(function(icon) {
|
||||
_this.form.icon = icon;
|
||||
})
|
||||
},
|
||||
/** 查询菜单列表 */
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
menuListApi(this.queryParams).then(res=>{
|
||||
let obj = {},menuList = [];
|
||||
res.forEach(item=>{
|
||||
obj = item;
|
||||
obj.parentId = item.pid;
|
||||
obj.children = [];
|
||||
menuList.push(obj);
|
||||
})
|
||||
this.menuDataList = menuList;
|
||||
this.menuList = this.handleTree(menuList, "menuId")
|
||||
this.listLoading = false;
|
||||
})
|
||||
},
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id ? node.id : 0,
|
||||
label: node.name ? node.name : '主目录',
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询菜单下拉树结构 */
|
||||
getTreeselect() {
|
||||
this.menuOptions = [];
|
||||
const menu = { menuId: 0, menuName: '主类目', children: [] };
|
||||
menu.children = this.handleTree(this.menuDataList, "menuId");
|
||||
this.menuOptions.push(menu);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
menuId: '',
|
||||
parentId: 0,
|
||||
name: '',
|
||||
icon: '',
|
||||
menuType: "M",
|
||||
sort: 0,
|
||||
isShow: true,
|
||||
component:'',
|
||||
perms:''
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = { name: '', menuType:''},
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
if (row != null && row.id) {
|
||||
this.form.pid = row.id;
|
||||
} else {
|
||||
this.form.pid = 0;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加菜单";
|
||||
},
|
||||
/** 展开/折叠操作 */
|
||||
toggleExpandAll() {
|
||||
this.refreshTable = false;
|
||||
this.isExpandAll = !this.isExpandAll;
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
});
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
menuInfo(row.id).then(response => {
|
||||
this.form = response;
|
||||
this.open = true;
|
||||
this.title = "修改菜单";
|
||||
loading.close();
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: Debounce(function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
menuUpdate(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
menuAdd(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}),
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
|
||||
return menuDelete(row.id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.routerView{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
<style lang="scss">
|
||||
.mb8{
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
.type_tag{
|
||||
display: inline-block;
|
||||
height: 32px;
|
||||
padding: 0 10px;
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.two{
|
||||
background: rgba(239, 156, 32, .1);
|
||||
color: rgba(239, 156, 32, 1);
|
||||
}
|
||||
.one{
|
||||
background: rgba(75, 202, 213, .1);
|
||||
color: rgba(75, 202, 213, 1);
|
||||
}
|
||||
.three{
|
||||
color: rgba(120, 128, 160, 1);
|
||||
background: rgba(120, 128, 160, .1);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-if="dialogVisible"
|
||||
title="运费模板"
|
||||
:visible.sync="dialogVisible"
|
||||
width="1000px"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<el-form ref="ruleForm" :model="ruleForm" label-width="120px" size="mini" v-if="dialogVisible" :rules="rules">
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input v-model="ruleForm.name" class="withs" placeholder="请输入模板名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计费方式" prop="type">
|
||||
<el-radio-group v-model="ruleForm.type" @change="changeRadio(ruleForm.type)">
|
||||
<el-radio :label="1">按件数</el-radio>
|
||||
<el-radio :label="2">按重量</el-radio>
|
||||
<el-radio :label="3">按体积</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="配送区域及运费" prop="region">
|
||||
<el-table v-loading="listLoading" :data="ruleForm.region" border fit highlight-current-row style="width: 100%" size="mini" class="tempBox">
|
||||
<el-table-column align="center" label="可配送区域" min-width="260">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.$index === 0">默认全国</span>
|
||||
<el-cascader
|
||||
v-else
|
||||
v-model="scope.row.city_ids"
|
||||
style="width: 98%"
|
||||
:options="cityList"
|
||||
:props="props"
|
||||
collapse-tags
|
||||
clearable
|
||||
filterable
|
||||
@change="changeRegion"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="130px" align="center" :label="columns.title" prop="first">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.first" :prop="'region.'+scope.$index+'.first'">
|
||||
<el-input-number v-model="scope.row.first" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120px" align="center" label="运费(元)" prop="firstPrice">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.firstPrice" :prop="'region.'+scope.$index+'.firstPrice'">
|
||||
<el-input-number v-model="scope.row.firstPrice" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120px" align="center" :label="columns.title2" prop="renewal">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.renewal" :prop="'region.'+scope.$index+'.renewal'">
|
||||
<el-input-number v-model="scope.row.renewal" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120" prop="renewalPrice">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.renewalPrice" :prop="'region.'+scope.$index+'.renewalPrice'">
|
||||
<el-input-number v-model="scope.row.renewalPrice" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.$index > 0"
|
||||
type="text"
|
||||
size="small"
|
||||
@click="confirmEdit(ruleForm.region,scope.$index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addRegion(ruleForm.region)">
|
||||
添加配送区域
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="指定包邮" prop="appoint">
|
||||
<el-radio-group v-model="ruleForm.appoint">
|
||||
<el-radio :label="true">开启</el-radio>
|
||||
<el-radio :label="false">关闭</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="ruleForm.appoint === true" prop="free">
|
||||
<el-table v-loading="listLoading" :data="ruleForm.free" border fit highlight-current-row style="width: 100%" size="mini">
|
||||
<el-table-column align="center" label="选择地区" min-width="220">
|
||||
<template slot-scope="{row}">
|
||||
<el-cascader
|
||||
v-model="row.city_ids"
|
||||
style="width: 95%"
|
||||
:options="cityList"
|
||||
:props="props"
|
||||
collapse-tags
|
||||
clearable
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="180px" align="center" :label="columns.title3">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number v-model="row.number" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120px" align="center" label="包邮金额(元)">
|
||||
<template slot-scope="{row}">
|
||||
<el-input-number v-model="row.price" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click="confirmEdit(ruleForm.free,scope.$index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="ruleForm.appoint === true">
|
||||
<el-button type="primary" size="mini" icon="el-icon-edit" @click="addFree(ruleForm.free)">
|
||||
添加指定包邮区域
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<!--<el-row :gutter="20">-->
|
||||
<!--<el-col :span="7">-->
|
||||
<!--<el-form-item label="指定区域不配送" prop="undelivery">-->
|
||||
<!--<el-radio-group v-model="ruleForm.undelivery">-->
|
||||
<!--<el-radio :label="1">开启</el-radio>-->
|
||||
<!--<el-radio :label="0">关闭</el-radio>-->
|
||||
<!--</el-radio-group>-->
|
||||
<!--</el-form-item>-->
|
||||
<!--</el-col>-->
|
||||
<!--<el-col :span="14">-->
|
||||
<!--<el-form-item v-if="ruleForm.undelivery === 1" class="noBox" prop="city_id3">-->
|
||||
<!--<el-cascader-->
|
||||
<!--v-model="ruleForm.city_id3"-->
|
||||
<!--placeholder="请选择不配送区域"-->
|
||||
<!--:options="cityList"-->
|
||||
<!--:props="props"-->
|
||||
<!--collapse-tags-->
|
||||
<!--clearable-->
|
||||
<!--style="width: 46%"-->
|
||||
<!--/>-->
|
||||
<!--</el-form-item>-->
|
||||
<!--</el-col>-->
|
||||
<!--</el-row>-->
|
||||
<el-form-item label="排序">
|
||||
<el-input v-model="ruleForm.sort" class="withs" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="onClose('ruleForm')">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onsubmit('ruleForm')" v-hasPermi="['admin:shipping:templates:update']">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as logistics from '@/api/logistics'
|
||||
import { Loading } from 'element-ui'
|
||||
import {Debounce} from '@/utils/validate'
|
||||
const defaultRole = {
|
||||
name: '',
|
||||
type: 1,
|
||||
appoint: false,
|
||||
sort: 0,
|
||||
region: [{
|
||||
first: 0,
|
||||
firstPrice: 0,
|
||||
renewal: 0,
|
||||
renewalPrice: 0,
|
||||
city_ids: []
|
||||
}],
|
||||
undelivery: 0,
|
||||
free: [],
|
||||
undelives: {},
|
||||
city_id3: []
|
||||
}
|
||||
const kg = '重量(kg)'
|
||||
const m = '体积(m³)'
|
||||
const statusMap = [
|
||||
{
|
||||
title: '首件',
|
||||
title2: '续件',
|
||||
title3: '包邮件数'
|
||||
},
|
||||
{
|
||||
title: `首件${kg}`,
|
||||
title2: `续件${kg}`,
|
||||
title3: `包邮${kg}`
|
||||
},
|
||||
{
|
||||
title: `首件${m}`,
|
||||
title2: `续件${m}`,
|
||||
title3: `包邮${m}`
|
||||
}
|
||||
]
|
||||
export default {
|
||||
name: 'CreatTemplates',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading : false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入模板名称', trigger: 'blur' }
|
||||
],
|
||||
free: [
|
||||
{ type: 'array', required: true, message: '请至少添加一个地区', trigger: 'change' }
|
||||
],
|
||||
appoint: [
|
||||
{ required: true, message: '请选择是否指定包邮', trigger: 'change' }
|
||||
],
|
||||
undelivery: [
|
||||
{ required: true, message: '请选择是否指定区域不配送', trigger: 'change' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '请选择计费方式', trigger: 'change' }
|
||||
],
|
||||
region: [
|
||||
{ required: true, message: '请选择活动区域', trigger: 'change' }
|
||||
],
|
||||
city_id3: [
|
||||
{ type: 'array', required: true, message: '请至少选择一个地区', trigger: 'change' }
|
||||
],
|
||||
first: [
|
||||
{ required: true, message: '请输入', trigger: 'blur' }
|
||||
],
|
||||
renewal: [
|
||||
{ required: true, message: '请输入', trigger: 'blur' }
|
||||
],
|
||||
firstPrice: [
|
||||
{ required: true, message: '请输入运费', trigger: 'blur' }
|
||||
],
|
||||
renewalPrice: [
|
||||
{ required: true, message: '请输入续费', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
nodeKey: 'city_id',
|
||||
props: {
|
||||
children: 'child',
|
||||
label: 'name',
|
||||
value: 'cityId',
|
||||
multiple: true
|
||||
},
|
||||
dialogVisible: false,
|
||||
ruleForm: Object.assign({}, defaultRole),
|
||||
listLoading: false,
|
||||
cityList: [],
|
||||
columns: {
|
||||
title: '首件',
|
||||
title2: '续件',
|
||||
title3: '包邮件数'
|
||||
},
|
||||
tempId: 0,
|
||||
type: 0 // 0添加 1编辑
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(()=>{
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.cityList = cityList;
|
||||
},1000);
|
||||
},
|
||||
methods: {
|
||||
changType(type) {
|
||||
this.type = type
|
||||
},
|
||||
onClose(formName) {
|
||||
this.dialogVisible = false
|
||||
this.$refs[formName].resetFields()
|
||||
},
|
||||
confirmEdit(row, index) {
|
||||
row.splice(index, 1)
|
||||
},
|
||||
popoverHide() {},
|
||||
handleClose() {
|
||||
// this.$refs['ruleForm'].resetFields()
|
||||
this.dialogVisible = false
|
||||
this.ruleForm={
|
||||
name: '',
|
||||
type: 1,
|
||||
appoint: false,
|
||||
sort: 0,
|
||||
region: [{
|
||||
first: 0,
|
||||
firstPrice: 0,
|
||||
renewal: 0,
|
||||
renewalPrice: 0,
|
||||
city_ids: []
|
||||
}],
|
||||
undelivery: 0,
|
||||
free: [],
|
||||
undelives: {},
|
||||
city_id3: []
|
||||
}
|
||||
},
|
||||
changeRegion(value) {
|
||||
console.log(value)
|
||||
},
|
||||
changeRadio(num) {
|
||||
this.columns = Object.assign({}, statusMap[num - 1])
|
||||
},
|
||||
// 添加配送区域
|
||||
addRegion(region) {
|
||||
region.push(Object.assign({}, {
|
||||
first: 0,
|
||||
firstPrice: 0,
|
||||
renewal: 0,
|
||||
renewalPrice: 0,
|
||||
city_ids: []
|
||||
}))
|
||||
},
|
||||
addFree(Free) {
|
||||
Free.push(Object.assign({}, {
|
||||
city_id: [],
|
||||
number: 1,
|
||||
price: 1,
|
||||
city_ids: []
|
||||
}))
|
||||
},
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* id 模板id
|
||||
* appoint true包邮 false不包邮
|
||||
**/
|
||||
getInfo(id, appoint) {
|
||||
this.tempId = id
|
||||
const loadingInstance = Loading.service({ fullscreen: true })
|
||||
logistics.templateDetailApi({ id }).then(res => {
|
||||
this.dialogVisible = true
|
||||
const info = res
|
||||
this.ruleForm = Object.assign(this.ruleForm, {
|
||||
name: info.name,
|
||||
type: info.type,
|
||||
appoint: info.appoint,
|
||||
sort: info.sort
|
||||
})
|
||||
this.columns = Object.assign({}, statusMap[this.ruleForm.type - 1])
|
||||
this.$nextTick(() => {
|
||||
loadingInstance.close()
|
||||
})
|
||||
// 不包邮地区
|
||||
this.shippingRegion()
|
||||
// 包邮地区
|
||||
if (info.appoint) {
|
||||
this.shippingFree()
|
||||
}
|
||||
}).catch(res => {
|
||||
// console.integralLog(res)
|
||||
this.$message.error(res.message)
|
||||
this.$nextTick(() => {
|
||||
loadingInstance.close()
|
||||
})
|
||||
})
|
||||
},
|
||||
// 不包邮
|
||||
shippingRegion() {
|
||||
logistics.shippingRegion({ tempId: this.tempId }).then(res => {
|
||||
res.forEach((item, index) => {
|
||||
item.title = JSON.parse(item.title)
|
||||
item.city_ids = item.title
|
||||
})
|
||||
this.ruleForm.region = res
|
||||
})
|
||||
},
|
||||
// 包邮
|
||||
shippingFree() {
|
||||
logistics.shippingFree({ tempId: this.tempId }).then(res => {
|
||||
res.forEach((item, index) => {
|
||||
item.title = JSON.parse(item.title)
|
||||
item.city_ids = item.title
|
||||
})
|
||||
this.ruleForm.free = res
|
||||
})
|
||||
},
|
||||
// 列表
|
||||
getCityList() {
|
||||
logistics.cityListTree().then(res => {
|
||||
sessionStorage.setItem('cityList',JSON.stringify(res));
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.cityList = cityList;
|
||||
}).catch(res => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
change(idBox) {
|
||||
idBox.map(item => {
|
||||
const ids = []
|
||||
item.city_ids.map(j => {
|
||||
j.splice(0, 1)
|
||||
ids.push(j[0])
|
||||
})
|
||||
item.city_id = ids
|
||||
})
|
||||
return idBox
|
||||
},
|
||||
changeOne(idBox) {
|
||||
const city_ids = []
|
||||
idBox.map(item => {
|
||||
item.splice(0, 1)
|
||||
city_ids.push(item[0])
|
||||
})
|
||||
return city_ids
|
||||
},
|
||||
onsubmit:Debounce(function(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
const param = {
|
||||
appoint: this.ruleForm.appoint,
|
||||
name: this.ruleForm.name,
|
||||
sort: this.ruleForm.sort,
|
||||
type: this.ruleForm.type,
|
||||
// 配送区域及运费
|
||||
// shippingTemplatesRegionRequestList: [],
|
||||
// // 指定包邮设置
|
||||
// shippingTemplatesFreeRequestList: []
|
||||
}
|
||||
this.ruleForm.region.forEach((el, index) => {
|
||||
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
|
||||
for (var i = 0; i < el.city_ids.length; i++) {
|
||||
el.city_ids[i].shift()
|
||||
}
|
||||
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
|
||||
})
|
||||
param.shippingTemplatesRegionRequestList = this.ruleForm.region
|
||||
param.shippingTemplatesRegionRequestList.forEach((el, index) => {
|
||||
// delete el.city_ids
|
||||
// delete el.city_id
|
||||
})
|
||||
if (this.ruleForm.appoint) {
|
||||
this.ruleForm.free.forEach((el, index) => {
|
||||
el.title = el.city_ids.length > 0 ? JSON.stringify(el.city_ids) : JSON.stringify([[0, 0]])
|
||||
for (var i = 0; i < el.city_ids.length; i++) {
|
||||
el.city_ids[i].shift()
|
||||
}
|
||||
el.cityId = el.city_ids.length > 0 ? el.city_ids.join(',') : 'all'
|
||||
})
|
||||
param.shippingTemplatesFreeRequestList = this.ruleForm.free
|
||||
param.shippingTemplatesFreeRequestList.forEach((el, index) => {
|
||||
// delete el.city_ids
|
||||
// delete el.city_id
|
||||
})
|
||||
}
|
||||
if (this.type === 0) {
|
||||
logistics.shippingSave(param).then(res => {
|
||||
this.$message.success('操作成功')
|
||||
this.handleClose()
|
||||
this.$nextTick(() => {
|
||||
this.dialogVisible = false
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.$emit('getList')
|
||||
}, 600)
|
||||
this.loading = false;
|
||||
})
|
||||
} else {
|
||||
logistics.shippingUpdate(param, { id: this.tempId }).then(res => {
|
||||
this.$message.success('操作成功')
|
||||
setTimeout(() => {
|
||||
this.$emit('getList')
|
||||
this.handleClose()
|
||||
}, 600)
|
||||
this.$nextTick(() => {
|
||||
this.dialogVisible = false
|
||||
})
|
||||
this.loading = false;
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}),
|
||||
clear() {
|
||||
this.ruleForm.name = ''
|
||||
this.ruleForm.sort = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.withs{
|
||||
width: 50%;
|
||||
}
|
||||
.noBox{
|
||||
/deep/.el-form-item__content{
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
}
|
||||
.tempBox{
|
||||
/deep/.el-input-number--mini{
|
||||
width: 100px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
192
admin/src/views/systemSetting/deliverGoods/freightSet/index.vue
Normal file
192
admin/src/views/systemSetting/deliverGoods/freightSet/index.vue
Normal file
@@ -0,0 +1,192 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<div class="container">
|
||||
<el-form ref="form" inline :model="form">
|
||||
<el-form-item label="模板名称:">
|
||||
<el-input v-model="form.keywords" placeholder="请输入模板名称" class="selWidth" size="small" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="handleSearch" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-button type="primary" size="mini" @click="handleSubmit()" v-hasPermi="['admin:shipping:templates:save']">添加运费模板</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData.list"
|
||||
style="width: 100%"
|
||||
size="mini"
|
||||
:header-cell-style=" {fontWeight:'bold'}"
|
||||
>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
min-width="60"
|
||||
/>
|
||||
<el-table-column
|
||||
label="模板名称"
|
||||
min-width="180"
|
||||
prop="name"
|
||||
/>
|
||||
<el-table-column
|
||||
min-width="100"
|
||||
label="计费方式"
|
||||
prop="type"
|
||||
>
|
||||
<template slot-scope="{row}">
|
||||
<p>{{ row.type | typeFilter }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
min-width="100"
|
||||
label="指定包邮"
|
||||
prop="appoint"
|
||||
>
|
||||
<template slot-scope="{row}">
|
||||
<p>{{ row.appoint | statusFilter }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column-->
|
||||
<!--min-width="120"-->
|
||||
<!--label="指定区域不配送"-->
|
||||
<!--prop="type"-->
|
||||
<!--/>-->
|
||||
<el-table-column
|
||||
label="排序"
|
||||
min-width="100"
|
||||
prop="sort"
|
||||
/>
|
||||
<el-table-column
|
||||
label="添加时间"
|
||||
min-width="150"
|
||||
prop="createTime"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="bindEdit(scope.row)" v-hasPermi="['admin:shipping:templates:info']">修改</el-button>
|
||||
<el-button type="text" size="small" @click="bindDelete(scope.row)" v-hasPermi="['admin:shipping:templates:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="block-pagination">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableData.limit"
|
||||
:current-page="tableData.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@current-change="pageChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<CreatTemplates ref="addTemplates" @getList="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CreatTemplates from './creatTemplates'
|
||||
import * as logistics from '@/api/logistics.js'
|
||||
export default {
|
||||
name: 'ShippingTemplates',
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
true: '开启',
|
||||
false: '关闭'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(status) {
|
||||
const statusMap = {
|
||||
1: '按件数',
|
||||
2: '按重量',
|
||||
3: '按体积'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
components: { CreatTemplates },
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
dialogVisible: false,
|
||||
form: {
|
||||
keywords: ''
|
||||
},
|
||||
tableData: '',
|
||||
page: 1,
|
||||
limit: 20,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 添加
|
||||
handleSubmit() {
|
||||
this.$refs.addTemplates.dialogVisible = true
|
||||
this.$refs.addTemplates.getCityList()
|
||||
this.$refs.addTemplates.changType(0)
|
||||
},
|
||||
handleSearch() {
|
||||
this.page = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 分页
|
||||
pageChange(e) {
|
||||
this.page = e
|
||||
this.getDataList()
|
||||
},
|
||||
handleSizeChange(e) {
|
||||
this.limit = e
|
||||
this.getDataList()
|
||||
},
|
||||
// 数据列表
|
||||
getDataList() {
|
||||
this.loading = true
|
||||
logistics.shippingTemplatesList({
|
||||
keywords: this.form.keywords,
|
||||
page: this.page,
|
||||
limit: this.limit
|
||||
}).then(res => {
|
||||
this.loading = false
|
||||
this.tableData = res
|
||||
})
|
||||
},
|
||||
// 编辑
|
||||
bindEdit(item) {
|
||||
this.$refs.addTemplates.getCityList()
|
||||
this.$refs.addTemplates.getInfo(item.id, item.appoint)
|
||||
this.$refs.addTemplates.changType(1)
|
||||
},
|
||||
// 删除
|
||||
bindDelete(item) {
|
||||
this.$modalSure().then(() => {
|
||||
logistics.shippingDetete({ id: item.id }).then(res => {
|
||||
this.$message.success('删除成功')
|
||||
this.getDataList()
|
||||
})
|
||||
})
|
||||
// logistics.shippingDetete()
|
||||
},
|
||||
getList() {
|
||||
this.getDataList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.selWidth{
|
||||
width: 350px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<div class="clearfix">
|
||||
<div class="container">
|
||||
<el-form size="small" label-width="100px" :inline="true" >
|
||||
<el-form-item label="时间选择:" class="width100">
|
||||
@@ -27,51 +27,68 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<cards-data :card-lists="cardLists" />
|
||||
</div>
|
||||
<el-table
|
||||
</el-card>
|
||||
<div class="mt20">
|
||||
<cards-data :card-lists="cardLists" />
|
||||
</div>
|
||||
<el-card class="box-card">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.data"
|
||||
style="width: 100%"
|
||||
size="mini"
|
||||
class="table"
|
||||
highlight-current-row
|
||||
:header-cell-style=" {fontWeight:'bold'}"
|
||||
>
|
||||
<el-table-column
|
||||
label="订单号"
|
||||
prop="orderId"
|
||||
min-width="170"
|
||||
min-width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="realName"
|
||||
label="用户信息"
|
||||
min-width="130"
|
||||
min-width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
label="推荐人信息"
|
||||
min-width="150"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.spreadInfo.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
<el-table-column
|
||||
label="商品信息"
|
||||
min-width="330"
|
||||
min-width="400"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div v-if=" scope.row.productList && scope.row.productList.length">
|
||||
<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle">
|
||||
<div class="demo-image__preview">
|
||||
<el-image
|
||||
:src="val.info.image"
|
||||
:preview-src-list="[val.info.image]"
|
||||
/>
|
||||
<el-popover trigger="hover" placement="right" >
|
||||
<div v-if=" scope.row.productList && scope.row.productList.length" slot="reference">
|
||||
<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle" style="flex-wrap: inherit;">
|
||||
<div class="demo-image__preview mr10">
|
||||
<el-image
|
||||
:src="val.info.image"
|
||||
:preview-src-list="[val.info.image]"
|
||||
/>
|
||||
</div>
|
||||
<div class="text_overflow">
|
||||
<span class="tabBox_tit mr10">{{ val.info.productName + ' | ' }}{{ val.info.sku ? val.info.sku:'-' }}</span>
|
||||
<span class="tabBox_pice">{{ '¥'+ val.info.price ? val.info.price + ' x '+ val.info.payNum : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="tabBox_tit mr10">{{ val.info.productName + ' | ' }}{{ val.info.suk ? val.info.suk:'-' }}</span>
|
||||
<span class="tabBox_pice">{{ '¥'+ val.info.price ? val.info.price + ' x '+ val.info.payNum : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pup_card" v-if=" scope.row.productList && scope.row.productList.length">
|
||||
<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle" style="flex-wrap: inherit;">
|
||||
<div class="">
|
||||
<span class="tabBox_tit mr10">{{ val.info.productName + ' | ' }}{{ val.info.sku ? val.info.sku:'-' }}</span>
|
||||
<span class="tabBox_pice">{{ '¥'+ val.info.price ? val.info.price + ' x '+ val.info.payNum : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -199,12 +216,12 @@
|
||||
this.tableData.data = res.list.list
|
||||
this.tableData.total = res.list.total
|
||||
this.cardLists = [
|
||||
{ name: '订单数量', count: res.total },
|
||||
{ name: '订单金额', count: res.orderTotalPrice },
|
||||
{ name: '退款总单数', count: res.refundTotal },
|
||||
{ name: '退款总金额', count: res.refundTotalPrice }
|
||||
{ name: '订单数量', count: res.total,color:'#1890FF',class:'one',icon:'icondingdan' },
|
||||
{ name: '订单金额', count: res.orderTotalPrice ,color:'#A277FF',class:'two',icon:'icondingdanjine'},
|
||||
{ name: '退款总单数', count: res.refundTotal,color:'#EF9C20',class:'three',icon:'icondingdanguanli' },
|
||||
{ name: '退款总金额', count: res.refundTotalPrice,color:'#1BBE6B',class:'four',icon:'iconshangpintuikuanjine' }
|
||||
]
|
||||
this.cardLists = res.data.stat
|
||||
// this.cardLists = res.data.stat
|
||||
this.listLoading = false
|
||||
}).catch(() => {
|
||||
this.listLoading = false
|
||||
@@ -247,4 +264,21 @@
|
||||
padding: 5px 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.text_overflow{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.pup_card{
|
||||
width: 200px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.flex-column{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
@@ -24,8 +24,8 @@
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="editForm('ruleForm')" v-if="id">修改</el-button>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')" v-else>提交</el-button>
|
||||
<el-button type="primary" @click="editForm('ruleForm')" v-if="id" v-hasPermi="['admin:system:staff:update']">修改</el-button>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')" v-else v-hasPermi="['admin:system:staff:save']">提交</el-button>
|
||||
</div>
|
||||
<customer-info ref="customer" @upImgUid="upImgUid"></customer-info>
|
||||
</el-dialog>
|
||||
@@ -35,6 +35,7 @@
|
||||
import customerInfo from '@/components/customerInfo';
|
||||
import { storeStaffSaveApi, storeStaffUpdateApi, storeStaffInfoApi, storeListApi } from '@/api/storePoint';
|
||||
import { getStoreStaff } from '@/libs/public'
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
name: "addClerk",
|
||||
components: { customerInfo },
|
||||
@@ -115,7 +116,7 @@
|
||||
this.$refs[name].resetFields();
|
||||
},
|
||||
// 提交
|
||||
submitForm (name) {
|
||||
submitForm:Debounce(function(name) {
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
let phone = this.ruleForm.phone;
|
||||
@@ -137,9 +138,9 @@
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
// 编辑
|
||||
editForm(name){
|
||||
editForm:Debounce(function(name){
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
let phone = this.ruleForm.phone;
|
||||
@@ -161,7 +162,7 @@
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -16,24 +16,19 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-button type="primary" size="small" @click="add">添加核销员</el-button>
|
||||
<el-button type="primary" size="small" @click="add" v-hasPermi="['admin:system:staff:save']">添加核销员</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
size="mini"
|
||||
style="width: 100%">
|
||||
size="small"
|
||||
:header-cell-style=" {fontWeight:'bold'}">
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
sortable
|
||||
width="80">
|
||||
</el-table-column>
|
||||
<!--<el-table-column-->
|
||||
<!--prop="nickname"-->
|
||||
<!--label="微信名称"-->
|
||||
<!--min-width="150">-->
|
||||
<!--</el-table-column>-->
|
||||
<el-table-column
|
||||
prop="staffName"
|
||||
label="核销员名称"
|
||||
@@ -59,29 +54,14 @@
|
||||
label="添加时间"
|
||||
min-width="180">
|
||||
</el-table-column>
|
||||
<!--<el-table-column-->
|
||||
<!--prop="status"-->
|
||||
<!--label="状态"-->
|
||||
<!--min-width="100">-->
|
||||
<!--<template slot-scope="{ row, index }">-->
|
||||
<!--<el-switch-->
|
||||
<!--v-model="row.status"-->
|
||||
<!--:active-value="1"-->
|
||||
<!--:inactive-value="0"-->
|
||||
<!--active-text="显示"-->
|
||||
<!--inactive-text="隐藏"-->
|
||||
<!--@change="onchangeIsShow(row.id,row.status)">-->
|
||||
<!--</el-switch>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
min-width="120">
|
||||
<template slot-scope="{ row, index }">
|
||||
<el-button type="text" size="small" @click="edit(row.id)">编辑</el-button>
|
||||
<el-button type="text" size="small" @click="edit(row.id)" v-hasPermi="['admin:system:staff:info']">编辑</el-button>
|
||||
<!--<el-divider direction="vertical"></el-divider>-->
|
||||
<el-button type="text" size="small" @click="storeDelete(row.id)">删除</el-button>
|
||||
<el-button type="text" size="small" @click="storeDelete(row.id)" v-hasPermi="['admin:system:staff:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -17,7 +17,7 @@
|
||||
clearable
|
||||
v-model="ruleForm.address"
|
||||
:options="addresData"
|
||||
:props="{ value: 'label' }"
|
||||
:props="{ value: 'name', label: 'name',children:'child',expandTrigger: 'hover'}"
|
||||
@change="handleChange"></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址:" prop="detailedAddress">
|
||||
@@ -54,8 +54,8 @@
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="editForm('ruleForm')" v-if="id">修改</el-button>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')" v-else>提交</el-button>
|
||||
<el-button type="primary" @click="editForm('ruleForm')" v-if="id" v-hasPermi="['admin:system:store:update']">修改</el-button>
|
||||
<el-button type="primary" @click="submitForm('ruleForm')" v-else v-hasPermi="['admin:system:store:save']">提交</el-button>
|
||||
</div>
|
||||
<el-dialog v-model="modalMap" title='上传经纬度' :visible.sync="modalMap" append-to-body class="mapBox" width="500px">
|
||||
<iframe
|
||||
@@ -69,10 +69,10 @@
|
||||
|
||||
<script>
|
||||
import { storeSaveApi, storeInfoApi, storeUpdateApi } from '@/api/storePoint';
|
||||
import { cityListTree } from '@/api/logistics';
|
||||
import * as logistics from '@/api/logistics'
|
||||
import { configInfo } from '@/api/systemConfig';
|
||||
import city from '@/utils/city';
|
||||
import Templates from "../../../appSetting/wxAccount/wxTemplate/index";
|
||||
import Templates from "../../../../appSetting/wxAccount/wxTemplate/index";
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
name: "index",
|
||||
components: {Templates},
|
||||
@@ -143,7 +143,9 @@
|
||||
},
|
||||
created(){
|
||||
this.ruleForm.image = '';
|
||||
this.addresData = city;
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.addresData = cityList;
|
||||
this.getCityList();
|
||||
this.getKey();
|
||||
},
|
||||
mounted(){
|
||||
@@ -182,7 +184,7 @@
|
||||
this.$refs[name].resetFields();
|
||||
},
|
||||
// 提交
|
||||
submitForm (name) {
|
||||
submitForm:Debounce(function(name) {
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
storeSaveApi(this.ruleForm).then(async () => {
|
||||
@@ -198,9 +200,9 @@
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
//编辑
|
||||
editForm(name){
|
||||
editForm:Debounce(function(name){
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
this.handleChange(this.ruleForm.address);
|
||||
@@ -216,7 +218,7 @@
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
//数据归为初始状态
|
||||
clearFrom(){
|
||||
this.ruleForm.introduction = '';
|
||||
@@ -261,6 +263,15 @@
|
||||
this.keyUrl = `https://apis.map.qq.com/tools/locpicker?type=1&key=${keys}&referer=myapp`;
|
||||
})
|
||||
},
|
||||
getCityList() {
|
||||
logistics.cityListTree().then(res => {
|
||||
sessionStorage.setItem('cityList',JSON.stringify(res));
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.addresData = cityList;
|
||||
}).catch(res => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<el-tabs v-model="artFrom.status" @tab-click="onClickTab">
|
||||
<el-tabs v-model="artFrom.status" @tab-click="onClickTab" v-if="checkPermi(['admin:system:store:count','admin:system:store:list'])" >
|
||||
<el-tab-pane :label="'显示中的提货点('+ headerCount.show +')'" name="1"></el-tab-pane>
|
||||
<el-tab-pane :label="'隐藏中的提货点('+ headerCount.hide +')'" name="0"></el-tab-pane>
|
||||
<el-tab-pane :label="'回收站的提货点('+ headerCount.recycle +')'" name="2"></el-tab-pane>
|
||||
@@ -14,13 +14,13 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-button type="primary" size="small" @click="add">添加提货点</el-button>
|
||||
<el-button type="primary" size="small" @click="add" v-hasPermi="['admin:system:store:save']">添加提货点</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
size="mini"
|
||||
size="small"
|
||||
:data="tableData"
|
||||
style="width: 100%">
|
||||
:header-cell-style=" {fontWeight:'bold'}">
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
@@ -64,7 +64,7 @@
|
||||
prop="isShow"
|
||||
label="是否显示"
|
||||
min-width="100">
|
||||
<template slot-scope="{ row, index }">
|
||||
<template slot-scope="{ row, index }" v-if="checkPermi(['admin:system:store:update:status'])">
|
||||
<el-switch
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
@@ -80,11 +80,11 @@
|
||||
label="操作"
|
||||
min-width="120">
|
||||
<template slot-scope="{ row, index }">
|
||||
<el-button type="text" size="small" @click="edit(row.id)">编辑</el-button>
|
||||
<el-button type="text" size="small" @click="edit(row.id)" v-hasPermi="['admin:system:store:info']">编辑</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<el-button v-if="artFrom.status==='2'" type="text" size="small" @click="storeRecovery(row.id)">恢复</el-button>
|
||||
<el-button v-if="artFrom.status==='2'" type="text" size="small" @click="storeRecovery(row.id)" v-hasPermi="['admin:system:store:recovery']">恢复</el-button>
|
||||
<el-divider v-if="artFrom.status==='2'" direction="vertical"></el-divider>
|
||||
<el-button type="text" size="small" @click="artFrom.status==='2'?allDelete(row.id):storeDelete(row.id)">删除</el-button>
|
||||
<el-button type="text" size="small" @click="artFrom.status==='2'?allDelete(row.id):storeDelete(row.id)" v-hasPermi="['admin:system:store:delete','admin:system:store:completely:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -106,6 +106,7 @@
|
||||
<script>
|
||||
import systemStore from './addPoint';
|
||||
import { storeListApi, storeGetCountApi, storeUpdateStatusApi, storeDeleteApi, allDeleteApi, storeRecoveryApi } from '@/api/storePoint';
|
||||
import { checkPermi } from "@/utils/permission"; // 权限判断函数
|
||||
export default {
|
||||
name: 'Point',
|
||||
components: { systemStore },
|
||||
@@ -128,6 +129,7 @@ export default {
|
||||
this.tableList();
|
||||
},
|
||||
methods: {
|
||||
checkPermi,
|
||||
//头部数量显示;
|
||||
storeGetCount(){
|
||||
let that = this;
|
||||
@@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<<template>
|
||||
<div>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {}
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="sass" scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,74 +0,0 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<parser v-if="isShow" class="formBox" :form-conf="formConf" :form-edit-data="formData" :is-edit="isCreate === 1" @submit="submit" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import parser from '@/components/FormGenerator/components/parser/Parser'
|
||||
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
|
||||
import { configSaveForm, configInfo } from '@/api/systemConfig.js'
|
||||
export default {
|
||||
name: 'Config',
|
||||
components: { parser },
|
||||
data() {
|
||||
return {
|
||||
// 表单
|
||||
formConf: { fields: [] },
|
||||
formId: 74,
|
||||
formData: {},
|
||||
isCreate: 0,
|
||||
isShow: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
systemFormConfigApi.getFormConfigInfo({ id: this.formId }).then(data => {
|
||||
this.formConf = JSON.parse(data.content)
|
||||
})
|
||||
this.getFormInfo()
|
||||
},
|
||||
methods: {
|
||||
submit(data) {
|
||||
const tempArr = []
|
||||
for (var key in data) {
|
||||
const obj = {}
|
||||
obj.name = key
|
||||
obj.title = key
|
||||
obj.value = data[key]
|
||||
tempArr.push(obj)
|
||||
}
|
||||
const _pram = {
|
||||
'fields': tempArr,
|
||||
'id': this.formId,
|
||||
'sort': 0,
|
||||
'status': true
|
||||
}
|
||||
configSaveForm(_pram).then(res => {
|
||||
this.getFormInfo()
|
||||
this.$message.success('操作成功')
|
||||
})
|
||||
},
|
||||
// 获取表单详情
|
||||
getFormInfo() {
|
||||
configInfo({ id: this.formId }).then(res => {
|
||||
this.isShow = false
|
||||
this.formData = res
|
||||
this.isCreate = 1
|
||||
setTimeout(() => { // 让表单重复渲染待编辑数据
|
||||
this.isShow = true
|
||||
}, 80)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-button--primary{
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -36,30 +36,30 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="130px" align="center" :label="columns.title" prop="first">
|
||||
<template scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.first" :prop="'region.'+scope.$index+'.first'">
|
||||
<el-input-number v-model="scope.row.first" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120px" align="center" label="运费(元)" prop="firstPrice">
|
||||
<template scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.firstPrice" :prop="'region.'+scope.$index+'.firstPrice'">
|
||||
<el-input-number v-model="scope.row.firstPrice" controls-position="right" />
|
||||
<el-input-number v-model="scope.row.firstPrice" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120px" align="center" :label="columns.title2" prop="renewal">
|
||||
<template scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.renewal" :prop="'region.'+scope.$index+'.renewal'">
|
||||
<el-input-number v-model="scope.row.renewal" controls-position="right" :step-strictly="ruleForm.type===1?true:false" :min="ruleForm.type===1?1:0.1"/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" align="center" label="续费(元)" min-width="120" prop="renewalPrice">
|
||||
<template scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item :rules="rules.renewalPrice" :prop="'region.'+scope.$index+'.renewalPrice'">
|
||||
<el-input-number v-model="scope.row.renewalPrice" controls-position="right" />
|
||||
<el-input-number v-model="scope.row.renewalPrice" controls-position="right" :min="0" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -266,6 +266,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(()=>{
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.cityList = cityList;
|
||||
},1000);
|
||||
},
|
||||
methods: {
|
||||
changType(type) {
|
||||
@@ -383,13 +387,9 @@ export default {
|
||||
// 列表
|
||||
getCityList() {
|
||||
logistics.cityListTree().then(res => {
|
||||
// console.integralLog(res, 'getCityList')
|
||||
res.forEach((el, index) => {
|
||||
el.child.forEach((cel, j) => {
|
||||
delete cel.child
|
||||
})
|
||||
})
|
||||
this.cityList = res
|
||||
sessionStorage.setItem('cityList',JSON.stringify(res));
|
||||
let cityList = JSON.parse(sessionStorage.getItem('cityList'));
|
||||
this.cityList = cityList;
|
||||
}).catch(res => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
@@ -505,4 +505,4 @@ export default {
|
||||
width: 100px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
294
admin/src/views/systemSetting/notification/index.vue
Normal file
294
admin/src/views/systemSetting/notification/index.vue
Normal file
@@ -0,0 +1,294 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<div>
|
||||
<el-card :bordered="false" class="box-card">
|
||||
<div>
|
||||
<el-tabs v-model="currentTab" @tab-click="changeTab">
|
||||
<el-tab-pane
|
||||
:label="item.label"
|
||||
:name="item.value.toString()"
|
||||
v-for="(item, index) in headerList"
|
||||
:key="index + '-only'"
|
||||
/>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-row type="flex" class="mb20 mt-1">
|
||||
<el-col>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-document"
|
||||
@click="syncRoutine()"
|
||||
v-hasPermi="['admin:wechat:routine:sync']"
|
||||
>同步小程序订阅消息</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-document"
|
||||
@click="syncWechat()"
|
||||
v-hasPermi="['admin:wechat:whcbqhn:sync']"
|
||||
>同步微信模版消息</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="description">
|
||||
<p><span class="iconfont iconxiaochengxu"></span> 小程序经营类目:生活服务 > 百货/超市/便利店</p>
|
||||
<p><span class="iconfont icongongzhonghao"></span> 公众号经营类目:IT科技/互联网|电子商务,IT科技/IT软件与服务</p>
|
||||
</div>
|
||||
<el-table
|
||||
:data="levelLists"
|
||||
ref="table"
|
||||
class="mt25"
|
||||
size="small"
|
||||
v-loading="loadingList"
|
||||
:header-cell-style=" {fontWeight:'bold'}">
|
||||
<el-table-column label="ID" prop="id" width="80"></el-table-column>
|
||||
<el-table-column label="通知类型" prop="type"></el-table-column>
|
||||
<el-table-column label="通知场景说明" prop="description"></el-table-column>
|
||||
<el-table-column label="标识" prop="mark"></el-table-column>
|
||||
<el-table-column label="公众号模板" prop="isWechat" v-if="currentTab == '1'">
|
||||
<template slot-scope="scope" v-if="scope.row.isWechat !== 0">
|
||||
<el-switch
|
||||
v-model="scope.row.isWechat"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
@change="changeWechat(scope.row)"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小程序订阅" prop="isRoutine" v-if="currentTab == '1'">
|
||||
<template slot-scope="scope" v-if="scope.row.isRoutine !== 0">
|
||||
<el-switch
|
||||
v-model="scope.row.isRoutine"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
@change="changeRoutine(scope.row)"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发送短信" prop="isSms">
|
||||
<template slot-scope="scope" v-if="scope.row.isSms !== 0">
|
||||
<el-switch
|
||||
v-model="scope.row.isSms"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
active-text="启用"
|
||||
inactive-text="禁用"
|
||||
@change="changeSms(scope.row)"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设置" prop="id">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="setting(scope.row)" v-hasPermi="['admin:system:notification:detail']">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
<el-dialog
|
||||
title="通知详情"
|
||||
:visible.sync="centerDialogVisible"
|
||||
width="50%"
|
||||
>
|
||||
<el-tabs :value="infoTab" @tab-click="changeInfo">
|
||||
<el-tab-pane
|
||||
:label="item.label"
|
||||
:name="item.value.toString()"
|
||||
v-for="(item, index) in currentTab == '1' ? infoList : infoList1"
|
||||
:key="index"
|
||||
/>
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-form-item label="ID">
|
||||
<el-input v-model="form.id" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板名" v-if="form.name">
|
||||
<el-input v-model="form.name" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板ID" v-if="form.tempId">
|
||||
<el-input v-model="form.tempId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板编号" v-if="form.tempKey">
|
||||
<el-input v-model="form.tempKey" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板说明" v-if="form.title">
|
||||
<el-input v-model="form.title" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板内容" v-if="form.content">
|
||||
<el-input v-model="form.content" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="1">开启</el-radio>
|
||||
<el-radio label="2">关闭</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tabs>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {notificationListApi,notificationRoutine,notificationWechat,notificationSms,notificationDetail,notificationUpdate} from '@/api/systemFormConfig'
|
||||
import {wechatAsyncApi,routineAsyncApi} from '@/api/wxApi'
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
modalTitle: "",
|
||||
notificationModal: false,
|
||||
headerList: [
|
||||
{ label: "通知会员", value: "1" },
|
||||
{ label: "通知平台", value: "2" },
|
||||
],
|
||||
id:0,
|
||||
levelLists: [],
|
||||
currentTab: "1",
|
||||
loading: false,
|
||||
formData: {},
|
||||
industry: null,
|
||||
loadingList:false,
|
||||
centerDialogVisible:false,
|
||||
infoList:[],
|
||||
infoList1:[
|
||||
{ label: "短信", value: "sms" },
|
||||
],
|
||||
form:{
|
||||
content:'',
|
||||
name:'',
|
||||
id:'',
|
||||
status:null,
|
||||
tempId:'',
|
||||
tempKey:'',
|
||||
title:'',
|
||||
},
|
||||
detailType:'',
|
||||
infoTab:''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getNotificationList(Number(this.currentTab));
|
||||
},
|
||||
methods: {
|
||||
changeTab(data) {
|
||||
this.getNotificationList(data.name);
|
||||
},
|
||||
//获取消息列表
|
||||
getNotificationList(id){
|
||||
this.loadingList = true;
|
||||
notificationListApi({sendType:id}).then(res=>{
|
||||
this.loadingList = false;
|
||||
this.levelLists = res;
|
||||
}).catch(res=>{
|
||||
this.loadingList = false;
|
||||
})
|
||||
},
|
||||
//公众号消息开关
|
||||
changeWechat(row){
|
||||
notificationWechat(row.id).then(res=>{
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
})
|
||||
},
|
||||
//小程序消息开关
|
||||
changeRoutine(row){
|
||||
notificationRoutine(row.id).then(res=>{
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
})
|
||||
},
|
||||
//短信消息开关
|
||||
changeSms(row){
|
||||
notificationSms(row.id).then(res=>{
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
})
|
||||
},
|
||||
//详情tab切换
|
||||
changeInfo(data){
|
||||
this.getNotificationDetail(data);
|
||||
},
|
||||
//详情数据
|
||||
getNotificationDetail(param){
|
||||
let data = {
|
||||
id:this.id,
|
||||
type:param.name
|
||||
};
|
||||
this.$set(this,'detailType',data.type);
|
||||
notificationDetail(data).then(res=>{
|
||||
this.form = res;
|
||||
this.$set(this.form,'status',res.status.toString());
|
||||
})
|
||||
},
|
||||
// 设置
|
||||
setting(row) {
|
||||
this.infoList = [];
|
||||
this.id = row.id;
|
||||
this.centerDialogVisible = true;
|
||||
if(row.isWechat !== 0){
|
||||
this.infoList.push({ label: "公众号模板消息", value: "wechat" });
|
||||
}
|
||||
if(row.isRoutine !== 0){
|
||||
this.infoList.push({ label: "小程序订阅消息", value: "routine"});
|
||||
}
|
||||
if(row.isSms !== 0){
|
||||
this.infoList.push({ label: "短信", value: "sms" });
|
||||
}
|
||||
this.infoTab = this.infoList[0].value;
|
||||
this.getNotificationDetail({name:this.infoTab});
|
||||
},
|
||||
//修改通知
|
||||
submit:Debounce(function(){
|
||||
let data = {
|
||||
id:this.id,
|
||||
status:Number(this.form.status),
|
||||
tempId:this.form.tempId,
|
||||
type:this.detailType
|
||||
};
|
||||
notificationUpdate(data).then(res=>{
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.centerDialogVisible = false;
|
||||
this.getNotificationList();
|
||||
})
|
||||
}),
|
||||
syncWechat(){
|
||||
wechatAsyncApi().then(res=>{
|
||||
this.$message.success('同步成功');
|
||||
})
|
||||
},
|
||||
syncRoutine(){
|
||||
routineAsyncApi().then(res=>{
|
||||
this.$message.success('同步成功');
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mt-1{
|
||||
margin-top:6px;
|
||||
}
|
||||
.description{
|
||||
padding: 16px;
|
||||
position: relative;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
color: #515a6e;
|
||||
line-height: 1.5;
|
||||
font-size: 14px;
|
||||
border: 1px solid #abdcff;
|
||||
background-color: #f0faff;
|
||||
}
|
||||
.iconfont{
|
||||
color:#06C05F;
|
||||
}
|
||||
</style>
|
||||
@@ -1,29 +1,12 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<el-tabs v-model="activeNamel1" @tab-click="handleTabClick" v-loading="loading">
|
||||
<el-tabs v-model="activeNamel1" @tab-click="handleTabClick" v-loading="loading" v-if="checkPermi(['admin:system:config:info'])">
|
||||
<el-tab-pane
|
||||
v-for="tab,index in treeList"
|
||||
:key="index"
|
||||
:label="tab.name"
|
||||
:name="tab.id.toString()"
|
||||
>
|
||||
<!-- 文件上传特殊处理-->
|
||||
<!-- <template v-if="activeNamel1 == 4">-->
|
||||
<!-- <el-radio-group v-model="activeNamel2" class="mb10">-->
|
||||
<!-- <el-radio v-for="tabItem,itemIndex in tab.child"-->
|
||||
<!-- :key="itemIndex"-->
|
||||
<!-- :label="tabItem.name" @change="()=>handleItemTabClick(tabItem.extra)">{{tabItem.name}}</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- <parser-->
|
||||
<!-- v-if="formConfChild.render"-->
|
||||
<!-- :is-edit="formConfChild.isEdit"-->
|
||||
<!-- :form-conf="formConfChild.content"-->
|
||||
<!-- :form-edit-data="currentEditData"-->
|
||||
<!-- @submit="handlerSubmit"-->
|
||||
<!-- />-->
|
||||
<!-- </template>-->
|
||||
<!-- 正常配置渲染-->
|
||||
:name="tab.id.toString()">
|
||||
<template>
|
||||
<el-tabs v-if="tab.child.length > 0" v-model="activeNamel2"
|
||||
type="border-card" @tab-click="handleItemTabClick">
|
||||
@@ -67,6 +50,8 @@ import * as systemSettingApi from '@/api/systemSetting.js'
|
||||
import * as systemConfigApi from '@/api/systemConfig.js'
|
||||
import Template from "@/views/appSetting/wxAccount/wxTemplate/index";
|
||||
import {beautifierConf} from "@/components/FormGenerator/utils";
|
||||
import { checkPermi } from "@/utils/permission"; // 权限判断函数
|
||||
import {Debounce} from '@/utils/validate'
|
||||
export default {
|
||||
// name: "index",
|
||||
components: {Template, parser },
|
||||
@@ -90,43 +75,7 @@ export default {
|
||||
this.getCurrentUploadSelectedFlag()
|
||||
},
|
||||
methods: {
|
||||
// handleTabClick(tab, event) {
|
||||
// if (tab.name) {
|
||||
// this.handlerGetLevel1FormConfig(tab.name)
|
||||
// } else if (tab.$children.length > 0 ) { // 初次加载第二层的第一个Tab数据
|
||||
// // if(tab.$children[0].panes){ // todo 优化。。。
|
||||
// // this.activeNamel2 = tab.$children[0].panes[0].name
|
||||
// // }else{
|
||||
// // conaole.integralLog()
|
||||
// // }
|
||||
// let _selected = tab.$children[0].panes[0]
|
||||
// // 设置特殊处理的文件长传表单默认选中第一个tab
|
||||
// this.activeNamel2 = _selected.name != 72 ? _selected.name : _selected.label
|
||||
// if(this.activeNamel2 == 108){
|
||||
// switch (this.currentSelectedUploadFlag) {
|
||||
// case 1:
|
||||
// this.activeNamel2 = '本地(不推荐)'
|
||||
// this.handlerGetLevel2FormConfig(108)
|
||||
// break
|
||||
// case 2:
|
||||
// this.activeNamel2 = '阿里云配置'
|
||||
// this.handlerGetLevel2FormConfig(81)
|
||||
// break
|
||||
// case 3:
|
||||
// this.activeNamel2 = '七牛云配置'
|
||||
// this.handlerGetLevel2FormConfig(82)
|
||||
// break
|
||||
// case 4:
|
||||
// this.activeNamel2 = '腾讯云配置'
|
||||
// this.handlerGetLevel2FormConfig(83)
|
||||
// break
|
||||
// }
|
||||
// }else{
|
||||
// this.handlerGetLevel2FormConfig(_selected.name)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// },
|
||||
checkPermi,
|
||||
handleTabClick(tab) {
|
||||
this.activeNamel2 = tab.$children[0].panes[0].name;
|
||||
this.handlerGetLevel2FormConfig(this.activeNamel2);
|
||||
@@ -180,9 +129,9 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
handlerSubmit(formValue) {
|
||||
handlerSubmit:Debounce(function(formValue) {
|
||||
this.handlerSave(formValue)
|
||||
},
|
||||
}),
|
||||
handlerSave(formValue) {
|
||||
const _pram = this.buildFormPram(formValue)
|
||||
let _formId = 0
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div class="acea-row roomBox">
|
||||
<div class="room-left">
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acea-row room-left-list">
|
||||
<div class="userHead mr10"><img src="../../../../assets/imgs/mobilehead.png"></div>
|
||||
<div class="userName">
|
||||
<span class="sp1" title="小红帽的外婆家">小红帽的外婆家</span>
|
||||
<span class="sp2">是的你好</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="room-med"></div>
|
||||
<div class="room-right"></div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "index"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.room{
|
||||
&-left::-webkit-scrollbar {
|
||||
display: none; /* Chrome Safari */
|
||||
}
|
||||
&-left{
|
||||
width: 230px;
|
||||
height: 600px;
|
||||
border: 1px solid #e6ebf5;
|
||||
padding: 0 0 15px 15px;
|
||||
box-sizing: border-box;
|
||||
scrollbar-width: none; /* firefox */
|
||||
-ms-overflow-style: none; /* IE 10+ */
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
&-list{
|
||||
border-bottom: 1px solid #e6ebf5;
|
||||
padding-bottom: 15px;
|
||||
padding: 15px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
&-med{
|
||||
width: 400px;
|
||||
height: 600px;
|
||||
border-top: 1px solid #e6ebf5;
|
||||
border-bottom: 1px solid #e6ebf5;
|
||||
}
|
||||
&-right{
|
||||
width: 250px;
|
||||
height: 600px;
|
||||
border: 1px solid #e6ebf5;
|
||||
}
|
||||
}
|
||||
.userHead{
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
.userName{
|
||||
.sp1{
|
||||
font-size: 15px;
|
||||
display: block;
|
||||
width: 118px;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sp2{
|
||||
font-size: 14px;
|
||||
display: block;
|
||||
color: #C0C4CC;
|
||||
margin-top: 21px;
|
||||
width: 118px;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +0,0 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "index"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user