Commit e86bcbbe by cwq0219

树形选择框,所属客户群体

1 parent 84e3eb11
......@@ -23,6 +23,11 @@ export const productApi = {
getListApi(data = {}) {
data.method = `${path}product.findProductByPage`
return request(data)
},
/** 新增产品 */
saveProApi(data = {}) {
data.method = `${path}product.saveProduct`
return request(data)
}
}
// 菜单
......
......@@ -2,8 +2,9 @@
<template>
<div class="glsx-combi-form">
<el-form
:ref="formRef"
:inline="true"
v-model="formObj"
:model="formObj"
:label-width="labelWidth"
:rules="formRules"
size="small"
......@@ -25,6 +26,8 @@
:maxlength="item.maxlength"
:clearable="item.isClear || false"
:type="item.inputType || 'text'"
:style="{ width: item.width || 'auto' }"
:show-word-limit="item.showLimit || false"
@keydown.native="e => handleInputDown(e, item)"
></el-input>
<!-- 选择-输入框 -->
......@@ -167,6 +170,10 @@ export default {
},
props: {
formRef: {
type: String,
default: 'formRef'
},
labelWidth: {
type: String,
default: '85px'
......
......@@ -113,7 +113,7 @@ export default {
return data[this.defaultProps.label].indexOf(query) !== -1
},
handleNodeClick(val) {
this.$emit('selected', { val: val, targetItem: this.targetItem })
this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
}
}
}
......
......@@ -66,10 +66,19 @@
:formData="editFormData"
:formRules="editRule"
>
<el-select
slot="parentid"
<template
slot="menuTree"
slot-scope="scope"
></el-select>
>
<select-tree
:form="editForm"
:targetItem="scope.scope"
:treeData="baseData.menuTreeList"
:defaultProps="treeDefaultProps"
@selected="handleTreeSelect"
></select-tree>
</template>
</glsx-combi-form>
</glsx-dialog>
</div>
......@@ -77,8 +86,8 @@
<script>
import _ from 'lodash'
import OwnCusCom from './components/OwnCusCom'
import SelectTree from './components/SelectTree'
import OwnCusCom from '../components/OwnCusCom'
import SelectTree from '../components/SelectTree'
import { functionApi, baseApi } from '@/api/productManage'
export default {
name: 'functionList',
......@@ -127,7 +136,8 @@ export default {
}, {
label: '菜单',
name: 'menu',
addHtml: 'menuTree'
addHtml: 'menuTree',
formName: 'searchForm'
}, {
label: '商户账户类型',
name: '',
......@@ -208,9 +218,10 @@ export default {
optionLabel: 'dictLabel',
optionsName: 'productList'
}, {
label: '父级菜单',
name: 'parentid',
addHtml: 'parentid'
label: '菜单',
name: 'menu',
addHtml: 'menuTree',
formName: 'editForm'
}, {
label: '功能名称',
name: '',
......@@ -334,8 +345,8 @@ export default {
this.editVisible = !this.editVisible
},
handleTreeSelect(obj) {
this.searchForm[obj.targetItem.name] = obj.val.menuName
this.searchForm.menuId = obj.val.id
this[obj.formName][obj.targetItem.name] = obj.val.menuName
this[obj.formName].menuId = obj.val.id
}
}
}
......
......@@ -50,10 +50,22 @@
:formData="editFormData"
:formRules="editRule"
>
<el-select
slot="parentid"
<template
slot="menuTree"
slot-scope="scope"
></el-select>
>
<select-tree
:form="editForm"
:targetItem="scope.scope"
:treeData="baseData.menuTreeList"
:defaultProps="treeDefaultProps"
@selected="handleTreeSelect"
></select-tree>
</template>
<template
slot="menuIcon"
slot-scope="scope"
></template>
</glsx-combi-form>
</glsx-dialog>
</div>
......@@ -62,6 +74,7 @@
<script>
import _ from 'lodash'
import { Util } from '@/common/util'
import SelectTree from '../components/SelectTree'
import { menuApi, baseApi } from '@/api/productManage'
export default {
name: 'menuList',
......@@ -81,8 +94,8 @@ export default {
type: 'select',
multiple: true,
optionList: [],
optionId: 'id',
optionLabel: 'productName',
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'productList',
changeAttr: (value, targetItem) => {
if (value.includes('')) {
......@@ -139,52 +152,74 @@ export default {
// 弹窗
title: '创建菜单',
editVisible: false,
editForm: {},
editForm: {
menu: '',
menuId: ''
},
editRule: {
productId: [{ required: true, message: '请选择产品', trigger: 'blur' }]
},
treeDefaultProps: {
children: 'childlist',
label: 'menuName'
},
editFormData: [{
label: '产品',
name: 'productId',
width: '300px',
type: 'select',
optionList: [],
optionId: 'id',
optionLabel: 'productName',
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'productList'
}, {
label: '父级菜单',
name: 'parentid',
addHtml: 'parentid'
name: 'menu',
addHtml: 'menuTree',
formName: 'editForm'
}, {
label: '菜单名称',
name: 'menuName',
type: 'input',
width: '300px',
maxlength: 15
}, {
label: '菜单地址',
name: 'menuUrl',
width: '300px',
type: 'input'
}, {
label: '菜单ICON'
label: '菜单ICON',
name: '',
addHtml: 'menuIcon'
}, {
label: '菜单排序值',
name: 'sort',
width: '300px',
type: 'input'
}],
// 基本数据
baseData: {
productList: []
productList: [],
menuTreeList: []
}
}
},
components: {
SelectTree
},
mounted() {
baseApi.getAllProduct().then(res => {
console.log(res)
baseApi.getAllDictApi({ dictType: 'product' }).then(res => {
// console.log(res)
this.baseData.productList = res.data
this.getOptionsList('searchFormData')
this.getOptionsList('editFormData', false)
})
baseApi.getMenuTree().then(res => {
this.baseData.menuTreeList = res.data
})
},
methods: {
......@@ -213,6 +248,10 @@ export default {
},
handleAdd() {
this.editVisible = !this.editVisible
},
handleTreeSelect(obj) {
this[obj.formName][obj.targetItem.name] = obj.val.menuName
this[obj.formName].menuId = obj.val.id
}
}
}
......
// import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
import notice from '@/common/notice'
const Apps = require.context('./', false, /\.vue$/)
......@@ -11,12 +12,7 @@ Apps.keys().map(item => {
config
} = data
vue.use(GlsxVueCommon, config)
vue.prototype.notice = notice
base.render(Apps(item).default)
})
})
// base.getConfig().then(data => {
// const { vue, config } = data
// vue.use(GlsxVueCommon, config)
// base.render(App)
// })
<!-- 产品列表 -->
<template>
<div>
<div class="prodect-list">
<el-row>
<el-col :span="12">
<el-button
......@@ -40,11 +40,13 @@
<glsx-dialog
:title="title"
:isVisible="editVisible"
@closeDialog="handleAdd"
@confirmDialog="handleAdd"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
>
<glsx-combi-form
ref="editFormRef"
labelWidth="100px"
:formRef="editChildRef"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
......@@ -101,20 +103,29 @@ export default {
// 弹窗
title: '创建产品',
editVisible: false,
editForm: {},
editChildRef: 'editChildRef',
editForm: {
productName: '',
productType: '',
productDetail: '',
productAddress: ''
},
editRule: {
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }]
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
productType: [{ required: true, message: '请选择产品类型', trigger: 'change' }],
productAddress: [{ required: true, message: '请输入产品地址', trigger: 'blur' }]
},
editFormData: [{
label: '产品名称',
name: 'productName',
type: 'input',
maxlength: 15,
isClear: true
width: '300px'
}, {
label: '产品类型',
name: 'productType',
type: 'select',
width: '300px',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
......@@ -124,12 +135,14 @@ export default {
name: 'productDetail',
type: 'input',
inputType: 'textarea',
maxlength: 50
maxlength: 50,
showLimit: true,
width: '300px'
}, {
label: '产品地址',
name: 'productAddress',
type: 'input',
isClear: true
width: '300px'
}],
// 基本数据
baseData: {
......@@ -142,6 +155,9 @@ export default {
}, {
confId: '3',
confLabel: '企微小程序'
}, {
confId: '4',
confLabel: 'H5'
}]
}
}
......@@ -170,10 +186,35 @@ export default {
},
handleAdd() {
this.editVisible = !this.editVisible
},
handleEditClose() {
this.editForm = {
productName: '',
productType: '',
productDetail: '',
productAddress: ''
}
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate()
this.handleAdd()
},
handleEditConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
productApi.saveProApi({ productCode: '123', ...this.editForm }).then(res => {
console.log(res)
this.notice.okTips()
this.handleEditClose()
this.keyDowmGetList()
})
}
})
}
}
}
</script>
<style scoped>
<style>
.prodect-list .el-textarea__inner {
height: 80px;
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!