Commit 11811f64 authored by zhengke's avatar zhengke

修改

parent 9ebdf5e7
......@@ -84,3 +84,15 @@ export function SetWebMenu(data) {
})
}
/**
* 获取网站菜单详情
*
*/
export function GetWebMenu(data) {
return request({
url: '/WebManager/GetWebMenu',
method: 'post',
data
})
}
......@@ -10,18 +10,18 @@
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.Name" ref="Name"
class="col-6 q-pr-lg q-pb-lg" label="菜单名称" :rules="[val => !!val || '请填写菜单名称']" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.MenuUrl" ref="MenuUrl"
class="col-6 q-pb-lg" label="菜单地址" />
<q-input stack-label maxlength="200" :dense="false" v-model="objOption.ParentId" class="col-6 q-pr-lg q-pb-lg"
class="col-6 q-pb-lg" label="菜单地址" :rules="[val => !!val || '请填写菜单地址']" />
<q-select class="col-6 q-pr-lg q-pb-lg" v-model="objOption.MenuLevel" :options="MenuLevelOpts" emit-value
map-options label="菜单等级" />
<q-input stack-label maxlength="200" :dense="false" v-model="objOption.ParentId" class="col-6 q-pb-lg"
label="父级Id" />
<q-input filled stack-label maxlength="100" :dense="false" @keyup.native="checkInteger(objOption,'MenuLevel')" v-model="objOption.MenuLevel" ref="MenuLevel"
class="col-6 q-pb-lg" label="菜单等级" />
<q-input filled stack-label maxlength="100" :dense="false" v-model="objOption.ClassName" ref="ClassName"
class="col-6 q-pb-lg q-pr-lg" label="班级名称" />
<q-input filled stack-label maxlength="100" :dense="false" @keyup.native="checkInteger(objOption,'SortNum')" v-model="objOption.SortNum" ref="SortNum"
class="col-6 q-pb-lg" label="排序" />
<q-input filled stack-label maxlength="100" :dense="false" @keyup.native="checkInteger(objOption,'SortNum')"
v-model="objOption.SortNum" ref="SortNum" class="col-6 q-pb-lg" label="排序" />
<div class="col-6 q-pb-lg q-pr-lg">
<q-uploader :style="{ backgroundImage: 'url(' + objOption.Icon + ')' }" style="width:auto;height:200px"
flat hide-upload-btn max-files="1" label="菜单图标" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
<q-uploader :style="{ backgroundImage: 'url(' + objOption.Icon + ')' }" style="width:auto;height:200px" flat
hide-upload-btn max-files="1" label="菜单图标" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
</q-uploader>
</div>
</div>
......@@ -38,9 +38,8 @@
<script>
import {
GetNavTypeList,
SetWebMenu,
GetWebNav
GetWebMenu
} from '../../api/system/webkit'
import {
UploadSelfFile
......@@ -55,9 +54,23 @@
data() {
return {
//菜单等级
MenuLevelOpts: [],
//菜单类型
NavTypeList: [],
MenuLevelOpts: [{
label: '全部',
value: -1
},
{
label: '一级',
value: 1
},
{
label: '二级',
value: 2
},
{
label: '三级',
value: 3
}
],
persistent: true,
objOption: {
Id: 0,
......@@ -65,9 +78,9 @@
MenuUrl: '',
ParentId: 0,
MenuLevel: '',
ClassName : '',
Icon:'',
SortNum:''
ClassName: '',
Icon: '',
SortNum: ''
},
optionTitle: "",
//菜单列表
......@@ -76,24 +89,9 @@
}
},
mounted() {
this.initNavType();
this.initObj()
},
methods: {
//初始化下拉框
initNavType() {
GetNavTypeList().then(res => {
if (res.Code == 1) {
this.NavTypeList = res.Data;
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: res.Message
})
}
})
},
uploadFile(files) {
UploadSelfFile("course", files[0], res => {
if (res.Code == 1) {
......@@ -104,26 +102,30 @@
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.Id > 0) {
GetWebNav({
GetWebMenu({
Id: this.saveObj.Id
}).then(res => {
console.log(res, '数据');
this.objOption.Id = res.Data.Id;
this.objOption.NavTitle = res.Data.NavTitle;
this.objOption.SubTitle = res.Data.SubTitle;
this.objOption.BgImg = res.Data.BgImg;
this.objOption.LinkUrl = res.Data.LinkUrl;
this.objOption.NavType = res.Data.NavType;
this.objOption.Name = res.Data.Name;
this.objOption.MenuUrl = res.Data.MenuUrl;
this.objOption.ParentId = res.Data.ParentId;
this.objOption.MenuLevel = res.Data.MenuLevel;
this.objOption.ClassName = res.Data.ClassName;
this.objOption.Icon = res.Data.Icon;
this.objOption.SortNum = res.Data.SortNum;
})
this.optionTitle = "修改网站导航信息"
this.optionTitle = "修改网站菜单信息"
} else {
this.optionTitle = "新增网站导航信息"
this.optionTitle = "新增网站菜单信息"
this.objOption.Id = 0;
this.objOption.NavTitle = '';
this.objOption.SubTitle = '';
this.objOption.BgImg = '';
this.objOption.LinkUrl = '';
this.objOption.NavType = 0;
this.objOption.Name = '';
this.objOption.MenuUrl = '';
this.objOption.ParentId = 0;
this.objOption.MenuLevel = 0;
this.objOption.ClassName = '';
this.objOption.Icon = '';
this.objOption.SortNum = 0;
}
},
//关闭弹窗
......@@ -133,21 +135,25 @@
},
//保存菜单
saveWebkitMenu() {
this.saveLoading = true
SetWebMenu(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
this.$refs.Name.validate();
this.$refs.MenuUrl.validate();
if (!this.$refs.Name.hasError && !this.$refs.MenuUrl.hasError) {
this.saveLoading = true
SetWebMenu(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
}
}
},
}
......
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