Commit 26c394b5 by 杨北旺

完成页面开发环境对接接口

1 parent ef94b0cb
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
VUE_APP_PORT = 6654
VUE_APP_PORT = 6651
......@@ -12,8 +12,6 @@
"core-js": "^3.4.4",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^1.3.2",
"glsx-components": "^1.0.1",
"glsx-table": "^1.1.0",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
......@@ -31,7 +29,8 @@
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"html-loader": "^2.1.2",
"glsx-common": "^1.4.0",
"glsx-components": "^1.0.4",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
......
......@@ -8,7 +8,7 @@ app.use(express.static('./dist'))
app.get('/', function(req, res) {
res.send('Hello jq')
})
const port = 6654
const port = 6652
app.listen(port)
console.log(`服务已运行:\r\n http://127.0.0.1:${port}`)
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
//商户
export function getMerchantTree(params = {}) {
params.method = 'org.ore.api.common.findMerchantTreeByMerchantNo.list'
params.sessionId = 'mini-6b96d5ee-1357-44f4-b723-23f875e78049-rop'
return http({
data: params,
method: 'POST',
})
}
//部门
export function getDepartment(params = {}) {
params.method = 'cn.com.glsx.entmicro.department.listDepartmentTree'
params.sessionId = 'mini-6b96d5ee-1357-44f4-b723-23f875e78049-rop'
return http({
data: params,
method: 'POST',
})
}
//关联企微
export function toGL(params = {}) {
params.method = 'org.ore.api.common.relevanceEntmicro.list'
params.sessionId = 'mini-6b96d5ee-1357-44f4-b723-23f875e78049-rop'
return http({
data: params,
})
}
// cn.com.glsx.merchants.merchant.findMerchantBaseInfo
// 查询商户基本信息
export function merchantInfo(params = {}) {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantBaseInfo'
params.sessionId = 'mini-6b96d5ee-1357-44f4-b723-23f875e78049-rop'
return http({
data: params,
})
}
// const GETLISTDEVICEFILEUNSTOCK1 = params => {
// return http({
// url: '/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
export default {
// getMerchantTree,
// GETLISTDEVICEFILEUNSTOCK1
}
\ No newline at end of file
<template>
<div class="adapter-home" id="adapter-frame" ref="adapter-frame"></div>
</template>
<script>
import { Postmate } from 'glsx-common'
export default {
name: 'GLExternal',
data() {
return {
container: null
}
},
mounted() {
this.container = this.$refs['adapter-frame']
this.create(this.$router.currentRoute.meta.url)
},
methods: {
create(url) {
this.container.innerHTML = ''
new Postmate({
container: this.container,
url,
name: 'adapter-frame',
classListArray: ['adapter-frame'],
data: () => 'aaa'
}).then(child => {
child.get('height').then(height => {
child.frame.setAttribute('scrolling', 'no')
child.frame.style.height = `${height}px`
})
child.call('push', { src: this.src })
child.on('route-to', (id, params) => {
console.log(params)
this.$history.push(id)
})
})
}
}
}
</script>
<style>
.adapter-frame {
width: 100%;
min-height: calc(100vh - 90px);
border: 0;
overflow-y: hidden;
box-sizing: border-box;
/* position: absolute; */
transition: all 0.48s ease;
}
</style>
<style scoped lang="scss">
.app-view-box {
padding: 0 !important;
}
</style>
/**
* type : primary,success,default,error,danger
* size: 按钮大小,参照elementui
* id: 权限判断id
* mode:按钮类型 是a标签还是button,可选值为:button、link
*/
// import { Button, Link } from 'element-ui'
// 权限校验
function judgePermissions(options) {
if (!options) {
return false
}
let _list = options.parent.permissions || []
let _o = options.props
let idx = _list.findIndex(k => k == _o.id)
// 如果没有权限,则返回空标签
if (idx < 0) {
return ''
}
if (_o.mode == 'link') {
return 'a'
}
return 'button'
}
// 获取class
function getClass(context) {
let o = context.props
let _class = []
_class.push('el-' + o.mode)
_class.push('el-' + o.mode + '--' + o.type)
if (o.size) {
_class.push('el-' + o.mode + '--' + o.size)
}
if (o.class) {
_class.push(o.class)
}
return _class
}
export default {
functional: true,
name: 'GLButton',
props: {
type: {
type: String,
default: 'default'
},
size: {
type: String,
default: 'medium'
},
id: {
type: [String, Number]
},
mode: {
type: String,
default: 'button'
},
class: {
type: String,
default: ''
}
},
render: function(createElement, context) {
let _props = context.props
let options = {
props: _props,
attrs: context.props,
class: getClass(context),
on: {
click: event => {
context.listeners.click('click', event)
}
}
}
return createElement(judgePermissions(context), options, context.children)
}
}
......@@ -17,7 +17,8 @@ module.exports = {
code_message_map: {}
},
request: {
baseURL: 'http://192.168.3.171:7300/mock/6136bea6ceeb5a5c2bec6950/',
baseURL: 'http://192.168.3.191:8064/rop-scrm-entmicro/router',
// baseURL: 'http://192.168.3.191:8082/rop-merchants/router',
// 设置超时时间
timeout: 180000,
// 携带凭证
......@@ -26,12 +27,12 @@ module.exports = {
responseType: 'json'
},
sign: {
app_key: '48e5e13229b82c1b4e6e8c96151f0637',
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
source: 'scrm-micro-settings'
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
}
\ No newline at end of file
......@@ -4,74 +4,16 @@
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-09-22 10:51:09
* @FilePath: \scrm\scrm-sub-account\src\main.js
* @LastEditTime: 2021-09-24 10:41:31
* @FilePath: \scrm\scrm-sub-blog\src\main.js
*/
import Vue from 'vue'
import App from './App.vue'
import './public-path'
// import './components'
import apis from './api'
import store from './store'
import routerBase from './router'
import { message } from './plugins/element.js'
import { fetchConfig } from '@/config'
import { GLExternal, GLButton } from 'glsx-components'
import { Http, utils } from 'glsx-common'
import './public-path'
import 'glsx-components/dist/glsx-components.css'
import glsxTable from 'glsx-table';
let { VueRouter, routes: staticRoutes, getRoutes } = routerBase
import { start } from '@/setup'
Vue.config.productionTip = false
let instance = null
let router = null
export async function bootstrap({ history, common, messenger, globalState }) {
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
}
async function singleRender() {
const { response, request, sign, secret } = await fetchConfig()
const http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: '1112223333444' } })
await _render(http, staticRoutes, '/')
}
async function qiankunRender(props = {}) {
const { response, request, sign, secret } = await fetchConfig()
const { name, id, globalState, routerBase, common } = props
const routes = getRoutes({ name, id, routesData: common.utils.deepClone(globalState.routers) })
const http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
await _render(http, routes, routerBase, globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'])
}
async function _render(http, routes, base, permissions) {
Vue.prototype.$http = http
Vue.prototype.$apis = apis
Vue.use(GLButton, { permissions })
Vue.use(GLExternal)
Vue.use(glsxTable);
router = new VueRouter({
base,
routes,
mode: 'history'
})
instance = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
}
// 独立运行时
if (!window.__POWERED_BY_QIANKUN__) {
singleRender()
}
export async function mount(props = {}) {
await qiankunRender(props)
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
export const http = params => instance.$http(params)
\ No newline at end of file
Vue.prototype.$apis = apis
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
import Vue from 'vue'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Table, TableColumn, Select, Option, TimePicker, Col, DatePicker, Tree } from 'element-ui'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Cascader, Table, TableColumn, } from 'element-ui'
Vue.use(Button)
Vue.use(ButtonGroup)
Vue.use(Form)
......@@ -18,4 +18,5 @@ Vue.use(DatePicker)
Vue.use(Tree)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Cascader)
export const message = Message
\ No newline at end of file
if (window.__POWERED_BY_QIANKUN__) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__
}
......@@ -23,8 +23,4 @@ function getRoutes({ name, id, routesData }) {
}
return routes
}
export default {
VueRouter,
routes,
getRoutes
}
export { VueRouter, routes, getRoutes }
......@@ -11,34 +11,22 @@ const staticRoutes = Object.freeze([{
meta: {}
},
{
name: 'Account',
path: '/account',
component: resolve => require([`@/views/account/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/merchant/index.html'
}
},
{
name: 'Role',
path: '/role',
component: resolve => require([`@/views/role/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/role/index.html'
}
},
{
name: 'Employee',
path: '/employee',
component: resolve => require([`@/views/employee/index.vue`], resolve),
meta: {
url: 'http://192.168.2.9:5501/html/employee/index.html'
}
name: 'Hidden',
path: '/about/hidden',
component: resolve => require([`@/views/about/hidden.vue`], resolve),
meta: {}
},
{
name: 'BaseInfo',
path: '/baseInfo',
component: resolve => require([`@/views/baseInfo/index.vue`], resolve),
meta: {}
}
},
{
name: 'Relevance',
path: '/baseInfo/relevance',
component: resolve => require([`@/views/baseInfo/relevance.vue`], resolve),
meta: {}
},
])
export default staticRoutes
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:31:52
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:09
* @FilePath: \scrm\scrm-sub-blog\src\setup\index.js
*/
import { bootstrap, mount, unmount } from './qiankun'
import { start } from './single'
export { bootstrap, mount, unmount, start }
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import render from './render'
import 'glsx-components/dist/glsx-components.css'
import ElementUI from 'element-ui'
let routes = []
let router = null
let instance = null
Vue.use(GLTable)
Vue.use(ElementUI)
export async function bootstrap({ name, id, history, common, messenger, globalState }) {
const { response, request, sign, secret } = await fetchConfig()
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes({ name, id, routesData })
subscribe({ messenger })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:04:32
* @LastEditors: limin
* @LastEditTime: 2021-09-23 20:34:32
* @FilePath: \scrm\scrm-sub-blog\src\qiankun\render.js
*/
import App from '../App.vue'
import Vue from 'vue'
import store from '@/store'
import { VueRouter } from '@/router'
const render = (base, routes) => {
const router = new VueRouter({
base,
routes,
mode: 'history'
})
const vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
return { router, vm }
}
export default render
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:02:23
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:17
* @FilePath: \scrm\scrm-sub-blog\src\setup\single.js
*/
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import render from './render'
import { routes } from '@/router'
export async function start() {
if (window.__POWERED_BY_QIANKUN__) return
const { response, request, sign, secret } = await fetchConfig()
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: '1112223333444' } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes)
}
\ No newline at end of file
<template>
<div class="report-home">
HOME
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div>
</template>
<script>
export default {
name: 'home',
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ from: 'blog', message: { from: 11, message: '11111' } })
}
}
}
</script>
......@@ -5,6 +5,7 @@
<label>请打开f12查看移动数据</label>
<el-button size="medium" type="info" @click="changeMode">当前模式:{{ mode }}</el-button>
<el-button size="medium" @click="clearChecked()">清除选中</el-button>
<el-button size="medium" @click="toHidden()">去=隐藏的路由</el-button>
</h4>
<div class="box">
<!-- lazy -->
......@@ -148,6 +149,9 @@ export default {
}, 1000)
},
methods: {
toHidden() {
this.$router.push('/about/hidden')
},
// 清除选中
clearChecked() {
this.$refs['wl-tree-transfer'].clearChecked()
......
<template>
<div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: this.$router.currentRoute.meta.url
}
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
})
}
}
}
</script>
<style></style>
......@@ -2,25 +2,25 @@
<div class="bloc-info-module">
<div class="wrapper">
<div class="wrap_left">
<div v-for="(item, index) in leftData" :key="index" class="out_box_wrap">
<div class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ item.name }}</div>
<div class="label_text">版本:{{ bloc.merchantModelName }}</div>
<div class="label_text dr_top">
开通门店数:
<span class="num_text">{{ item.num }}家</span>
<span class="num_text">{{ bloc.numberStores }}家</span>
</div>
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
<glsx-table v-if="item.open" :hasPage="false" :tableParams="tableParams" :tableData="item.list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></glsx-table>
<div :class="isOpen? 'table_wrapper_open' : 'table_wrapper_close'">
<GLTable v-if="isOpen" :hasPage="false" :tableParams="tableParams" :tableData="list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></GLTable>
</div>
<div class="fixed_footer" @click="changeLeftOpenStatus(item, index)">
<i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
<div class="fixed_footer" @click="changeRightOpenStatus(isOpen)">
<i :class="isOpen ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ isOpen ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div>
<div class="wrap_right">
<!-- <div class="wrap_right">
<div v-for="(item, index) in rightData" :key="index" class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ item.name }}</div>
......@@ -31,19 +31,14 @@
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
<glsx-table v-if="item.open"
:hasPage="false"
:tableParams="tableParams"
:tableData="item.list"
:headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"
></glsx-table>
<glsx-table v-if="item.open" :hasPage="false" :tableParams="tableParams" :tableData="item.list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></glsx-table>
</div>
<div class="fixed_footer" @click="changeRightOpenStatus(item, index)">
<i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div>
</div> -->
</div>
</div>
</template>
......@@ -58,26 +53,31 @@ export default {
leftData: [],
rightData: [],
tableParams: {
listName:'list',
listName: 'list',
tableColumns: [
{
label: '门店名称',
prop: 'name'
prop: 'merchantName'
},
{
label: '有效期',
prop: 'stateDate'
prop:'date'
}
]
}
},
isOpen:false
}
},
props:{
list:Array,
bloc:null
},
methods: {
changeLeftOpenStatus(item, index) {
this.leftData[index].open = !item.open
},
changeRightOpenStatus(item, index) {
this.rightData[index].open = !item.open
changeRightOpenStatus(isOpen) {
this.isOpen = !isOpen
},
handlerData() {
let arr = this.dataList
......@@ -92,43 +92,12 @@ export default {
})
this.leftData = left
this.rightData = right
console.log(left);
console.log(right);
console.log(left)
console.log(right)
},
monidata() {
let arr = []
for (let i = 0; i < 3; i++) {
let obj = {
id: i + 1,
open:false,
name:'嘀嘀虎',
num:i+10,
list: [
{
name: '1之花',
stateDate: '2021-09-29',
sort: 1
},
{
name: '2之花',
stateDate: '2021-09-29',
sort: 2
},
{
name: '3之花',
stateDate: '2021-09-29',
sort: 3
}
]
}
arr.push(obj)
}
this.dataList = arr
this.handlerData()
}
},
mounted() {
this.monidata()
}
}
</script>
......@@ -176,12 +145,12 @@ export default {
}
}
.table_wrapper_close {
height: 0%;
transition: height 0.3s ease-in-out;
height: 0;
// transition: height 0.1s ease-in-out;
}
.table_wrapper_open {
height: 494px;
transition: height 0.3s ease-in-out;
// transition: height 0.1s ease-in-out;
}
.fixed_footer {
width: 100%;
......@@ -200,4 +169,9 @@ export default {
}
}
}
.bloc-info-module /deep/ .el-table__body-wrapper{
height: 440px;
overflow-y: auto;
overflow-x: hidden;
}
</style>
\ No newline at end of file
......@@ -4,37 +4,88 @@
<img class="sign_icon" src="../../assets/scrm_base_info_icon_one.png" />
<div class="info_widget">
<div class="title_text">
深圳XXX汽车4s店
<span class="min_text">(商户号:1231)</span>
{{ blocInfo.merchantName }}
<span class="min_text">(商户号:{{ blocInfo.merchantNo }})</span>
</div>
<div class="sec_title_text dr_top_1">
<span>关联企微:深圳***店</span>
<div class="auth_btn" :class="platform==1?'auth_btn_cp':''">已授权</div>
<span>关联企微:{{ blocInfo.entmicroName || '无' }}</span>
<div v-if="blocInfo.entmicroName" class="auth_btn" :class="platform == 1 ? 'auth_btn_cp' : ''">已授权</div>
</div>
<div class="min_text dr_top_1">所属企业:深圳XXX有限公司</div>
<div class="min_text">企微员工:70人</div>
<div class="min_text dr_top_1">所属企业:{{ blocInfo.parentName }}</div>
<div class="min_text">企微员工:{{ blocInfo.entMicroEmployeeCount }}人</div>
</div>
</div>
<blocModule v-if="platform==1"></blocModule>
<shopModule v-if="platform==2"></shopModule>
<blocModule :bloc="blocInfo" :list.sync="storesList" v-if="platform == 1"></blocModule>
<shopModule v-if="platform == 2"></shopModule>
</div>
</template>
<script>
import shopModule from "./shop.vue"
import blocModule from "./bloc.vue"
import shopModule from './shop.vue'
import blocModule from './bloc.vue'
import { merchantInfo } from '../../api/modules/baseinfoApi'
import { utils } from 'glsx-common'
export default {
name: 'index',
components:{
shopModule,
blocModule
components: {
shopModule,
blocModule
},
data(){
return {
platform:1,//1 集团 2 门店
}
data() {
return {
platform: 1, //1 集团 2 门店
blocInfo: {
merchantName: ''
},
storesList: []
}
},
methods: {}
created() {
this.getBlocData()
},
methods: {
getBlocData() {
let para = {
merchantId: 44209603
}
merchantInfo(para).then(res => {
this.blocInfo = res
this.storesList = res.stores.map(item=>{
item.date = `${this.dateFormat(item.starttime,'yyyy.MM.dd')}--${this.dateFormat(item.endtime,'yyyy.MM.dd')}`
return item
})
let aaa = this.storesList[0]
for(let i = 0;i<30;i++){
this.storesList.push(aaa)
}
})
},
dateFormat: function (date, str = 'yyyy-MM-dd') {
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds() //毫秒
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
}
return fmt
}
let result = new Date(date).format(str)
return result
}
}
}
</script>
<style lang="scss" scoped>
......
<template>
<div class="gl-page">
<div class="page-title">
<span>门店账户关联企微</span>
<span class="min-title">关联之后不允许修改,请谨慎操作!</span>
</div>
<div class="page-wrapper">
<div class="wrap-title">
<span>选择你要绑定的商户/门店</span>
<span class="wrap-min-title">(只有账户状态正常的门店和商户才允许关联,如未开通,请联系您的专属顾问)</span>
</div>
<div class="sel-wrap">
<div class="sel-lable">商户/门店账户</div>
<el-cascader ref="cascaderRef1" placeholder="请选择商户/门店" @change="getCurMerchant" :show-all-levels="false" v-model="shopName" :props="mypropParam1" :options="shopList" size="small" style="width: 320px" separator=" " filterable></el-cascader>
</div>
<div style="height: 32px"></div>
<div class="wrap-title">
<span>选择你要绑定的企微门店</span>
<span class="wrap-min-title">(企业微信授权成功后,企业微信相关内容才会显示)</span>
</div>
<div class="sel-wrap">
<div class="sel-lable">企业微信</div>
<el-cascader ref="cascaderRef" @change="getCurDepartment" placeholder="请选择企微门店" :show-all-levels="false" v-model="selectedDepartment" :props="mypropsParam" :options="departmentList" size="small" style="width: 320px" separator=" " filterable></el-cascader>
</div>
<div class="btn-wrap">
<el-button type="purple" size="small" icon="el-icon-link" @click="handlerGL">关联</el-button>
</div>
</div>
<div class="tbale-wrapper">
<div class="wrap-title">
<span>绑定的商户/门店</span>
<span class="wrap-min-title">(绑定成功后,门店账户管理列表-关联的企业微信会显示关联的内容)</span>
</div>
<div class="table_widget">
<GLTable :hasPage="false" :tableParams="tableParams" :tableData="dataList" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px', height: '54px' }">
<template slot="auth-button" slot-scope="scope" :data="scope.scope">
<span @click="deleteLine(scope.scope)" class="blue-text">删除</span>
</template>
</GLTable>
</div>
</div>
<div style="height: 64px"></div>
<div class="fixed-footer">
<div :style="{ width: customWidth + 'px' }" class="btn-custom">取消</div>
<div style="width: 40px"></div>
<div :style="{ width: customWidth + 'px' }" ref="btnWidth" class="btn-custom pruple" @click="handleMutiGL">确定关联({{ dataList.length }})</div>
</div>
</div>
</template>
<script>
import { getMerchantTree, getDepartment, toGL } from '../../api/modules/baseinfoApi'
export default {
name: '',
data() {
return {
departmentList: [],
shopList: [],
qwShop: '',
tableParams: {
tableColumns: [
{
label: '商户/门店账户',
prop: 'merchantName'
},
{
label: '企微门店',
prop: 'departmentName'
}
],
tableOption: {}
},
mypropParam1: {
value: 'id',
label: 'label',
children: 'children',
disabled:'entmicroName'
},
mypropsParam: {
label: 'departmentName',
value: 'id',
children: 'children',
checkStrictly: true,
disabled:'relevanceMerchant'
},
dataList: [],
customWidth: 113,
shopName: '',
selectedDepartment: ''
}
},
created() {
this.getDepartmentList()
this.getMerchantList()
},
mounted() {},
methods: {
// 设置底部按钮宽度
setBtnWidth() {
let _this = this
this.$nextTick(function () {
_this.customWidth = _this.$refs.btnWidth.clientWidth
})
},
// 获取当前选择的商户
getCurMerchant(val) {
let id = val[val.length - 1]
let labels = this.$refs.cascaderRef1.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
this.curTempMerchant = {
merchantId: id,
merchantName: curLabel
}
},
// 获取当前选择的部门
getCurDepartment(val) {
let ids = val[val.length - 1]
let labels = this.$refs.cascaderRef.getCheckedNodes()[0].pathLabels
let curLabel = labels[labels.length - 1]
this.tempDepart = {
departmentId: ids,
departmentName: curLabel,
}
this.$refs.cascaderRef.dropDownVisible = false
},
getDepartmentList() {
getDepartment({ id: 1 }).then(res => {
this.departmentList = res
})
},
getMerchantList() {
getMerchantTree().then(res => {
this.shopList = res
})
},
// 关联当前选择的
handlerGL() {
if(!this.curTempMerchant){
this.$message({
message: '请选择门店/商户',
type: 'warning'
})
return;
}
if(!this.tempDepart){
this.$message({
message: '请选择企微门店',
type: 'warning'
})
return;
}
this.curGLData = {
...this.curTempMerchant,
...this.tempDepart,
}
let flag = false
this.dataList.forEach(item => {
if (item.departmentId == this.curGLData.departmentId && item.merchantId == this.curGLData.merchantId) {
flag = true
}
})
if (flag) {
this.$message({
message: '该关联已在列表当中',
type: 'warning'
})
return
}
this.dataList.push(this.curGLData)
this.setBtnWidth()
},
// 批量关联
handleMutiGL() {
if(!this.dataList.length){
this.$message({
message: '请选择',
type: 'warning'
})
return;
}
let merchantIds = []
let departmentIds = []
let departNames = []
this.dataList.forEach(item => {
merchantIds.push(item.merchantId)
departmentIds.push(item.departmentId)
departNames.push(item.departmentName)
})
let para = {
'list.merchantId': merchantIds,
'list.departmentId': departmentIds,
'list.departName': departNames,
}
toGL(para).then(res => {
if (res) {
this.$message({
message: '操作成功',
type: 'success'
})
}
})
},
deleteLine(row) {
let tempindex = 0
this.dataList.forEach((item, index) => {
if (item.departmentId == row.departmentId) {
tempindex = index
}
})
console.log(tempindex)
this.$confirm('此操作将删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.dataList.splice(tempindex, 1)
this.setBtnWidth()
this.$message({
type: 'success',
message: '删除成功!'
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style lang="scss" scoped>
.gl-page {
box-sizing: border-box;
padding: 20px;
}
.page-title {
font-size: 20px;
font-weight: 500;
color: #424242;
.min-title {
font-size: 12px;
font-weight: 500;
color: #5850ff;
letter-spacing: 1px;
margin-left: 10px;
}
}
.page-wrapper {
width: 100%;
height: 320px;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 32px 0 0 20px;
margin-top: 20px;
.sel-wrap {
display: flex;
align-items: center;
margin-top: 12px;
.sel-lable {
width: 128px;
box-sizing: border-box;
padding-right: 10px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
}
}
.btn-wrap {
padding-left: 20px;
padding-top: 40px;
}
}
.tbale-wrapper {
width: 100%;
height: 590px;
background: #ffffff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
box-sizing: border-box;
padding: 20px;
margin-top: 20px;
.table_widget {
margin-top: 16px;
// height: 439px;
}
.blue-text {
font-size: 14px;
font-weight: 400;
color: #5850ff;
cursor: pointer;
}
}
.fixed-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
// background: #5850ff;
height: 64px;
z-index: 10;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
.btn-custom {
font-size: 14px;
color: #fff;
font-weight: 400;
background: #999999;
border-radius: 4px;
cursor: pointer;
text-align: center;
padding: 8px 0;
}
.pruple {
background: #5850ff;
}
}
.wrap-title {
font-size: 16px;
font-weight: 500;
color: #333333;
.wrap-min-title {
font-size: 12px;
font-weight: 500;
color: #999999;
letter-spacing: 1px;
margin-left: 10px;
}
}
// table{
// max-height: 430px!important;
// }
.el-button--purple {
color: #fff;
background-color: #5850ff;
border-color: #5850ff;
border-radius: 4px;
}
</style>
\ No newline at end of file
<template>
<div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: this.$router.currentRoute.meta.url
}
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
})
}
}
}
</script>
<style></style>
<template>
<div class="report-home">
HOME
<glsx-button type="danger" @click="test()" class="test555" id="1211" mode="link">权限按钮测试</glsx-button>
<glsx-button type="success" size="small" @click="test()" id="1211" class="test">权限按钮测试2</glsx-button>
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div>
</template>
......
......@@ -5,7 +5,7 @@
</h2>
<div id="nav">
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/about')">应用内跳转</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about/index')">应用内跳转</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1-1')">子应用1-ui测试-组件测试</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">子应用1-关于子应用</el-button>
<el-button type="primary" size="medium" @click="toAppReport({ path: 'sub01/changeData' })">不存在的路由</el-button>
......
<template>
<div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: this.$router.currentRoute.meta.url
}
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
})
}
}
}
</script>
<style></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!