|
@@ -73,33 +73,7 @@
|
|
|
rules: [{ required: true, message: '请输入名称!' }] }]"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
- <!-- 路由英文名 -->
|
|
|
- <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路由英文名" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入路由英文名"
|
|
|
- v-decorator="['formData.routeName', {
|
|
|
- initialValue: formData.routeName,
|
|
|
- rules: [{ required: true, message: '请输入路由英文名!' }] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
- <!-- 路径 -->
|
|
|
- <!-- <a-form-item v-if="!formData.type||formData.type=='0'" label="路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入路径"
|
|
|
- v-decorator="['formData.routePath', {
|
|
|
- initialValue: formData.routePath,
|
|
|
- rules: [{ required: true, message: '请输入路径!' }] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
- <!-- 请求路径 -->
|
|
|
- <!-- <a-form-item v-if="formData.type==1" label="请求路径" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入请求路径"
|
|
|
- v-decorator="['formData.urlPath', {
|
|
|
- initialValue: formData.urlPath,
|
|
|
- rules: [{ required: true, message: '请输入请求路径!' }] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
+
|
|
|
<!-- 前端权限编码 -->
|
|
|
<a-form-item label="前端权限编码" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
<a-input
|
|
@@ -125,35 +99,9 @@
|
|
|
]"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
- <!-- 图标 -->
|
|
|
- <!-- <a-form-item v-if="!formData.type ||formData.type=='0' " label="图标" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入图标名称"
|
|
|
- v-decorator="['formData.icon', {
|
|
|
- initialValue: formData.icon,
|
|
|
- rules: [] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
- <!-- 前端组件 -->
|
|
|
- <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="前端组件" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入前端组件路径"
|
|
|
- v-decorator="['formData.componentPath', {
|
|
|
- initialValue: formData.componentPath,
|
|
|
- rules: [{ required: true, message: '请输入前端组件路径!' }] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
-
|
|
|
- <!-- 第三方链接 -->
|
|
|
- <!-- <a-form-item v-if="!formData.type ||formData.type=='0'" label="第三方链接" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
- <a-input
|
|
|
- placeholder="请输入第三方链接地址"
|
|
|
- v-decorator="['formData.urlPath', {
|
|
|
- initialValue: formData.urlPath,
|
|
|
- rules: [] }]"
|
|
|
- />
|
|
|
- </a-form-item> -->
|
|
|
-
|
|
|
+ <a-form-item label="价格权限" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
+ <a-checkbox-group v-model="authPrice" :options="priceOptions" @change="onPriceChange" />
|
|
|
+ </a-form-item>
|
|
|
<!-- 排序值 -->
|
|
|
<a-form-item label="排序值" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
|
|
|
<a-input-number
|
|
@@ -184,12 +132,9 @@
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item :wrapper-col="{ span: 12, offset: 5 }">
|
|
|
- <a-button type="primary" @click="handleSubmit()">
|
|
|
+ <a-button size="large" type="primary" @click="handleSubmit()">
|
|
|
保存
|
|
|
</a-button>
|
|
|
- <a-button :style="{ marginLeft: '8px' }" @click="clear">
|
|
|
- 重置
|
|
|
- </a-button>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
|
|
@@ -214,6 +159,14 @@ export default {
|
|
|
props: {},
|
|
|
data () {
|
|
|
return {
|
|
|
+ priceOptions:[
|
|
|
+ {label:'售价',value:'salesPrice'},
|
|
|
+ {label:'成本价',value:'costPrice'},
|
|
|
+ {label:'省级价',value:'provincePrice'},
|
|
|
+ {label:'市级价',value:'cityPrice'},
|
|
|
+ {label:'特约价',value:'specialPrice'}
|
|
|
+ ],
|
|
|
+ authPrice: [],
|
|
|
treeData: [],
|
|
|
dataList: [],
|
|
|
searchValue: '',
|
|
@@ -225,6 +178,7 @@ export default {
|
|
|
form: this.$form.createForm(this, { name: 'menu' }),
|
|
|
showChildModal: false,
|
|
|
parentData: {}, // 父级菜单
|
|
|
+ currMenusData:null,
|
|
|
formData: {
|
|
|
id: '',
|
|
|
name: '',
|
|
@@ -249,18 +203,71 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ onPriceChange(val){
|
|
|
+ console.log(val,this.authPrice,this.currMenusData)
|
|
|
+ const data = this.currMenusData
|
|
|
+ if(!data){
|
|
|
+ this.$message.warning('请选择一个父级菜单')
|
|
|
+ this.authPrice = []
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ // 当前选中节点的价格code
|
|
|
+ const child = data&&data.dataRef&&data.dataRef.children ? data.dataRef.children : []
|
|
|
+ data.dataRef.children = child
|
|
|
+ const curAuth = []
|
|
|
+ child.map(item=>{
|
|
|
+ const a = item.code.split('_')
|
|
|
+ curAuth.push(a[a.length-1])
|
|
|
+ })
|
|
|
+
|
|
|
+ // 添加
|
|
|
+ if(val.length > curAuth.length){
|
|
|
+ const diff = val.filter(item => !new Set(curAuth).has(item))
|
|
|
+ console.log(diff)
|
|
|
+ const n = this.priceOptions.find(item=>item.value == diff[0])
|
|
|
+ this.addChildPrice({
|
|
|
+ parentId: data.id,
|
|
|
+ name: n.label,
|
|
|
+ code: data.code +'_'+diff[0],
|
|
|
+ status: 1,
|
|
|
+ sort: curAuth.length
|
|
|
+ },function(ret){
|
|
|
+ ret.title = ret.name
|
|
|
+ child.push(ret)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // 删除
|
|
|
+ const diff = curAuth.filter(item => !new Set(val).has(item))
|
|
|
+ const idx = child.findIndex(item => {
|
|
|
+ const a = item.code.split('_')
|
|
|
+ return a[a.length-1] == diff[0]
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(child[idx])
|
|
|
+ this.delChildPrice(child[idx].id,function(){
|
|
|
+ child.splice(idx,1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
onExpand (expandedKeys) {
|
|
|
// console.log('onExpand', expandedKeys)
|
|
|
this.expandedKeys = expandedKeys
|
|
|
this.autoExpandParent = false
|
|
|
},
|
|
|
onSelect (selectedKeys, info) {
|
|
|
- console.log('onSelect', info)
|
|
|
this.selectedKeys = selectedKeys
|
|
|
if (info.selected) {
|
|
|
+ this.clear()
|
|
|
const data = info.selectedNodes[0].data.props
|
|
|
- const isLeaf = data.dataRef.children
|
|
|
- // this.formData = Object.assign({}, this.formData, info.selectedNodes[0].data.props)
|
|
|
+ const isLeaf = data.dataRef.children || []
|
|
|
+ console.log('onSelect', isLeaf)
|
|
|
+ this.currMenusData = data // 当前节点的子级
|
|
|
+ // 价格权限回显
|
|
|
+ isLeaf.map(item => {
|
|
|
+ const a = item.code.split('_')
|
|
|
+ this.authPrice.push(a[a.length-1])
|
|
|
+ })
|
|
|
this.formData = {
|
|
|
id: data.id,
|
|
|
parentId: data.parentId,
|
|
@@ -353,7 +360,6 @@ export default {
|
|
|
this.showChildModal = true
|
|
|
this.parentData = {}
|
|
|
},
|
|
|
-
|
|
|
// 取消选择
|
|
|
cancelSel () {
|
|
|
this.selectedKeys = []
|
|
@@ -364,6 +370,7 @@ export default {
|
|
|
clear () {
|
|
|
this.form.resetFields()
|
|
|
this.formData.id = ''
|
|
|
+ this.formData.parentId = ''
|
|
|
this.formData.name = ''
|
|
|
this.formData.routePath = ''
|
|
|
this.formData.icon = ''
|
|
@@ -376,8 +383,9 @@ export default {
|
|
|
this.formData.code = ''
|
|
|
this.formData.permission = ''
|
|
|
this.formData.isLeaf = true
|
|
|
+ this.currMenusData = null
|
|
|
+ this.authPrice = []
|
|
|
},
|
|
|
-
|
|
|
// 删除数据
|
|
|
delect () {
|
|
|
if (!this.selectedKeys.length) {
|
|
@@ -391,46 +399,50 @@ export default {
|
|
|
okText: '确定',
|
|
|
cancelText: '取消',
|
|
|
onOk () {
|
|
|
- deleteYyMenu({
|
|
|
- id: _this.formData.id
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success('删除成功')
|
|
|
- _this.getYyMenuList()
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- _this.$message.success('删除失败, 请稍后重试')
|
|
|
- })
|
|
|
+ _this.delChildPrice(_this.formData.id)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ // 删除子级
|
|
|
+ delChildPrice(id,callback){
|
|
|
+ const _this = this
|
|
|
+ deleteYyMenu({
|
|
|
+ id: id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success('删除成功')
|
|
|
+ _this.getYyMenuList()
|
|
|
+ callback&&callback()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ _this.$message.success('删除失败, 请稍后重试')
|
|
|
+ })
|
|
|
+ },
|
|
|
// 保存提交
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
this.form.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
- console.log(values.formData, ' formData.type222222222')
|
|
|
if (values.formData.permission) {
|
|
|
values.formData.permission = values.formData.permission.replace(/\//g, '_')
|
|
|
}
|
|
|
- saveYyMenu(Object.assign({ id: this.formData.id }, values.formData)).then(res => {
|
|
|
- console.log(res, 'res--save')
|
|
|
- if (res.status + '' === '200') {
|
|
|
- this.$message.success(res.message ? res.message : '保存成功')
|
|
|
- _this.getYyMenuList()
|
|
|
- _this.clear()
|
|
|
- } else {
|
|
|
- // this.$message.warning(res.message)
|
|
|
- }
|
|
|
- })
|
|
|
+ this.addChildPrice(Object.assign({ id: this.formData.id }, values.formData))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 新增子级
|
|
|
+ addChildPrice(data,callback){
|
|
|
+ saveYyMenu(data).then(res => {
|
|
|
+ if (res.status + '' === '200') {
|
|
|
+ this.$message.success(res.message ? res.message : '保存成功')
|
|
|
+ this.getYyMenuList()
|
|
|
+ callback&&callback(res.data)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
handleCancel () {
|
|
|
this.clear()
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
mounted () {
|
|
|
},
|