Commit 350f5abe by huyue

修改账户、字典跳转问题

1 parent 74980605
Showing 64 changed files with 4105 additions and 0 deletions
> 1%
last 2 versions
not ie <= 8
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
/build/
/config/
/dist/
/*.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/prettier'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
},
extends: 'eslint:recommended',
// required to lint *.vue files
plugins: [
'html'
],
// check if imports actually resolve
'settings': {
'import/resolver': {
'webpack': {
'config': 'build/webpack.base.conf.js'
}
}
},
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': [2, 'allow-null'],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 2,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
module.exports = {
plugins: {
autoprefixer: {}
}
}
{
"semi": false,
"singleQuote": true
}
\ No newline at end of file
## 独立部署账户中心
### 账户、员工类
\ No newline at end of file
module.exports = {
presets: ["@vue/app"]
};
This diff could not be displayed because it is too large.
{
"name": "glsx-oss-account",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "cwq0219 <cwqnn2015@163.com>",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.18.0",
"element-ui": "^2.15.1",
"glsx-table": "^1.0.3",
"glsx-vue-common": "^2.0.5",
"lodash": "^4.17.10",
"md5": "^2.3.0",
"moment": "^2.29.1",
"sass-loader": "^7.1.0",
"sha1": "^1.1.1",
"vue": "^2.5.17"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-prettier": "^3.0.1",
"eslint-plugin-html": "^4.0.5",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.5.17"
}
}
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 multiple-pages doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
import request from './request'
const path = 'merchants.api.accountype.'
const path1 = 'merchants.api.product.'
const accountApi = {
/** 账户类型分页数据*/
getPageApi(data = {}) {
data.method = `${path}page`
return request(data)
},
/** 账户类型列表 */
getList(data = {}) {
data.method = `${path}list`
return request(data)
},
/** 删除账户类型 */
delete(data = {}) {
data.method = `${path}deleteById`
return request(data)
},
/** 根据id获取账户类型 */
getById(data = {}) {
data.method = `${path}getById`
return request(data)
},
/** 新增账户类型 */
insert(data = {}) {
data.method = `${path}insert`
return request(data, 'post')
},
/** 编辑账户类型 */
update(data = {}) {
data.method = `${path}update`
return request(data, 'post')
},
/** 根据产品id查询菜单功能树 */
findProductById(data = {}) {
data.method = `${path1}findProductById`
return request(data)
},
saveStaff(data = {}) {
data.method = 'merchants.api.staff.saveStaff'
return request(data)
},
// 获取账户类型下产品菜单功能树
accountTypeSearchRequest(data) {
data.method = 'merchants.api.merchant.accountTypeSearchRequest'
return request(data)
}
}
export { accountApi }
import request from './request'
const path = 'merchants.api.menu.'
const dictApi = {
/** 查询字典类型*/
findDictType(data = {}) {
data.method = `${path}findDictType`
return request(data)
},
/** 删除字典类型 */
deleteDictType(data = {}) {
data.method = `${path}deleteDictType`
return request(data)
},
/** 保存字典类型 */
saveDictType(data = {}) {
data.method = `${path}saveDictType`
return request(data)
},
/** 更新字典类型 */
updateDictType(data = {}) {
data.method = `${path}updateDictType`
return request(data)
},
/** 查询字典数据列表 */
findDictData(data = {}) {
data.method = `${path}findDictData`
return request(data)
},
/** 删除字典数据 */
deleteDictData(data = {}) {
data.method = `${path}deleteDictData`
return request(data)
},
/** 保存字典数据 */
saveDictData(data = {}) {
data.method = `${path}saveDictData`
return request(data)
},
/** 更新字典数据 */
updateDictData(data = {}) {
data.method = `${path}updateDictData`
return request(data)
},
/** 查询所有字典 */
findAllDictData(data = {}) {
data.method = `${path}findAllDictData`
return request(data)
}
}
export { dictApi }
import request from './request'
const path = 'merchants.api.'
export const baseApi = {
// 获取所有产品
getAllProduct(data = {}) {
data.method = `${path}product.findProduct`
return request(data)
},
// 所有字典
getAllDictApi(data = {}) {
data.method = `${path}menu.findAllDictData`
return request(data)
},
// 所有菜单树
getMenuTree(data = {}) {
data.method = `${path}menu.findMerProMenuTree`
return request(data)
},
// 图片上传
upload(url, data = {}) {
data.method = 'glsx.accounts.biz.common.pictureUpload'
return request(data, 'post', ['file'], url)
},
// 获取ICON
getIcon(data = {}) {
data.method = `${path}menu.findMerchantFile`
return request(data)
}
}
// 产品
export const productApi = {
/** 获取财务管理列表*/
getListApi(data = {}) {
data.method = `${path}product.findProductByPage`
return request(data)
},
/** 新增产品 */
saveProApi(data = {}) {
data.method = `${path}product.saveProduct`
return request(data, 'post')
},
/** 编辑产品 */
updateProApi(data = {}) {
data.method = `${path}product.updateProduct`
return request(data, 'post')
}
}
// 菜单
export const menuApi = {
/** 获取财务管理列表*/
getListApi(data = {}) {
data.method = `${path}menu.findMerProMenuByPage`
return request(data)
},
/** 新增菜单 */
saveMenuApi(data = {}) {
data.method = `${path}menu.saveMerchantProductMenu`
return request(data, 'post')
},
// 更新菜单
updateMenuApi(data = {}) {
data.method = `${path}menu.updateMerchantProductMenu`
return request(data, 'post')
},
// 删除菜单
deleteMenuApi(data = {}) {
data.method = `${path}menu.deleteMerchantProductMenu`
return request(data, 'post')
},
// 批量导入菜单
buildVersionMenuFunctionNew(data = {}){
data.method = `${path}menu.buildVersionMenuFunctionNew`
return request(data, 'post')
}
}
// 功能
export const functionApi = {
/** 获取财务管理列表*/
getListApi(data = {}) {
data.method = `${path}menu.findMerchantFunction`
return request(data)
},
/** 新增功能 */
saveFunApi(data = {}) {
data.method = `${path}menu.saveMerchantFunction`
return request(data, 'post')
},
/** 编辑功能 */
updateFunApi(data = {}) {
data.method = `${path}menu.updateMerchantFunction`
return request(data, 'post')
}
}
import RequestMethods from './request.methods'
import axios from 'axios'
import qs from 'qs'
// import GlsxVueCommon from 'glsx-vue-common'
import sign from './sign'
import { GlAxios } from 'glsx-vue-common'
const request = (
params = {},
method = RequestMethods.GET,
noSignAttr = [],
url = '',
isMd5 = false,
isParams=true
) => {
params.source = 'glsx-oss-merchant-data'
params.appKey = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime()
params.v = '1.0.0'
params.format = 'json'
params.sessionAuth = 'st'
// params.createBy = this.$get_session_config().user.id
if (isMd5) {
params.app_key = params.appKey
delete params.appKey
// return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
}
var data = isMd5 ? sign(params, noSignAttr, true) : sign(params, noSignAttr)
if (url && isParams) {
return axios.post(`${url}/router?method=${method}`, qs.stringify(data))
}
if (url && !isParams) {
return axios.post(`${url}/router`, qs.stringify(data))
}
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 md5 from 'md5'
import qs from 'qs'
import _ from 'lodash'
const secret = window.location.href.includes('dj.glsx.com.cn') ? '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353' : 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const sign = (params, noSignAttr = [],isMd5) => {
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 = isMd5
? md5(secret + str.join('') + secret).toUpperCase()
: sha1(secret + str.join('') + secret).toUpperCase()
return realObj
}
export default sign
import request from './request'
import Vue from 'vue'
const uploadApi = {
// 多文件上传接口
multipleUpload(data = {}) {
data.method = 'glsx.accounts.biz.common.pictureUpload'
return request(data, 'glsx.accounts.biz.common.pictureUpload',['file'], Vue.prototype.fileUploadURL,true)
}
}
export { uploadApi }
\ No newline at end of file
// The Vue build version to load with the `import` command
// (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'
import { Request as request } from 'glsx-vue-common'
import notice from '@/common/notice'
import '@/styles/index.css'
// 组件
import '@/components'
import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
import _ from 'lodash'
// import axios from 'axios'
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Common = Common
Vue.prototype.$Constants = Constants
Vue.prototype.notice = notice
Vue.use(ElementUI)
Vue.use(glsxTable)
var mixin = {
data() {
return {
flag: true,
eventBus: new Vue()
}
},
mounted() {
const _this = this
const theme = new this.$Theme()
const connection = this.$Penpal.connectToParent({
methods: {
setTheme(color) {
theme.change(color)
},
height() {
return document.height || document.body.offsetHeight // document.documentElement.clientHeight || document.body.clientHeight //
},
translate(params) {
_this.eventBus.$emit('params', params)
}
}
})
connection.promise.then(parent => {
const cfg = _this.$get_session_config()
_this.$$parent = parent
console.log(parent, '---')
if (cfg) return
parent.getResources().then(config => {
_this.$set_session_config(config)
})
})
},
methods: {
/**
* 页面跳转方法 用法 :
* this.$root.to(['MOCK系统A', '一键导航', '导航数据', 'MOCK数据B', 'localhost'],'1123')
* 或:
* this.$parent.to(['MOCK系统A', '一键导航', '导航数据', 'MOCK数据B', 'localhost'],'1123')
*
* @param {*} path 如: ['一级菜单名称','二级菜单名称','三级菜单名称','四级菜单名称','五级菜单名称']
* @param {*} params 传给下一个页面的参数
*/
to(path, params) {
if (this.$$parent) {
this.$$parent.to(path, params)
} else {
this.$$connection.promise.then(parent => {
parent.to(path, params)
})
}
},
close() {
this.$$parent.close()
}
}
}
const URL = 'https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl='
const getConfig = (url = URL + 'glsx-oss-account-config') => {
return new Promise((resolve, reject) => {
request({ url }).then(res => {
if (res.status === 'success') {
resolve({ 'vue': Vue, 'config': JSON.parse(res.data) })
} else {
reject('ERROR.')
}
})
})
}
/* eslint-disable no-new */
const render = App => {
window.vm = new Vue({
el: '#app',
mixins: [mixin],
render: h => h(App)
})
}
export default { render, getConfig }
import Vue from 'vue'
export default new Vue({
methods: {
warningTips(message) {
this.$notify({
type: 'warning',
title: message
})
},
okTips(message) {
this.$notify({
type: 'success',
title: message || '操作成功'
})
},
errorTips(message) {
this.$notify({
type: 'error',
title: message || '操作失败'
})
}
}
})
import Vue from 'vue'
import { Message, MessageBox, Loading } from 'element-ui';
import moment from 'moment'
let loadingInstance = ''
export const Util = {
/**
* 简单alert
* title 标题
* message 内容
* className 自定义class
* showCancelButton 是否展示取消按钮
* confirmButtonText 确认按钮文案
* cancelButtonText 取消按钮文案
* confirmButtonColor 确认按钮颜色
* cancelButtonColor 取消按钮颜色
*/
msg: function(options) {
MessageBox({
title: options.title || '',
type: options.type || 'error',
message: options.message || '',
className: options.className || '',
showCancelButton: options.showCancelButton || false,
confirmButtonText: options.confirmButtonText || '确认',
cancelButtonText: options.cancelButtonText || '取消',
confirmButtonColor: options.confirmButtonColor || '#1989fa',
cancelButtonColor: options.cancelButtonColor || '#000',
dangerouslyUseHTMLString: true,
callback: function(action, done) {
if (action == 'confirm') {
if (options.success) {
(options.success)(done)
}
} else {
console.log(done);
// done()
}
}
});
/* Vue.$vux.alert.show({
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
},
/**
* 提示框
*/
Info: function(options) {
Message({
message: options.message || '提示',
type: options.type || 'error',
duration: options.time || 2000,
onClose: options.onClose || ''
});
},
/**
* 轻提示
*/
Tips: function(options) {
Message({
message: options.message || '提示',
duration: options.duration || 3000,
type: options.type || 'text',
icon: options.icon || ''
})
},
/**
* loading
*/
loading: function(message) {
loadingInstance = Loading.service({
text: message || '加载中...'
});
},
/**
* 关闭loading
*/
closeLoading: function() {
loadingInstance.close();
},
/**
* 校验手机号码格式
*/
checkPhone: function(mobile) {
let myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/;
return myreg.test(mobile);
},
/**
* 校验固定电话
*/
validationTel: function(tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/;
return reg.test(tel);
},
/**
* 是否特殊字符
*/
isSpecialLetter: function(str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]");
return reg.test(str);
},
/**
* 只能输入英文字母和数字,不能输入中文
*/
validationInput: function(str) {
let reg = /[^\w\.\/]/ig;
return reg.test(str);
},
/**
* 获取当前时间
*/
getCurrentDate: function() {
let time = new Date();
let y = time.getFullYear();
let m = time.getMonth() + 1;
let d = time.getDate();
return {
date: y + '/' + m + '/' + d
}
},
/**
   * 获取浏览器参数
   */
  getUrlParams: function(name) {
    let vars = [],
      hash;
      let oParams = {};
    let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for (let i = 0; i < hashes.length; i++) {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      oParams[hash[0]] = hash[1];
    }
    console.log(vars);
    if(name){
      return oParams[name];
    }else{
      return oParams;
    }
  },
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function(day) {
let date1 = new Date();
let date2 = new Date(date1);
let time = 30;
if (day) {
time = day;
}
date2.setDate(date1.getDate() + time);
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate();
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
};
},
/**
* 日期格式转换
*/
dateFormate: function(str, type) {
let txt = 'YYYY-MM-DD'
if (type) {
txt = type
}
const m = moment(str).format(txt)
return m
},
/**
* 字段截取
*/
cutStr: function(str, num) {
if (!str) {
return ''
}
let m = 10
let n = str
if (num) {
m = num
}
if (str.length > m) {
n = str.slice(0, m) + '...'
}
return n
}
}
<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"
:loading="btnLoading"
>{{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'
},
btnLoading: {
type: Boolean,
default: false
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style>
.app-dialog .el-dialog__header {
padding: 20px;
}
.app-dialog .el-dialog__footer {
padding: 10px;
background: #fff;
}
.app-dialog .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 {
overflow-y: auto;
padding: 20px 20px;
}
.container > span {
display: block;
}
</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
:highlight-current-row="true"
:stripe="true"
@sort-change="sortChange"
@selection-change="handleSelect"
size="medium"
>
<el-table-column
v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName"
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+(page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 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="scope.row[item.prop]"></span>
</template>
<template v-else>
<span v-text="tableData[scope.$index][item.prop]"></span>
</template>
<template v-if="item.addSymbol">
<span v-text="item.addSymbol"></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 slot-scope="scope">
<slot
name="auth-button"
:scope="scope.row"
></slot>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="hasPage"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]"
:page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal"
:layout="layout"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'd2-table',
data() {
return {
loading: false,
data: [],
// 页码
page: {},
total: 10,
// 排序
sortColum: '',
sort: '',
// 多选数组
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => {}
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 0
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
pageConf: {
type: Object,
default: () => ({ pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'totalCount' })
},
// 分页组件配置
layout: {
type: String,
default: 'sizes,total,->,prev,pager,next,jumper'
},
// 序号,默认有
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: () => []
}
}
}
}
},
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()
},
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(true, true)
},
refreshTable(clearMuti = true, resetPageNum = false) {
this.beforeSearchFn().then(res => {
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
resetPageNum && (this.page.pageNum = 1)
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)
this.data = this.findVal(res, this.tableParams.listName)
this.total = this.findVal(res, this.pageConf.totalCount)
this.loading = false
}).catch(() => {
this.loading = false
})
})
},
// 找返回值
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[this.pageConf.pageSize] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
// 页码
handleCurrentChange(value) {
this.page[this.pageConf.pageNum] = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.a-click {
cursor: pointer;
}
.el-table .cell {
line-height: 14px;
}
.d2-table p {
margin: 10px 0;
}
</style>
/**
* 时间控件-限制月份
*/
export const rangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
<!-- 搜索 -->
<template>
<div class="glsx-combi-form">
<el-form
:ref="formRef"
:inline="true"
:model="formObj"
:label-width="labelWidth"
:rules="formRules"
size="mini"
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, 'tips': item.tips}"
:label="item.label ? (item.label + ':') : ''"
:prop="item.name"
>
<slot
v-if="item.addHtml"
:name="item.addHtml"
:scope="item"
></slot>
<el-input
v-else-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'"
:style="{ width: item.width || 'auto' }"
:show-word-limit="item.showLimit || false"
@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]"
:disabled="subItem.isDisabled || false"
>
</el-option>
</el-select>
<!-- radio -->
<el-radio-group
v-else-if="item.type === 'radio'"
v-model="formObj[item.name]"
:disabled="item.isDisabled"
@change="item.handleRadioChange"
>
<el-radio
v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionId]"
>{{subItem[item.optionLabel]}}</el-radio>
</el-radio-group>
<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>
</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: {
formRef: {
type: String,
default: 'formRef'
},
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--mini .el-form-item__content,
.el-form-item--mini .el-form-item__label {
width: 100%;
}
/* .glsx-combi-form .el-form-item--mini .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;
}
.glsx-combi-form .tips {
margin: 0;
}
</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"
:size="btn_size"
@click="handleConfirm"
>{{btnOkLabel}}</el-button>
<el-button
v-if="!noCancel"
:size="btn_size"
@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>
import Vue from 'vue'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('basic-dialog', () => import('./basic-dialog/index.vue'))
Vue.component('rule-form', () => import('./rule-form/index.vue'))
Vue.component('glsx-dialog', () => import('./glsx-dialog/index.vue'))
Vue.component('glsx-combi-form', () => import('./glsx-combi-form/index.vue'))
<template>
<div>
<el-form
:model="ruleForm"
:rules="rules"
:label-position="labelPosition"
:label-width="labelWidth"
: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 slot-scope="scope">
<template v-if="item.type === 'input'">
<el-input
v-if="item.clickFunc"
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
@click.native="item.clickFunc"
:class="item.clickFunc ? 'pointer' : ''"
:ref="item.ref"
v-model="ruleForm[item.prop]"
@input="update($event)"
>
</el-input>
<el-input
v-else
:type="item.inputText || 'text'"
:readonly="item.readonly || false"
:disabled="item.disabled || false"
v-model="ruleForm[item.prop]"
:maxlength="item.maxlength"
:minlength="item.minlength"
:show-password="item.showPassword || false"
:clearable="item.clearable"
:show-word-limit="item.showWordLimit || false"
>
</el-input>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-if="item.visibleFunc"
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false"
@change="selectChange"
@visible-change="item.visibleFunc"
>
<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-select
v-else
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false"
@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]"
:active-text="item.activeText || '开'"
:inactive-text="item.inactiveText || '关'"
></el-switch>
</template>
<template v-else-if="item.type === 'radio'">
<el-radio-group
@change="radioChange($event,item.prop)"
v-model="ruleForm[item.prop]"
:disabled="item.disabled"
>
{{ruleForm[item.prop]}}
<el-radio
v-for="(child,childIndex) in item.children"
:key="childIndex"
:label="childIndex"
>{{child}}</el-radio>
</el-radio-group>
<el-select
v-if="item.hasSelect"
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 == 'customize'">
<slot
:scope="scope"
:name="item.slotName"
>
</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: 'right'
},
size: {
type: String,
default: 'small'
},
labelWidth: {
type: String,
default: '100px'
}
},
mounted() {
},
methods: {
selectChange(val) {
this.$emit('selectChange', val)
},
radioChange(event, prop) {
this.$emit('radioChange', event, prop)
},
update(e) {
this.$forceUpdate()
}
}
}
</script>
<style>
.pointer input {
cursor: pointer;
}
</style>
\ No newline at end of file
body {
overflow: auto;
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%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
#app {
height: 100%;
}
*,
*:before,
*:after {
-webkit-box-sizing: inherit;
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:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.app-main {
overflow: auto;
}
.app-container {
padding: 20px;
}
.el-table--medium td {
padding: 4px 0 !important;
}
.el-table .cell {
padding: 0 0;
}
.dot {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 5px;
vertical-align: middle;
margin-right: 2px;
}
.green-text {
color: #00A854;
}
.red-text {
color: red;
}
.green {
background-color: #00A854;
}
.gray {
background-color: #BFBFBF;
}
.blue {
background-color: #0051ff;
}
.red {
background-color: red;
}
.yellow {
background-color: #d9ff00;
}
.orange {
background-color: #ff9100;
}
.statusText {
vertical-align: middle;
}
.w-300 {
width: 300px;
}
/*# sourceMappingURL=index.css.map */
\ No newline at end of file
body {
overflow: auto;
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 {
&:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
}
//main-container全局样式
.app-main {
overflow: auto;
}
.app-container {
padding: 20px;
}
// element
.el-table--medium td {
padding: 4px 0 !important;
}
.el-table .cell {
padding: 0 0;
}
// 状态
.dot {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 5px;
vertical-align: middle;
margin-right: 2px;
}
.green-text {
color: #00A854;
}
.red-text {
color: rgb(255, 0, 0);
}
.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;
}
\ No newline at end of file
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() : ''
})
},
/**
* 正整数
* */
checkRegExpNumber(rule, value, callback) {
var rxp = /^\+?[1-9][0-9]*$/
if (!rule.required) {
if (!value) {
callback()
} else if (!rxp.test(value)) {
return callback(new Error('只支持正整数'))
}
}
if (!value) {
return callback(new Error('请输入正整数'))
} else {
callback()
}
},
getParams: function(str = window.location.href) {
var params = str.split('?')
if (params.length < 2) return {}
var param = params[1].split('&')
var obj = {}
for (let i = 0; i < param.length; i++) {
var paramsA = param[i].split('=')
var key = paramsA[0]
var value = paramsA[1]
obj[key] = value
}
return obj
},
go: function(module, page, params, blank) {
var _p = !params || Object.keys(params).length === 0 ? '' : genurl(params)
var href = '/customer/' + module + '/' + page + '.html'
if (blank) {
window.open(href, '_blank')
} else {
window.location.href = _p ? href + '?' + _p : href
}
},
}
function genurl(param, key, encode) {
// if (!param || layui.$.isEmptyObject(param)) return ''
var params = []
var t = typeof param
if (t == 'string' || t == 'number' || t == 'boolean') {
params.push(key + '=' + (encode == null || encode ? encodeURIComponent(param) : param))
} else {
for (var i in param) {
var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i)
params.push(genurl(param[i], k, encode))
}
}
return params.join('&')
}
const Constants = {
// 字典状态
DICT_STATUS: {
'1': '启用, green',
'2': '停用, red'
},
ACCOUNT_STAUS: {
'0': '已启用',
'1': '存草稿'
},
ACCOUNT_STAUS_LIST: [
{
label: '全部',
value: ''
},
{
label: '已启用',
value: 0
},
{
label: '存草稿',
value: 1
}
],
DICT_STATUS_OPTIONS: [
{
label: '全部',
value: ''
},
{
label: '启用',
value: 1
},
{
label: '停用',
value: 2
}
]
}
export default Constants
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div class="detail">
<el-form :model="detailForm" label-width="100px">
<h3 class="content-title">基本信息</h3>
<el-form-item label="账户名称:">
<div>{{ detailForm.accounttypeName }}</div>
</el-form-item>
<el-form-item label="账户类型ID:">
<div>{{ detailForm.accounttypeCode }}</div>
</el-form-item>
<el-form-item label="描述:">
<div>{{ detailForm.accounttypeDetail }}</div>
</el-form-item>
<el-form-item label="登录权限:">
<div>{{ detailForm.accountAuth }}</div>
</el-form-item>
</el-form>
<h3 class="content-title">功能权限</h3>
<el-tabs
v-if="detailForm.requestList && detailForm.requestList.length != 0"
v-show="activeName"
v-model="activeName"
@tab-click="handleClick"
class="m-b-lg"
>
<el-tab-pane
v-for="(item, index) in detailForm.requestList"
:key="item.productId"
:label="item.productName"
:name="item.productName"
>
<el-tree
style="font-size:13px"
:ref="`tree${index}`"
:data="treeData[index] ? treeData[index].merchantProTreeResponses : []"
node-key="id"
:props="defaultProps"
default-expand-all
:expand-on-click-node="false"
:render-content="renderContent"
>
</el-tree>
</el-tab-pane>
</el-tabs>
<div class="footer-btn">
<el-button :size="btn_size" @click="cancel" type="primary"
>关闭</el-button
>
</div>
</div>
</template>
<script>
import { accountApi } from '@/api/accountManage'
import _ from 'lodash'
export default {
data() {
return {
detailForm: {
requestList: []
},
activeName: '',
detailId: '',
treeData: [],
defaultProps: {
disabled: 'disabled',
label: 'label',
children: 'children'
}
}
},
mounted() {
if (this.$Common.getParams()) {
this.detailId = this.$Common.getParams().id
this.getById(this.detailId)
this.accountTypeSearchRequest(this.detailId)
}
// this.$root.eventBus.$on('params', params => {
// console.log(params)
// this.detailId = params.id
// this.getById(params.id)
// this.accountTypeSearchRequest(params.id)
// })
},
methods: {
setDisabled(data) {
if (data) {
data.forEach(item => {
if (item.children && item.children.length != 0) {
item.children.forEach(i => {
this.setDisabled(i.children)
i.disabled = true
})
}
item.disabled = true
})
}
return data
},
getById(id) {
accountApi.getById({ id }).then(res => {
const { code, data } = res
if (code == '0') {
this.detailForm = {
accounttypeName: data.accounttypeName,
accounttypeDetail: data.accounttypeDetail || '无',
accounttypeCode: data.accounttypeCode,
requestList: data.responseList,
accountAuth: data.responseList ? data.responseList.map(item => item.productName).join('、') : '无'
}
}
})
},
accountTypeSearchRequest(id) {
accountApi.accountTypeSearchRequest({ ids: id }).then(res => {
if (res.code == '0') {
const data = _.cloneDeep(res.data[0].products)
this.treeData = data
this.activeName = res.data[0].products[0].productName
setTimeout(() => {
this.addStyle()
}, 1000 / 60)
}
})
},
// findProductById() {
// const productId = this.detailForm.requestList.map(item => item.productId)
// const params = { productId }
// if (this.detailId) params.accountTypeId = this.detailId
// accountApi.findProductById(params).then(res => {
// if (res.code == '0') {
// const data = _.cloneDeep(res.data)
// console.log(data, '---')
// this.treeData = this.setDisabled(data)
// // 编辑
// if (this.detailForm.requestList && this.detailForm.requestList.length != 0) {
// this.$nextTick(() => {
// this.activeName = this.detailForm.requestList[0].productName
// this.detailForm.requestList.forEach((item, index) => {
// this.$refs[`tree${index}`][0].setCheckedKeys(item.menuIdList)
// })
// this.addStyle()
// })
// }
// }
// })
// },
// 渲染树结构
renderContent(h, v) {
if (v.data.logo == 'functionValue') {
return (
<div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span>
</div>
)
} else {
return (
<div class="custom-tree-node">
<span>{v.node.label}</span>
</div>
)
}
},
addStyle() {
const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode
parentNode.style.float = 'left'
}
},
handleClick() {},
cancel() {
const cfg = this.$get_session_common_config()
window.history.go(-1)
// this.$root.close(cfg.axios.detailUrl.slice(-1))
// this.$root.to(cfg.axios.listUrl)
// this.$$parent.close()
}
}
}
</script>
<style>
.detail {
height: calc(100% - 30px);
overflow: auto;
}
.detail .el-form-item {
margin-bottom: 0;
}
.footer-btn {
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
background-color: #fff;
}
.detail .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner,
.detail .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
background-color: #409EFF;
border-color: #409EFF;
}
.detail .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after,
.detail .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner::before {
border-color: #fff;
}
.detail .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner::before {
background-color: #fff;
border-color: #fff;
}
</style>
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<!-- 账户管理 -->
<template>
<div>
<el-row>
<el-col :span="2" style="padding-top: 7px;">
<el-button
type="primary"
icon="el-icon-plus"
:size="btn_size"
@click="btnClick('create')"
>添加账户类型</el-button>
</el-col>
<el-col style="text-align: right;" :span="22">
<el-form :inline="true" :model="accountSearchForm">
<el-form-item label="账户状态:">
<el-select
v-model="accountSearchForm.delFlag"
:size="btn_size"
clearable
placeholder="请选择"
>
<el-option
v-for="item in ACCOUNT_STAUS"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="账户类型名称:">
<el-input
v-model="accountSearchForm.accounttypeName"
clearable
:size="btn_size"
placeholder="请输入内容"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" :size="btn_size" @click="reset">重置</el-button>
<el-button type="primary" :size="btn_size" :id="accountTableParams.btnId">搜索</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<d2-table
ref="accountTable"
:searchForm="accountSearchForm"
:getListApi="getListApi"
:tableParams="accountTableParams"
:pageConf="pageConf"
>
<div slot="auth-button" slot-scope="scope">
<el-button type="text" :size="btn_size" @click="btnClick('detail', scope.scope)">查看详情</el-button>
<el-button type="text" :size="btn_size" @click="btnClick('edit', scope.scope)">修改</el-button>
<el-button
v-if="scope.scope.delFlag == 1"
type="text"
:size="btn_size"
@click="btnClick('delete', scope.scope)"
>删除</el-button>
</div>
</d2-table>
</div>
</template>
<script>
import { accountApi } from '@/api/accountManage'
export default {
data() {
return {
accountSearchForm: {
delFlag: ''
},
getListApi: accountApi.getPageApi,
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count'
},
accountTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableColumns: [
{
label: '账户类型ID',
prop: 'accounttypeCode'
},
{
label: '账户类型名称',
prop: 'accounttypeName'
},
{
label: '更新时间',
prop: 'updatedTime'
},
{
label: '状态',
prop: 'delFlag',
formatter: cellValue => {
return this.$Constants.ACCOUNT_STAUS[cellValue.delFlag]
}
}
],
tableOption: true
},
ACCOUNT_STAUS: this.$Constants.ACCOUNT_STAUS_LIST
}
},
methods: {
btnClick(type, scope) {
const cfg = this.$get_session_common_config()
console.log(cfg)
switch (type) {
case 'create':
console.log('create')
window.location.href = `./add.html`
window.parent.postMessage({
type: 'location-change',
url: `/add.html`
}, '*');
// this.$Common.go('account', 'add')
// this.$root.close('账户类型列表')
// this.$root.close(cfg.axios.listUrl.slice(-1))
// this.$root.to(cfg.axios.accountUrl, { id: '' })
break
case 'edit':
window.location.href = `./add.html?id=${scope.id}`
window.parent.postMessage({
type: 'location-change',
url: `/add.html?id=${scope.id}`
}, '*');
// this.$Common.go('account', 'add', {
// id: scope.id
// })
// this.$root.close('账户类型列表')
// this.$root.close(cfg.axios.listUrl.slice(-1))
// this.$root.to(cfg.axios.accountUrl, {id: scope.id})
break
// eslint-disable-next-line no-case-declarations
case 'delete':
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'warning',
callBack: () => {
const params = { id: scope.id }
console.log(params)
accountApi.delete(params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.accountTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
break
case 'detail':
window.location.href = `./detail.html?id=${scope.id}`
window.parent.postMessage({
type: 'location-change',
url: `/detail.html?id=${scope.id}`
}, '*');
// this.$root.close(cfg.axios.listUrl.slice(-1))
// // this.$root.close('账户类型列表')
// this.$root.to(cfg.axios.detailUrl, {id: scope.id})
break
}
},
reset() {
this.accountSearchForm = {
delFlag: '',
accounttypeName: ''
}
this.$nextTick(() => {
this.$refs.accountTable.refreshTable()
})
}
}
}
</script>
<style scoped></style>
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-form :inline="true" style="text-align: right;" :model="dictDataSearchForm">
<el-form-item>
<el-input
v-model="dictDataSearchForm.dictName"
clearable
:size="btn_size"
placeholder="请输入字典名称"
></el-input>
</el-form-item>
<el-form-item>
<el-input
v-model="dictDataSearchForm.dictType"
:size="btn_size"
readonly
placeholder="请输入字典类型"
></el-input>
</el-form-item>
<el-form-item>
<el-select
v-model="dictDataSearchForm.enableStatus"
clearable
:size="btn_size"
placeholder="请选择字典状态"
>
<el-option
v-for="item in $Constants.DICT_STATUS_OPTIONS"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button :size="btn_size" type="primary" @click="reset">重置</el-button>
<el-button type="primary" :size="btn_size" :id="dictDataTableParams.btnId">搜索</el-button>
<el-button type="primary" :size="btn_size" @click="btnClick('create')">新增字典数据</el-button>
</el-form-item>
</el-form>
<d2-table
ref="dictDataTable"
:tableParams="dictDataTableParams"
:searchForm="dictDataSearchForm"
:getListApi="getListApi"
:pageConf="pageConf"
>
<span slot="status" slot-scope="scope">
<span
class="dot"
:class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
></span>
<span
class="statusText"
>{{ scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
</span>
<span slot="auth-button" slot-scope="scope">
<el-button
v-for="(j, idx) in dictDataTableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)"
>{{ j.name }}</el-button>
</span>
</d2-table>
<basic-dialog
:title="dictDataDialogTitle"
:isVisible="dictDataVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictDataForm"
:rules="dictDataRules"
:ruleData="dictDataData"
ref="dictDataForm"
></rule-form>
</slot>
</basic-dialog>
</div>
</template>
<script>
import { dictApi } from '@/api/dictManage'
export default {
data() {
return {
DICTSTATUS: this.$Constants.DICT_STATUS,
dictDataSearchForm: {
dictType: '',
enableStatus: ''
},
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count'
},
dictDataTableData: [
{
id: 1,
dictName: 'dasf'
}
],
getListApi: dictApi.findDictData,
dictDataTableParams: {
numName: '字典编码',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableColumns: [
{
label: '字典标签',
prop: 'dictLabel'
},
{
label: '字典键值',
prop: 'dictValue'
},
{
label: '字典排序',
prop: 'dictSort'
},
{
label: '备注',
prop: 'remark'
},
{
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
},
{
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 140,
btnList: [
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
// 弹窗
dictDataDialogTitle: '新增字典',
dictDataVisible: false,
dictDataForm: {},
dictDataData: [
{
label: '字典类型:',
prop: 'dictType',
type: 'input',
readonly: true
},
{
label: '字典标签:',
prop: 'dictLabel',
type: 'input',
maxlength: 20
},
{
label: '字典键值:',
prop: 'dictValue',
type: 'input',
maxlength: 50
},
{ label: '字典排序:', prop: 'dictSort', type: 'input', maxlength: 5 },
{ label: '状态:', prop: 'enableStatus', type: 'switch' },
{
label: '备注:',
prop: 'remark',
type: 'input',
inputText: 'textarea',
maxlength: 200,
showWordLimit: true
}
],
dictDataRules: {
dictType: [{ required: true }],
dictLabel: [
{ required: true, message: '请输入字典标签', trigger: 'blur' }
],
dictValue: [
{ required: true, message: '请输入字典键值', trigger: 'blur' },
{ validator: this.$Common.checkRegExpNumber, trigger: 'blur' }
],
dictSort: [
{ required: true, message: '请输入字典排序', trigger: 'blur' },
{ validator: this.$Common.checkRegExpNumber, trigger: 'blur' }
],
enableStatus: [{ required: true }]
},
dictData: {},
params: ''
}
},
mounted() {
this.params = this.$Common.getParams()
console.log(this.params, 'params');
this.dictDataSearchForm.dictType = this.params.dictType
this.dictData = this.params
this.$refs.dictDataTable.refreshTable()
},
methods: {
// 确定
handleConfirm() {
this.$refs.dictDataForm.$children[0].validate(valid => {
if (valid) {
const params = JSON.parse(JSON.stringify(this.dictDataForm))
params.enableStatus = this.dictDataForm.enableStatus ? 1 : 2
let api = 'saveDictData'
if (params.id) {
api = 'updateDictData'
delete params.delFlag
delete params.disabled
delete params.deleted
delete params.typeDeleted
delete params.typeDisabled
}
dictApi[api](params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose()
this.$refs.dictDataTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.dictDataVisible && this.$refs.dictDataForm) {
this.$refs.dictDataForm.$children[0].resetFields()
}
this.dictDataVisible = !this.dictDataVisible
},
// 按钮事件
btnClick(pType, scope) {
switch (pType) {
case 'create':
this.dictDataDialogTitle = '新增字典'
// const params = this.getInitStorage()
this.dictDataForm = {
dictType: this.dictData.dictType,
enableStatus: this.dictData.enableStatus == 1
}
this.handleClose()
break
case 'edit':
this.dictDataDialogTitle = '编辑字典'
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
}
},
// 编辑触发事件
editEvent(row) {
this.dictDataForm = JSON.parse(JSON.stringify(row))
this.dictDataForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictDataForm.createdDate
delete this.dictDataForm.isDefault
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'warning',
callBack: () => {
const params = { id }
console.log(params)
dictApi.deleteDictData(params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.dictDataTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
},
reset() {
this.dictDataSearchForm = {
enableStatus: '',
dictType: this.params.dictType
}
this.$nextTick(() => {
this.$refs.dictDataTable.refreshTable()
})
}
}
}
</script>
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-form :inline="true" style="text-align: right;" :model="dictSearchForm">
<el-form-item label="字典名称:">
<el-input
v-model="dictSearchForm.dictName"
clearable
:size="btn_size"
placeholder="请输入字典名称"
></el-input>
</el-form-item>
<el-form-item label="字典类型:">
<el-input
v-model="dictSearchForm.dictType"
clearable
:size="btn_size"
placeholder="请输入字典类型"
></el-input>
</el-form-item>
<el-form-item label="字典状态:">
<el-select
v-model="dictSearchForm.enableStatus"
clearable
:size="btn_size"
placeholder="请选择字典状态"
>
<el-option
v-for="item in $Constants.DICT_STATUS_OPTIONS"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button :size="btn_size" type="primary" @click="reset">重置</el-button>
<el-button type="primary" :size="btn_size" :id="dictTableParams.btnId">查询</el-button>
<el-button type="primary" :size="btn_size" @click="btnClick('create')">新增字典</el-button>
</el-form-item>
</el-form>
<d2-table
ref="dictTable"
:hasNum="false"
:tableParams="dictTableParams"
:searchForm="dictSearchForm"
:getListApi="getListApi"
:pageConf="pageConf"
>
<span slot="status" slot-scope="scope">
<span
class="dot"
:class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
></span>
<span
class="statusText"
>{{ scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
</span>
<span slot="auth-button" slot-scope="scope">
<el-button
v-for="(j, idx) in dictTableParams.tableOption.btnList"
:key="idx"
:type="j.type || 'text'"
:size="btn_size"
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</d2-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>
import { dictApi } from '@/api/dictManage'
export default {
data() {
return {
DICTSTATUS: this.$Constants.DICT_STATUS,
dictSearchForm: {
enableStatus: ''
},
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count'
},
tableData: [
{
id: 1,
dictName: 'dsfd'
}
],
getListApi: dictApi.findDictType,
dictTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableColumns: [
{
label: '字典主键',
prop: 'id'
},
{
label: '字典名称',
prop: 'dictName'
},
{
label: '字典类型',
prop: 'dictType'
},
{
label: '字典备注',
prop: 'remark'
},
{
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
},
{
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 150,
btnList: [
{
name: '列表',
pType: 'list'
},
{
name: '编辑',
pType: 'edit'
},
{
name: '删除',
pType: 'delete'
}
]
}
},
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {
enableStatus: true
},
dictionaryData: [
{ label: '字典名称:', prop: 'dictName', type: 'input', maxlength: 20 },
{
label: '字典类型:',
prop: 'dictType',
type: 'input',
maxlength: 50,
readonly: false
},
{ label: '状态:', prop: 'enableStatus', type: 'switch' },
{
label: '备注:',
prop: 'remark',
type: 'input',
inputText: 'textarea',
maxlength: 200,
showWordLimit: true
}
],
dictionaryRules: {
dictName: [
{ required: true, message: '请输入字典名称', trigger: blur }
],
dictType: [
{ required: true, message: '请输入字典类型', trigger: blur }
],
enableStatus: [{ required: true }]
}
}
},
methods: {
// 确定
handleConfirm() {
console.log(this.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate(valid => {
if (valid) {
const params = JSON.parse(JSON.stringify(this.dictionaryForm))
params.enableStatus = this.dictionaryForm.enableStatus ? 1 : 2
console.log(params)
let api = 'saveDictType'
if (params.id) api = 'updateDictType'
dictApi[api](params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '操作成功!'
})
this.$refs.dictTable.refreshTable()
this.handleClose()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
})
},
// 取消
handleClose() {
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'create':
this.dictionaryDialogTitle = '新增字典'
this.dictionaryForm = {
enableStatus: true
}
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = false
}
})
this.handleClose()
break
case 'edit':
this.dictionaryDialogTitle = '编辑字典'
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = true
}
})
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
window.location.href = `./dictionaryData.html?dictType=${scope.dictType}&enableStatus=${scope.enableStatus}`
window.parent.postMessage({
type: 'location-change',
url: `/dictionaryData.html?dictType=${scope.dictType}&enableStatus=${scope.enableStatus}`
}, '*');
// this.$root.to(
// [
// '账户中心',
// '商户账户管理',
// '字典管理',
// '字典类型管理',
// '*字典数据'
// ],
// { dictType: scope.dictType, enableStatus: scope.enableStatus }
// )
break
}
},
// 编辑触发时间
editEvent(row) {
this.dictionaryForm = JSON.parse(JSON.stringify(row))
this.dictionaryForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictionaryForm.createdDate
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'warning',
callBack: () => {
const params = { id }
console.log(params)
dictApi.deleteDictType(params).then(res => {
if (res.code == 0) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.dictTable.refreshTable()
} else {
this.$message({
type: 'error',
message: res.message
})
}
})
}
}
this.$Common.confirmDialog(tipData)
},
reset() {
this.dictSearchForm = {
enableStatus: ''
}
this.$nextTick(() => {
this.$refs.dictTable.refreshTable()
})
}
}
}
</script>
<style>
.el-table .cell {
line-height: 16px !important;
}
</style>
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<!-- -->
<template>
<div>
<a href="http://www.glsx.com.cn/">广联赛讯主页</a>
</div>
</template>
<script>
export default {
data() {
return {
}
}
}
</script>
<style scoped>
</style>
import App from './app.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div
id="app"
class="outsider"
>
<gl-card class="index-card">
<div slot="header">
广联运营平台
</div>
<ul>
<li>
<a href="../customer/account/index.html">账户管理</a>
</li>
<li>
<a href="../customer/account/add.html">添加账户</a>
</li>
<li>
<a href="../customer/dictionaryManage/index.html">字典类型</a>
</li>
<li>
<a href="../customer/dictionaryManage/dictionaryData.html">字典数据</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>
</template>
<script>
export default {
name: 'App'
}
</script>
<style scoped>
.outsider {
background-color: #fff;
padding: 20px 0px 40px 0px;
/* margin: 20px 20px; */
}
</style>
<!-- 所属客户群体 - 组件 -->
<template>
<div class="flex">
<el-select
v-model="form[targetItem.firstVal]"
:placeholder="'请选择'"
@change="handleFirstChange('')"
>
<el-option
v-for="subItem in optionList"
:key="subItem[targetItem.optionId]"
:label="subItem[targetItem.optionLabel]"
:value="subItem[targetItem.optionId]"
></el-option>
</el-select>
<!-- <el-input
v-show="[3].includes(form[targetItem.firstVal])"
v-model="subVal.input"
placeholder="请输入商户/门店ID"
@change="handleFirstChange"
></el-input> -->
<el-select
v-show="[1, 2, 4].includes(form[targetItem.firstVal])"
v-model="form[targetItem.secondVal]"
:multiple="targetItem.multiple || false"
@change="handleFirstChange"
>
<el-option
v-for="subItem in baseData[attrToList[form[targetItem.firstVal]]]"
:key="subItem.dictValue"
:label="subItem.dictLabel"
:value="subItem.dictValue"
></el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'OwnCusCom',
data() {
return {
// subVal: {
// input: '',
// mutiSelect: []
// },
// 下拉框对应List
attrToList: {
'1': 'accounTypetList',
'2': 'accountLevelList',
'4': 'accountRoleList'
}
}
},
props: {
targetItem: {
type: Object,
default: () => { }
},
form: {
type: Object,
default: () => { }
},
optionList: {
type: Array,
default: () => []
},
baseData: {
type: Object,
default: () => { }
}
},
mounted() {
// console.log(this.targetItem)
},
methods: {
handleFirstChange(val) {
// if (!val) {
// this.subVal = {
// input: '',
// mutiSelect: []
// }
// }
this.$emit('changeSecond', { val: val, targetItem: this.targetItem })
}
}
}
</script>
<style scoped>
.flex {
display: flex;
}
</style>
\ No newline at end of file
<!-- 树形搜索 -->
<template>
<div>
<el-popover
ref="popover"
placement="bottom-start"
trigger="click"
v-model="popoverVisible"
:disabled="targetItem.isDisabled"
@show="onShowPopover"
@hide="onHidePopover"
>
<el-tree
ref="tree"
class="select-tree"
highlight-current
default-expand-all
node-key="id"
:expand-on-click-node="isExpand"
:style="`min-width: ${treeWidth}`"
:data="treeData"
:current-node-key="form[targetItem.name]"
:props="defaultProps"
:filter-node-method="handleFilterNode"
@current-change="handleNodeClick"
></el-tree>
<el-input
slot="reference"
ref="input"
v-model="form[targetItem.nameLabel]"
clearable
:disabled="targetItem.isDisabled"
:style="`width: ${width}px`"
:class="{ 'rotate': popoverVisible }"
suffix-icon="el-icon-arrow-down"
:placeholder="'请选择' + targetItem.label"
@change="handleClear"
>
</el-input>
</el-popover>
</div>
</template>
<script>
export default {
name: 'SelectTree',
data() {
return {
isExpand: false,
// 树状菜单显示状态
popoverVisible: false,
treeWidth: 'auto'
}
},
props: {
// 输入框宽度
width: String,
form: {
type: Object,
default: () => { }
},
targetItem: {
type: Object,
default: () => { }
},
treeData: {
type: Array,
default: () => []
},
defaultProps: {
type: Object,
default: () => ({
parent: 'parentId',
value: 'id',
label: 'menuName',
children: 'childlist'
})
}
},
watch: {
form(val) {
if (this.form[this.targetItem.name]) {
this.form[this.targetItem.nameLabel] = this.queryTree(this.treeData, this.form[this.targetItem.name])
this.$nextTick().then(() => {
this.$refs.tree.setCheckedKeys([this.form[this.targetItem.name]])
})
}
}
},
created() {
// 获取输入框宽度同步至树状菜单宽度
this.$nextTick(() => {
this.treeWidth = `${(this.width || this.$refs.input.$refs.input.clientWidth) - 24}px`
})
},
mounted() {
if (this.form[this.targetItem.name]) {
// console.log(this.treeData)
// console.log(this.form)
this.form[this.targetItem.nameLabel] = this.queryTree(this.treeData, this.form[this.targetItem.name])
this.$nextTick().then(() => {
this.$refs.tree.setCheckedKeys([this.form[this.targetItem.name]])
})
}
},
methods: {
// 显示时触发
onShowPopover() {
this.popoverVisible = true
this.$refs.tree.filter(false)
},
// 隐藏时触发
onHidePopover() {
this.popoverVisible = false
},
// 树节点过滤方法
handleFilterNode(query, data) {
if (!query) return true
return data[this.defaultProps.label].indexOf(query) !== -1
},
handleNodeClick(val) {
this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
this.onHidePopover()
},
handleClear(val) {
this.$emit('selected', { val: val, targetItem: this.targetItem, formName: this.targetItem.formName })
window.event.stopPropagation()
},
// 搜索树状数据中的 ID
queryTree(tree, id) {
let stark = []
stark = stark.concat(tree)
while (stark.length) {
const temp = stark.shift()
if (temp[this.defaultProps.children]) {
stark = stark.concat(temp[this.defaultProps.children])
}
if (temp[this.defaultProps.value] === id) {
return temp[this.defaultProps.label]
}
}
return
}
}
}
</script>
<style>
.el-input.el-input--suffix.rotate .el-input__suffix .el-icon-arrow-down {
transform: rotate(-180deg);
}
.select-tree {
max-height: 400px;
overflow-y: scroll;
}
</style>
\ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
// import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
import Vue from 'vue'
const Apps = require.context('./', false, /\.vue$/)
Apps.keys().map(item => {
base.getConfig().then(data => {
console.log(data);
const {
vue,
config
} = data
Vue.prototype.fileUploadURL = config.axios.fileUploadURL
vue.use(GlsxVueCommon, config)
base.render(Apps(item).default)
})
})
// base.getConfig().then(data => {
// const { vue, config } = data
// vue.use(GlsxVueCommon, config)
// base.render(App)
// })
// 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)
})
})
<!-- 产品列表 -->
<template>
<div class="prodect-list">
<el-row>
<el-col :span="12" style="padding-top: 16px;">
<el-button icon="el-icon-plus" :size="btn_size" type="primary" @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="btn_size" type="primary" @click="reset">重置</el-button>
<el-button :size="btn_size" 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"
slot-scope="scope"
type="text"
@click="handleProEdit(scope.scope)"
>修改</el-button>
</d2-table>
<glsx-dialog
:title="editForm.productCode ? '编辑产品' : '创建产品'"
:isVisible="editVisible"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
>
<glsx-combi-form
ref="editFormRef"
labelWidth="100px"
:formRef="editChildRef"
:formObj="editForm"
:formData="editFormData"
:formRules="editRule"
></glsx-combi-form>
</glsx-dialog>
</div>
</template>
<script>
import _ from 'lodash'
import { productApi, baseApi } 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: 'pageNum',
totalCount: 'data.count'
},
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
tableOption: true,
tableColumns: [
{
label: '产品名称',
prop: 'productName'
},
{
label: '类型',
prop: 'productType',
formatter: cellValue => {
return this.baseData.productTypeList.find(
item => item.dictValue === cellValue.productType
).dictLabel
}
},
{
label: '产品编号',
prop: 'productCode'
},
{
label: '产品说明',
prop: 'productDetail'
},
{
label: '创建时间',
prop: 'createdTime'
}
]
},
// 弹窗
title: '创建产品',
editVisible: false,
editChildRef: 'editChildRef',
editForm: {
productName: '',
productType: '',
productDetail: '',
productAddress: ''
},
editRule: {
productName: [
{ required: true, message: '请输入产品名称', trigger: 'blur' }
],
productType: [
{ required: true, message: '请选择产品类型', trigger: 'change' }
],
productAddress: [
{ required: true, message: '请输入产品地址', trigger: 'blur' },
{
required: true,
validator: (rule, value, callback) => {
return /[\u4E00-\u9FA5]+/.test(value)
? callback('只能输入字母、数字和符号')
: callback()
},
trigger: 'blur'
}
]
},
editFormData: [
{
label: '产品名称',
name: 'productName',
type: 'input',
maxlength: 15,
width: '300px'
},
{
label: '产品类型',
name: 'productType',
type: 'select',
width: '300px',
optionList: [],
optionId: 'dictValue',
optionLabel: 'dictLabel',
optionsName: 'productTypeList'
},
{
label: '产品说明',
name: 'productDetail',
type: 'input',
inputType: 'textarea',
maxlength: 50,
showLimit: true,
width: '300px'
},
{
label: '产品地址',
name: 'productAddress',
type: 'input',
maxlength: 50,
width: '300px'
}
],
// 基本数据
baseData: {
productTypeList: []
}
}
},
mounted() {
this.getProductType()
},
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)
}
}
})
},
getProductType() {
baseApi.getAllDictApi({ dictType: 'product_type' }).then(res => {
this.baseData.productTypeList = res.data
this.getOptionsList('editFormData', false)
})
},
handleAdd() {
this.editFormData[
this.editFormData.findIndex(item => item.name === 'productType')
].isDisabled = !!this.editForm.id
this.editVisible = !this.editVisible
this.$refs.editFormRef.$refs[this.editChildRef] &&
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate()
},
handleProEdit(row) {
this.editForm = _.clone(row)
// console.log(row)
this.handleAdd()
},
handleEditClose() {
this.editForm = {
productName: '',
productType: '',
productDetail: '',
productAddress: ''
}
this.handleAdd()
},
handleEditConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
console.log(this.editForm)
var apiName = this.editForm.productCode
? 'updateProApi'
: 'saveProApi'
productApi[apiName](this.editForm)
.then(res => {
if (res.code === '0') {
this.notice.okTips()
this.handleEditClose()
this.keyDowmGetList()
} else {
this.notice.errorTips(res.message)
}
})
.catch(errMsg => {
this.notice.errorTips(errMsg)
})
}
})
},
reset() {
this.searchForm = {}
this.$nextTick(() => {
this.$refs.productTable.refreshTable()
})
}
}
}
</script>
<style>
.prodect-list .el-textarea__inner {
height: 80px;
}
</style>
\ No newline at end of file
File mode changed
File mode changed
module.exports = {
index: '主页',
'customer/glsx': '广联赛讯'
}
'use strict'
const titles = require('./title.js')
const glob = require('glob')
const pages = {}
// const mode = process.env.NODE_ENV || 'development'
glob.sync('./src/views/**/app.js').forEach(path => {
const chunk = path.split('./src/views/')[1].split('/app.js')[0]
pages[chunk] = {
entry: path,
template: 'public/index.html',
title: titles[chunk],
chunks: ['chunk-vendors', 'chunk-common', chunk]
}
})
module.exports = {
pages,
chainWebpack: config => config.plugins.delete('named-chunks'),
configureWebpack: (config) => {
// config.devtool = (mode === 'development') ? 'inline-source-map' : false
// config.mode = mode
},
devServer: {
port: 8085,
host: '0.0.0.0',
open: true,
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
pathRewrite: { '^/api': '' }
}
}
}
}
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!