Commit c47521bd by 前端

Merge branch 'dev_v4.5.2' into 'develop'

Dev v4.5.2

See merge request !13
2 parents 693677be fb727502
Showing 79 changed files with 2158 additions and 1315 deletions
......@@ -22,59 +22,97 @@ module.exports = {
echarts: false
},
rules: {
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'arrow-spacing': [
2,
{
before: true,
after: true
}
],
eqeqeq: 'off',
// 'no-eval': ['error', { allowIndirect: false }], // default is false
'no-eval': 'off', // default is false
// allow async-await
'generator-star-spacing': 'off',
// 'block-spacing': [2, 'always'],
'brace-style': [
2,
'1tbs',
{
allowSingleLine: true
}
],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-spacing': [
2,
{
before: false,
after: true
}
],
'comma-style': [2, 'last'],
'curly': [2, 'multi-line'],
curly: [2, 'multi-line'],
'dot-location': [2, 'property'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
indent: [
2,
2,
{
SwitchCase: 1
}
],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'keyword-spacing': [
2,
{
before: true,
after: true
}
],
'new-cap': [
2,
{
newIsCap: true,
capIsNew: false
}
],
'no-extra-parens': [2, 'functions'],
'no-floating-decimal': 2,
'no-multi-spaces': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-multiple-empty-lines': [
2,
{
max: 1
}
],
'no-trailing-spaces': 2,
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
semi: [2, 'never'],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
// 'space-before-function-paren': [2, 'never'],
'space-before-function-paren': 0,
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'space-unary-ops': [
2,
{
words: true,
nonwords: false
}
],
'spaced-comment': [2, 'always'],
'prefer-const': 2
}
};
}
......@@ -2,4 +2,8 @@
[D2Admin](https://github.com/d2-projects/d2-admin) simplified version of the start template, delete all the sample code in the full version, retain all core functions.
[Gitee](https://gitee.com/fairyever/d2-admin-start-kit)
\ No newline at end of file
[Gitee](https://gitee.com/fairyever/d2-admin-start-kit)
从 develop 分支号 dev_v4.4.0 本来用来开发审核以及报表功能版本, wangql_dev_v4.4.0 已开发部分对应需求,未往 dev_v4.4.0 版本合并,因此目前 dev_v4.4.0 分支无用
从 develop 拉分支号 dev_v4.5.1 用来开发转化加 V4.5.0 功能需求
从 dev_v4.5.0 拉分支号 dev_v4.5.2 用来新建菜单对应现在的虚拟对公账户功能,以前的菜单保留以防万一
No preview for this file type
......@@ -4938,6 +4938,22 @@
"safer-buffer": "^2.1.0"
}
},
"echarts": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.2.tgz",
"integrity": "sha512-LWCt7ohOKdJqyiBJ0OGBmE9szLdfA9sGcsMEi+GGoc6+Xo75C+BkcT/6NNGRHAWtnQl2fNow05AQjznpap28TQ==",
"requires": {
"tslib": "2.3.0",
"zrender": "5.3.1"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
},
"editorconfig": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
......@@ -16005,6 +16021,21 @@
"dev": true
}
}
},
"zrender": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.3.1.tgz",
"integrity": "sha512-7olqIjy0gWfznKr6vgfnGBk7y4UtdMvdwFmK92vVQsQeDPyzkHW1OlrLEKg6GHz1W5ePf0FeN1q2vkl/HFqhXw==",
"requires": {
"tslib": "2.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
}
}
}
{
"name": "dj-car-life-system",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"start": "npm run serve",
......@@ -16,6 +17,7 @@
"better-scroll": "^1.15.2",
"dayjs": "^1.8.12",
"default-passive-events": "^2.0.0",
"echarts": "^5.3.2",
"element-ui": "^2.13.1",
"file-saver": "^2.0.5",
"flex.css": "^1.1.7",
......@@ -34,7 +36,7 @@
"vue": "^2.6.10",
"vue-i18n": "^8.14.0",
"vue-qr": "^2.5.0",
"vue-router": "^3.0.3",
"vue-router": "3.0.5",
"vuex": "^3.0.1",
"xlsx": "^0.16.9"
},
......
import request from './request'
const path = 'dj.api.'
// const path = 'dj.api.'
const path2 = 'dj.api.smartcarlife.'
export function getTodayInvite(data) {
......@@ -45,4 +45,4 @@ export function getIncomeFlowList(data) {
export function getIncomeProductList(data) {
data.method = `${path2}workbench.statistics.goods.grossProfitRadio`
return request(data)
}
\ No newline at end of file
}
......@@ -101,4 +101,10 @@ export function moneyValidApi(data) {
export function getWsUrlApi(data) {
data.method = `${path}user.getWsUrl`
return request(data)
}
\ No newline at end of file
}
// 商户管理 - 查看详情 - 修改入驻日期
export function entrydateUpdate(data) {
data.method = `${path2}entrydate.update`
return request(data, 'post')
}
......@@ -15,12 +15,24 @@ export function registerYseMerchantApi(data) {
return request(data, 'post')
}
// 注册线下商户_新版 registerYseMerchantApiNew
export function registerYseMerchantApiNew(data) {
data.method = `${djPath}yseMerchantOffline.registerNew`
return request(data, 'post')
}
// 注册线下商户-存草稿
export function draftYseMerchantApi(data) {
data.method = `${djPath}yseMerchantOffline.saveDrafts`
return request(data, 'post')
}
// 注册线下商户-存草稿_新版
export function draftYseMerchantApiNew(data) {
data.method = `${djPath}yseMerchantOffline.saveDraftsNew`
return request(data, 'post')
}
// 获取商户虚拟对公账户详情
export function getDetailApi(data) {
data.method = `${djPath}yseMerchantOffline.getDetail`
......@@ -38,3 +50,20 @@ export function getMerchantPageSearch(data) {
data.method = `${path}page.search`
return request(data, 'post')
}
// 下载账户合同
export function downloadContract(data) {
data.method = `${path}yseMerchantOffline.downSign`
return request(data, 'post')
}
// 获取省市区信息
export function getAreaInfoApi(data) {
data.method = `${djPath}yseMerchantOffline.getAreaInfo`
return request(data, 'post')
}
// 根据开户支行编号查询区域信息
export function getAreaInfoByOpenAccBankTypeApi(data) {
data.method = `${djPath}yseMerchantOffline.getAreaInfoByOpenAccBankType`
return request(data, 'post')
}
......@@ -25,22 +25,18 @@ const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => {
* mock - url = params.method
* 调后端接口 - url = ''
*/
const url = params.method // ''
const url = params.method
// console.log(url)
/**
* 调后端接口,请使用以下代码。
*/
var reqData =
// baseURL: process.env.VUE_APP_API + '?method=' + params.method,
method === RequestMethods.POST
? {
// baseURL: process.env.VUE_APP_API + '?method=' + params.method,
baseURL: '/',
data: sign(params, noSignAttr)
}
: {
params: sign(params, noSignAttr)
}
console.log(method === RequestMethods.POST)
console.log(url)
? { baseURL: '/', data: sign(params, noSignAttr) }
: { params: sign(params, noSignAttr) }
// console.log(method === RequestMethods.POST)
// console.log(url)
return axios({
url,
method,
......
......@@ -41,4 +41,4 @@ export function GETYQMERCHANTCONFIGDETAIL(data) {
export function UPDATEYQMERCHANTCONFIG(data) {
data.method = `dj.api.smarcarlife.yqMerchantConfig.modify`
return request(data, 'post')
}
\ No newline at end of file
}
......@@ -9,7 +9,7 @@ import request from './request'
import RequestMethods from './request.methods'
// 用户相关
const USER_PATH = 'dj.api.'
// 角色相关
// 角色相关
const ROLE_PATH = 'fims.role.'
export const LOGIN_URL = `${USER_PATH}user.login`
......@@ -23,23 +23,23 @@ export const ROLE_LIST_URL = `${ROLE_PATH}list`
export function AccountLogin(data) {
data.method = LOGIN_URL
return request(data)
// return new Promise(resolve => {
// resolve({
// roleId: 7,
// roleType: 2,
// mobile: '15234057707',
// userName: 'wxw',
// loginName: 'foutouren',
// authes: []
// // authes: [{
// // authId: '10101',
// // parentId: '101'
// // }, {
// // authId: '102',
// // parentId: '0'
// // }]
// })
// })
// return new Promise(resolve => {
// resolve({
// roleId: 7,
// roleType: 2,
// mobile: '15234057707',
// userName: 'wxw',
// loginName: 'foutouren',
// authes: []
// // authes: [{
// // authId: '10101',
// // parentId: '101'
// // }, {
// // authId: '102',
// // parentId: '0'
// // }]
// })
// })
}
// 选择账号
......@@ -199,4 +199,4 @@ export function RoleList(data = {}) {
export function RoleDetail(data = {}) {
data.method = `${ROLE_PATH}detail`
return request(data, RequestMethods.GET)
}
\ No newline at end of file
}
/*
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2021-06-07 16:30:53
*/
import request from './request'
import RequestMethods from './request.methods'
export const BASE_DATA_URL = 'fims.configuration.from.conftype'
const path = 'dj.api.'
// 获取商品分类列表
export function getProductType(data) {
data.method = `${path}goods.type.list`
return request(data)
}
// 获取渠道列表
export function getChannelType(data) {
data.method = `${path}channel.type.list`
return request(data)
}
// 图片上传
export function uploadImg(data) {
data.method = `${path}common.uploadImg`
return request(data, RequestMethods.POST, ['file'])
}
// 图片识别
export function imgRecognitionApi(data) {
data.method = `${path}common.ocr.recognition`
return request(data, RequestMethods.POST)
}
// 银行列表
export function getBankListApi(data) {
data.method = `${path}yseBankInfo.bankList`
return request(data, RequestMethods.POST)
}
// 银行列表-支行
export function getYseBankListApi(data) {
data.method = `${path}yseBankInfo.listWithPage`
return request(data, RequestMethods.POST)
}
// 给指定号码发送验证码
export function sendToSmsCodeApi(data) {
data.method = `${path}smartcarlife.sms.sendSmsCode`
return request(data, RequestMethods.POST)
}
// 获取配置列表
export function commonConfigApi(data) {
data.method = `${path}common.config.list`
return request(data, RequestMethods.POST)
}
/*
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2021-06-07 16:30:53
*/
import request from './request'
import RequestMethods from './request.methods'
export const BASE_DATA_URL = 'fims.configuration.from.conftype'
const path = 'dj.api.'
// 获取商品分类列表
export function getProductType(data) {
data.method = `${path}goods.type.list`
return request(data)
}
// 获取渠道列表
export function getChannelType(data) {
data.method = `${path}channel.type.list`
return request(data)
}
// 图片上传
export function uploadImg(data) {
data.method = `${path}common.uploadImg`
return request(data, RequestMethods.POST, ['file'])
}
// 图片识别
export function imgRecognitionApi(data) {
data.method = `${path}common.ocr.recognition`
return request(data, RequestMethods.POST)
}
// 银行列表
export function getBankListApi(data) {
data.method = `${path}yseBankInfo.bankList`
return request(data, RequestMethods.POST)
}
// 银行列表-支行
export function getYseBankListApi(data) {
data.method = `${path}yseBankInfo.listWithPage`
return request(data, RequestMethods.POST)
}
// 给指定号码发送验证码
export function sendToSmsCodeApi(data) {
data.method = `${path}smartcarlife.sms.sendSmsCode`
return request(data, RequestMethods.POST)
}
// 获取配置列表
export function commonConfigApi(data) {
data.method = `${path}common.config.list`
return request(data, RequestMethods.POST)
}
......@@ -328,7 +328,7 @@ export function limitPrice(
regRule
) {
var reg = {
priceReg: /^\d[\d\.]*$/,
priceReg: /^\d[\d\.]*$/, // eslint-disable-line
numReg: /^[1-9]\d*$/
}
regRule = regRule || 'priceReg'
......@@ -415,7 +415,7 @@ export const afterTodayOptions = {
// 'N':'不扣水续费'
// }
//财务列表-订单表-表头原始数据
// 财务列表-订单表-表头原始数据
export const orderTableHead = [
{
name: '序号',
......@@ -465,7 +465,7 @@ export const orderTableHead = [
prop: 'orderType',
sort: 21,
formatter: function(row, column) {
let orderTypeList = [
const orderTypeList = [
{
confId: '1',
confLabel: '正常'
......@@ -487,7 +487,7 @@ export const orderTableHead = [
confLabel: '未收款'
}
]
let o = orderTypeList.find(k => +k.confId === row.orderType)
const o = orderTypeList.find(k => +k.confId === row.orderType)
return o ? o.confLabel : '-'
}
}
......@@ -688,7 +688,7 @@ export const billsTableHead = [
prop: 'divisionType',
sort: 5,
formatter: function(row, column) {
let divisionTypeList = [
const divisionTypeList = [
{
confId: '1',
confLabel: '线下对账'
......@@ -698,7 +698,7 @@ export const billsTableHead = [
confLabel: '线上分账'
}
]
let o = divisionTypeList.find(k => {
const o = divisionTypeList.find(k => {
return k.confId == row.divisionType
})
return o ? o.confLabel : '-'
......@@ -720,7 +720,7 @@ export const billsTableHead = [
prop: 'odDivisionStatus',
sort: 19,
formatter: function(row, column) {
let ODDIVISIONSTATUS = {
const ODDIVISIONSTATUS = {
1: '待分账',
2: '分账中',
3: '分账成功',
......@@ -737,7 +737,7 @@ export const billsTableHead = [
prop: 'deductChargeFlag',
sort: 20,
formatter: function(row, column) {
let DEDUCTCHARGEFLAG = {
const DEDUCTCHARGEFLAG = {
Y: '扣除手续费(按0.6%的标准)',
N: '不扣水续费'
}
......
// 将该代码定义为一个js文件
const resize = {
bind(el, binding) {
let width = ''
let height = ''
function isResize() {
const style = document.defaultView.getComputedStyle(el)
if (width !== style.width || height !== style.height) {
binding.value()
}
width = style.width
height = style.height
}
el._vueSetInterval_ = setInterval(isResize, 300)
},
unbind(el) {
clearInterval(el._vueSetInterval_)
}
}
export default resize
import Vue from 'vue'
import { Message, MessageBox, Loading } from 'element-ui';
// import Vue from 'vue'
import { Message, MessageBox, Loading } from 'element-ui'
import moment from 'moment'
let loadingInstance = ''
export const Util = {
/**
* 简单alert
* title 标题
......@@ -31,25 +29,25 @@ export const Util = {
callback: function(action, done) {
if (action == 'confirm') {
if (options.success) {
(options.success)(done)
options.success(done)
}
} else {
console.log(done);
console.log(done)
// done()
}
}
});
})
/* Vue.$vux.alert.show({
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
},
/**
......@@ -61,8 +59,7 @@ export const Util = {
type: options.type || 'error',
duration: options.time || 2000,
onClose: options.onClose || ''
});
})
},
/**
......@@ -83,108 +80,110 @@ export const Util = {
loading: function(message) {
loadingInstance = Loading.service({
text: message || '加载中...'
});
})
},
/**
* 关闭loading
*/
closeLoading: function() {
loadingInstance.close();
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);
const 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);
const reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel)
},
/**
* 是否特殊字符
*/
isSpecialLetter: function(str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]");
return reg.test(str);
const reg = new RegExp(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
)
return reg.test(str)
},
/**
* 只能输入英文字母和数字,不能输入中文
*/
validationInput: function(str) {
let reg = /[^\w\.\/]/ig;
return reg.test(str);
const reg = /[^\w\.\/]/gi // eslint-disable-line
return reg.test(str)
},
/**
* 获取当前时间
*/
getCurrentDate: function() {
let time = new Date();
let y = time.getFullYear();
let m = time.getMonth() + 1;
let d = time.getDate();
const time = new Date()
const y = time.getFullYear()
const m = time.getMonth() + 1
const 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;
    }
  },
* 获取浏览器参数
*/
getUrlParams: function(name) {
const vars = []
let hash
const oParams = {}
const 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;
const date1 = new Date()
const date2 = new Date(date1)
let time = 30
if (day) {
time = day;
time = day
}
date2.setDate(date1.getDate() + time);
date2.setDate(date1.getDate() + time)
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate();
const _date =
date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
};
}
},
/**
* 日期格式转换
*/
......@@ -213,7 +212,7 @@ export const Util = {
if (str.length > m) {
n = str.slice(0, m) + '...'
}
return n
},
......@@ -223,7 +222,7 @@ export const Util = {
* console.log(bar===foo) false
* @param {*} obj
*/
deepClone: function (obj) {
deepClone: function(obj) {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
......@@ -243,12 +242,11 @@ export const Util = {
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
},
}
}
export const showModal = Util.msg
export const showToast = Util.Info
export const showLoading = Util.loading
export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
\ No newline at end of file
export const deepClone = Util.deepClone
<template>
<el-dialog id="baseDialog"
top="30vh"
:close-on-click-modal="true"
:close-on-press-escape="true"
:title="dialogConfig.title"
:width="dialogConfig.width"
:visible.sync="visible"
:show-close="config.showClose"
:append-to-body="config.appendToBody">
<slot></slot>
<div slot="footer"
v-if="config.isShowFooter">
<el-button type="danger"
@click="confirmBtn">
{{config.confirm_name}}
</el-button>
<el-button @click="visible = false">
{{ config.cancel_name }}
</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'baseDialog',
props: {
dialogConfig: {
required: false,
type: Object,
default: function () {
return {
title: '提示',
width: '480px'
}
}
},
config: {
required: false,
type: Object,
default: function () {
return {
showClose: true,
appendToBody: false, // 是否将自身插入至 body 元素,有嵌套的弹窗时一定要设置
isShowFooter: true,
cancel_name: '取 消',
confirm_name: '确 定'
}
}
},
isShow: {
// 弹窗是否展示
type: Boolean,
default: false
}
// width: {
// //弹窗宽度
// type: String,
// default: '',
// },
// cancel_name: {
// //取消按钮名称
// type: String,
// default: '取 消',
// },
// confirm_name: {
// //确定按钮名称
// type: String,
// default: '确 定',
// },
// isShowFooter: {
// //是否自定底部
// type: Boolean,
// default: true,
// },
// closeClick: {
// type: Boolean,
// default: false,
// },
// appendToBody: {
// // 是否将自身插入至 body 元素,有嵌套的弹窗时一定要设置
// type: Boolean,
// default: false,
// },
},
data() {
return {}
},
computed: {
visible: {
get() {
return this.isShow
},
set(val) {
this.$emit('update:isShow', false)
}
}
},
methods: {
confirmBtn() {
// 触发保存
this.$emit('handleClick')
}
},
created() {
// console.log('baseDialog')
},
mounted() { }
}
</script>
<style scoped lang="scss">
::v-deep .el-dialog {
// height: 90vh;
border-radius: 6px;
// padding: 0;
overflow: hidden;
.el-dialog__header {
// box-shadow: 0px 0px 5px 0px rgba(136, 152, 157, 0.3);
border-bottom: solid 1px #e6e6e6;
border-radius: 6px 6px 0px 0px;
padding: 18px 20px 18px 25px;
.el-dialog__title {
// color: #212121;
color: #333333;
font-family: PingFangSC-Medium;
font-size: 20px;
font-weight: 600;
// font-weight: 16px;
}
.el-dialog__close {
color: #666;
font-weight: 600;
font-size: 20px;
}
}
.el-dialog__body {
box-sizing: border-box;
// padding-left: 25px;
padding: 15px 20px 30px;
color: #333;
max-height: calc(100% - 121px);
// height: calc(100% - 121px);
}
.roleTitle {
margin-right: 40px;
}
}
</style>
export default {
name: 'AuthButton',
props: {
label: {
type: String,
default: ''
},
size: {
type: String,
default: 'mini'
},
// type: {
// type: String,
// default: 'text'
// },
category: {
type: String,
default: 'operation'
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
id: {
type: String,
default: null
},
accept: {
type: String,
default: null
},
mapping: {
type: Object,
default: null
},
showBtnIds: {
type: Array,
default: []
},
data: Object
},
functional: true, // 开启函数化组件
render: (h, ctx) => {
const _this = ctx.parent // 获取 vue this 实例
// console.log(ctx);
/**
* 获取传入参数
* category 非必填 button 类别 暂时两种 1 表格操作:operation ,2 Button 按钮: action 默认 operation ----- route 中不标明 视为默认值 operation
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮
* size 按钮样式,默认mini
* showBtnIds 按需显示按钮
*/
const {
category,
data,
mapping,
label,
size,
showBtnIds
} = ctx.props
let curBtns = []
/**
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
* @param {*} btn
*/
const filter = btn => mapping ? mapping[data[mapping['field']]].includes(btn.label) : true
const $store = _this.$store.getters['d2admin/auth/curBtns']
if (!$store) return h('div')
if (label) { // 指定label
const __item = $store.find(btn => (btn.label === label) && filter(btn))
__item && curBtns.push(__item)
} else {
/**
* 拿到当前模块(页面) 所拥有按钮列表 过滤type属性 与 映射关系 返回需要显示的按钮列表
*/
curBtns = $store.filter(btn => {
if (category === 'operation') {
return (btn.category === 'operation' || !btn.category) && filter(btn)
} else if (!category) { // 未指定类别
return !btn.category && filter(btn)
}
return (btn.category === category) && filter(btn)
})
}
if (curBtns.length === 0) return h('div')
const __aBtns = []
/**
* 循环最终显示的按钮列表
* 并渲染到页面
*/
curBtns = showBtnIds.length ? curBtns.filter(item => showBtnIds.includes(item.authId)) : curBtns
curBtns.forEach(btn => {
// var judgeRes = data ? (data.yqMerchantId === _this.$store.state.d2admin.user.info.detail.merchantId) : true
// var isShow = !btn.judgeShow ? true : judgeRes
// if ((btn.category === 'Button') || (data && isShow)) {
__aBtns.push(h('el-button', {
props: {
type: btn.type || (btn.category === 'Button' ? '' : 'text'),
icon: btn.icon ? `el-icon-${btn.icon}` : '',
size: size,
disabled: btn.ruleObj ? (btn.ruleObj.hasOwnProperty('disabledStatusList') ? btn.ruleObj.disabledStatusList.includes(data[btn.ruleObj.attr]) : false) : false
},
style: {
color: btn.color
},
on: {
click: (e) => btn.handle && _this[btn.handle](data, e)
}
}, [btn.ruleObj ? btn.ruleObj.rule[data[btn.ruleObj.attr]] : btn.label]))
// }
})
return h('span', {}, [...__aBtns, ctx.children])
}
}
export default {
name: 'AuthButton',
props: {
label: {
type: String,
default: ''
},
size: {
type: String,
default: 'mini'
},
// type: {
// type: String,
// default: 'text'
// },
category: {
type: String,
default: 'operation'
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
id: {
type: String,
default: null
},
accept: {
type: String,
default: null
},
mapping: {
type: Object,
default: null
},
showBtnIds: {
type: Array,
// props类型为Object/Array 使用函数方法解决
default: () => []
},
data: Object
},
functional: true, // 开启函数化组件
render: (h, ctx) => {
const _this = ctx.parent // 获取 vue this 实例
// console.log(ctx);
/**
* 获取传入参数
* category 非必填 button 类别 暂时两种 1 表格操作:operation ,2 Button 按钮: action 默认 operation ----- route 中不标明 视为默认值 operation
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮
* size 按钮样式,默认mini
* showBtnIds 按需显示按钮
*/
const { category, data, mapping, label, size, showBtnIds } = ctx.props
let curBtns = []
/**
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
* @param {*} btn
*/
const filter = btn =>
mapping ? mapping[data[mapping['field']]].includes(btn.label) : true
const $store = _this.$store.getters['d2admin/auth/curBtns']
if (!$store) return h('div')
if (label) {
// 指定label
const __item = $store.find(btn => btn.label === label && filter(btn))
__item && curBtns.push(__item)
} else {
/**
* 拿到当前模块(页面) 所拥有按钮列表 过滤type属性 与 映射关系 返回需要显示的按钮列表
*/
curBtns = $store.filter(btn => {
if (category === 'operation') {
return (btn.category === 'operation' || !btn.category) && filter(btn)
} else if (!category) {
// 未指定类别
return !btn.category && filter(btn)
}
return btn.category === category && filter(btn)
})
}
if (curBtns.length === 0) return h('div')
const __aBtns = []
/**
* 循环最终显示的按钮列表
* 并渲染到页面
*/
curBtns = showBtnIds.length
? curBtns.filter(item => showBtnIds.includes(item.authId))
: curBtns
curBtns.forEach(btn => {
// var judgeRes = data ? (data.yqMerchantId === _this.$store.state.d2admin.user.info.detail.merchantId) : true
// var isShow = !btn.judgeShow ? true : judgeRes
// if ((btn.category === 'Button') || (data && isShow)) {
__aBtns.push(
h(
'el-button',
{
props: {
type: btn.type || (btn.category === 'Button' ? '' : 'text'),
icon: btn.icon ? `el-icon-${btn.icon}` : '',
size: size,
disabled: btn.ruleObj
? btn.ruleObj.hasOwnProperty('disabledStatusList')
? btn.ruleObj.disabledStatusList.includes(
data[btn.ruleObj.attr]
)
: false
: false
},
style: {
color: btn.color
},
on: {
click: e => btn.handle && _this[btn.handle](data, e)
}
},
[btn.ruleObj ? btn.ruleObj.rule[data[btn.ruleObj.attr]] : btn.label]
)
)
// }
})
return h('span', {}, [...__aBtns, ctx.children])
}
}
<template>
<div class="d2-container-full">
<!-- <el-scrollbar> -->
<div v-if="$slots.header" class="d2-container-full__header" ref="header" :class="this.active?'active':'close'">
<slot name="header" />
<d2-header-switch />
</div>
<div class="d2-container-full__body" ref="body">
<slot />
</div>
<div v-if="$slots.footer" class="d2-container-full__footer" ref="footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
</div>
</template>
<script>
import scroll from './mixins/normal'
export default {
name: 'd2-container-full',
mixins: [scroll],
components: {
// d2HeaderSwitch: () => import('./d2-header-switch.vue')
},
data() {
return {
oHeaderStyle: {
padding: '20px 20px 0 20px'
}
}
},
computed: {
active() {
return this.$store.state.d2admin.tsearch.active
}
},
mounted() {
// 增加滚动事件监听
this.addScrollListener()
},
beforeDestroy() {
// 移除滚动事件监听
this.removeScrollListener()
}
}
</script>
<style lang="scss">
.d2-container-full {
.d2-container-full__header {
position: relative;
transition: all .2s ease;
&.close{
height: 0;
padding: 0 20px !important;
form{
opacity: 0;
}
border-bottom-color:rgba(0,0,0,0) !important;
}
.el-form-item{
margin-bottom: 4px;
}
}
}
//滚动条的宽度
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
//滚动条的滑块
::-webkit-scrollbar-thumb {
background-color: #a1a3a9;
border-radius: 3px;
}
</style>
<template>
<div class="d2-container-full">
<!-- <el-scrollbar> -->
<div v-if="$slots.header"
class="d2-container-full__header"
ref="header"
:class="this.active?'active':'close'">
<slot name="header" />
<d2-header-switch />
</div>
<div class="d2-container-full__body"
ref="body">
<slot />
</div>
<div v-if="$slots.footer"
class="d2-container-full__footer"
ref="footer">
<slot name="footer" />
</div>
<!-- </el-scrollbar> -->
</div>
</template>
<script>
import scroll from './mixins/normal'
export default {
name: 'd2-container-full',
mixins: [scroll],
components: {
d2HeaderSwitch: () => import('./d2-header-switch.vue')
},
data() {
return {
oHeaderStyle: {
padding: '20px 20px 0 20px'
}
}
},
computed: {
active() {
return this.$store.state.d2admin.tsearch.active
}
},
mounted() {
// 增加滚动事件监听
this.addScrollListener()
},
beforeDestroy() {
// 移除滚动事件监听
this.removeScrollListener()
}
}
</script>
<style lang="scss">
.d2-container-full {
.d2-container-full__header {
position: relative;
transition: all 0.2s ease;
&.close {
height: 0;
padding: 0 20px !important;
form {
opacity: 0;
}
border-bottom-color: rgba(0, 0, 0, 0) !important;
}
.el-form-item {
margin-bottom: 4px;
}
}
}
//滚动条的宽度
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
//滚动条的滑块
::-webkit-scrollbar-thumb {
background-color: #a1a3a9;
border-radius: 3px;
}
</style>
<template>
<div
v-if="show"
class="d2-header-switch"
:class="{ 'd2-header-switch--active': isActive }"
@click="handleClick">
<d2-el-icon :name="name"/>
<li :class="$store.state.d2admin.tsearch.active?'fa fa-compress':'fa fa-expand'"></li>
</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
data() {
return {
isActive: false,
path: ''
}
},
computed: {
show() {
return true
},
name() {
return this.$store.state.d2admin.tsearch.active ? 'top-right' : 'bottom-left'
}
},
mounted() {
setTimeout(() => (this.isActive = true), 0)
},
methods: {
...mapMutations('d2admin/tsearch', ['toggle']),
// 点击按钮的时候跳转到源代码
handleClick() {
this.toggle()
}
}
}
</script>
<style lang="scss" scoped>
.d2-header-switch {
$borderRadius: 30px;
$paddingLR: 30px;
$paddingTB: 2px;
$fontSize: 12px;
$rightOuter: $paddingLR / 2;
opacity: 0;
position: absolute;
z-index: 2019;
right: 20%;
bottom: -17px;
font-size: $fontSize;
line-height: $fontSize;
font-weight: bold;
border-radius: 0 0 $borderRadius $borderRadius;
padding: $paddingTB $paddingLR;
background-color: rgba(#fff, 1);
border: 1px solid #DCDFE6;
border-top: none;
color: #606266;
transition: all .3s;
@extend %unable-select;
&.d2-header-switch--active {
opacity: 1;
}
}
</style>
<template>
<div v-if="show"
class="d2-header-switch"
:class="{ 'd2-header-switch--active': isActive }"
@click="handleClick">
<d2-el-icon :name="name" />
<li :class="$store.state.d2admin.tsearch.active?'fa fa-compress':'fa fa-expand'"></li>
</div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
data() {
return {
isActive: false,
path: ''
}
},
computed: {
show() {
return true
},
name() {
return this.$store.state.d2admin.tsearch.active ? 'top-right' : 'bottom-left'
}
},
mounted() {
setTimeout(() => (this.isActive = true), 0)
},
methods: {
...mapMutations('d2admin/tsearch', ['toggle']),
// 点击按钮的时候跳转到源代码
handleClick() {
this.toggle()
}
}
}
</script>
<style lang="scss" scoped>
.d2-header-switch {
$borderRadius: 30px;
$paddingLR: 30px;
$paddingTB: 2px;
$fontSize: 12px;
$rightOuter: $paddingLR / 2;
opacity: 0;
position: absolute;
z-index: 2000;
right: 20%;
bottom: -17px;
font-size: $fontSize;
line-height: $fontSize;
font-weight: bold;
border-radius: 0 0 $borderRadius $borderRadius;
padding: $paddingTB $paddingLR;
background-color: rgba(#fff, 1);
border: 1px solid #dcdfe6;
border-top: none;
color: #606266;
transition: all 0.3s;
@extend %unable-select;
&.d2-header-switch--active {
opacity: 1;
}
}
</style>
<!-- 编辑商品弹窗 -->
<template>
<d2-dialog
title="添加绑定升级商品"
:isVisible.sync="relateProVisible"
btnOkLabel="关联"
width="950px"
@confirmDialog="handleRelateProConfirm"
@closeDialog="handleRelateProClose"
class="relatePro"
>
<d2-dialog title="添加绑定升级商品"
:isVisible.sync="relateProVisible"
btnOkLabel="关联"
width="950px"
@confirmDialog="handleRelateProConfirm"
@closeDialog="handleRelateProClose"
class="relatePro">
<div class="relateProDialog flex">
<img
v-show="proInfo.thumbUrl"
:src="proInfo.thumbUrl"
/>
<img
v-show="!proInfo.thumbUrl"
src="./image/no-choice.png"
/>
<el-form
:model="proInfo"
:rules="rules"
label-width="110px"
ref="proRuleForm1"
style="width: calc(100% - 180px);"
>
<img v-show="proInfo.thumbUrl"
:src="proInfo.thumbUrl" />
<img v-show="!proInfo.thumbUrl"
src="./image/no-choice.png" />
<el-form :model="proInfo"
:rules="rules"
label-width="110px"
ref="proRuleForm1"
style="width: calc(100% - 180px);">
<div class="w-50">
<el-form-item
label="选择产品"
prop="goodsCode"
>
<el-select
style="width: 98%;"
v-model="proInfo.goodsCode"
placeholder="请选择一款作为升级商品"
value-key="goodsCode"
filterable="true"
@change="handleChangeGood"
>
<el-option
v-for="item in proList"
:key="item.goodsCode"
:label="item.goodsName"
:value="item.goodsCode"
:disabled="item.disabled"
></el-option>
<el-form-item label="选择产品"
prop="goodsCode">
<el-select style="width: 98%;"
v-model="proInfo.goodsCode"
placeholder="请选择一款作为升级商品"
value-key="goodsCode"
filterable
@change="handleChangeGood">
<el-option v-for="item in proList"
:key="item.goodsCode"
:label="item.goodsName"
:value="item.goodsCode"
:disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</div>
<div class="w-50">
<el-form-item label="分类">
<el-input
disabled
placeholder="分类"
:value="proInfo.goodsTypeName"
class="dis-in-block"
></el-input>
<el-input disabled
placeholder="分类"
:value="proInfo.goodsTypeName"
class="dis-in-block"></el-input>
</el-form-item>
</div>
<div class="w-50">
</div>
<div class="w-50">
<el-form-item label="编号">
<el-input
disabled
placeholder="编号"
:value="proInfo.sapCode"
class="dis-in-block"
></el-input>
<el-input disabled
placeholder="编号"
:value="proInfo.sapCode"
class="dis-in-block"></el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item
label="产品成本"
prop="shopPrice"
>
<el-input
v-model="proInfo.shopPrice"
placeholder="请输入建议产品成本"
class="dis-in-block"
@input="handleShopPrice"
@blur="handleShopPriceBlur"
>
<i
slot="suffix"
class="suffix"
>元</i>
<el-form-item label="产品成本"
prop="shopPrice">
<el-input v-model="proInfo.shopPrice"
placeholder="请输入建议产品成本"
class="dis-in-block"
@input="handleShopPrice"
@blur="handleShopPriceBlur">
<i slot="suffix"
class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item
label="建议升级价格"
prop="upgradePrice"
>
<el-input
v-model="proInfo.upgradePrice"
placeholder="请输入建议升级价格"
class="dis-in-block"
@input="handleUpgradePrice"
>
<i
slot="suffix"
class="suffix"
>元</i>
<el-form-item label="建议升级价格"
prop="upgradePrice">
<el-input v-model="proInfo.upgradePrice"
placeholder="请输入建议升级价格"
class="dis-in-block"
@input="handleUpgradePrice">
<i slot="suffix"
class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div class="w-50">
<el-form-item
label="商品最低价"
prop="shopMinPrice"
>
<el-input
v-model="proInfo.shopMinPrice"
placeholder="请输入商品最低价"
class="dis-in-block"
@input="handleShopMinPrice"
>
<i
slot="suffix"
class="suffix"
>元</i>
<el-form-item label="商品最低价"
prop="shopMinPrice">
<el-input v-model="proInfo.shopMinPrice"
placeholder="请输入商品最低价"
class="dis-in-block"
@input="handleShopMinPrice">
<i slot="suffix"
class="suffix">元</i>
</el-input>
</el-form-item>
</div>
<div
class="w-50"
v-show="warrantyProList.includes(proInfo.goodsType)"
>
<el-form-item
label="质保年限"
prop="warrantyPeriod"
>
<el-select
style="width: 98%;"
:class="{ 'select-suffix': !!proInfo.warrantyPeriod }"
v-model="proInfo.warrantyPeriod"
>
<el-option
v-for="item in warrantyPeriodList"
:key="item.confId"
:label="item.confLabel"
:value="item.confId"
></el-option>
<div class="w-50"
v-show="warrantyProList.includes(proInfo.goodsType)">
<el-form-item label="质保年限"
prop="warrantyPeriod">
<el-select style="width: 98%;"
:class="{ 'select-suffix': !!proInfo.warrantyPeriod }"
v-model="proInfo.warrantyPeriod">
<el-option v-for="item in warrantyPeriodList"
:key="item.confId"
:label="item.confLabel"
:value="item.confId"></el-option>
</el-select>
</el-form-item>
</div>
......@@ -178,14 +134,24 @@ export default {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
upgradePrice: [
{ required: true, message: '请输入建议升级价', trigger: 'blur' },
{ required: true,
{
required: true,
trigger: 'blur',
validator: (rule, value, callback) => {
(+value < +this.proInfo.shopPrice) ? callback(new Error('建议升级价需要大于或等于产品成本')) : callback()
}
}],
shopPrice: [{ required: true, message: '请输入产品成本', trigger: 'blur' }],
shopMinPrice: [{ required: true, message: '请输入商品最低价', trigger: 'blur' }]
shopMinPrice: [
{ required: true, message: '请输入商品最低价', trigger: 'blur' },
{
required: true,
trigger: 'blur',
validator: (rule, value, callback) => {
(+value < +this.proInfo.shopPrice) ? callback(new Error('商品最低价数值小于产品成本')) : callback()
}
}
]
},
oldVal: {
upgradePrice: '',
......
......@@ -17,50 +17,50 @@ export default {
props: {
show: {
type: Boolean,
default: false,
default: false
},
title: {
type: String,
default: '提示',
default: '提示'
},
width: {
type: String,
default: '46%',
default: '46%'
},
cancel: {
required: false,
type: Function,
type: Function
},
confirm: {
required: false,
type: Function,
type: Function
},
usefooter: {
required: false,
type: Boolean,
default: false,
default: false
},
appendtobody: {
required: false,
type: Boolean,
default: false,
},
default: false
}
},
data() {
return {
hasFooter: false,
hasFooter: false
}
},
created() {
let o = this.$slots
const o = this.$slots
this.hasFooter = o.footer
},
mounted: function () {},
mounted: function() {},
methods: {
/**
* 取消关闭弹框
*/
onCancel: function () {
onCancel: function() {
// 兼容以前的页面
this.$emit('close')
},
......@@ -68,8 +68,8 @@ export default {
/**
* 确定
*/
onConfirm: function () {},
},
onConfirm: function() {}
}
}
</script>
......
import Vue from 'vue'
import d2Container from './d2-container'
import authButton from './d2-auth/d2-auth-btn.js'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-container', d2Container)
Vue.component('d2-icon', () => import('./d2-icon'))
Vue.component('d2-el-icon', () => import('./d2-el-icon'))
Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component('d2-table-header', () => import('./d2-table-header/index.vue'))
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('d2-dialog', () => import('./d2-dialog/index.vue'))
Vue.component('d2-form', () => import('./d2-form/index.vue'))
Vue.component('d2-search', () => import('./d2-search/index.vue'))
Vue.component('relateStoreDialog', () => import('./d2-form/relateStoreDialog.vue'))
Vue.component([authButton.name], authButton)
import Vue from 'vue'
import d2Container from './d2-container'
import authButton from './d2-auth/d2-auth-btn.js'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-container', d2Container)
Vue.component('d2-icon', () => import('./d2-icon'))
Vue.component('d2-el-icon', () => import('./d2-el-icon'))
Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component('d2-table-header', () => import('./d2-table-header/index.vue'))
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('d2-dialog', () => import('./d2-dialog/index.vue'))
Vue.component('d2-form', () => import('./d2-form/index.vue'))
Vue.component('d2-search', () => import('./d2-search/index.vue'))
Vue.component('relateStoreDialog', () =>
import('./d2-form/relateStoreDialog.vue')
)
// Vue.component([authButton.name], authButton)
Vue.component(authButton.name, authButton)
......@@ -12,7 +12,7 @@
:key="index"
:command="language.value">
<d2-icon :name="$i18n.locale === language.value ? 'dot-circle-o' : 'circle-o'" class="d2-mr-5"/>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
......
......@@ -9,18 +9,12 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>-->
<div
v-popover:popover-personal
class="d2-mr personal-wrap"
>
<span
v-if="show"
class="btn-text"
>{{info && info.detail ? (info.detail.userType == 2 ? `${info.detail.userName}` : '管理员') : '未登录'}}</span>
<span
class="btn-text out-txt"
@click="clear"
>退出</span>
<div v-popover:popover-personal
class="d2-mr personal-wrap">
<span v-if="show"
class="btn-text">{{info && info.detail ? (info.detail.userType == 2 ? `${info.detail.userName}` : '管理员') : '未登录'}}</span>
<span class="btn-text out-txt"
@click="clear">退出</span>
<!-- <el-popover ref="popover-personal" placement="bottom-end" v-model="userVisible" trigger="manual">
<i slot="reference" :class="['arrow-icon', 'el-icon-arrow-down', userVisible ? 'drOpen' : '']" @click="handleAccountClose"></i>
<el-popover popper-class="accout-panel" placement="left-end" :visible-arrow="false" v-model="accountPanelVisible" trigger="manual">
......@@ -38,7 +32,7 @@
<script>
import { mapActions } from 'vuex'
import PersonalPanel from '../personal-panel'
// import PersonalPanel from '../personal-panel'
export default {
data() {
return {
......@@ -47,11 +41,14 @@ export default {
userVisible: false,
accountInfo: {
accountList: []
},
info: {
}
}
},
components: {
PersonalPanel
// PersonalPanel
},
mounted() {
this.show = false
......@@ -76,8 +73,8 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
const reload = async() => {
}).then(async () => {
const reload = async () => {
localStorage.clear()
await this.logout()
window.location.reload()
......@@ -100,7 +97,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
}).then(async () => {
this.$router.push('/login')
await this.logout()
await this.$StoreReset.call(this.$store) // 重置 store
......@@ -124,7 +121,7 @@ export default {
cursor: pointer;
}
.el-icon-arrow-down {
transition: all .2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.personal-wrap .arrow-icon.drOpen {
transform: rotate(-180deg);
......
......@@ -127,7 +127,7 @@ export default {
}
)
.then(() => {
const reload = async () => {
const reload = async() => {
localStorage.clear()
await this.logout()
this.$store.commit('d2admin/gray/set', false)
......@@ -161,7 +161,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
.then(async() => {
await this.$store.commit('d2admin/gray/set', false)
resolve(true)
})
......
......@@ -9,7 +9,7 @@ const COOKIE_NAME_PREFIX = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.
* @param {Object} setting cookie setting
*/
cookies.set = function(name = 'default', value = '', cookieSetting = {}) {
let currentCookieSetting = {
const currentCookieSetting = {
expires: 1
}
Object.assign(currentCookieSetting, cookieSetting)
......
......@@ -13,7 +13,7 @@ const util = {
* @description 更新标题
* @param {String} title 标题
*/
util.title = function (titleText) {
util.title = function(titleText) {
const processTitle = process.env.VUE_APP_TITLE
window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}`
}
......@@ -22,7 +22,7 @@ util.title = function (titleText) {
* @description 打开新页面
* @param {String} url 地址
*/
util.open = function (url, target) {
util.open = function(url, target) {
var a = document.createElement('a')
a.setAttribute('href', url)
a.setAttribute('target', target || '_blank')
......@@ -64,9 +64,9 @@ util.deepClone = (obj) => {
* @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数
* @param {String} children 子数组的key
*/
util.deepFind = function (menus, id) {
util.deepFind = function(menus, id) {
const cloneMenus = util.deepClone(menus)
for (let menu of cloneMenus) {
for (const menu of cloneMenus) {
if (menu.id === id) {
delete menu.children
return menu
......@@ -112,7 +112,7 @@ util.colorToRgb = (sColor, alpha) => {
* 重置form
* 用法: util.resetForm.call(this,'formName')
*/
util.resetForm = function (formName) {
util.resetForm = function(formName) {
this.$nextTick(() => {
for (var key in this[formName]) {
if (this[formName].hasOwnProperty(key)) {
......@@ -127,7 +127,7 @@ util.resetForm = function (formName) {
* 格式化时间
* @param {Array} time
*/
util.formatTime = function (time) {
util.formatTime = function(time) {
return {
startTime: time ? time[0] + ' ' + '00:00:00' : '',
endTime: time ? time[1] + ' ' + '23:59:59' : ''
......
......@@ -31,7 +31,7 @@ Vue.use(d2Admin)
Vue.prototype.notice = notice
const isProd = process.env.NODE_ENV === 'production'
console.log(isProd)
// console.log(isProd)
if (!isProd) {
Vue.config.devtools = true
}
......@@ -44,6 +44,8 @@ axios({
method: 'get'
}).then(({ data }) => {
baseConfig = data
// 先本地切换到测试环境接口
// data.axios.baseURL = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
new Vue({
router,
store,
......
import store from '@/store'
import axios from 'axios'
import {
Message
} from 'element-ui'
import { Message } from 'element-ui'
import util from '@/libs/util'
import router from '@/router'
// import {
// LogExternals
// } from '@/common/constants'
import {
baseConfig
} from '@/main'
import { baseConfig } from '@/main'
import Qs from 'qs'
axios.defaults.withCredentials = true
// const expiresMinute = 60 // 过期时间(分钟)
......@@ -48,9 +44,11 @@ function errorLog(error) {
const service = axios.create({
// baseURL: baseURL,
timeout: 100000, // 请求超时时间
transformRequest: [function(data) {
return Qs.stringify(data)
}]
transformRequest: [
function(data) {
return Qs.stringify(data)
}
]
})
// 请求拦截器
......@@ -71,7 +69,38 @@ service.interceptors.request.use(
// })
// }
// config.url = baseConfig.axios.baseURL + config.url
config.url = baseConfig.axios.baseURL
// console.log(config.data.method.includes('dj.api.common.uploadImg'))
// console.log(config)
// console.log(Object.prototype.toString.call(config.data))
// console.log(config.data.method)
if (process.env.NODE_ENV == 'development') {
// 处理图片开发环境没用的问题
const type = Object.prototype.toString.call(config.data)
const methodList = [
'dj.api.common.uploadImg',
'dj.api.common.ocr.recognition',
'dj.api.smartcarlife.sms.sendSmsCode'
]
if (
type == '[object Object]' &&
methodList.includes(config.data.method)
) {
config.url = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
} else {
config.url = baseConfig.axios.baseURL
}
} else {
config.url = baseConfig.axios.baseURL
}
// if (config.params && config.params.method.includes('common.uploadImg')) {
// config.url = 'http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// } else {
// config.url = baseConfig.axios.baseURL
// }
// config.url = baseConfig.axios.baseURL
// config.timeout = baseConfig.axios.timeout
resolve(config)
})
......
import Vue from 'vue'
import VueRouter from 'vue-router'
// 进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import store from '@/store/index'
import util from '@/libs/util.js'
// 路由数据
import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
// 导出路由 在 main.js 里使用
const router = new VueRouter({
routes
})
const setCurrent = path => {
return new Promise(async resolve => {
path !== '/login' && await store.dispatch('d2admin/page/currentSet', path)
resolve()
})
}
/**
* 路由拦截
* 权限验证
*/
router.beforeEach(async(to, from, next) => {
const source = store.state.d2admin.auth.source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
// await store.dispatch('d2admin/page/isLoaded')
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
// await store.dispatch('d2admin/size/isLoaded')
// 设置当前页 下次登录 默认打开此页面
await setCurrent(to.fullPath)
// 进度条
NProgress.start()
// 关闭搜索面板
store.commit('d2admin/search/set', false)
if (from.name === null && to.path !== '/login' && !source) { // 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await store.dispatch('d2admin/auth/init')
await store.dispatch('d2admin/account/load')
next(to.path)
} else {
if (store.state.d2admin.user.info) { // sessionstorage 用户存在继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面
next()
} else {
if (to.path === '/login') { // 如果是登录页面路径,就直接next()
next()
} else { // 不然就跳转到登录;
await store.dispatch('d2admin/account/logout')
next('/login')
}
}
}
})
router.afterEach(to => {
// 进度条
NProgress.done()
// 多页控制 打开新的页面
store.dispatch('d2admin/page/open', to)
// 更改标题
util.title(to.meta.title)
// 保存当前页面meta信息
store.dispatch('d2admin/auth/setCurrentPageMeta', to.meta)
})
export const ResetRouter = () => new VueRouter({
routes
})
export default router
import Vue from 'vue'
import VueRouter from 'vue-router'
// 进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import store from '@/store/index'
import util from '@/libs/util.js'
// 路由数据
import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push(location, onResolve, onReject) {
// 解决Uncaught (in promise) 控制台报错问题
// console.log(onResolve)
// console.log(onReject)
if (onResolve || onReject) {
return originalPush.call(this, location, onResolve, onReject)
}
// return originalPush.call(this, location).catch(err => err)
return (
originalPush.call(this, location) &&
originalPush.call(this, location).catch(err => err)
)
}
Vue.use(VueRouter)
// 导出路由 在 main.js 里使用
const router = new VueRouter({
routes
})
const setCurrent = path => {
return new Promise(async resolve => {
path !== '/login' && (await store.dispatch('d2admin/page/currentSet', path))
resolve()
})
}
/**
* 路由拦截
* 权限验证
*/
router.beforeEach(async (to, from, next) => {
const source = store.state.d2admin.auth.source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
// await store.dispatch('d2admin/page/isLoaded')
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
// await store.dispatch('d2admin/size/isLoaded')
// 设置当前页 下次登录 默认打开此页面
await setCurrent(to.fullPath)
// 进度条
NProgress.start()
// 关闭搜索面板
store.commit('d2admin/search/set', false)
if (from.name === null && to.path !== '/login' && !source) {
// 页面刷新 动态路由会失效 初始化路由与左侧菜单栏
await store.dispatch('d2admin/auth/init')
await store.dispatch('d2admin/account/load')
next(to.path)
} else {
if (store.state.d2admin.user.info) {
// sessionstorage 用户存在继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面
next()
} else {
if (to.path === '/login') {
// 如果是登录页面路径,就直接next()
next()
} else {
// 不然就跳转到登录;
await store.dispatch('d2admin/account/logout')
next('/login')
}
}
}
})
router.afterEach(to => {
// 进度条
NProgress.done()
// 多页控制 打开新的页面
store.dispatch('d2admin/page/open', to)
// 更改标题
util.title(to.meta.title)
// 保存当前页面meta信息
store.dispatch('d2admin/auth/setCurrentPageMeta', to.meta)
})
export const ResetRouter = () =>
new VueRouter({
routes
})
export default router
......@@ -795,6 +795,54 @@ export const resources = {
activePath: '/accountList'
},
component: _import('systemConfig/account/applyAccount')
},
'90610': {
path: '/accountList_new',
name: 'accountList_new',
meta: {
title: '新虚拟对公账户',
authId: '90610',
parentId: '906',
cache: false
},
auth: [
{
authId: '9061001',
parentId: '90610',
label: '申请虚拟对公账户',
handle: 'handleApply',
ruleObj: {
attr: 'accountStatus',
rule: {
1: '申请虚拟对公账户',
2: '申请虚拟对公账户',
3: '账户详情',
4: '申请虚拟对公账户'
},
disabledStatusList: [2]
},
addRoutePath: [
{
authId: '90611',
name: '申请虚拟对账账户',
parentId: '90610'
}
]
}
],
component: _import('systemConfig/accountNew/accountList')
},
'90611': {
path: '/applyAccount_new',
name: 'applyAccount_new',
meta: {
title: '申请虚拟对账账户',
authId: '90611',
parentId: '90610',
cache: false,
activePath: '/accountList_new'
},
component: _import('systemConfig/accountNew/applyAccount')
}
// '90602': {
// path: '/serviceStore',
......
......@@ -11,7 +11,7 @@ Vue.prototype.$StoreReset = function() {
Vue.use(Vuex)
const isProd = process.env.NODE_ENV === 'production'
console.log(isProd)
// console.log(isProd)
if (!isProd) {
Vue.config.devtools = true
}
......
......@@ -5,17 +5,14 @@
* @Last Modified time: 2020-11-15 10:22:06
*/
import {
getChannelType,
getProductType
} from '@/api/sys.base'
import {
BaseData
} from '@/common/constants'
const map = {
[BaseData.channelType]: getChannelType,
[BaseData.productType]: getProductType
}
import { getChannelType, getProductType } from '@/api/sys.base'
// import {
// BaseData
// } from '@/common/constants'
// const map = {
// [BaseData.channelType]: getChannelType,
// [BaseData.productType]: getProductType
// }
export default {
namespaced: true,
state: {
......@@ -30,31 +27,23 @@ export default {
* 每次登录会强制 初始化
* @param {*} param0
*/
init({
state,
dispatch,
commit
}) {
init({ state, dispatch, commit }) {
return new Promise(async resolve => {
Promise.all([
getChannelType({}),
getProductType({})
]).then(async([channelType, productType]) => {
state.channelType = channelType.slice(0, 2)
state.productType = productType
await dispatch('save2db', {
name: '',
value: state
})
resolve(state)
})
Promise.all([getChannelType({}), getProductType({})]).then(
async([channelType, productType]) => {
state.channelType = channelType.slice(0, 2)
state.productType = productType
await dispatch('save2db', {
name: '',
value: state
})
resolve(state)
}
)
})
},
// 重置
clear({
state,
dispatch
}) {
clear({ state, dispatch }) {
return new Promise(async resolve => {
state.channelType = []
state.productType = []
......@@ -72,14 +61,13 @@ export default {
* @param {*} param0
* @param {*} name 名称 state 中的任意一个 强烈建议 使用 @/common/constants/BaseData 中的常量 便于灵活修改
*/
get({
state,
dispatch
}, name) {
get({ state, dispatch }, name) {
return new Promise(async resolve => {
let __data = state[name]
if (__data) {
__data = await dispatch('getFromdb', `base.${name}`) || await dispatch('getFromAjax', name)
__data =
(await dispatch('getFromdb', `base.${name}`)) ||
(await dispatch('getFromAjax', name))
state[name] = __data
await dispatch('save2db', {
name,
......@@ -89,13 +77,7 @@ export default {
resolve(__data)
})
},
set({
state,
dispatch
}, {
name,
value
}) {
set({ state, dispatch }, { name, value }) {
return new Promise(async resolve => {
state[name] = value
await dispatch('save2db', {
......@@ -111,13 +93,11 @@ export default {
* 内存 -> 前端持久化数据库 -> 后台接口
* @param {*} param0
*/
load({
state,
dispatch
}) {
load({ state, dispatch }) {
return new Promise(async resolve => {
if (state.channelType.length === 0) {
state = await dispatch('getFromdb', 'base') || await dispatch('init')
state =
(await dispatch('getFromdb', 'base')) || (await dispatch('init'))
}
const { channelType, productType } = state
resolve({ channelType, productType })
......@@ -128,17 +108,19 @@ export default {
* @param {*} param0
* @param {*} path 数据 路径
*/
getFromdb({
dispatch
}, path) {
getFromdb({ dispatch }, path) {
return new Promise(async resolve => {
const value = await dispatch('d2admin/db/get', {
dbName: 'database',
path,
user: false
}, {
root: true
})
const value = await dispatch(
'd2admin/db/get',
{
dbName: 'database',
path,
user: false
},
{
root: true
}
)
resolve(value)
})
},
......@@ -148,21 +130,20 @@ export default {
* @param {*} param0
* @param {*} param1 value 需要持久化的数据 path 需要持久化的数据路径
*/
save2db({
dispatch
}, {
value,
name
}) {
save2db({ dispatch }, { value, name }) {
return new Promise(async resolve => {
await dispatch('d2admin/db/set', {
dbName: 'database',
path: name ? `base.${name}` : 'base',
value,
user: false
}, {
root: true
})
await dispatch(
'd2admin/db/set',
{
dbName: 'database',
path: name ? `base.${name}` : 'base',
value,
user: false
},
{
root: true
}
)
resolve(value)
})
},
......@@ -171,19 +152,13 @@ export default {
* @param {*} param0
* @param {*} name @/common/constants/BaseData 中的常量
*/
getFromAjax({
state,
dispatch,
commit
}, name) {
getFromAjax({ state, dispatch, commit }, name) {
return new Promise(async resolve => {
// const value = await map[name]({ [TYPE_NAME]: Object.values(BaseData).find(data => data.KEY === name).TYPE })
resolve()
})
},
async reset({
dispatch
}) {
async reset({ dispatch }) {
await dispatch('clear')
}
}
......
......@@ -11,12 +11,12 @@ const userInfo = JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))) || {
const INDEX_PATH = userInfo ? (userInfo.detail.accountType !== 7 ? '/index' : '/onlineAccountList') : '/index'
const defaultPage = userInfo ? (userInfo.detail.accountType !== 7 ? home : localRoutes['90503']) : home
defaultPage.fullPath = INDEX_PATH
// 判定是否需要缓存
// 判定是否需要缓存
const isKeepAlive = data => _.get(data, 'meta.cache', false)
// const setIcon = meta => {
// console.log(meta)
// return (meta.icon = localRoutes[meta.authId].icon)
// }
// const setIcon = meta => {
// console.log(meta)
// return (meta.icon = localRoutes[meta.authId].icon)
// }
export default {
namespaced: true,
......@@ -84,28 +84,28 @@ export default {
// valid 有效列表 1, 1, 0, 1 => 有效, 有效, 失效, 有效
const valid = []
const __oSource = await dispatch('d2admin/auth/load', null, {
root: true
})
// 处理数据
root: true
})
// 处理数据
state.opened = value
.map(opened => {
// 忽略首页
if (opened.fullPath === INDEX_PATH) {
valid.push(1)
// setIcon(opened.meta)
// setIcon(opened.meta)
return opened
}
// 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
const find = state.pool.find(item => {
return (
item.path === opened.path &&
return (
item.path === opened.path &&
__oSource.some(obj => +obj.authId === +item.meta.authId)
)
})
// 记录有效或无效信息
)
})
// 记录有效或无效信息
valid.push(find ? 1 : 0)
// 返回合并后的数据 新的覆盖旧的
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
// 返回合并后的数据 新的覆盖旧的
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
return Object.assign({}, opened, find)
})
.filter((opened, index) => valid[index] === 1)
......@@ -113,7 +113,7 @@ export default {
// state.openedLoaded = true
// 根据 opened 数据生成缓存设置
commit('keepAliveRefresh')
// end
// end
resolve()
})
},
......@@ -128,16 +128,16 @@ export default {
return new Promise(async resolve => {
// 设置数据
dispatch(
'd2admin/db/set', {
dbName: 'sys',
path: 'page.opened',
value: state.opened,
user: true
}, {
root: true
}
)
// end
'd2admin/db/set', {
dbName: 'sys',
path: 'page.opened',
value: state.opened,
user: true
}, {
root: true
}
)
// end
resolve()
})
},
......@@ -163,10 +163,10 @@ export default {
page.params = params || page.params
page.query = query || page.query
page.fullPath = fullPath || page.fullPath
// state.opened.splice(index, 1, page)
// 持久化
// state.opened.splice(index, 1, page)
// 持久化
await dispatch('opend2db')
// end
// end
resolve()
})
},
......@@ -192,16 +192,16 @@ export default {
newTag.params = params || newTag.params
newTag.query = query || newTag.query
newTag.fullPath = fullPath || newTag.fullPath
// setIcon(newTag.meta)
// 添加进当前显示的页面数组
// setIcon(newTag.meta)
// 添加进当前显示的页面数组
state.opened.push(newTag)
// 如果这个页面需要缓存 将其添加到缓存设置
// 如果这个页面需要缓存 将其添加到缓存设置
if (isKeepAlive(newTag)) {
dispatch('keepAlivePush', tag.name)
}
// 持久化
await dispatch('opend2db')
// end
// end
resolve()
})
},
......@@ -224,11 +224,11 @@ export default {
return new Promise(async resolve => {
// 已经打开的页面
const opened = state.opened
// 判断此页面是否已经打开 并且记录位置
// let pageOpendIndex = 0
// 判断此页面是否已经打开 并且记录位置
// let pageOpendIndex = 0
const page = opened.find((page, index) => {
const same = page.fullPath === fullPath
// pageOpendIndex = same ? index : pageOpendIndex
// pageOpendIndex = same ? index : pageOpendIndex
return same
})
if (page) {
......@@ -242,7 +242,7 @@ export default {
} else {
// 页面以前没有打开过
const page = state.pool.find(t => t.name === name)
// 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
// 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
if (page) {
await dispatch('add', {
tag: Object.assign({}, page),
......@@ -274,7 +274,7 @@ export default {
// 下个新的页面
let newPage = state.opened[0]
const isCurrent = state.current === tagName
// 如果关闭的页面就是当前显示的页面
// 如果关闭的页面就是当前显示的页面
if (isCurrent) {
// 去找一个新的页面
const len = state.opened.length
......@@ -294,12 +294,12 @@ export default {
if (index >= 0) {
// 如果这个页面是缓存的页面 将其在缓存设置中删除
dispatch('keepAliveRemove', state.opened[index].name)
// 更新数据 删除关闭的页面
// 更新数据 删除关闭的页面
state.opened.splice(index, 1)
}
// 持久化
await dispatch('opend2db')
// 最后需要判断是否需要跳到首页
// 最后需要判断是否需要跳到首页
if (isCurrent) {
const {
name = '', params = {}, query = {}
......@@ -328,21 +328,21 @@ export default {
} = {}) {
return new Promise(async resolve => {
await dispatch('_do', {
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
if (currentIndex > 0) {
// 删除打开的页面 并在缓存设置中删除
await dispatch('_splice', {
index: 1,
howmany: currentIndex - 1
})
}
resolve()
})
}
})
// end
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
if (currentIndex > 0) {
// 删除打开的页面 并在缓存设置中删除
await dispatch('_splice', {
index: 1,
howmany: currentIndex - 1
})
}
resolve()
})
}
})
// end
resolve()
})
},
......@@ -390,28 +390,28 @@ export default {
} = {}) {
return new Promise(async resolve => {
await dispatch('_do', {
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
// 删除打开的页面数据 并更新缓存设置
if (currentIndex === 0) {
await dispatch('_splice', {
index: 1
})
} else {
await dispatch('_splice', {
index: currentIndex + 1
})
await dispatch('_splice', {
index: 1,
howmany: currentIndex - 1
})
}
resolve()
})
}
})
// end
pageSelect,
call: currentIndex => {
return new Promise(async resolve => {
// 删除打开的页面数据 并更新缓存设置
if (currentIndex === 0) {
await dispatch('_splice', {
index: 1
})
} else {
await dispatch('_splice', {
index: currentIndex + 1
})
await dispatch('_splice', {
index: 1,
howmany: currentIndex - 1
})
}
resolve()
})
}
})
// end
resolve()
})
},
......@@ -428,11 +428,11 @@ export default {
return new Promise(async resolve => {
// 删除打开的页面 并在缓存设置中删除
await dispatch('closeOpened')
// dispatch('currentSet', _index)
// 持久化
// await dispatch('opend2db')
// dispatch('currentSet', _index)
// 持久化
// await dispatch('opend2db')
router.replace(INDEX_PATH)
// end
// end
resolve()
})
},
......@@ -458,14 +458,14 @@ export default {
}
})
await call(currentIndex)
// 设置当前的页面
// dispatch('currentSet', pageAim)
// 设置当前的页面
// dispatch('currentSet', pageAim)
if (router.app.$route.fullPath !== pageAim) {
router.push(pageAim)
}
// 持久化
await dispatch('opend2db')
// end
// end
resolve()
})
},
......@@ -508,7 +508,7 @@ export default {
}, fullPath) {
return new Promise(async resolve => {
await commit('setCurrent', fullPath)
// 设置数据
// 设置数据
dispatch(
'd2admin/db/set', {
dbName: 'sys',
......@@ -562,11 +562,11 @@ export default {
return new Promise(async resolve => {
// 删除打开的页面 并在缓存设置中删除
await dispatch('_splice', {
index: 1
})
// 持久化
index: 1
})
// 持久化
await dispatch('opend2db')
// end
// end
resolve()
})
},
......@@ -688,4 +688,4 @@ export default {
})
}
}
}
\ No newline at end of file
}
import util from '@/libs/util.js'
export default {
namespaced: true,
mutations: {
/**
* @description 显示版本信息
* @param {Object} state state
*/
versionShow() {
util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`)
console.log('广联赛讯 http://www.glsx.com.cn')
}
}
}
import util from '@/libs/util.js'
export default {
namespaced: true,
mutations: {
/**
* @description 显示版本信息
* @param {Object} state state
*/
versionShow() {
util.log.capsule(
process.env.VUE_APP_TITLE,
`v${process.env.VUE_APP_VERSION}`
)
console.log('广联赛讯 http://www.glsx.com.cn')
}
}
}
......@@ -46,7 +46,7 @@ export default {
load({ state, commit, dispatch }) {
return new Promise(async resolve => {
// store 赋值
let activeName = await dispatch('d2admin/db/get', {
const activeName = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'theme.activeName',
defaultValue: state.list[0].name,
......
......@@ -88,4 +88,4 @@ export default {
dispatch('clear')
}
}
}
\ No newline at end of file
}
......@@ -19,12 +19,9 @@
<el-radio-button label="2">4S店</el-radio-button>
<el-radio-button label="7">服务商</el-radio-button>
<el-radio-button label="6">园区店</el-radio-button>
<!-- <el-radio-button label="2"
@click.native.prevent="clickMerchantType('2')">4S店</el-radio-button>
<el-radio-button label="7"
@click.native.prevent="clickMerchantType('7')">服务商</el-radio-button>
<el-radio-button label="6"
@click.native.prevent="clickMerchantType('6')">园区店</el-radio-button> -->
<!-- <el-radio-button label="2" @click.native.prevent="clickMerchantType('2')">4S店</el-radio-button>
<el-radio-button label="7" @click.native.prevent="clickMerchantType('7')">服务商</el-radio-button>
<el-radio-button label="6" @click.native.prevent="clickMerchantType('6')">园区店</el-radio-button> -->
</el-radio-group>
</el-form-item>
<el-form-item label="选择商户:"
......@@ -43,7 +40,7 @@
multiple-limit="10"
filterable
style="width:400px">
<el-option v-for="(item, index) in baseData.merchantList"
<el-option v-for="item in baseData.merchantList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId"></el-option>
......@@ -86,14 +83,16 @@
</template>
<script>
import { BaseData, rangePickerOptions } from '@/common/constants.js'
import {
// BaseData,
rangePickerOptions} from '@/common/constants.js'
import dayjs from 'dayjs'
import * as api from '@api/finance'
import { getMerchantPageSearch } from '@api/publicAccount'
export default {
name: 'downloadAccountDialog',
data () {
let validateLonlat = (rule, value, callback) => {
data() {
const validateLonlat = (rule, value, callback) => {
if (value) {
if (!this.infoForm.payEndDate) {
callback(new Error('请选择结束日期'))
......@@ -214,19 +213,19 @@ export default {
// }
},
created () {
created() {
// this.$nextTick(() => {
// this.$refs.accountForm.resetFields();
// })
},
components: {},
mounted () {
mounted() {
this.selectMerchant()
},
methods: {
selectMerchant () {
selectMerchant() {
var params = {}
params.currentPage = 1
params.pageSize = 1000
......@@ -245,26 +244,26 @@ export default {
})
},
clickMerchantType (e) {
clickMerchantType(e) {
e === this.infoForm.merchantType
? (this.infoForm.merchantType = '')
: (this.infoForm.merchantType = e)
console.log(this.infoForm.merchantType)
},
changeType () {
changeType() {
this.infoForm.merchant = []
// this.baseData.merchantList = []
this.selectMerchant()
},
changeStartDate () {
changeStartDate() {
if (this.infoForm.payEndDate) {
this.infoForm.payEndDate = ''
}
},
remoteMethod (query) {
remoteMethod(query) {
// if (query !== '') {
this.selectLoading = true
var params = {}
......@@ -284,7 +283,7 @@ export default {
// }
},
handleAddConfirm () {
handleAddConfirm() {
// console.log(this.infoForm.remark)
console.log(this.infoForm)
// this.handleClose()
......@@ -316,7 +315,7 @@ export default {
})
},
handleClose () {
handleClose() {
this.$emit('accountClose', true)
}
}
......
......@@ -423,14 +423,14 @@ import {
orderTypeList
} from '@/common/constants.js'
import downloadAccountDialog from './downloadAccountDialog'
import * as echarts from 'echarts'
export default {
name: 'financeList',
components: {
downloadAccountDialog
},
data () {
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
isSubOrder: false,
......@@ -575,7 +575,7 @@ export default {
}
},
mounted () {
mounted() {
// console.log(document.getElementById('financeChart'))
if (this.userInfo.beSuper) {
getParkStore({}).then(res => {
......@@ -602,14 +602,14 @@ export default {
this.getTotal()
},
watch: {
summaryDate (newValue) {
summaryDate(newValue) {
this.getSummary()
}
},
methods: {
...mapActions({ close: 'd2admin/page/close' }),
handleAddClose (isRefresh = false) { },
drawFunnelChart () {
handleAddClose(isRefresh = false) { },
drawFunnelChart() {
// console.log(funnelOption)
getTransferData({}).then(res => {
funnelOption.series[0].data[0].tooltipValue = res.totalCustomerNums
......@@ -621,7 +621,7 @@ export default {
this.financeChart.setOption(funnelOption)
})
},
handleReset () {
handleReset() {
this.searchForm = {
time: '',
yqMerchantId: '',
......@@ -643,7 +643,7 @@ export default {
this.getOptionsList()
},
// 导出
handleExport () {
handleExport() {
var params = this.getParams()
params.pageNum = 1
api.exportFile(params).then(res => {
......@@ -651,12 +651,12 @@ export default {
this.$open(res)
})
},
//下载对账单
downloadAccount () {
// 下载对账单
downloadAccount() {
this.accountVisible = !this.accountVisible
},
// 查看明细
handleDetail (data) {
handleDetail(data) {
this.close({ tagName: '/financeDetail' })
this.$router.push({
name: 'financeDetail',
......@@ -666,7 +666,7 @@ export default {
})
},
getServiceStore (merchantId) {
getServiceStore(merchantId) {
getServiceStore({
yqMerchantId: merchantId
}).then(res => {
......@@ -675,14 +675,11 @@ export default {
})
},
getOptionsList () {
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === 'select') {
if (
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this.showFormData[index].optionLabel
] !== '全部'
this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部'
) {
const temp = {}
temp[this.showFormData[index].optionId] = ''
......@@ -697,7 +694,7 @@ export default {
}
})
},
getSummary () {
getSummary() {
api
.getSummary({
beginDateStr: this.summaryDate
......@@ -715,10 +712,10 @@ export default {
this.summayData = res
})
},
keyDowmGetList () {
keyDowmGetList() {
this.getList()
},
getList () {
getList() {
var params = this.getParams()
params = {
...this.page,
......@@ -750,7 +747,7 @@ export default {
this.total = res.total
})
},
numAddPrefix (item) {
numAddPrefix(item) {
const moneyLabels = [
'goodsCost',
'totalPrice',
......@@ -777,7 +774,7 @@ export default {
}
return item
},
getSelectInputParams () {
getSelectInputParams() {
const list = Object.keys(this.searchSelectObj)
var params = {}
list.forEach(i => {
......@@ -786,7 +783,7 @@ export default {
})
return params
},
getParams () {
getParams() {
var params = this.getSelectInputParams()
if (this.searchForm.yqMerchantId) {
params.yqMerchantId = this.searchForm.yqMerchantId
......@@ -814,29 +811,29 @@ export default {
// }
return params
},
getTotal () {
getTotal() {
api.getListTotal(this.getParams()).then(res => {
this.totalObj = res
})
},
handleSearch () {
handleSearch() {
this.page.pageNum = 1
this.getList()
this.getTotal()
},
// 每页条数
handleSizeChange (value) {
handleSizeChange(value) {
this.page.pageSize = value
this.getList()
},
// 页码
handleCurrentChange (value) {
handleCurrentChange(value) {
this.page.pageNum = value
this.getList()
},
accountClose (isRefresh) {
accountClose(isRefresh) {
this.accountVisible = !this.accountVisible
// isRefresh && this.handleSearch()
}
......
<!-- 商品管理 -->
<template>
<d2-container class="commodity">
<div
class="header"
slot="header"
>
<d2-search
ref="showSearch"
class="show-search"
:searchForm="searchForm"
:formData="showFormData"
>
<div class="header"
slot="header">
<d2-search ref="showSearch"
class="show-search"
:searchForm="searchForm"
:formData="showFormData">
<!-- <p>
<el-input
size="small"
......@@ -22,84 +18,60 @@
</p> -->
</d2-search>
<div class="up-btns">
<el-button
:id="tableParams.btnId"
size="small"
type="primary"
>查询</el-button>
<el-button
size="small"
@click="handleReset"
>重置</el-button>
<el-button :id="tableParams.btnId"
size="small"
type="primary">查询</el-button>
<el-button size="small"
@click="handleReset">重置</el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<span slot="left">
<auth-button
category="Button"
style="{display: inline-block}"
showBtnIds="['9030201']"
></auth-button>
<auth-button category="Button"
style="{display: inline-block}"
:showBtnIds="['9030201']"></auth-button>
</span>
<auth-button
category="Button"
style="{display: inline-block}"
showBtnIds="['9030202']"
></auth-button>
<auth-button category="Button"
style="{display: inline-block}"
:showBtnIds="['9030202']"></auth-button>
</d2-table-header>
<d2-table
ref="commodityTable"
:hasNum="false"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<img
slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.goodsInfo.thumbUrl"
/>
<template
v-if="Object.keys(scope.scope).includes('upgradeGoodsList')"
slot="auth-button"
slot-scope="scope"
>
<el-button
type="text"
size="mini"
style="margin-right: 10px;"
@click="handleCommodityDetail(scope.scope)"
>查看</el-button>
<auth-button
:data="scope.scope"
></auth-button>
<d2-table ref="commodityTable"
:hasNum="false"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn">
<img slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.goodsInfo.thumbUrl" />
<template v-if="Object.keys(scope.scope).includes('upgradeGoodsList')"
slot="auth-button"
slot-scope="scope">
<el-button type="text"
size="mini"
style="margin-right: 10px;"
@click="handleCommodityDetail(scope.scope)">查看</el-button>
<auth-button :data="scope.scope"></auth-button>
</template>
</d2-table>
</div>
<d2-dialog
:title="detailData ? detailData.goodsInfo.goodsName : ''"
:className="storeDetail"
:isVisible.sync="detailVisible"
:showClose="showClose"
noCancel="true"
@closeDialog="handleDetailClose"
@confirmDialog="handleDetailClose"
>
<store-detail
v-if="detailVisible"
:detailData="detailData"
></store-detail>
<d2-dialog v-if="detailVisible"
:title="detailData ? detailData.goodsInfo.goodsName : ''"
:className="storeDetail"
:isVisible.sync="detailVisible"
:showClose="showClose"
noCancel="true"
@closeDialog="handleDetailClose"
@confirmDialog="handleDetailClose">
<store-detail :detailData="detailData"></store-detail>
</d2-dialog>
<!-- 查看面板 -->
<drawer-detail
v-if="drawerDetailVisible"
:drawerDetailVisible="drawerDetailVisible"
:commodityInfoId="commodityDetailInfoId"
@handleDrawerClose="handleDrawerClose"
></drawer-detail>
<drawer-detail v-if="drawerDetailVisible"
:drawerDetailVisible="drawerDetailVisible"
:commodityInfoId="commodityDetailInfoId"
@handleDrawerClose="handleDrawerClose"></drawer-detail>
</d2-container>
</template>
......
<!-- 发券宝 -->
<template>
<d2-container class="coupons">
<div
class="header"
slot="header"
>
<d2-search
ref="showSearch"
class="show-search"
:searchForm="parentSearchForm"
:formData="showFormData"
>
<div class="header"
slot="header">
<d2-search ref="showSearch"
class="show-search"
:searchForm="parentSearchForm"
:formData="showFormData">
</d2-search>
<div class="up-btns">
<el-button
size="small"
type="primary"
@click="handleSearch"
>查询</el-button>
<el-button
size="small"
@click="handleReset"
>重置</el-button>
<el-button size="small"
type="primary"
@click="handleSearch">查询</el-button>
<el-button size="small"
@click="handleReset">重置</el-button>
</div>
</div>
<div
class="d2-container-content"
style="position: positive;"
>
<div class="d2-container-content"
style="position: positive;">
<span style="position: absolute; right: 41px; top: 42px; z-index: 999;">
<auth-button
:showBtnIds="activeName === 'storeList' ? ['9030601', '9030605'] : ['9030605']"
category="Button"
></auth-button>
<auth-button :showBtnIds="activeName === 'storeList' ? ['9030601', '9030605'] : ['9030605']"
category="Button"></auth-button>
</span>
<el-tabs
v-model="activeName"
type="card"
@tab-click="handleSearch"
>
<el-tab-pane
label="店面列表"
name="storeList"
>
<store-list
ref="storeList"
:parentSearchForm="parentSearchForm"
></store-list>
<el-tabs v-model="activeName"
type="card"
@tab-click="handleSearch">
<el-tab-pane label="店面列表"
name="storeList">
<store-list ref="storeList"
:parentSearchForm="parentSearchForm"></store-list>
</el-tab-pane>
<el-tab-pane
label="领用明细"
name="couponsDetail"
>
<coupons-detail
ref="couponsDetail"
:parentSearchForm="parentSearchForm"
></coupons-detail>
<el-tab-pane label="领用明细"
name="couponsDetail">
<coupons-detail ref="couponsDetail"
:parentSearchForm="parentSearchForm"></coupons-detail>
</el-tab-pane>
</el-tabs>
</div>
<edit-coupons-dialog
:couponsVisible="couponsVisible"
@couponClose="couponClose"
></edit-coupons-dialog>
<edit-coupons-dialog :couponsVisible="couponsVisible"
@couponClose="couponClose"></edit-coupons-dialog>
</d2-container>
</template>
......
<!-- 产品管理 -->
<template>
<d2-container class="product">
<div
class="header"
slot="header"
>
<d2-search
ref="showSearch"
class="show-search"
:searchForm="searchForm"
:formData="showFormData"
>
<div class="header"
slot="header">
<d2-search ref="showSearch"
class="show-search"
:searchForm="searchForm"
:formData="showFormData">
<!-- <p>
<el-input
size="small"
......@@ -22,50 +18,36 @@
</p> -->
</d2-search>
<div class="up-btns">
<el-button
:id="tableParams.btnId"
size="small"
type="primary"
>查询</el-button>
<el-button
size="small"
@click="handleReset"
>重置</el-button>
<el-button :id="tableParams.btnId"
size="small"
type="primary">查询</el-button>
<el-button size="small"
@click="handleReset">重置</el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<span slot="left">
<auth-button
category="Button"
style="{display: inline-block}"
showBtnIds="['9030101']"
></auth-button>
<auth-button category="Button"
style="{display: inline-block}"
showBtnIds="['9030101']"></auth-button>
</span>
<auth-button
category="Button"
style="{display: inline-block}"
showBtnIds="['9030103']"
></auth-button>
<auth-button category="Button"
style="{display: inline-block}"
showBtnIds="['9030103']"></auth-button>
</d2-table-header>
<d2-table
ref="productTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<img
slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.thumbUrl"
/>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
<d2-table ref="productTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn">
<img slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.thumbUrl" />
<auth-button slot="auth-button"
slot-scope="scope"
:data="scope.scope"></auth-button>
</d2-table>
</div>
</d2-container>
......
......@@ -3,7 +3,7 @@ const customTransOption = {
tooltip: {
trigger: 'axis',
axisPointer: {
}
},
legend: {
......@@ -17,7 +17,7 @@ const customTransOption = {
containLabel: true
},
toolbox: {
},
xAxis: {
type: 'category',
......@@ -26,15 +26,15 @@ const customTransOption = {
axisLine: {
show: false,
lineStyle: {
}
},
axisTick: {
show: false
},
axisLabel: {
//interval: 0,
//rotate: 45
// interval: 0,
// rotate: 45
},
offset: 10
},
......@@ -53,17 +53,17 @@ const customTransOption = {
{
name: '客户到店',
type: 'line',
//stack: '总量',
// stack: '总量',
itemStyle: {
color: '#0947C6'
},
data: [120, 132, 101, 134, 90, 230, 210],
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '客户转化',
type: 'line',
//stack: '总量',
// stack: '总量',
itemStyle: {
color: '#2B9AFF'
},
......
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result;
let timeout, args, context, timestamp, result
const later = function () {
const later = function() {
// 据上一次触发时间间隔
const last = +new Date() - timestamp;
const last = +new Date() - timestamp
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last);
timeout = setTimeout(later, wait - last)
} else {
timeout = null;
timeout = null
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args);
if (!timeout) context = args = null;
result = func.apply(context, args)
if (!timeout) context = args = null
}
}
};
}
return function (...args) {
context = this;
timestamp = +new Date();
const callNow = immediate && !timeout;
return function(...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait);
if (!timeout) timeout = setTimeout(later, wait)
if (callNow) {
result = func.apply(context, args);
context = args = null;
result = func.apply(context, args)
context = args = null
}
return result;
};
}
\ No newline at end of file
return result
}
}
......@@ -2,7 +2,7 @@ const incomeFlowOption = {
tooltip: {
trigger: 'axis',
axisPointer: {
}
},
/* legend: {
......@@ -16,7 +16,7 @@ const incomeFlowOption = {
containLabel: true
},
toolbox: {
},
xAxis: {
type: 'category',
......@@ -25,15 +25,15 @@ const incomeFlowOption = {
axisLine: {
show: false,
lineStyle: {
}
},
axisTick: {
show: false
},
axisLabel: {
//interval: 0,
//rotate: 45
// interval: 0,
// rotate: 45
},
offset: 10
},
......@@ -57,8 +57,8 @@ const incomeFlowOption = {
color: '#0947C6'
},
data: [120, 132, 101, 134, 90, 230, 210],
smooth: true,
},
smooth: true
}
/* {
name: '支出',
type: 'line',
......@@ -72,4 +72,4 @@ const incomeFlowOption = {
]
}
export default incomeFlowOption
\ No newline at end of file
export default incomeFlowOption
const incomeProductOption = {
color: ['rgba(9,71,198,0.8)', 'rgba(255,178,25,1)','rgba(255,178,25,0.8)','rgba(0,157,255,1)', 'rgba(0,157,255,0.8)', 'rgba(0,157,255,0.6)', 'rgba(0,228,115,1)','rgba(0,228,115,0.8)'],
color: [
'rgba(9,71,198,0.8)',
'rgba(255,178,25,1)',
'rgba(255,178,25,0.8)',
'rgba(0,157,255,1)',
'rgba(0,157,255,0.8)',
'rgba(0,157,255,0.6)',
'rgba(0,228,115,1)',
'rgba(0,228,115,0.8)'
],
title: {
text: '累计收入\n555555元',
top: '50%',
......@@ -14,8 +23,10 @@ const incomeProductOption = {
},
tooltip: {
trigger: 'item',
formatter: (params) => {
return `${insertTooltipBr(params.name)} : ${params.value}(${params.percent}%)`
formatter: params => {
return `${insertTooltipBr(params.name)} : ${params.value}(${
params.percent
}%)`
},
position: [10, 10]
},
......@@ -23,12 +34,12 @@ const incomeProductOption = {
{
name: '毛利',
type: 'pie',
minAngle: 5,
minAngle: 5,
avoidLabelOverlap: true,
radius: ['40%', '60%'],
center: ['50%', '60%'],
label:{
show: false,
label: {
show: false
/* align: 'left',
normal:{
formatter(v) {
......@@ -57,24 +68,33 @@ const incomeProductOption = {
}
]
}
function insertBr(text) {
if(text.length <= 8){
return text;
}else if(text.length > 8 && text.length <= 16){
return text = `${text.slice(0,8)}\n${text.slice(8)}\n`
}else if(text.length > 16 && text.length <= 24){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16)}\n`
}else if(text.length > 24 && text.length <= 30){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16,24)}\n${text.slice(24)}\n`
}else if(text.length > 30){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16,24)}\n${text.slice(24,30)}\n${text.slice(30)}\n`
}
}
// function insertBr(text) {
// if (text.length <= 8) {
// return text
// } else if (text.length > 8 && text.length <= 16) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8)}\n`)
// } else if (text.length > 16 && text.length <= 24) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16
// )}\n`)
// } else if (text.length > 24 && text.length <= 30) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16,
// 24
// )}\n${text.slice(24)}\n`)
// } else if (text.length > 30) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16,
// 24
// )}\n${text.slice(24, 30)}\n${text.slice(30)}\n`)
// }
// }
function insertTooltipBr(text) {
if(text.length <= 30){
return text;
}else if(text.length > 30){
return text = `${text.slice(0,30)}</br>${text.slice(30)}`
if (text.length <= 30) {
return text
} else if (text.length > 30) {
text = `${text.slice(0, 30)}</br>${text.slice(30)}`
return text
}
}
export default incomeProductOption
const storeFlowOption = {
color: ['rgba(9,71,198,1)', 'rgba(9,71,198,0.8)', 'rgba(9,71,198,0.6)','rgba(9,71,198,0.4)','rgba(9,71,198,0.3)'],
color: [
'rgba(9,71,198,1)',
'rgba(9,71,198,0.8)',
'rgba(9,71,198,0.6)',
'rgba(9,71,198,0.4)',
'rgba(9,71,198,0.3)'
],
tooltip: {
trigger: 'item',
//formatter: '{a} <br/>{b} : {c} ({d}%)',
formatter: (params) => {
return `${insertTooltipBr(params.name)} : ${params.value}(${params.percent}%)`
// formatter: '{a} <br/>{b} : {c} ({d}%)',
formatter: params => {
return `${insertTooltipBr(params.name)} : ${params.value}(${
params.percent
}%)`
},
position: [10, 10]
},
......@@ -13,9 +20,9 @@ const storeFlowOption = {
orient: 'vertical',
right: 0,
data: [],
formatter: function (name) {
if(name.length>8) {
return name.substr(0,8)+'...'
formatter: function(name) {
if (name.length > 8) {
return name.substr(0, 8) + '...'
}
return name
},
......@@ -30,12 +37,12 @@ const storeFlowOption = {
{
name: '4s门店客流量',
type: 'pie',
minAngle: 5,
minAngle: 5,
avoidLabelOverlap: true,
radius: '50%',
center: ['40%', '65%'],
label:{
show:false,
label: {
show: false
/* align: 'left',
normal:{
formatter(v) {
......@@ -48,23 +55,21 @@ const storeFlowOption = {
} */
},
data: [
{
value: 335,
name: '直接访问',
{
value: 335,
name: '直接访问'
},
{
value: 335,
name: '直接访问',
{
value: 335,
name: '直接访问'
},
{
value: 335,
name: '直接访问',
{
value: 335,
name: '直接访问',
itemStyle: {
color: 'rgba(9,71,198,0.6)'
},
},
}
}
],
emphasis: {
itemStyle: {
......@@ -77,25 +82,34 @@ const storeFlowOption = {
]
}
function insertBr(text) {
if(text.length <= 8){
return text;
}else if(text.length > 8 && text.length <= 16){
return text = `${text.slice(0,8)}\n${text.slice(8)}\n`
}else if(text.length > 16 && text.length <= 24){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16)}\n`
}else if(text.length > 24 && text.length <= 30){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16,24)}\n${text.slice(24)}\n`
}else if(text.length > 30){
return text = `${text.slice(0,8)}\n${text.slice(8,16)}\n${text.slice(16,24)}\n${text.slice(24,30)}\n${text.slice(30)}\n`
}
}
// function insertBr(text) {
// if (text.length <= 8) {
// return text
// } else if (text.length > 8 && text.length <= 16) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8)}\n`)
// } else if (text.length > 16 && text.length <= 24) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16
// )}\n`)
// } else if (text.length > 24 && text.length <= 30) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16,
// 24
// )}\n${text.slice(24)}\n`)
// } else if (text.length > 30) {
// return (text = `${text.slice(0, 8)}\n${text.slice(8, 16)}\n${text.slice(
// 16,
// 24
// )}\n${text.slice(24, 30)}\n${text.slice(30)}\n`)
// }
// }
function insertTooltipBr(text) {
if(text.length <= 30){
return text;
}else if(text.length > 30){
return text = `${text.slice(0,30)}</br>${text.slice(30)}`
if (text.length <= 30) {
return text
} else if (text.length > 30) {
text = `${text.slice(0, 30)}</br>${text.slice(30)}`
return text
}
}
......
......@@ -151,7 +151,7 @@ import { mapActions } from 'vuex'
// import { getOrderDetail } from '@api/order'
export default {
name: 'orderDetail',
data () {
data() {
return {
imgVisible: false,
detail: {
......@@ -180,7 +180,8 @@ export default {
1: '预录员',
2: '转化员',
3: '转化员',
4: '用户'
4: '用户',
5: '管理员'
},
constructioOpts: {
'Y': '已施工',
......@@ -195,7 +196,7 @@ export default {
}
},
mounted () {
mounted() {
this.detail = this.$route.params.detail
// console.log(this.detail)
},
......@@ -214,10 +215,10 @@ export default {
// getTotalNums() {
// return this.detail.subOrderList.reduce((prev, item) => prev + item.nums, 0)
// },
handleEnlargeImg () {
handleEnlargeImg() {
this.imgVisible = !this.imgVisible
},
getSummaries (param) {
getSummaries(param) {
const { columns } = param
const sums = []
columns.forEach((column, index) => {
......@@ -241,7 +242,7 @@ export default {
return sums
},
handleClose () {
handleClose() {
this.close({ tagName: '/orderList' })
this.$router.push({ name: 'orderList' })
this.close({ tagName: '/orderDetail' })
......
......@@ -163,7 +163,7 @@ import { mapActions } from 'vuex'
import { getServiceStore, getParkStore } from '@api/editCustomer'
export default {
name: 'orderList',
data () {
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
statusOpts: {
......@@ -173,8 +173,8 @@ export default {
4: '已支付',
// 5: '已退款',
6: '已评价',
9: '已撤销'
9: '已撤销',
10: '已关闭'
},
upgradeOpts: {
'Y': '已升级',
......@@ -295,7 +295,7 @@ export default {
},
{
confId: 10,
confLabel: 'test'
confLabel: '已关闭'
}
],
upgradeList: [{
......@@ -332,7 +332,7 @@ export default {
}
},
mounted () {
mounted() {
if (this.userInfo.beSuper) {
getParkStore({}).then(res => {
res.forEach(item => {
......@@ -351,7 +351,7 @@ export default {
methods: {
...mapActions({ close: 'd2admin/page/close' }),
handleReset () {
handleReset() {
this.searchForm = {
status: '',
upgradeFinishFlag: '',
......@@ -364,7 +364,7 @@ export default {
this.baseData.storeIdList = []
this.getOptionsList()
},
getServiceStore (merchantId) {
getServiceStore(merchantId) {
getServiceStore({
yqMerchantId: merchantId
}).then(res => {
......@@ -372,7 +372,7 @@ export default {
this.getOptionsList()
})
},
getOptionsList () {
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === 'select') {
if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
......@@ -385,7 +385,7 @@ export default {
}
})
},
getParams () {
getParams() {
const params = _.cloneDeep(this.searchForm)
const form = this.searchForm
......@@ -396,10 +396,10 @@ export default {
return params
},
keyDowmGetList () {
keyDowmGetList() {
this.getList()
},
getList () {
getList() {
var params = this.getParams()
params = {
...this.page,
......@@ -413,7 +413,7 @@ export default {
this.total = res.total
})
},
getOrderCount () {
getOrderCount() {
var params = this.getParams()
params = {
...params
......@@ -422,13 +422,13 @@ export default {
this.totalCount = res.totalPriceCount
})
},
handleSearch () {
handleSearch() {
this.page.pageNum = 1
this.getOrderCount()
this.getList()
},
// 导出
handleExport () {
handleExport() {
var params = this.getParams()
params.pageNum = 1
exportFile(params).then(res => {
......@@ -436,7 +436,7 @@ export default {
})
},
// 查看详情
handleDetail (data) {
handleDetail(data) {
// console.log(data.row)
this.close({ tagName: '/orderDetail' })
this.$router.push({
......@@ -447,13 +447,13 @@ export default {
})
},
// 每页条数
handleSizeChange (value) {
handleSizeChange(value) {
this.page.pageSize = value
this.getList()
},
// 页码
handleCurrentChange (value) {
handleCurrentChange(value) {
this.page.pageNum = value
this.getList()
}
......
......@@ -244,11 +244,11 @@ export default {
// 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码
this.login(_p)
.then(async ({ isMutiAccount, accountInfo, userInfo }) => {
if(isMutiAccount) {
this.isMutiAccount = isMutiAccount
this.accountInfo = accountInfo
this.loginToken = accountInfo.loginToken
.then(async({ isMutiAccount, accountInfo, userInfo }) => {
if (isMutiAccount) {
this.isMutiAccount = isMutiAccount
this.accountInfo = accountInfo
this.loginToken = accountInfo.loginToken
} else {
const _current = userInfo.detail.accountType !== 7 ? await this.current() : '/onlineAccountList'
await this.initBaseData()
......
......@@ -32,7 +32,7 @@
import { getDetailApi } from '@api/publicAccount'
export default {
name: 'accountDetail',
data () {
data() {
return {
detailForm: {},
// 图片对于字段
......@@ -200,7 +200,7 @@ export default {
},
watch: {
accountDetailVisible (newVal) {
accountDetailVisible(newVal) {
if (newVal) {
this.merchantId = this.merchantRow.merchantId
this.getDetail()
......@@ -208,13 +208,13 @@ export default {
}
},
mounted () {
mounted() {
this.merchantId = this.merchantRow.merchantId
this.getDetail()
},
methods: {
getDetail () {
getDetail() {
getDetailApi({ merchantId: this.merchantId }).then(res => {
// console.log(res)
this.currentPage = res.yseMerchantInfo ? res.yseMerchantInfo.custType : 'O'
......
......@@ -159,7 +159,7 @@ import { uploadImg, imgRecognitionApi, getBankListApi, getYseBankListApi, sendTo
import { registerYseMerchantApi, draftYseMerchantApi, getDetailApi } from '@api/publicAccount'
export default {
name: 'applyAccount',
data () {
data() {
var checkPhoneObj = {
required: true,
validator: (rule, value, callback) => {
......@@ -641,7 +641,7 @@ export default {
glUploadImg
},
mounted () {
mounted() {
if (this.$route.params.merchantId) {
this.targetAccount = this.$route.params
sessionStorage.setItem(this.sessionName, JSON.stringify(this.$route.params))
......@@ -681,7 +681,7 @@ export default {
close: 'd2admin/page/close'
}),
// 获取详情,数据恢复
getDetail () {
getDetail() {
getDetailApi({ merchantId: this.targetAccount.merchantId }).then(res => {
// console.log(res)
if (res.yseMerchantInfo) {
......@@ -750,19 +750,19 @@ export default {
})
},
// 开户行
getBankList () {
getBankList() {
getBankListApi({}).then(res => {
this.formList[this.findFormIdx('bankType')].optionList = res
})
},
// 支行
getYseBankList () { },
getYseBankList() { },
// 找到在formList的位置,通过name来匹配
findFormIdx (name) {
findFormIdx(name) {
return this.formList.findIndex(item => item.name === name)
},
// 切换radio后,将obj里面的图片写入editForm
afterChangePic () {
afterChangePic() {
// this[this.typeToForm[this.custType]]
var picKeys = Object.keys(this.picObj)
picKeys.forEach(item => {
......@@ -776,7 +776,7 @@ export default {
// console.log(this.picObj)
},
// 切换radio/编辑,开户行恢复opt数据
recoveryOpenAccBank () {
recoveryOpenAccBank() {
this.formList[this.findFormIdx('openAccBankType')].optionList = this.editForm.openAccBankType ? [{ branchBankType: this.editForm.openAccBankType, branchBankName: this.editForm.openAccBankName }] : []
},
// 上传/删除图片后,将图片的值写入Obj中
......@@ -785,7 +785,7 @@ export default {
// ? (this.editForm.papers[this.picObj[attrName].attrName] = this.picObj[attrName].url)
// : delete this.editForm.papers[this.picObj[attrName].attrName]
// },
handleImgChange ({ file, attrName, targetItem }) {
handleImgChange({ file, attrName, targetItem }) {
var hasFnList = ['idCard', 'idCardBack', 'bankCard', 'businessLicense']
var reader = new FileReader()
var fileInfo = file.raw
......@@ -804,18 +804,18 @@ export default {
})
}
},
handleImgRemove ({ attrName, targetItem }) {
handleImgRemove({ attrName, targetItem }) {
this.picObj[attrName].url = ''
delete this.editForm.papers[this.picObj[attrName].attrName]
// this.writeToEditForm(attrName, false)
// this.$refs.editFormRef.$refs.editFrom.validateField(targetItem.name)
},
handlePreview (file, attrName) {
handlePreview(file, attrName) {
// console.log(file)
// console.log(attrName)
},
// 验证码
handleSend () {
handleSend() {
sendToSmsCodeApi({ phone: this.editForm.operPhone }).then((res) => {
this.notice.okTips('已发送,30分钟内有效')
this.isSend = true
......@@ -824,7 +824,7 @@ export default {
this.msgDown()
})
},
msgDown () {
msgDown() {
this.time = setTimeout(() => {
clearTimeout(this.time)
if (this.sendMsg > 1) {
......@@ -836,7 +836,7 @@ export default {
}, 1000)
},
// 自动识别type - 识别类型(1:身份证;2:银行卡;3:营业执照);imgUrl - 图片地址
handleAutoRecognition (type, imgUrl, needWriteList) {
handleAutoRecognition(type, imgUrl, needWriteList) {
// console.log(type)
// console.log(imgUrl)
imgRecognitionApi({ type: type, imgUrl: imgUrl }).then(res => {
......@@ -865,7 +865,7 @@ export default {
}
})
},
getParams () {
getParams() {
var params = _.cloneDeep(this.editForm)
params.merchantId = this.targetAccount.merchantId
// 身份证日期
......@@ -886,11 +886,11 @@ export default {
return params
},
jumpScroll (idName) {
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView()
},
// 确认
handleConfirm () {
handleConfirm() {
var params = this.getParams()
var picKeys = Object.keys(this.picObj)
for (var item of picKeys) {
......@@ -912,7 +912,7 @@ export default {
})
},
// 存草稿
handleDraft () {
handleDraft() {
var params = this.getParams()
draftYseMerchantApi(params).then(res => {
this.notice.okTips()
......@@ -920,11 +920,11 @@ export default {
})
},
// 删除session
deleteSession () {
deleteSession() {
sessionStorage.removeItem(this.sessionName)
},
// 取消
handleCancel () {
handleCancel() {
this.isSend = false
this.time && clearTimeout(this.time)
this.deleteSession()
......
<!-- 虚拟对账账户 -->
<template>
<d2-container class="account-list">
<div class="header"
slot="header">
<d2-search ref="showSearch"
:searchForm="searchForm"
:formData="showFormData">
<!-- :slot-scope="item" -->
<template slot="channelType">
<el-cascader style="width: 50%;"
:options="merchantLevelOptions[nameToOption[searchForm.channelType]]"
:props="{ checkStrictly: true, value: 'id', label: 'merchantName' }"
:show-all-levels="false"
v-model="merchantLevelVal"
clearable
filterable></el-cascader>
</template>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary">查询</el-button>
<el-button size="small"
@click="handleReset">重置</el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table ref="merchantTable"
:getListApi="getListApi"
:searchForm="searchFormSearch"
:tableParams="tableParams"
:beforeSearchFn="beforeSearchFn">
<auth-button slot="auth-button"
slot-scope="scope"
:data="scope.scope"></auth-button>
</d2-table>
</div>
<!-- width="70%"
title="申请虚拟对公账户详情"
btnOkLabel="确定"
v-if="accountDetailVisible"
@confirmDialog="handleDetailClose"
noCancel="true" -->
<!-- v-if="accountDetailVisible" -->
<baseDialog :isShow.sync="accountDetailVisible"
:config="dialogConfig.setting"
:dialogConfig="dialogConfig.config"
@closeDialog="handleDetailClose">
<!-- <span>test</span> -->
<account-detail v-if="accountDetailVisible"
:accountDetailVisible="accountDetailVisible"
:merchantRow="merchantRow"></account-detail>
</baseDialog>
<!-- <d2-dialog
title="申请虚拟对公账户详情"
:isVisible.sync="accountDetailVisible"
width="70%"
btnOkLabel="确定"
noCancel="true"
@confirmDialog="handleDetailClose"
@closeDialog="handleDetailClose"
>
<account-detail
:accountDetailVisible="accountDetailVisible"
:merchantRow="merchantRow"
></account-detail>
</d2-dialog> -->
</d2-container>
</template>
<script>
import _ from 'lodash'
import { Util } from '@/common/util'
import { getListApi, getMerchantLevelApi } from '@api/publicAccount'
import { mapActions } from 'vuex'
import accountDetail from './accountDetail'
import { BaseData, merchantStoreServiceList } from '@/common/constants.js'
import baseDialog from '@/components/baseDialog/baseDialog'
export default {
name: 'accountList',
data() {
return {
// 账户详情
accountDetailVisible: false,
merchantRow: {},
nameToOption: {
1: 'dj',
2: 'gh'
},
merchantLevelOptions: {
dj: [],
gh: []
},
// 搜索
merchantLevelVal: [],
searchForm: {
merchantType: '',
channelType: '',
merchantName: '',
accountStatus: '',
merchantId: ''
},
searchFormSearch: {},
showFormData: [{
label: '商户分类',
name: 'merchantType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'merchantStoreServiceList'
}, {
label: '渠道',
name: 'channelType',
addHtml: 'channelType',
type: 'select',
width: '50%',
optionList: [],
optionId: 'value',
optionLabel: 'name',
optionsName: 'channelTypeList',
changeAttr: (value, targetItem) => {
this.merchantLevelVal = []
}
}, {
label: '商户名称',
name: 'merchantName',
type: 'input',
isClear: true,
placeholder: '请输入4S店/服务商名称',
keyFn: this.keyDowmGetList
}, {
label: '账户状态',
name: 'accountStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'statusList'
}, {
label: '商户号',
name: 'merchantId',
type: 'input',
inputType: 'number',
maxlength: '9',
isClear: true,
placeholder: '请输入4S店/服务商商务号',
keyFn: this.keyDowmGetList
}],
// 表格
getListApi: getListApi,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '名称',
prop: 'merchantName'
}, {
label: '编号',
prop: 'merchantId'
}, {
label: '商户分类',
prop: 'merchantType',
formatter: (cellValue) => {
// var item = this.baseData.merchantStoreServiceList.find(item => item.confId === cellValue.merchantType)
return cellValue.merchantType === 7 ? '服务商' : '4S店'
}
}, {
label: '渠道',
prop: '',
formatter: cellValue => {
return cellValue.channelType === 1 ? '嘀加' : '广汇'
}
}, {
label: '账户状态',
prop: 'accountStatus',
formatter: (cellValue) => {
return this.baseData.statusList.find(item => item.confId === cellValue.accountStatus).confLabel
}
}, {
label: '最近更新时间',
prop: 'updatedDate',
formatter: (cellValue) => {
return Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss')
}
}]
},
baseData: {
channelTypeList: [],
statusList: [{
confId: 1,
confLabel: '未申请'
}, {
confId: 2,
confLabel: '审核中'
}, {
confId: 3,
confLabel: '生效'
}, {
confId: 4,
confLabel: '失败'
}],
merchantStoreServiceList: merchantStoreServiceList
},
dialogConfig: {
setting: {
showClose: true,
appendToBody: false,
// width: '720px',
btnList: [
// { name: '取消', type: 'cancel' },
// { name: '前往', type: 'confirm' }
]
},
config: {
title: '查看详情',
width: '720px'
}
}
}
},
components: {
accountDetail,
baseDialog
},
mounted() {
this.getBaseData()
// 1-嘀加;2-广汇
this.getMerchantLevel(1)
this.getMerchantLevel(2)
// console.log(this.merchantLevelOptions)
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
async getBaseData() {
this.baseData.channelTypeList = await this.get(BaseData.channelType)
this.getOptionsList()
},
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === 'select') {
if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
const temp = {}
temp[this.showFormData[index].optionId] = ''
temp[this.showFormData[index].optionLabel] = '全部'
this.baseData[item.optionsName].unshift(temp)
}
this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
}
})
},
getMerchantLevel(channelType) {
// channelType:1-嘀加;2-广汇
getMerchantLevelApi({ channelType: channelType }).then(res => {
// this.merchantLevelOptions[this.nameToOption[channelType]] = JSON.parse(res)
this.merchantLevelOptions[this.nameToOption[channelType]] = res
})
},
// 账户状态不同,会有不同的操作
// 1/4 - 待申请/失败(编辑);2 - 审核中(置灰); 3 - 生效中(详情)
handleApply(cellValue) {
// 查看详情
if (cellValue.accountStatus === 3) {
this.merchantRow = cellValue
this.handleDetailClose()
return true
}
// 编辑
this.close({ tagName: '/applyAccount_new' })
this.$router.push({
name: 'applyAccount_new',
params: cellValue
})
},
handleReset() {
this.searchForm = {
merchantType: '',
channelType: '',
merchantName: '',
accountStatus: '',
merchantId: ''
}
this.merchantLevelVal = []
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = _.cloneDeep(this.searchForm)
this.searchFormSearch.merchantTypeList = this.searchForm.merchantType ? [this.searchForm.merchantType] : [2, 7]
this.searchFormSearch.merchantId = this.searchForm.merchantId ? this.searchForm.merchantId : this.merchantLevelVal[this.merchantLevelVal.length - 1]
delete this.searchFormSearch.merchantType
resolve()
})
},
keyDowmGetList() {
this.$refs.merchantTable.refreshTable()
},
handleDetailClose() {
// console.log('visible')
this.accountDetailVisible = !this.accountDetailVisible
}
}
}
</script>
<style>
.el-cascader-panel .el-cascader-menu {
width: 260px;
}
</style>
<!-- 编辑表单组件 -->
<template>
<d2-container>
<el-form ref="editForm"
class="editForm d2-container-content"
:model="editForm"
:rules="formRules"
:label-width="labelWidth"
v-loading="$store.state.d2admin.loading.value">
<!-- <p name="title"
class="edit-title">{{title}}</p> -->
<slot name="failMessage"></slot>
<div v-for="(item, index) in formList"
:key="index"
:style="{...item.style}">
<p v-if="item.isTitle"
class="edit-title"
style="margin-bottom:22px">{{item.titleName}}</p>
<el-form-item v-if="(item.showAttrList ? item.showAttrList.includes(currentPage) : true) && (item.showForsettlement ? item.showForsettlement.includes(settlementPage) : true) && (item.showForContractType ? item.showForContractType.includes(contractTypePage) : true)"
:prop="item.name"
:label="typeof item.label === 'object' ? (item.label[currentPage] || item.label[settlementPage] || item.label[contractTypePage] + ':') : (item.label ? item.label + ':' : '')"
:id="item.name"
:label-width="item.label ? labelWidth : '0px'"
:rules="item.showAttrList ? (item.showAttrList.includes(currentPage) ? item.rules : []) : item.rules"
class="dis-in-block is-required"
:style="{'margin-bottom': !item.type ? '0px' : '22px'}">
<el-input v-if="item.type === 'input'"
:id="item.name"
v-model="editForm[item.name]"
:size="item.size || 'mini'"
:placeholder="typeof item.placeholder === 'object' ? (item.placeholder[currentPage] || item.placeholder[settlementPage]): (item.placeholder || ('请输入' + item.label))"
:maxlength="item.maxlength || 80"
:style="{'width': item.width || formDefaultWidth}"
:disabled="item.isDisabled"
clearable
@blur="blur($event,item)"
@input="input($event,item)">
<i slot="suffix"
class="suffix">{{item.unit}}</i>
</el-input>
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'"
:id="item.name"
v-model="editForm[item.name]"
:size="item.size || 'mini'"
:clearable="item.isClear"
:placeholder="typeof item.placeholder === 'object' ? (item.placeholder[currentPage] || item.placeholder[settlementPage]): (item.placeholder || '请选择' + item.label)"
@change="item.hanleSelectChange($event, item)"
filterable
:style="{'width': item.width || formDefaultWidth}"
:disabled="item.isDisabled">
<el-option v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]">
</el-option>
</el-select>
<!-- 选择框 - 远程搜索 -->
<el-select v-else-if="item.type === 'filterSelect'"
:id="item.name"
v-model="editForm[item.name]"
:size="item.size || 'mini'"
filterable
remote
:allow-create="item.noAllowCreate || false"
:placeholder="typeof item.placeholder === 'object' ? (item.placeholder[currentPage] || item.placeholder[settlementPage]): (item.placeholder || '请选择' + item.label)"
:remote-method="(query) => item.remoteMethod(query, item)"
@change="item.hanleSelectChange($event, item)"
:style="{'width': item.width || formDefaultWidth}"
clearable>
<el-option v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]">
</el-option>
</el-select>
<!-- 单选框 -->
<el-radio-group v-else-if="item.type === 'radio'"
:id="item.name"
:size="item.size || 'mini'"
v-model="editForm[item.name]"
@change="change($event,item)">
<el-radio v-for="(subItem, subIdx) in item.radioOptList"
:key="subIdx"
:label="subItem.value">
{{subItem.label}}
<el-tooltip content="线下签约确定提交后,请联系银盛工作人员人工审核"
v-if="item.name == 'contractType' && subIdx == 0"
placement="top">
<i class="el-icon-question"
@click.native.prevent="stop"
style="color: #606266;"></i>
</el-tooltip>
</el-radio>
</el-radio-group>
<!-- 时间 -->
<el-date-picker v-else-if="item.type === 'datePicker'"
:id="item.name"
v-model="editForm[item.name]"
:size="item.size || 'mini'"
:type="item.datePickerType || 'date'"
:clearable="item.isClear || false"
:placeholder="'请选择' + (item.placeholder || item.label)"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="change($event,item)">
</el-date-picker>
<slot v-else
:name="item.slotName"
:scope="item"></slot>
<span v-show="item.itemSuffix"
:style="{...item.itemSuffixStyle}">{{item.itemSuffix}}</span>
</el-form-item>
</div>
<el-form-item style="margin-top: 20px;">
<el-button type="primary"
@click="handleConfirm">确定</el-button>
<el-button @click="handleDraft">存草稿</el-button>
<el-button @click="handleCancel">取消</el-button>
</el-form-item>
</el-form>
</d2-container>
</template>
<script>
export default {
name: 'editForm',
data() {
return {
labelWidth: '170px',
formDefaultWidth: '350px'
}
},
props: {
title: {
type: String,
default: '编辑'
},
// 标记字段,用于显示/隐藏某些表单项
currentPage: {
type: String,
default: ''
},
// 标记字段,用于显示/隐藏结算方式对应的项
settlementPage: {
type: [String, Number],
default: ''
},
// 标记字段,用于显示/隐藏签约方式对应的项
contractTypePage: {
type: [String, Number],
default: ''
},
// 表单规则
formRules: {
type: Object,
default: () => { }
},
// 绑定的表单值
editForm: {
type: Object,
default: () => { }
},
// 表单列表
formList: {
type: Array,
default: () => []
}
},
mounted() { },
methods: {
stop() {
console.log('stop')
},
// selectAddAttr(value, targetItem) { }
// 处理属性没有对应事件的情况
input(event, item) {
// console.log(event)
// input($event,item)
// console.log(item)
item.handleInput && item.handleInput(event, item)
},
blur(event, item) {
item.handleBlur && item.handleBlur(event, item)
},
change(event, item) {
item.handleChange && item.handleChange(event, item)
},
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView(event)
// document.getElementById(idName).scrollIntoView(event, item)
},
// 确认
handleConfirm() {
this.$refs.editForm.validate((valid, opt) => {
var hasError = Object.keys(opt)
if (!valid) {
this.jumpScroll(hasError[0])
return false
}
this.$emit('handleConfirm')
})
},
// 存草稿
handleDraft() {
this.$emit('handleDraft')
},
// 取消
handleCancel() {
this.$emit('handleCancel')
}
}
}
</script>
<style scoped>
.d2-container-content {
margin-top: 0 !important;
}
</style>
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!