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

setmenu

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