Commit daba7204 authored by 樊国敬's avatar 樊国敬

setmenu

parent 85dfd15a
......@@ -969,6 +969,7 @@ export default {
title:'套餐名称',
remark:'备注',
status:'状态',
menuIds:'菜单'
},//多租户-菜单管理
menu: {
id: '',
......
......@@ -10,7 +10,7 @@
<Col :span="12"><FormItem :label="l('password')" prop="password"> <Input v-model="entity.password" type="password"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <Dictionary code="system.account.status" v-model="entity.status"></Dictionary>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <Dictionary code="crm.customer.status" v-model="entity.status"></Dictionary>
</FormItem></Col>
......@@ -29,7 +29,7 @@
data() {
return {
disabled: false,
entity: {
entity: {status:1
},
rules: {
name: [{ required: true, message: '必填' }],
......
......@@ -10,7 +10,7 @@
<Col :span="12"><FormItem :label="l('password')" prop="password"> <Input v-model="entity.password" type="password"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <Dictionary code="system.account.status" v-model="entity.status"></Dictionary>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <Dictionary code="crm.customer.status" v-model="entity.status"></Dictionary>
</FormItem></Col>
</Row>
<FormItem>
......
......@@ -48,7 +48,7 @@ keys:{op:"name,loginName,password,token,source,remark",value:null}
deletelModal: false,
curId: 0,
columns: [
{ key:"id",title:this.l("id") ,hide:true ,align:"left" },
//{ key:"id",title:this.l("id") ,hide:true ,align:"left" },
{ key:"name",title:this.l("name") ,align:"center",width:160 ,easy:true ,high:true },
{ key:"loginName",title:this.l("loginName") ,align:"center", width:160 ,easy:true ,high:true },
{ key:"creationTime",title:this.l("creationTime") ,hide:true ,align:"left" },
......@@ -60,7 +60,7 @@ keys:{op:"name,loginName,password,token,source,remark",value:null}
{ key:"deletionTime",title:this.l("deletionTime") ,hide:true ,align:"left" },
{ key:"lastLoginTime",title:this.l("lastLoginTime") ,align:"center" , width:260 ,high:true },
{ key:"loginTimes",title:this.l("loginTimes") ,align:"center" , width:160 ,high:true },
{ key:"status",title:this.l("status") ,align:"center" ,width:160 ,high:true ,code:'system.account.status' },
{ key:"status",title:this.l("status") ,align:"center" ,width:160 ,high:true ,code:'crm.customer.status' },
{
title: '操作',
key: 'id',
......
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"><FormItem :label="l('title')" prop="title"> <Input v-model="entity.title"> </Input>
</FormItem></Col>
<Col :span="24"><FormItem :label="l('remark')" prop="remark"> <Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <InputNumber v-model="entity.status"></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90" >
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('status')" prop="status">
<Dictionary code="crm.customer.status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('menuIds')" style="margin-bottom:0px"></FormItem>
</Col>
<Col :span="24">
<div style="overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px">
<Tree ref="tree" :data="menuData" show-checkbox multiple ></Tree>
</div>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
entity: {
},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "set_menu" + "." + key;
return this.$t(key)
import Api from "./api";
import api1 from '../menu/api'
export default {
name: "Add",
data() {
return {
disabled: false,
entity: {status:1},
menuData:[],//菜单树数据
menuIds:[],//勾选的菜单数组
rules: {
title: [{ required: true, message: "必填"}],
status:[{ required: true, message: "必填" }]
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
};
},
props: {
v: Object
},
mounted(){
api1.getTree().then((v)=>{
this.menuData=v.result
})
},
methods: {
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
//获取选中和半选的节点
let node=this.$refs.tree.getCheckedAndIndeterminateNodes();
let menuId=node.map(item=>{
return item.id
})
this.entity.menuIds=this.menuIds=menuId
//console.log(menuId)
Api.create(this.entity)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "set_menu" + "." + key;
return this.$t(key);
}
</script>
\ No newline at end of file
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
}
}
};
</script>
\ No newline at end of file
......@@ -17,4 +17,5 @@ export default {
delete(params) {
return Api.delete(`${system}/setmenu/delete`,{params:params});
},
}
\ No newline at end of file
<template>
<div class="detail">
<Form ref="form" :model="entity" :rules="rules" :label-width="90" >
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed>
</Row>
</div>
<Col :span="24">
<FormItem :label="l('status')" prop="status">
<Dictionary code="crm.customer.status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('menuIds')" style="margin-bottom:0px"></FormItem>
</Col>
<Col :span="24">
<div style="overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px">
<Tree ref="tree" :data="menuData" show-checkbox multiple ></Tree>
</div>
</Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
import api1 from '../menu/api'
export default {
name: 'Add',
data() {
return {
entity: {},
menuData:[],
menuIds:[],
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
mounted(){
api1.getTree().then((v)=>{
this.menuData=v.result
})
},
props: {
eid: Number
},
......@@ -29,9 +54,29 @@
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.menuIds=this.entity.menuIds;
this.setChecked(this.menuData,this.menuIds)
this.$emit('on-load')
})
},
setChecked(data,ids){
if(ids.length==0){
return data;
}
data.forEach(item=>{
if(!item.children || item.children.length == 0){
if(ids.indexOf(item.id)>-1){
this.$set(item,"checked",true);
}
}else if (item.children && item.children.length > 0) {
this.setChecked(item.children, ids)
}
})
},
handleClose() {
this.$emit('on-close')
},
......
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"><FormItem :label="l('title')" prop="title"> <Input v-model="entity.title"> </Input>
</FormItem></Col>
<Col :span="24"><FormItem :label="l('remark')" prop="remark"> <Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('status')" prop="status"> <InputNumber v-model="entity.status"></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
<Form ref="form" :model="entity" :rules="rules" :label-width="90" >
<Row>
<Col :span="24">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Form>
</Col>
<Col :span="24">
<FormItem :label="l('status')" prop="status">
<Dictionary code="crm.customer.status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('menuIds')" style="margin-bottom:0px"></FormItem>
</Col>
<Col :span="24">
<div style="overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px">
<Tree ref="tree" :data="menuData" show-checkbox multiple ></Tree>
</div>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {
},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "set_menu" + "." + key;
return this.$t(key)
import Api from "./api";
import api1 from '../menu/api'
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
menuData:[],
menuIds:[],
rules: {
title: [{ required: true, message: "必填"}],
status:[{ required: true, message: "必填" }]
}
};
},
props: {
eid: Number
},
mounted(){
api1.getTree().then((v)=>{
this.menuData=v.result
})
},
computed:{
// menuIds:function(){ return this.entity.menuIds}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.menuIds=this.entity.menuIds;
this.setChecked(this.menuData,this.menuIds)
//this.menuData=d;
console.log(this.menuData)
this.$emit("on-load");
});
},
setChecked(data,ids){
if(ids.length==0){
return data;
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
data.forEach(item=>{
if(!item.children || item.children.length == 0){
if(ids.indexOf(item.id)>-1){
this.$set(item,"checked",true);
}
}else if (item.children && item.children.length > 0) {
this.setChecked(item.children, ids)
}
})
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
//获取选中和半选的节点
let node=this.$refs.tree.getCheckedAndIndeterminateNodes();
let menuId=node.map(item=>{
return item.id
})
this.entity.menuIds=this.menuIds=menuId
Api.update(this.entity)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "set_menu" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
};
</script>
\ No newline at end of file
......@@ -11,7 +11,7 @@
</template>
</DataGrid>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
<Add @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="editModal" title="编辑" footer-hide>
<Edit :eid="curId" @on-close="cancel" @on-ok="addOk" />
......@@ -31,6 +31,8 @@ import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
import api from '../account/api'
import api1 from '../menu/api'
export default {
name: 'list',
components:{
......@@ -48,17 +50,17 @@ keys:{op:"title,remark",value:null}
deletelModal: false,
curId: 0,
columns: [
{ key:"id",title:this.l("id") ,hide:true ,align:"left" },
{ key:"creationTime",title:this.l("creationTime") ,hide:true ,align:"left" },
//{ key:"id",title:this.l("id") ,hide:true ,align:"left" },
{ key:"creationTime",title:this.l("creationTime") ,align:"center" ,width:200 },
{ key:"creatorUserId",title:this.l("creatorUserId") ,hide:true ,align:"left" },
{ key:"lastModificationTime",title:this.l("lastModificationTime") ,hide:true ,align:"left" },
{ key:"lastModifierUserId",title:this.l("lastModifierUserId") ,hide:true ,align:"left" },
{ key:"isDeleted",title:this.l("isDeleted") ,hide:true ,align:"left" },
{ key:"deletionTime",title:this.l("deletionTime") ,hide:true ,align:"left" },
{ key:"deleterUserId",title:this.l("deleterUserId") ,hide:true ,align:"left" },
{ key:"title",title:this.l("title") ,align:"left" ,easy:true ,high:true },
{ key:"remark",title:this.l("remark") ,align:"left" ,easy:true ,high:true },
{ key:"status",title:this.l("status") ,align:"left" ,high:true },
{ key:"title",title:this.l("title") ,align:"center" ,easy:true ,high:true ,width:240 },
// { key:"remark",title:this.l("remark") ,align:"left" ,easy:true ,high:true },
{ key:"status",title:this.l("status") ,align:"center" ,high:true ,width:140,code:'crm.customer.status' },
{
title: '操作',
key: 'id',
......@@ -77,7 +79,9 @@ keys:{op:"title,remark",value:null}
},
mounted(){
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
},
......
......@@ -66,7 +66,7 @@ export default {
curId: 0,
datacurId: 0,
columns: [
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
// { key: 'id', title: this.l('id'), hide: true, align: 'left' },
{
key: 'name',
title: this.l('name'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment