Commit 925a71bb by 胡悦

合并代码提交

0 parents
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# glsx-micro-system-child
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This diff could not be displayed because it is too large.
{
"name": "glsx-micro-system-child",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.20.0",
"core-js": "^3.6.5",
"element-ui": "^2.13.2",
"vue": "^2.6.11",
"vue-router": "^3.4.6",
"vuex": "^3.5.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"node-sass": "^4.14.1",
"sass-loader": "^10.0.3",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="glsx-sub-system"></div>
<!-- built files will be auto injected -->
</body>
</html>
<template>
<div
id="glsx-system-sub"
class="glsx-system-sub"
>
<div id="nav">
<!-- <router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> -->
<!-- <p>a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好<a href="/about">parent About</a></p> -->
<p v-if="isQiankun">
主项目把router传给子项目,子项目用这个router来跳转
<span @click="goToPage('/about')">parent About</span>
<span @click="goToPage('/app-vue-history/about')">app-vue-history About</span>
</p>
</div>
<router-view />
</div>
</template>
<script>
import { mapMutations } from 'vuex';
import BaseService from './services/Base';
export default {
data() {
return {
isQiankun: window.__POWERED_BY_QIANKUN__,
}
},
methods: {
...mapMutations(['updateBaseURL']),
goToPage(path) {
console.log(this.$root.parentRouter);
this.$root.parentRouter.push(path);
}
},
mounted() {
const baseService = new BaseService();
baseService.getBaseConfig().then((res) => {
console.log(res);
const baseURL = res.axios.baseURL;
this.updateBaseURL(baseURL);
}, (err) => {
});
}
}
</script>
<style>
#glsx-system-sub {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* text-align: center; */
color: #2c3e50;
}
/* .glsx-system-sub #nav {
padding: 30px;
} */
.glsx-system-sub #nav a {
font-weight: bold;
color: #2c3e50;
}
.glsx-system-sub #nav a.router-link-exact-active {
color: #42b983;
}
/* .glsx-system-sub span {
font-weight: bold;
color: #2c3e50;
cursor: pointer;
margin: 0 15px;
text-decoration: underline;
} */
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
:close-on-click-modal="false"
:width="width"
class="app-dialog"
>
<div class="container">
<slot></slot>
</div>
<div slot="footer">
<slot name="btn-front"></slot>
<el-button @click="handleClose">取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
>{{btnOkLabel}}</el-button>
<slot name="btn-behind"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'basic-dialog',
props: {
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
btnOkLabel: {
type: String,
default: '确定'
},
width: {
type: String,
default: '580px'
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style lang="scss">
.app-dialog {
.el-dialog__header {
padding: 20px;
}
.el-dialog__footer {
padding: 10px;
background: #fff;
}
.el-dialog__body {
padding: 0;
border-top: 1px solid #eaeefb;
border-bottom: 1px solid #eaeefb;
min-height: 250px;
max-height: 500px;
overflow-y: auto;
.container {
> span {
display: block;
}
overflow-y: auto;
padding: 20px 20px;
}
}
}
</style>
<!-- 表格+分页 -->
<template>
<div class="d2-table">
<el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading"
:border="tableParams.border || false"
:highlight-current-row="true"
:stripe="tableParams.stripe || true"
:size="tableParams.size || 'mini'"
@sort-change="sortChange"
@selection-change="handleSelect"
:header-cell-style="{background:'#f5f7fa'}"
>
<el-table-column
v-if="tableParams.mutiSelectUniqueKey"
type="selection"
width="55"
:reserve-selection="true"
>
</el-table-column>
<el-table-column
v-if="hasNum"
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(pagination.pageSize - 1) * pagination.pageNum + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableParams.tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
:min-width="item.minWidth"
:align="item.align||'center'"
:sortable="item.sortable"
>
<template slot-scope="scope">
<slot
v-if="item.addHtml"
:name="item.addHtml"
:scope="scope.row"
:prop="item.prop"
:width="item.width"
></slot>
<template v-else-if="item.tagLabel">
<el-tag
v-if="!item.tagName"
:type="tableParams.tag.type[scope.row[item.prop]]"
v-text="tableParams.tag.label[scope.row[item.prop]]"
>
</el-tag>
<el-tag
v-else
:type="tableParams[item.tagName].type[scope.row[item.prop]]"
v-text="tableParams[item.tagName].label[scope.row[item.prop]]"
></el-tag>
</template>
<template v-else-if="item.formatter">
<span v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span v-text="data[scope.$index][item.prop]"></span>
</template>
<template v-else>
<span v-text="tableData[scope.$index][item.prop]"></span>
</template>
</template>
</el-table-column>
<el-table-column
v-if="tableParams.tableOption"
label="操作"
:align="tableParams.tableOption.align||'center'"
:width="tableParams.tableOption.width||'200'"
fixed="right"
>
<!-- <template>
<el-button
v-for="(j, idx) in tableParams.tableOption"
:key="idx"
:type="j.type"
size="mini"
>{{j.name}}</el-button>
</template> -->
<template slot-scope="scope">
<slot
name="table-button"
:scope="scope.row"
></slot>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="!tableParams.hasPage && hasPage"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="getListApi ? total : tableTotal"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'basic-table',
data() {
return {
loading: false,
oldValue: {},
data: [],
page: {
pageNum: 10,
pageSize: 1
},
total: 10,
// 排序
sortColum: '',
sort: '',
pagination: {},
// 多选数组
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => { }
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => [
{
id: 1,
account: '胡悦',
username: 'jkjk',
departmentName: '平台研发中心',
phoneNumber: '1546861321',
enablesStatus: 1,
createDate: '2013556'
}
]
},
tableTotal: {
type: Number,
default: 10
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
// 序号,默认有
hasNum: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
}
},
watch: {
},
mounted() {
const btn = document.getElementById(this.tableParams.btnId)
// this.tableData = [
// {
// id: 1,
// account: '胡悦',
// username: 'jkjk',
// departmentName: '平台研发中心',
// phoneNumber: '1546861321',
// enablesStatus: 1,
// createDate: '2013556'
// }
// ]
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
methods: {
// 排序
sortChange({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// 多选
handleSelect(val) {
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
},
// 清空多选
clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() {
this.$emit('searchChange')
this.refreshTable()
},
refreshTable(clearMuti = true) {
console.log('??????')
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
console.log(this.searchForm)
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
console.log(res)
var data = res.data
this.data = data[this.tableParams.listName]
console.log(this.data)
this.total = data.total
this.loading = false
}).catch(() => {
this.loading = false
})
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
handleCurrentChange(value) {
this.page.pageNum = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.el-table thead {
color: #909399;
font-weight: 500;
}
</style>
<template>
<div>
<el-form
:inline="inline"
:model="formModel"
:size="size || 'small'"
:clearable="clearable"
>
<el-form-item
v-for="(item, index) in formList"
:key="index"
:label="item.label || ''"
>
<el-input
v-if="item.type == 'input'"
v-model="formModel[item.model]"
:type="item.inputType || 'text'"
:placeholder="item.placeholder || '请输入'"
:clearable="item.clearable || false"
:maxlength="item.maxlength || 10"
:minlength="item.minlength || 4"
:show-word-limit="item.showWordLimit"
:show-password="item.showPassword"
:disabled="item.disabled"
:size="btn_size"
:prefix-icon="item.prefixIcon"
:suffix-icon="item.suffixIcon"
:rows="item.rows"
:autosize="item.autosize"
:readonly="item.readonly"
@change="item.change || defaultChange"
></el-input>
<el-select
v-if="item.type == 'select'"
v-model="formModel[item.model]"
:placeholder="item.placeholder || '请选择'"
:clearable="item.clearable"
:filterable="item.filterable"
:filter-method="item.filterMethod"
:disabled="item.disabled"
:multiple="item.multiple"
:allow-create="item.allowCreate"
:remote="item.remote"
:remote-method="item.remoteMethod"
:loading="item.loading"
:loading-text="item.loadingText"
@change="item.change || defaultChange"
@remove-tag="item.removeTag || defaultRemoveTag"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
<el-date-picker
v-if="item.type == 'datePicker'"
v-model="formModel[item.model]"
:type="item.dateType || 'date'"
:placeholder="item.placeholder || '选择日期'"
:readonly="item.readonly"
:disabled="item.disabled"
:editable="item.editable || false"
:clearable="item.clearable"
:size="btn_size"
:start-placeholder="item.startPlaceholder || ''"
:end-placeholder="item.endPlaceholder || ''"
:format="item.format"
:value-format="item.valueFormat"
:align="item.align"
:picker-options="item.pickerOptions"
:range-separator="item.rangeSeparator"
:default-value="item.defaultValue"
@change="item.change || defaultChange"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<template
name="form-slot"
slot-scope="scope"
>
<slot :scope="scope">
</slot>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'd2-form',
data() {
},
props: {
inline: {
type: Boolean,
default: true
},
formModel: {
type: Object,
default: () => { }
},
size: {
type: String,
default: 'small'
},
clearable: {
type: Boolean,
default: false
},
formList: {
type: Array,
default: () => []
}
},
methods: {
defaultChange(e) {
return e
},
defaultRemoveTag(e) {
return e
}
}
}
</script>
<style lang="">
</style>
\ No newline at end of file
import Vue from 'vue'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-form', () => import('./d2-form/index.vue'))
Vue.component('basic-table', () => import('./basic-table/index.vue'))
Vue.component('search-form', () => import('./search-form/index.vue'))
Vue.component('sticky-table', () => import('./sticky-table/index.vue'))
Vue.component('basic-dialog', () => import('./basic-dialog/index.vue'))
Vue.component('rule-form', () => import('./rule-form/index.vue'))
Vue.component('table-tree-column', () => import('./table-tree-column/index.vue'))
<template>
<div>
<el-form
:model="ruleForm"
:rules="rules"
:label-position="labelPosition"
label-width="100px"
:size="size"
>
<el-form-item
v-for="(item, index) in ruleData"
:key="index"
:label="item.label"
:prop="item.prop || ''"
:class="item.class"
v-show="!item.hidden"
>
<template>
<template v-if="item.type === 'input'">
<el-input
v-if="item.clickFunc"
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
:disabled="item.disabled || false"
@click.native="item.clickFunc"
:class="item.clickFunc ? 'pointer' : ''"
:ref="item.ref"
v-model="ruleForm[item.prop]"
>
</el-input>
<el-input
v-else
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
:disabled="item.disabled || false"
v-model="ruleForm[item.prop]"
>
</el-input>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
@change="selectChange"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type === 'switch'">
<el-switch v-model="ruleForm[item.prop]"></el-switch>
</template>
<template v-else-if="item.type === 'radio'">
<el-radio-group
@change="radioChange($event,item.prop)"
v-model="ruleForm[item.prop]"
>
<el-radio
v-for="(child,childIndex) in item.children"
:key="childIndex"
:label="child.id"
>{{child.label}}</el-radio>
</el-radio-group>
</template>
<template
v-else-if="item.type == 'customize'"
name="form-slot"
slot-scope="scope"
>
<slot :scope="scope">
</slot>
</template>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'rule-form',
data() {
return {
// labelPosition: 'left'
}
},
props: {
// 表单数据
ruleData: {
type: Array,
default: () => {
return []
}
},
// 表单model
ruleForm: {
type: Object,
default: () => {
return {}
}
},
// 表单验证规则
rules: {
type: Object,
default: () => {
return {}
}
},
// 标签位置
labelPosition: {
type: String,
default: 'left'
},
size: {
type: String,
default: 'small'
}
},
methods: {
selectChange(val) {
// console.log(val ,'selectChange')
this.$emit('selectChange', val)
},
radioChange(event, prop) {
// console.log(event,prop,'radioChange')
this.$emit('radio-change', event, prop)
}
}
}
</script>
<style lang="scss">
.pointer input {
cursor: pointer;
}
</style>
\ No newline at end of file
<template>
<div>
<el-form
class="clearfix search-form"
:model="formModel"
:size="size"
>
<el-form-item
v-for="(item, index) in formList"
:key="index"
:label="item.label || ''"
>
<template>
<template v-if="item.type === 'input'">
<el-input
v-model="formModel[item.prop]"
:type="item.inputType || 'text'"
:placeholder="item.placeholder || '请输入'"
></el-input>
</template>
<template v-else-if="item.type === 'select'">
<el-select
v-model="formModel[item.prop]"
:placeholder="item.placeholder || '请选择'"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
</template>
</template>
</el-form-item>
<el-form-item>
<template
name="form-slot"
slot-scope="scope"
>
<slot :scope="scope">
</slot>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
name: 'search-form',
props: {
formModel: {
type: Object,
default: () => { }
},
size: {
type: String,
default: 'small'
},
formList: {
type: Array,
default: () => []
}
}
}
</script>
<style lang="scss">
.search-form {
padding: 20px 20px 0;
.el-form-item {
float: left;
width: 50%;
max-width: 420px;
margin-right: 18px;
}
.el-form-item__content {
width: 100%;
}
}
</style>
\ No newline at end of file
<template>
<div>
<basic-table
class="head-table"
v-show="showHead"
ref="headTable"
:tableParams="headTableParams"
>
</basic-table>
<basic-table
ref="addStoreTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
</basic-table>
</div>
</template>
<script>
export default {
name: 'sticky-table',
props: {
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
},
headTableParams: {
type: Object
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索条件
searchForm: {
type: Object,
default: () => { }
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 10
}
},
data() {
return {
showHead: false,
scrollTop: 0,
headTableHeight: 0,
tableOffset: {
top: 0,
height: 0
}
}
},
watch: {
scrollTop(val, oldVal) {
if (val > this.tableOffset.top - this.headTableHeight) {
this.showHead = true
} else {
this.showHead = false
}
}
},
mounted() {
window.addEventListener('scroll', () => {
this.scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
// console.log(this.scrollTop)
})
setTimeout(() => {
this.$refs.headTable.$children[0].bodyWrapper.setAttribute('style', 'display: none')
console.log(this.$refs.addStoreTable, this.$refs.addStoreTable.$el.offsetTop)
this.tableOffset.top = this.$refs.addStoreTable.$el.offsetTop
this.tableOffset.height = this.$refs.addStoreTable.$el.offsetHeight
this.headTableHeight = this.$refs.headTable.$el.offsetHeight
}, 1000)
}
}
</script>
<style scoped>
.head-table {
position: sticky;
top: 0;
z-index: 1;
}
</style>
\ No newline at end of file
<template>
<el-table-column
:prop="prop"
v-bind="$attrs"
>
<template slot-scope="scope">
<span
@click.prevent="toggleHandle(scope.$index, scope.row)"
:style="childStyles(scope.row)"
>
<i
:class="iconClasses(scope.row)"
:style="iconStyles(scope.row)"
></i>
{{ scope.row[prop] }}
</span>
</template>
</el-table-column>
</template>
<script>
import isArray from 'lodash/isArray'
export default {
name: 'table-tree-column',
data() {
return {
arr: []
}
},
props: {
prop: {
type: String
},
treeKey: {
type: String,
default: 'id'
},
parentKey: {
type: String,
default: 'parentId'
},
levelKey: {
type: String,
default: 'level'
},
childKey: {
type: String,
default: 'children'
}
},
methods: {
childStyles(row) {
return { 'padding-left': (row[this.levelKey] * 25) + 'px' }
},
iconClasses(row) {
return [!row._expanded ? 'el-icon-caret-right' : 'el-icon-caret-bottom']
},
iconStyles(row) {
return { 'visibility': this.hasChild(row) ? 'visible' : 'hidden' }
},
hasChild(row) {
return (isArray(row[this.childKey]) && row[this.childKey].length >= 1) || false
},
// 切换处理
toggleHandle(index, row) {
// console.log(row,'this row ')
if (this.hasChild(row)) {
var data = this.$parent.store.states.data.slice(0)
data[index]._expanded = !data[index]._expanded
if (data[index]._expanded) {
data = data.splice(0, index + 1).concat(this.addChildNode(row[this.childKey])).concat(data)
// data = data.splice(0, index + 1).concat(row[this.childKey]).concat(data)
} else {
data = this.removeChildNode(data, row[this.treeKey])
}
// console.log(data,'show data')
this.$parent.store.commit('setData', data)
this.$nextTick(() => {
this.$parent.doLayout()
})
}
},
addChildNode(row) {
// console.log(row,'点击当前项的产生的下级数据 row ')
// 遍历下一级项 如果下级数据中 存在展开项 继续操作
var arr = []
this.forE(row, arr)
return arr
},
forE(row, arr) {
var _this = this
row.forEach(item => {
if (item._expanded) {
arr.push(item)
// item['children'].forEach(childitem => {
// if(childitem._expanded){
// arr.push(childitem)
// // arr.push(childitem['children'])
// //继续循环
// }else{
// arr.push(childitem)
// }
// });
_this.forE(item[_this.childKey], arr)
} else {
arr.push(item)
}
})
},
// 移除子节点
removeChildNode(data, parentId) {
var parentIds = isArray(parentId) ? parentId : [parentId]
if (parentId.length <= 0) {
return data
}
var ids = []
for (var i = 0; i < data.length; i++) {
if (parentIds.indexOf(data[i][this.parentKey]) !== -1 && parentIds.indexOf(data[i][this.treeKey]) === -1) {
ids.push(data.splice(i, 1)[0][this.treeKey])
i--
}
}
return this.removeChildNode(data, ids)
}
}
}
</script>
\ No newline at end of file
<template>
<el-table-column :prop="prop" v-bind="$attrs">
<template slot-scope="scope">
<span @click.prevent="toggleHandle(scope.$index, scope.row)" :style="childStyles(scope.row)">
<i :class="iconClasses(scope.row)" :style="iconStyles(scope.row)"></i>
{{ scope.row[prop] }}
</span>
</template>
</el-table-column>
</template>
<script>
import isArray from 'lodash/isArray'
export default {
name: 'table-tree-column',
props: {
prop: {
type: String
},
treeKey: {
type: String,
default: 'id'
},
parentKey: {
type: String,
default: 'parentId'
},
levelKey: {
type: String,
default: 'level'
},
childKey: {
type: String,
default: 'children'
}
},
methods: {
childStyles (row) {
return { 'padding-left': (row[this.levelKey] * 25) + 'px' }
},
iconClasses (row) {
return [ !row._expanded ? 'el-icon-caret-right' : 'el-icon-caret-bottom' ]
},
iconStyles (row) {
return { 'visibility': this.hasChild(row) ? 'visible' : 'hidden' }
},
hasChild (row) {
return (isArray(row[this.childKey]) && row[this.childKey].length >= 1) || false
},
// 切换处理
toggleHandle (index, row) {
if (this.hasChild(row)) {
var data = this.$parent.store.states.data.slice(0)
data[index]._expanded = !data[index]._expanded
if (data[index]._expanded) {
data = data.splice(0, index + 1).concat(row[this.childKey]).concat(data)
} else {
data = this.removeChildNode(data, row[this.treeKey])
}
this.$parent.store.commit('setData', data)
this.$nextTick(() => {
this.$parent.doLayout()
})
}
},
// 移除子节点
removeChildNode (data, parentId) {
var parentIds = isArray(parentId) ? parentId : [parentId]
if (parentId.length <= 0) {
return data
}
var ids = []
for (var i = 0; i < data.length; i++) {
if (parentIds.indexOf(data[i][this.parentKey]) !== -1 && parentIds.indexOf(data[i][this.treeKey]) === -1) {
ids.push(data.splice(i, 1)[0][this.treeKey])
i--
}
}
return this.removeChildNode(data, ids)
}
}
}
</script>
\ No newline at end of file
import store from '@/store/index'
let BASE_URL = store.state.baseURL
const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const env = process.env.NODE_ENV
if (!BASE_URL) {
BASE_URL = env === 'development' ? 'http://localhost:8080'
: ''
}
const API = {
getMockConfig() {
return MOCK_CONFIG_URL + '/test_config'
},
LOGIN_ACTION: BASE_URL + '/login_action',
USER_SEARCH: BASE_URL + '/usercenter/user/search'
}
export { API }
if (window.__POWERED_BY_QIANKUN__) {
// 动态设置 webpack publicPath,防止资源加载出错
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
}
\ No newline at end of file
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueRouter from "vue-router";
import App from './App.vue'
import routes from "./routes";
import store from './store'
import '@/styles/index.scss'
import '@/components'
import './core/public-path';
import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
// import axios from 'axios'
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Common = Common
Vue.prototype.$Constants = Constants
Vue.use(VueRouter);
Vue.use(ElementUI)
Vue.config.productionTip = false;
let router = null;
let instance = null;
function render({ data = {} , container } = {}) {
console.log('render innnnnn')
router = new VueRouter({
base: window.__POWERED_BY_QIANKUN__ ? '/vue' : '/',
routes,
});
instance = new Vue({
router,
store,
data(){
return {
parentRouter: data.router,
parentVuex: data.store,
}
},
render: h => h(App),
}).$mount(container ? container.querySelector('#glsx-sub-system') : '#glsx-sub-system');
}
if (!window.__POWERED_BY_QIANKUN__) {
render();
}
//测试全局变量污染
console.log('window.a',window.a)
export async function bootstrap() {
console.log('vue app bootstraped');
}
export async function mount(props) {
console.log('props from main framework', props.data);
render(props);
}
export async function unmount() {
instance.$destroy();
instance.$el.innerHTML = "";
instance = null;
router = null;
}
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
},
{
path: '/user',
name: 'User',
component: () => import('../views/user/index.vue')
},
{
path: '/role',
name: 'Role',
component: () => import('../views/role/index.vue')
},
{
path: '/orginizaManage',
name: 'OrginizaManage',
component: () => import('../views/orginizaManage/index.vue')
},
{
path: '/dictionaryManage',
name: 'DictionaryManage',
component: () => import('../views/dictionaryManage/index.vue')
}
]
export default routes
import HTTP from '@/utils/http';
import { API } from '@/config/config';
export default class BaseService extends HTTP {
getBaseConfig () {
return new Promise((resolve, reject) => {
this.axiosGet({
url: API.getMockConfig(),
data: {},
success (data) {
resolve(data);
},
error (error) {
// 网络请求失败
console.log('网络请求失败');
// window.location.reload();
}
})
});
}
}
import HTTP from '@/utils/http'
import { API } from '@/config/config'
export default class UserService extends HTTP {
getUserList () {
return new Promise((resolve, reject) => {
this.axiosGet({
url: API.USER_SEARCH,
data: {},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
// window.location.reload()
}
})
})
}
}
import Vue from 'vue';
import Vuex from 'vuex';
import state from './state';
import mutations from './mutations';
Vue.use(Vuex);
const store = new Vuex.Store({
state,
mutations
})
export default store;
\ No newline at end of file
export default {
//更新全局baseURL
updateBaseURL(state, newBaseURL) {
state.baseURL = newBaseURL;
}
}
const state = {
baseURL: '',
token: '', // 令牌
loginStatus: false, // 是否登录
userInfo: {
username: '', // 用户名
phoneNumber: '', // 手机号
tenantId: '', // 租户id
superiorId: '', // 上级id
account: '', // 登录名
email: '',
gender: '',
position: ''
}
}
try {
} catch(e) {}
export default state;
\ No newline at end of file
.table-btn {
margin-bottom: 20px;
}
.searchTop {
margin-bottom: 30px;
}
.border-shadow {
border: 1px solid rgb(235, 235, 235);
border-image: initial;
border-radius: 3px;
transition: all 0.2s ease 0s;
}
.border-shadow:hover {
box-shadow: rgba(232, 237, 250, 0.6) 0px 0px 8px 0px,
rgba(232, 237, 250, 0.5) 0px 2px 4px 0px;
}
// 状态
.dot {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 5px;
vertical-align: middle;
margin-right: 2px;
}
.green {
background-color: #00A854;
}
.gray {
background-color: #BFBFBF;
}
.blue {
background-color: rgb(0, 81, 255);
}
.red {
background-color: rgb(255, 0, 0);
}
.yellow {
background-color: rgb(217, 255, 0);
}
.orange {
background-color: rgb(255, 145, 0);
}
.statusText {
vertical-align: middle;
}
@import './common.scss';
body {
overflow: hidden;
height: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}
html {
height: 100%;
box-sizing: border-box;
}
#app {
height: 100%;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
hr {
height: 1px;
border: 0px;
background-color: #e7eaec
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
outline: none;
text-decoration: none;
}
div:focus {
outline: none;
}
a:focus,
a:active {
outline: none;
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
text-decoration: none;
}
.clearfix {
zoom: 1;
&:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
}
//main-container全局样式
.app-main {
overflow: auto;
}
.app-container {
padding: 20px;
}
export const Common = {
// 提示框
confirmDialog: (tipData) => {
tipData.that.$confirm(tipData.tipText, tipData.tipTitle, {
confirmButtonText: tipData.confirmButtonText || '确定',
cancelButtonText: tipData.cancelButtonText || '取消',
type: tipData.type,
showCancelButton: tipData.showCancelButton
}).then(() => {
tipData.callBack ? tipData.callBack() : ''
}).catch(() => {
tipData.errorCallBack ? tipData.errorCallBack() : ''
})
}
}
const Constants = {
// (0:系统管理员,1:服务商,2:门店,3:技工)
USERTYPE: {
'0': '超级管理员',
'1': '服务商',
'2': '商户',
'3': '技工',
'ADMIN': 0,
'PROVIDER': 1,
'STORE': 2,
'WORKER': 3
},
// 控制台 涨跌 图标
// 商户管理状态
DASHUPDOWN: {
'1': 'el-icon-caret-top green-cl',
'2': 'el-icon-caret-bottom red-cl'
},
// 日期
DASHBOARDDATETYPE: {
'今日': 'd',
'本周': 'w',
'本月': 'm',
'全年': 'y'
},
HOURS: ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24'],
WEEKS: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
DAYS: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
MONTHS: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
// 菜单管理状态
MENUSTATUS: {
'1': '显示,green',
'0': '不显示,gray',
'2': '注销,red'
},
// 菜单类型
MENUMANAGEMENUTYPE: {
'1': '目录',
'2': '菜单',
'3': '按钮'
},
// 组织管理状态
ORGINIZASTATUS: {
'1': '正常,green',
'2': '停用,gray',
'3': '注销,red'
},
ORGINIZATYPE: {
'1': '层级',
'2': '机构',
'3': '根组织'
},
// 角色管理状态
ROLESTATUS: {
'sys_user_status_normal': '正常,green',
'sys_user_status_nonuse': '停用,gray',
'sys_user_status_logout': '注销,red'
},
// 商户管理状态
STORESTATUS: {
'sys_user_status_normal': '启用,green',
'sys_user_status_nonuse': '禁用,gray',
'sys_user_status_logout': '注销,red'
},
// 库存管理订货单状态
STOCKORDERSTATUS: {
'1': '已取消订单,gray',
'50': '已取消订单,gray',
'10': '待审核订单,yellow',
'20': '待发货订单,blue',
'30': '待收货订单,red',
'40': '已完成订单,green'
},
STOCKORDERDETAILSTATUS: {
'10': '待审核订单,yellow',
'20': '待发货订单,blue',
'30': '待收货订单,red',
'40': '已完成订单,green',
'1': '已取消订单,gray',
'50': '已取消订单,gray'
},
// 技工管理状态
TECHNICIANSTATUS: {
'sys_user_status_normal': '启用,green',
'sys_user_status_nonuse': '禁用,gray',
'sys_user_status_logout': '注销,red'
},
TECHNICIANVISITTYPE: {
'1': '上门',
'2': '驻店'
},
// 技工审核状态
TECHNICIANVERIFYSTATUS: {
'sys_user_status_pass_check': '通过,green',
'sys_user_status_uncheck': '待审核,gray',
'sys_user_status_nopass_check': '不通过,red'
},
TECHNICIANVERIFYSTATUSNEW: {
'sys_user_status_pass_check': '已认证,green',
'sys_user_status_checking': '认证中,gray',
'sys_user_status_uncheck': '未认证,red'
},
// 资源匹配管理状态
RESOURCESTATUS: {
'sys_user_status_unbound_service': '未绑定服务商,gray',
'sys_user_status_unbound_mechanic': '未指定技工,yellow',
'sys_user_status_bound': '已匹配,green'
},
// 订单管理状态
PROGRESSSTATUS: {
'1': '已下单',
'2': '已派单',
'3': '服务商拒单',
'4': '已派单',
'5': '技工拒单',
'6': '已接单',
'7': '已预约',
'8': '已完成',
'110': '重新指派技工',
'115': '修改安装地址',
'120': '重新预约',
'125': '已上门'
},
AFTERTYPE: {
1: '更换车辆,gray',
2: '设备维修,gray',
3: '设备拆除,gray'
},
ORDERTYPE: {
1: '安装单,gray',
2: '拆除单,gray',
3: '检修单,gray'
},
ORDERTECHNICIANSTATUS: {
'4': '待接单,red',
'6': '待完成,blue',
'7': '待完成,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
ORDERSTORESTATUS: {
'1': '待接单,blue',
'2': '待接单,blue',
'3': '待接单,blue',
'4': '待接单,blue',
'5': '待接单,blue',
'6': '已接单,blue',
'7': '已接单,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
ORDERSERVERSTATUS: {
'1': '待指派,orange',
'2': '待指派,orange',
'3': '已拒绝,red',
'4': '待完成,blue',
'5': '待指派,orange',
'6': '待完成,blue',
'7': '待完成,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
BIDDINGORDERTECHNICIANSTATUS: {
'4': '待接单,red',
'6': '待完成,blue',
'7': '待完成,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
BIDDINGORDERSTORESTATUS: {
'1': '待接单,gray',
'3': '待接单,gray',
'10': '待接单,gray',
'15': '待接单,gray',
'2': '已接单,blue',
'4': '已接单,blue',
'5': '已接单,blue',
'6': '已接单,blue',
'7': '已接单,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
BIDDINGORDERSERVERSTATUS: {
'1': '待指派,gray',
'2': '待指派,gray',
'4': '待完成,blue',
'6': '待完成,blue',
'7': '待完成,blue',
'8': '已完成,green',
'9': '已取消,gray'
},
ORDERALLSTATUS: {
'1': '商户已派单,blue',
'2': '服务商已接单,yellow',
'3': '服务商已拒单,red',
'4': '服务商已指派,blue',
'5': '技工拒单,red',
'6': '技工已接单,blue',
'7': '已预约,orange',
'8': '已完成,green',
'9': '已取消,gray',
'10': '竞价开始,orange',
'15': '竞价中,red'
},
ORDERDISPATCHREASON: {
'1': '未匹配到商户,blue',
'2': '未绑定服务商,orange'
},
// 对账单列表状态
ACOUNTSTATUSADMIN: {
'10': '账单生成中,blue',
'20': '账单已生成,green'
},
ACOUNTSTATUSSERVICE: {
'10': '待确认,red',
'20': '待运营审核,blue',
'30': '待财务打款,orange',
'40': '财务已打款,green'
},
ACCOUNTSTATUSSELECTIONS: [
{ value: '', label: '全部' },
{ value: '10', label: '待确认' },
{ value: '20', label: '待运营审核' },
{ value: '30', label: '待财务打款' },
{ value: '40', label: '财务已打款' }
],
// 权限按钮
PERMISSIONBUTTONNAME: {
'新增': 'add',
'修改': 'edit',
'删除': 'delete',
'导出': 'export',
'编辑': 'edit',
'重置': 'reset'
},
POLICY_STATUS: {
'1': '待投保',
'2': '已投保',
'3': '投保失败',
'9': '已退保'
}
}
export default Constants
import axios from 'axios';
import qs from 'qs';
// import store from '@/store/index';
// const baseURL = store.state.baseURL;
// let loadingInstance = null // 加载全局的loading
const instance = axios.create({ //创建axios实例,在这里可以设置请求的默认配置
timeout: 60000, // 设置超时时间60s
// baseURL
})
// 文档中的统一设置post请求头。
// instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
let httpCode = {
601: '(601)请求参数错误',
704: '(704)权限不足, 请重新登录',
703: '(703)服务器拒绝本次访问',
// 404: '(404)请求资源未找到',
// 500: '(500)内部服务器错误',
707: '(707)服务器不支持该请求中使用的方法',
// 502: '(502)网关错误',
// 504: '(504)网关超时'
}
/** 添加请求拦截器 **/
instance.interceptors.request.use(config => {
/**
* 在这里:可以根据业务需求可以在发送请求之前做些什么。
* config.headers['token'] = sessionStorage.getItem('token') || ''
*/
// loadingInstance = Loading.service({ // 发起请求时加载全局loading,请求失败或有响应时会关闭
// spinner: 'fa fa-spinner fa-spin fa-3x fa-fw',
// text: '拼命加载中...'
// })
return config
}, error => {
// 对请求错误做些什么
console.log('请求错误,原因:', error)
return Promise.reject(error)
})
/** 添加响应拦截器 **/
instance.interceptors.response.use(response => {
// loadingInstance.close()
if (response.data.code === 200 || response.status === 200) { // 响应结果里的status: 200是我与后台的约定,大家可以根据实际情况去做对应的判断
if(response.status) {
return Promise.resolve(response);
}
return Promise.resolve(response.data);
} else {
// Message({
// message: response.data.message,
// type: 'error'
// })
console.log(response.data.message)
return Promise.reject(response.data.message)
}
}, error => {
// loadingInstance.close()
if (error.response) {
/**
* 在这里:可以根据业务需求可以在请求失败后做什么。
* 根据请求失败的http状态码去给用户相应的提示
*/
let tips = error.response.status in httpCode ? httpCode[error.response.status] : error.response.data.message
// Message({
// message: tips,
// type: 'error'
// })
console.log(tips)
return Promise.reject(error)
} else {
// Message({
// message: '请求失败',
// type: 'error'
// })
return Promise.reject(new Error('请求失败'))
}
})
export default class HTTP {
axiosPost (options) {
instance({
url: options.url,
method: 'post',
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: qs.stringify(options.data)
}).then((res) => {
options.success(res.data);
}).catch((err) => {
options.error(err);
})
}
axiosGet (options) {
instance({
url: options.url,
method: 'get'
}).then((res) => {
options.success(res.data);
}).catch((err) => {
options.error(err);
})
}
}
\ No newline at end of file
function trimSpace(str) {
return str.replace(/\s+/g, '');
}
// trimSpace(str).length < = 0弹出提示
function throttle (fn, delay) {
var t = null,
begin = new Date().getTime();
return function () {
var _self = this,
args = arguments,
cur = new Date().getTime();
clearTimeout(t);
if(cur - begin >= delay) {
fn.apply(_self, args);
begin = cur;
} else {
t = setTimeout(function () {
fn.apply(_self, args);
}, delay);
}
}
}
export {
trimSpace,
throttle
}
\ No newline at end of file
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png" >
<span v-if="isQiankun" @click="changeParentState">主项目的数据:{{ commonData.parent }},点击累加</span>
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'Home',
components: {
HelloWorld
},
data() {
return {
num: 0,
isQiankun: window.__POWERED_BY_QIANKUN__,
}
},
computed: {
commonData(){
return this.isQiankun ? this.$root.parentVuex.state.commonData : '';
}
},
mounted() {
console.log('app-vue-hash Home.vue mounted')
},
methods: {
changeParentState(){
if(this.isQiankun){
this.$root.parentVuex.commit('setCommonData', { parent: this.num++ });
}
}
},
}
</script>
<template>
<div>
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
>
<slot name="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</template>
<script>
export default {
data() {
return {
searchForm: {},
dictionaryFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
placeholder: '请输入字典名称'
},
{
type: 'input',
inputType: 'text',
prop: 'type',
placeholder: '请输入字典类型'
},
{
type: 'select',
prop: 'status',
placeholder: '请选择字典状态',
options: [
{
label: '正常',
value: 1
}, {
label: '停用',
value: 2
}
]
}
],
tableParams: {
mutiSelectName: 'dictionary',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '字典主键',
prop: 'id'
}, {
label: '字典名称',
prop: 'dictName'
}, {
label: '字典类型',
prop: 'dictType'
}, {
label: '字典备注',
prop: 'remark'
}, {
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 300,
btnList: [
{
type: 'primary',
name: '列表',
pType: 'list'
},
{
type: 'primary',
name: '编辑',
pType: 'edit'
},
{
type: 'danger',
name: '删除',
pType: 'delete'
}
]
}
},
getListApi: null,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {},
dictionaryData: [
{ label: '字典名称:', prop: 'dictName', type: 'input' },
{ label: '字典类型', prop: 'dictType', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
dictionaryRules: {}
}
},
methods: {
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'edit':
this.handleClose(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list')
break
}
},
// 确定
handleConfirm() {
console.log(this.$refs.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
console.log('error')
}
})
},
// 取消
handleClose(row) {
console.log(row)
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
\ No newline at end of file
<template>
<div id="home">
VUE MIRCRO CHILD
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
<template>
<div>
<div>
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="roleFormList"
>
<slot name="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="roleDialogTitle"
:isVisible="roleVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="roleName"
:rules="roleRules"
:ruleData="roleData"
ref='roleName'
>
<slot
name="form-slot"
slot-scope="scope"
>
<el-tree
:data="data"
show-checkbox
default-expand-all
node-key="id"
ref="tree"
highlight-current
>
</el-tree>
</slot>
</rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
export default {
data() {
return {
searchForm: {},
roleFormList: [
{
type: 'input',
inputType: 'text',
prop: 'roleName',
placeholder: '请输入角色名称'
}
],
tableParams: {
mutiSelectName: 'role',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '角色名称',
prop: 'roleName'
}, {
label: '创建时间',
prop: 'createDate'
}, {
label: '备注',
prop: 'remark'
}
],
tableOption: {
btnList: [
{
type: 'primary',
name: '新增',
pType: 'create'
},
{
type: 'primary',
name: '编辑',
pType: 'edit'
},
{
type: 'danger',
name: '删除',
pType: 'delete'
}
]
}
},
getListApi: null,
// 弹窗数据
roleDialogTitle: '新增用户',
roleVisible: false,
roleName: {
account: '胡悦',
departmentId: '',
superiorId: '',
enableStatus: true
},
roleData: [
{ label: '角色名称', prop: 'roleName', type: 'input' },
{ label: '备注', prop: 'remark', type: 'input' },
{ label: '状态:', prop: 'enableStatus', type: 'switch' },
{ label: '数据权限', prop: 'superiorId', type: 'radio', children: [{ id: 1, label: '本人' }, { id: 2, label: '本人及下属' }, { id: 3, label: '本部门' }, { id: 4, label: '本部门&下属' }, { id: 5, label: '全部' }] },
{ label: '菜单权限', prop: 'rolename', type: 'customize' }
],
roleRules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: blur }]
},
data: [{
id: 1,
label: '一级 1',
children: [{
id: 4,
label: '二级 1-1',
children: [{
id: 9,
label: '三级 1-1-1'
}, {
id: 10,
label: '三级 1-1-2'
}]
}]
}, {
id: 2,
label: '一级 2',
children: [{
id: 5,
label: '二级 2-1'
}, {
id: 6,
label: '二级 2-2'
}]
}, {
id: 3,
label: '一级 3',
children: [{
id: 7,
label: '二级 3-1'
}, {
id: 8,
label: '二级 3-2'
}]
}]
}
},
methods: {
// 确定
handleConfirm() {
console.log(this.$refs.roleForm)
this.$refs.roleForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
console.log('error')
}
})
},
// 取消
handleClose() {
if (!this.roleVisible && this.$refs.roleForm) {
this.$refs.roleForm.$children[0].resetFields()
}
this.roleVisible = !this.roleVisible
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'create':
this.editEvent()
break
case 'edit':
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
}
},
// 编辑触发事件
editEvent(row) {
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
\ No newline at end of file
const path = require('path')
const packageName = require('./package.json').name
function resolve (dir) {
return path.join(__dirname, dir)
}
module.exports = {
devServer: {
overlay: {
warning: false,
errors: false
},
// 监听端口
port: 10200,
// 关闭主机检查,使微应用可以被 fetch
disableHostCheck: true,
// 配置跨域请求头,解决开发环境的跨域问题
headers: {
'Access-Control-Allow-Origin': '*'
}
},
lintOnSave: false,
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('components', resolve('src/components'))
.set('config', resolve('src/config'))
.set('utils', resolve('src/utils'))
.set('services', resolve('src/services'))
},
configureWebpack: {
output: {
// 微应用的包名,这里与主应用中注册的微应用名称一致
library: `GLSXManagementSystemSub`,
// 将你的 library 暴露为所有的模块定义下都可运行的方式
libraryTarget: 'umd',
// 按需加载相关
jsonpFunction: `webpackJsonp_${packageName}`
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!