Commit 6e225071 by cwq0219

产品功能管理;axios;table组件

1 parent 7a3b212d
......@@ -2677,6 +2677,11 @@
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",
"dev": true
},
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
},
"check-types": {
"version": "7.4.0",
"resolved": "http://registry.npm.taobao.org/check-types/download/check-types-7.4.0.tgz",
......@@ -3344,6 +3349,11 @@
"which": "^1.2.9"
}
},
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
},
"crypto-browserify": {
"version": "3.12.0",
"resolved": "http://registry.npm.taobao.org/crypto-browserify/download/crypto-browserify-3.12.0.tgz",
......@@ -5474,10 +5484,26 @@
"minimatch": "~3.0.2"
}
},
"glsx-table": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/glsx-table/-/glsx-table-1.0.1.tgz",
"integrity": "sha512-FdSsdJbIGle5nFyVPUf7gA2ALgoHdjgsSInMNUoYzvM+rbPg1h7YmfWBR8y380DpiQ4fj4GQZ0BWKaxJvfKeew==",
"requires": {
"element-ui": "^2.13.1",
"vue": "^2.6.12"
},
"dependencies": {
"vue": {
"version": "2.6.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz",
"integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ=="
}
}
},
"glsx-vue-common": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/glsx-vue-common/-/glsx-vue-common-1.2.8.tgz",
"integrity": "sha512-xUJ2kuVH26Hs/aAJLxkHkj1XXEY3xcS8SX4FmFPwTxgvWeRYJzMK3prkiuxbDuvDt7MybeYAi+K0bjTdRiEF2w==",
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/glsx-vue-common/-/glsx-vue-common-1.2.9.tgz",
"integrity": "sha512-oG7tbd5ex0xmcmrBzmYYrRj8aXjFpfBl2/etUqzwHhuSswNl7hAxuhmJxF1JhnOoOcOjgq/HqIFYtnv3eGt1jw==",
"requires": {
"vue": "^2.5.10"
}
......@@ -10634,6 +10660,15 @@
"safe-buffer": "^5.0.1"
}
},
"sha1": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz",
"integrity": "sha1-rdqnqTFo85PxnrKxUJFhjicA+Eg=",
"requires": {
"charenc": ">= 0.0.1",
"crypt": ">= 0.0.1"
}
},
"shallow-clone": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/shallow-clone/download/shallow-clone-1.0.0.tgz",
......
......@@ -12,10 +12,12 @@
"dependencies": {
"axios": "^0.18.0",
"element-ui": "^2.15.1",
"glsx-vue-common": "^1.2.8",
"glsx-table": "^1.0.1",
"glsx-vue-common": "^1.2.9",
"lodash": "^4.17.10",
"node-sass": "^4.9.3",
"sass-loader": "^7.1.0",
"sha1": "^1.1.1",
"vue": "^2.5.17"
},
"devDependencies": {
......
import request from './request'
// 产品
export const productApi = {
/** 获取财务管理列表*/
getListApi(data = {}) {
data.method = 'cn.com.glsx.merchants.product.findProductByPage'
return request(data)
}
}
// 菜单
// 功能
import RequestMethods from './request.methods'
// import GlsxVueCommon from 'glsx-vue-common'
import sign from './sign'
import {
GlAxios
} from 'glsx-vue-common'
const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => {
params.source = 'glsx-oss-merchant-data'
params.appKey = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime()
params.v = '1.0.0'
params.format = 'json'
// params.createBy = this.$get_session_config().user.id
var data = sign(params, noSignAttr)
return method === RequestMethods.GET ? GlAxios.get('router', {
params: sign(params, noSignAttr)
}) : GlAxios.post('router', data)
}
export default request
const RequestMethods = {
POST: 'post',
GET: 'get',
PUT: 'put',
DELETE: 'delete'
}
export default RequestMethods
import sha1 from 'sha1'
import qs from 'qs'
import _ from 'lodash'
const secret = window.location.href.includes('dj.glsx.com.cn') ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' : 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const sign = (params, noSignAttr = []) => {
delete params.sign
var objStr = qs.stringify(_.cloneDeep(params), {
arrayFormat: 'indices',
allowDots: true,
encodeValuesOnly: true
})
var objVal = objStr.split('&')
var realObj = {}
objVal.forEach(item => {
const idx = item.indexOf('=')
realObj[item.split('=')[0]] = decodeURIComponent(item.slice(idx + 1))
})
const keys = Object.keys(realObj).sort()
var str = []
var obj = null
for (const key in realObj) {
obj = realObj[key]
if (obj === null) {
obj = ''
} else if (typeof obj === 'object') {
obj = JSON.stringify(obj)
}
realObj[key] = obj
}
keys.forEach(e => {
!noSignAttr.includes(e) && str.push(e + realObj[e])
})
realObj.sign = sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
export default sign
......@@ -2,6 +2,7 @@
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
import glsxTable from 'glsx-table'
import 'element-ui/lib/theme-chalk/index.css'
// import GlsxVueComponents from 'glsx-vue-components'
// import 'glsx-vue-components/dist/glsx-vue-components.css'
......@@ -14,6 +15,7 @@ import _ from 'lodash'
// import axios from 'axios'
Vue.use(ElementUI)
Vue.use(glsxTable)
var mixin = {
mounted() {
......
......@@ -2,7 +2,7 @@
<template>
<div class="d2-table">
<el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:ref="tableParams.mutiSelectName + 'MutiTable' || 'MutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading"
......@@ -26,7 +26,7 @@
width="60px"
label="序号"
type='index'
:index="index=>index+(page.currentPage - 1) * page.pageSize + 1"
:index="index=>index+(page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableParams.tableColumns"
......@@ -93,9 +93,9 @@
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.currentPage"
:current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal"
:layout="layout"
>
......@@ -111,10 +111,7 @@ export default {
loading: false,
data: [],
// 页码
page: {
pageSize: 10,
currentPage: 1
},
page: {},
total: 10,
// 排序
sortColum: '',
......@@ -158,6 +155,10 @@ export default {
type: Boolean,
default: true
},
pageConf: {
type: Object,
default: () => ({ pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'totalCount' })
},
// 分页组件配置
layout: {
type: String,
......@@ -213,6 +214,9 @@ export default {
},
mounted() {
this.page = {}
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageNum] = 1
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
......@@ -244,13 +248,12 @@ export default {
this.refreshTable(true, true)
},
refreshTable(clearMuti = true, resetCurrentPage = false) {
refreshTable(clearMuti = true, resetPageNum = false) {
this.beforeSearchFn().then(res => {
// console.log(res)
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
resetCurrentPage && (this.page.currentPage = 1)
resetPageNum && (this.page.pageNum = 1)
var params = {
...this.page,
...this.searchForm
......@@ -260,8 +263,8 @@ export default {
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
this.data = res[this.tableParams.listName]
this.total = res.pagination.totalCount
this.data = this.findVal(res, this.tableParams.listName)
this.total = this.findVal(res, this.pageConf.totalCount)
this.loading = false
}).catch(() => {
this.loading = false
......@@ -269,15 +272,24 @@ export default {
})
},
// 找返回值
findVal(res, rankStr, attr) {
var rankList = rankStr.split('.')
if (!rankStr) {
return res
}
return this.findVal(res[rankList[0]], rankList.splice(1).join('.'), attr)
},
// 每页条数
handleSizeChange(value) {
this.page.pageSize = value
this.page[this.pageConf.pageSize] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
// 页码
handleCurrentChange(value) {
this.page.currentPage = value
this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
......
/**
* 时间控件-限制月份
*/
export const rangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
<!-- 搜索 -->
<template>
<div class="glsx-combi-form">
<el-form
:inline="true"
v-model="formObj"
:label-width="labelWidth"
:rules="formRules"
size="small"
class="glsx-combi-form-block"
>
<template v-for="(item, index) in formData">
<el-form-item
v-if="!item.isHide"
:key="index"
:class="{'no-label': !item.label}"
:label="item.label ? (item.label + ':') : ''"
:prop="item.name"
>
<el-input
v-if="item.type === 'input'"
:placeholder="item.placeholder || ('请输入' + item.label)"
v-model.trim="formObj[item.name]"
:disabled="item.isDisabled"
:maxlength="item.maxlength"
:clearable="item.isClear || false"
:type="item.inputType || 'text'"
@keydown.native="e => handleInputDown(e, item)"
></el-input>
<!-- 选择-输入框 -->
<el-input
v-else-if="item.type === 'selectInput'"
:placeholder="'请输入' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label"
v-model.trim="searchSelectObj[item.selectName].value"
:clearable="item.isClear || false"
class="input-with-select"
>
<el-select
v-model="searchSelectObj[item.selectName].attr"
style="width: 130px"
slot="prepend"
placeholder="请选择"
@change="item.handleSelectChange"
>
<el-option
v-for="(subItem, subIndex) in item.selectOption"
:key="subIndex"
:label="subItem.label"
:value="subItem.name"
></el-option>
</el-select>
</el-input>
<!-- 选择-时间选择框 -->
<template v-else-if="item.type === 'selectDatePicker'">
<el-select
v-model="searchSelectObj[item.selectName].attr"
style="width: 130px"
placeholder="请选择"
@change="item.handleSelectChange"
>
<el-option
v-for="(subItem, subIndex) in item.selectOption"
:key="subIndex"
:label="subItem.label"
:value="subItem.name"
></el-option>
</el-select>
<el-date-picker
v-model="searchSelectObj[item.selectName].value"
style="width: calc(100% - 130px)"
:type="item.dateType || 'daterange'"
:clearable="item.isClear || false"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOption[item.pickerOptions]"
>
</el-date-picker>
</template>
<!-- 双选择框 -->
<template v-else-if="item.type === 'selectDouble'">
<el-select
v-model="searchSelectObj[item.selectName].attr"
style="width: 130px"
placeholder="请选择"
@change="item.handleSelectChange"
>
<el-option
v-for="(subItem, subIndex) in item.selectOption"
:key="subIndex"
:label="subItem.label"
:value="subItem.name"
></el-option>
</el-select>
<el-select
v-model="searchSelectObj[item.selectName].value"
style="width: calc(100% - 130px)"
:placeholder="'请选择' + item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).label"
>
<el-option
label="全部"
value=""
></el-option>
<el-option
v-for="subItem in item.selectOption.find(k => k.name === searchSelectObj[item.selectName].attr).optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]"
></el-option>
</el-select>
</template>
<!-- 选择框 -->
<el-select
v-else-if="item.type === 'select'"
:style="{ width: item.width || '100%'}"
v-model="formObj[item.name]"
:clearable="item.isClear || false"
:placeholder="'请选择' + item.label"
:filterable="!item.noFilter"
:disabled="item.isDisabled"
:no-data-text="item.noDataText || '无数据'"
:multiple="item.multiple || false"
:collapse-tags="item.collapseTags || true"
@change="selectAddAttr($event, item)"
>
<el-option
v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]"
>
</el-option>
</el-select>
<el-date-picker
v-else-if="item.type === 'datePicker'"
v-model="formObj[item.name]"
:type="item.dateType || 'daterange'"
:clearable="item.isClear || false"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOption[item.pickerOptions]"
>
</el-date-picker>
<slot
v-if="item.addHtml"
:name="item.addHtml"
:scope="item"
></slot>
</el-form-item>
</template>
<slot></slot>
</el-form>
</div>
</template>
<script>
import { rangePickerOptions } from './common'
export default {
name: 'glsx-combi-form',
data() {
return {
pickerOption: {
rangePickerOptions: rangePickerOptions
}
}
},
props: {
labelWidth: {
type: String,
default: '85px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => { }
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => { }
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => { }
}
},
mounted() { },
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
.glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content,
.el-form-item--small .el-form-item__label {
width: 100%;
}
/* .glsx-combi-form .el-form-item--small .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
</style>
<!-- 弹窗 -->
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:show-close="showClose"
:before-close="handleClose"
:close-on-click-modal="false"
:width="width"
>
<span slot="title">
{{title}}
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
<div slot="footer">
<slot name="btn-start"></slot>
<el-button
type="primary"
@click="handleConfirm"
>{{btnOkLabel}}</el-button>
<el-button
v-if="!noCancel"
@click="handleClose"
>取消</el-button>
<slot name="btn-middle"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'glsx-dialog',
data() {
return {
}
},
props: {
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
showClose: {
type: Boolean,
default: true
},
btnOkLabel: {
type: String,
default: '确定'
},
noCancel: {
type: Boolean,
default: false
},
width: {
type: String,
default: '580px'
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style scoped>
.dialog-sub-title {
font-size: 12px;
color: #666666;
}
</style>
......@@ -2,3 +2,5 @@ import Vue from 'vue'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('glsx-dialog', () => import('./glsx-dialog/index.vue'))
Vue.component('glsx-combi-form', () => import('./glsx-combi-form/index.vue'))
<template>
<div id="app" class="outsider">
<div
id="app"
class="outsider"
>
<gl-card class="index-card">
<div slot="header">
广联运营平台
</div>
<ul>
<li>
<a href="../customer/glsx.html" target="_self">
<a
href="../customer/glsx.html"
target="_self"
>
广联赛讯——主页
</a>
</li>
<li>
<a
href="../productManage/productList.html"
target="_self"
>
产品列表
</a>
</li>
<li>
<a
href="../productManage/menuList.html"
target="_self"
>
菜单列表
</a>
</li>
<li>
<a
href="../productManage/functionList.html"
target="_self"
>
功能管理
</a>
</li>
</ul>
</gl-card>
</div>
......@@ -23,8 +53,8 @@ export default {
</script>
<style scoped>
.outsider{
background-color: #FFF;
.outsider {
background-color: #fff;
padding: 20px 0px 40px 0px;
/* margin: 20px 20px; */
}
......
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
const Apps = require.context('./', false, /\.vue$/)
Apps.keys().map(item => {
base.getConfig().then(data => {
const {
vue,
config
} = data
vue.use(GlsxVueCommon, config)
base.render(Apps(item).default)
})
})
<!-- 功能列表 -->
<template>
<div>
<el-button
icon="el-icon-plus"
@click="handleAdd"
>创建功能</el-button>
<glsx-combi-form
ref="showSearch"
labelWidth="120px"
:formObj="searchForm"
:searchSelectObj="searchSelectObj"
:formData="searchFormData"
>
<el-button
size="small"
type="primary"
:id="tableParams.btnId"
>查询</el-button>
</glsx-combi-form>
<glsx-table
ref="functionTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<el-button
slot="auth-button"
type="text"
>编辑</el-button>
</glsx-table>
<glsx-dialog
:title="title"
:isVisible="editVisible"
@closeDialog="handleAdd"
@confirmDialog="handleAdd"
>
<glsx-combi-form
labelWidth="130px"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
>
<el-select
slot="parentid"
slot-scope="scope"
></el-select>
</glsx-combi-form>
</glsx-dialog>
</div>
</template>
<script>
import _ from 'lodash'
export default {
name: 'functionList',
data() {
return {
searchForm: {
functionName: '',
merchantName: ''
},
searchSelectObj: {
funcOrName: {
attr: 'functionName',
value: ''
}
},
searchFormData: [{
label: '产品',
name: 'productId',
type: 'select',
multiple: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'productList'
}, {
label: '菜单',
name: '',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
label: '功能属性类型',
name: '',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
label: '商户账户类型',
name: '',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
label: '所属客户群体',
name: '',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}, {
type: 'selectInput',
selectName: 'funcOrName',
isClear: true,
selectOption: [{
label: '功能名称',
name: 'functionName'
}, {
label: '商户名称',
name: 'merchantName'
}],
handleSelectChange: (value) => {
this.searchSelectObj.funcOrName.value = ''
}
}],
getListApi: '',
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '功能名称',
prop: 'functionName'
}, {
label: '功能属性名',
prop: 'functionAttributeName'
}, {
label: '功能属性类型',
prop: 'functionType'
}, {
label: '所属菜单名',
prop: 'menuId'
}, {
label: '所属菜单地址',
prop: ''
}, {
label: '所属产品',
prop: ''
}, {
label: '所属客户群体',
prop: 'ownedCusgroupValue'
}, {
label: '更新时间',
prop: ''
}]
},
// 弹窗
title: '创建产品',
editVisible: false,
editForm: {},
editRule: {
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }]
},
editFormData: [{
label: '产品',
name: 'productId',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'productList'
}, {
label: '父级菜单',
name: 'parentid',
addHtml: 'parentid'
}, {
label: '功能名称',
name: '',
type: 'input',
maxlength: 15
}, {
label: '功能属性名',
name: '',
type: 'input'
}, {
label: '所属客户群体'
}, {
label: '功能值',
name: '',
type: 'input'
}, {
label: '排序值',
name: 'sort',
type: 'input'
}],
// 基本数据
baseData: {
productList: [{
confId: '1',
confLabel: '产品1'
}, {
confId: '2',
confLabel: '产品2'
}, {
confId: '3',
confLabel: '产品3'
}]
}
}
},
mounted() {
this.getOptionsList('searchFormData')
this.getOptionsList('editFormData', false)
},
methods: {
keyDowmGetList() {
this.$refs.productTable.refreshTable()
},
getOptionsList(formName, hasAll = true) {
this[formName].forEach((item, index) => {
if (item.type === 'select') {
this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
},
getSelectInputParams() {
const list = Object.keys(this.searchSelectObj)
var params = {}
list.forEach(i => {
const item = this.searchSelectObj[i]
item.value && (params[item.attr] = item.value)
})
return params
},
getParams() {
var params = _.cloneDeep(this.searchForm)
const tempParams = this.getSelectInputParams()
params = {
...params,
...tempParams
}
return params
},
handleAdd() {
this.editVisible = !this.editVisible
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
// import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
const Apps = require.context('./', false, /\.vue$/)
console.log('00000000000000')
Apps.keys().map(item => {
console.log(item)
base.getConfig().then(data => {
const {
vue,
config
} = data
vue.use(GlsxVueCommon, config)
base.render(Apps(item).default)
})
})
// base.getConfig().then(data => {
// const { vue, config } = data
// vue.use(GlsxVueCommon, config)
// base.render(App)
// })
<!-- 菜单列表 -->
<template>
<div>
<el-row>
<el-col :span="8">
<el-button
icon="el-icon-plus"
@click="handleAdd"
>创建菜单</el-button>
</el-col>
<el-col
style="text-align: right;"
:span="16"
>
<glsx-combi-form
ref="showSearch"
:formObj="searchForm"
:formData="searchFormData"
>
<el-button
size="small"
type="primary"
:id="tableParams.btnId"
>查询</el-button>
</glsx-combi-form>
</el-col>
</el-row>
<glsx-table
ref="menuTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<span slot="auth-button">
<el-button type="text">修改</el-button>
<el-button type="text">删除</el-button>
</span>
</glsx-table>
<glsx-dialog
:title="title"
:isVisible="editVisible"
@closeDialog="handleAdd"
@confirmDialog="handleAdd"
>
<glsx-combi-form
labelWidth="100px"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
>
<el-select
slot="parentid"
slot-scope="scope"
></el-select>
</glsx-combi-form>
</glsx-dialog>
</div>
</template>
<script>
import _ from 'lodash'
export default {
name: 'menuList',
data() {
return {
searchForm: {
productId: [],
menuName: ''
},
searchFormData: [{
label: '产品',
name: 'productId',
type: 'select',
multiple: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'productList'
}, {
label: '菜单名称',
name: 'menuName',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}],
getListApi: '',
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '菜单名称',
prop: 'menuName'
}, {
label: '菜单编号',
prop: 'menuCode'
}, {
label: '排序值',
prop: 'sort'
}, {
label: '菜单地址',
prop: 'menuUrl'
}, {
label: '父级菜单名',
prop: ''
}, {
label: '产品名称',
prop: ''
}, {
label: '更新时间',
prop: ''
}]
},
// 弹窗
title: '创建菜单',
editVisible: false,
editForm: {},
editRule: {
productId: [{ required: true, message: '请选择产品', trigger: 'blur' }]
},
editFormData: [{
label: '产品',
name: 'productId',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'productList'
}, {
label: '父级菜单',
name: 'parentid',
addHtml: 'parentid'
}, {
label: '菜单名称',
name: 'menuName',
type: 'input',
maxlength: 15
}, {
label: '菜单地址',
name: 'menuUrl',
type: 'input'
}, {
label: '菜单ICON'
}, {
label: '菜单排序值',
name: 'sort',
type: 'input'
}],
// 基本数据
baseData: {
productList: [{
confId: '1',
confLabel: '产品1'
}, {
confId: '2',
confLabel: '产品2'
}, {
confId: '3',
confLabel: '产品3'
}]
}
}
},
mounted() {
this.getOptionsList('searchFormData')
this.getOptionsList('editFormData', false)
},
methods: {
keyDowmGetList() {
this.$refs.productTable.refreshTable()
},
getOptionsList(formName, hasAll = true) {
this[formName].forEach((item, index) => {
if (item.type === 'select') {
this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
},
handleAdd() {
this.editVisible = !this.editVisible
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
// import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
const Apps = require.context('./', false, /\.vue$/)
Apps.keys().map(item => {
base.getConfig().then(data => {
const {
vue,
config
} = data
vue.use(GlsxVueCommon, config)
base.render(Apps(item).default)
})
})
// base.getConfig().then(data => {
// const { vue, config } = data
// vue.use(GlsxVueCommon, config)
// base.render(App)
// })
<!-- 产品列表 -->
<template>
<div>
<el-row>
<el-col :span="12">
<el-button
icon="el-icon-plus"
@click="handleAdd"
>创建产品</el-button>
</el-col>
<el-col
style="text-align: right;"
:span="12"
>
<glsx-combi-form
ref="showSearch"
:formObj="searchForm"
:formData="searchFormData"
>
<el-button
size="small"
type="primary"
:id="tableParams.btnId"
>查询</el-button>
</glsx-combi-form>
</el-col>
</el-row>
<d2-table
ref="productTable"
:searchForm="searchForm"
:pageConf="pageConf"
:tableParams="tableParams"
:getListApi="getListApi"
>
<el-button
slot="auth-button"
type="text"
>修改</el-button>
</d2-table>
<glsx-dialog
:title="title"
:isVisible="editVisible"
@closeDialog="handleAdd"
@confirmDialog="handleAdd"
>
<glsx-combi-form
labelWidth="100px"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
>
</glsx-combi-form>
</glsx-dialog>
</div>
</template>
<script>
import _ from 'lodash'
import { productApi } from '@/api/productManage'
export default {
name: 'productList',
data() {
return {
searchForm: {
productName: ''
},
searchFormData: [{
label: '产品名称',
name: 'productName',
type: 'input',
isClear: true,
keyFn: this.keyDowmGetList
}],
getListApi: productApi.getListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNumer', totalCount: 'data.totalCount' },
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableOption: true,
tableColumns: [{
label: '产品名称',
prop: 'productName'
}, {
label: '类型',
prop: 'productType',
formatter: cellValue => {
return cellValue.productType
}
}, {
label: '产品编号',
prop: 'productCode'
}, {
label: '产品说明',
prop: 'productDetail'
}, {
label: '创建时间',
prop: 'createdTime'
}]
},
// 弹窗
title: '创建产品',
editVisible: false,
editForm: {},
editRule: {
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }]
},
editFormData: [{
label: '产品名称',
name: 'productName',
type: 'input',
maxlength: 15,
isClear: true
}, {
label: '产品类型',
name: 'productType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'productTypeList'
}, {
label: '产品说明',
name: 'productDetail',
type: 'input',
inputType: 'textarea',
maxlength: 50
}, {
label: '产品地址',
name: 'productAddress',
type: 'input',
isClear: true
}],
// 基本数据
baseData: {
productTypeList: [{
confId: '1',
confLabel: 'web'
}, {
confId: '2',
confLabel: '微信小程序'
}, {
confId: '3',
confLabel: '企微小程序'
}]
}
}
},
mounted() {
this.getOptionsList('editFormData', false)
},
methods: {
keyDowmGetList() {
this.$refs.productTable.refreshTable()
},
getOptionsList(formName, hasAll = true) {
this[formName].forEach((item, index) => {
if (item.type === 'select') {
this.$set(this[formName][index], 'optionList', _.cloneDeep(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
},
handleAdd() {
this.editVisible = !this.editVisible
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -21,7 +21,7 @@ module.exports = {
},
devServer: {
port: 8085,
host: 'localhost',
host: '0.0.0.0',
open: true,
proxy: {
'/api': {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!