Commit 1d2f9ccc by 张立顺

Merge branch 'SAAS+V4.37.0' into 'SAAS+V4.37.0_0326'

Saas+v4.37.0

See merge request !1
2 parents 5756c0ef 08648443
Showing 83 changed files with 4440 additions and 0 deletions
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
VUE_APP_PORT = 6652
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file
{
"root": true,
"env": {
"node": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
},
"parserOptions": {
"parser": "babel-eslint"
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"printWidth": 800,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 820,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
# subapp-blog
微前端博客子应用
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"component",
{
libraryName: "element-ui",
styleLibraryName: "theme-chalk"
}
]
]
};
This diff could not be displayed because it is too large.
{
"name": "quality",
"version": "1.0.0",
"description": "A Vue.js project",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"bignumber.js": "^9.1.1",
"core-js": "^3.4.4",
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^2.0.9",
"glsx-components": "^1.5.4",
"rfdc": "^1.3.1",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.3",
"babel-plugin-component": "^1.1.1",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.10"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="referrer" content="never">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<title>微前端子应用:博客</title>
</head>
<body>
<noscript>
<strong>We're sorry but module-report doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file
var express = require('express')
// var history = require('connect-history-api-fallback')
var cors = require('cors')
var app = express()
// app.use(history())
app.use(cors())
app.use(express.static('./dist'))
app.get('/', function(req, res) {
res.send('Hello jq')
})
const port = 6652
app.listen(port)
console.log(`服务已运行:\r\n http://127.0.0.1:${port}`)
<template>
<div id="app">
<!-- <h2>
报表子应用
<span class="right"></span>
</h2>
<div id="nav">
<span>切换路由:</span>
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/')">报表</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about')">穿梭框</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1')">表格</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">日历</el-button>
<el-button type="primary" size="medium" @click="toAppReport('3-1')">aaaa</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<span>rxjs通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('rxjs')">通知父应用变天了</el-button>
</div>
<div>
<span>官方通信方案:</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('default')">通知父应用收到</el-button>
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div>-->
<router-view />
</div>
</template>
<script>
export default {
name: 'report-app',
props: {
msg: String,
message: String
},
data() {
return {
myMsg: '',
gs: ''
}
},
created() {
this.myMsg = this.msg
this.myMessage = this.message
}
}
</script>
<style lang="scss">
.parent-child-communication {
padding: 20px 0;
line-height: 36px;
}
#app {
padding: 0px 20px 20px 40px;
// overflow-y: auto;
height: 100%;
}
</style>
>
/*
所有模块都定义在 modules
|-modules
|----demo.js
|----demo1.js
|----...
|-index.js ---动态对外暴露所有模块 无须手动添加
参考demo.js 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
*/
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
import { http } from '@/main'
const path = 'scrm.api.mindworkplate.'
const path2 = 'dj.api.smartcarlife.'
// 质检管理
const getReclistWithPage = params => {
params.method = `${path}badge.employeeBadgeReclistWithPage`
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
// 工牌统计管理
const statisticsEmployeeBadge = params => {
params.method = `${path}badge.statisticsEmployeeBadge`
return http({
url: 'rop-scrm-partner/router',
method: 'POST',
data: params,
sign: true
})
}
// 分页查询接待批次列表
const conversationPage = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}inspection.conversation.batch.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
/** 获取园区店列表 - 园区店 */
const listShop4sByRef = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.scenemerchantref.listShop4sByRef`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//获取一级二级分类
const getPointCategory = (params = {}) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}inspection.conversation.point.category`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// // 质检详情-质检分析
const conversationCheckList=(params)=>{
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}inspection.conversation.check.detail`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 质检详情-分页查询对话列表
const conversationDetailPage=(params)=>{
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `${path2}inspection.conversation.detail.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// // 质检点管理-分页列表
// const conversationPointPage=(data)=> {
// data.method = `${path2}inspection.conversation.point.page`
// return request(data, "post")
// }
// // 工牌管理
// const employeeBadgelistWithPage(data)= {
// data.method = `${path}badge.employeeBadgelistWithPage`
// return request(data, "post")
// }
// // 同步数据
const syncBadge=(params = {}) =>{
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.routerMethod = `dj.api.mindworkplate.badge.syncBadge`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
getReclistWithPage,
statisticsEmployeeBadge,
conversationPage,
listShop4sByRef,
getPointCategory,
conversationCheckList,
conversationDetailPage,
syncBadge
}
import { http,http_common } from '@/main'
const path = "dj.api."
const defaultPath = 'scrm.api.carlife.'
// 获取不同场景的商品分类
const getGoodsCategoryConfiguration = (params) => {
params.method = `scrm.api.boutiquecoupon.rop.router.twoCityTale`
params.currentPage = 1
params.pageSize = 999999
params.routerMethod = `${path}goodsCategoryConfiguration.page`
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
// 视频上传
const uploadVideo = params => {
params.method = `${defaultPath}common.uploadVideo`
return http({
url: 'rop-scrm-carlife/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const uploadImg = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
export default { getGoodsCategoryConfiguration, uploadImg, uploadVideo }
.left {
float: left;
}
.right {
float: right;
}
.align-right {
text-align: right;
}
.left{float:left}.right{float:right}.align-right{text-align:right}
$color-yellow:#fdb757;
$color-green:#2cca74;
$color-gray:#999;
//背景图片 100%
@mixin bkgMaxSize($url) {
background-image: url($url);
background-repeat: no-repeat;
background-size: 100% 100%;
}
@mixin font-setting-group($font-size,$font-family,$font-weight,$color,$line-height){
font-size: $font-size;
font-family: $font-family;
font-weight: $font-weight;
color: $color;
line-height: $line-height;
}
//边框圆角
@mixin borderRadius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
-o-border-radius: $radius;
border-radius: $radius;
}
//定位上下左右居中
@mixin positionCenter {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
//定位上下居中
@mixin ct {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
//定位左右居中
@mixin cl {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
//定位全屏
@mixin allcover {
position: absolute;
top: 0;
right: 0;
}
//相对定位
@mixin my-absolute($left, $top,$z) {
position: absolute;
z-index: $z;
margin-left: $left;
margin-top: $top;
}
//宽高-不同
@mixin widthHeightN($width, $height){
width: $width;
height: $height;
}
//宽高-相同
@mixin widthHeightY($number){
width: $number;
height: $number;
}
//字体大小,颜色
@mixin sizeColor($size, $color){
font-size: $size;
color: $color;
}
//flex布局
@mixin center_none{
display: flex;
justify-content: center;
align-items: center;
}
@mixin center_center{
display: flex;
justify-content: center;
align-items: center;
}
@mixin flex-start_center{
display: flex;
justify-content: flex-start;
align-items: center;
}
@mixin space-between_center{
display: flex;
justify-content: space-between;
align-items: center;
}
@mixin space-around_center{
display: flex;
justify-content: space-around;
align-items: center;
}
@mixin flex-end_center{
display: flex;
justify-content: flex-end;
align-items: center;
}
@mixin wrap_flex-start{
display: flex;
flex-wrap:wrap;
align-content:flex-start;
}
@mixin flex-start_column{
display: flex;
justify-content: flex-start;
flex-direction: column;
}
@mixin none_center_column{
display: flex;
align-items: center;
flex-direction: column;
}
@mixin center_center_column{
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: column;
}
//圆点
@mixin dot{
width: 6px;
height: 6px;
border-radius: 50%;
display: inline-block;
vertical-align: middle;
margin-right: 8px;
}
body,
html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f4f5fa;
}
.container {
background: #ffffff;
padding: 20px;
}
.quality .table-title {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}
.quality .edit-container {
margin-bottom: 16px;
}
// form-start
.quality.edit-box .container {
padding: 0 0 20px;
}
.quality .edit-form-container {
margin:20px 20px 0 0;
}
.quality .edit-title {
font-size: 16px;
font-weight: 600;
height: 58px;
line-height: 58px;
border-bottom: 1px solid #e7eaec;
margin: 0 0;
padding: 0 0 0 20px;
}
// form-end
// 单行省略
.ellipsis-1 {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
/* for Opera */
}
.m-b-20 {
margin-bottom: 20px;
}
.p-t-20 {
padding-top: 20px;
}
.quality .p-0 {
padding: 0;
}
.pointer {
cursor: pointer;
}
.img-36 {
width: 36px;
height: 36px;
}
.text-6{
color: #666666;
}
.text-3{
color: #333333;
}
.font-12{
font-size: 12px;
}
.weight-6 {
font-weight: 600;
}
.carIcon {
display: inline-block;
width: 22px;
height: 22px;
background: url(../../images/shoppingCarIcon.webp) no-repeat;
background-size: 100% 100%;
margin-right: 4px;
}
.el-tooltip__popper.is-light {
background: #ffffff;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08);
border: 1px solid #e4e7ed !important;
width: 177px;
box-sizing: border-box;
}
.el-tooltip__popper[x-placement^='top'] .popper__arrow {
border-color: #e4e7ed !important;
}
.el-tooltip__popper[x-placement^='top'] .popper__arrow:after {
border-bottom-color: #e4e7ed !important;
}
/**
* 根据路由匹配地址
* @param {*} data 路由数据
* @param {*} base 路由前缀
* @param {*} options 粗略的配置项
*/
function routeMatch(data, base, options = { url: 'url', name: 'name', id: 'id', permissions: 'permissions' }) {
if (!Array.isArray(data)) return []
// 主视图路由 正式项目需要区分登陆注册等
/* let userRouter = {
path: "/layout",
name: "layout",
component: () => import('@/views/layout/index.vue'),
redirect: '/index',
children: []
}; */
// 创建路由盒子
let routerBox = []
// 将菜单数据处理为一维函数 如果有多级菜单
// let menu = flattenDeep(data, 'children');
let menu = data
// 遍历处理路由
menu.forEach(item => {
if (!item[options.url]) return
let _url = item[options.url].replace(base, '')
try {
let routerItem = {
path: _url, // 路由路径名
name: item[options.name] || item[options.id], // 命名路由 用于配合菜单简洁跳转
meta: {
purview: item[options.permissions]
}, // 路由元信息 定义路由时即可携带的参数,可用来管理每个路由的按钮操作权限
component: () => import(`@/views${_url}/index.vue`) // 路由映射真实视图路径
}
routerBox.push(routerItem)
} catch (err) {
item[options.url] = '/err-404'
}
})
// 推入需要授权后等异步加载的,非服务端获取的功能性页面
// routerBox.push(...nextRouter);
let errorBox = {
path: '*',
redirect: '/err-404'
}
routerBox.push(errorBox)
return routerBox
}
export default routeMatch
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, maxValue, regRule) {
/* eslint-disable */
var reg = {
priceReg: /^\d[\d\.]*$/,
numReg: /^[1-9]\d*$/,
zNumReg: /^\d*$/
}
/* eslint-enable */
regRule = regRule || 'priceReg'
if (newValue && ((minValue && newValue < minValue) || (maxValue && newValue > maxValue))) {
return oldValue || ''
}
if (newValue && reg[regRule].test(newValue + '')) {
if (/\./.test(newValue)) {
newValue = newValue + ''
var interger = newValue.split('.')[0]
var point = newValue.split('.')[1]
var intergerNum = interger.length > intergerDigit ? oldValue.split('.')[0] : interger
var pointNum = point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit ? intergerNum + '.' + pointNum : newValue.split('.')[0]
} else {
newValue = newValue.length > intergerDigit ? oldValue.slice(0, intergerDigit) : newValue
if (regRule == 'zNumReg') {
newValue = newValue.split('')[0] == '0' ? '0' : newValue
}
}
return newValue
} else {
return newValue ? oldValue : newValue
}
}
const orderManageStatusList = [
{ confId: '1', confName: '未支付' },
{ confId: '2', confName: '已支付' },
{ confId: '3', confName: '已失效' },
{ confId: '4', confName: '已发货' },
{ confId: '5', confName: '已收货' },
{ confId: '6', confName: '待审核' },
{ confId: '7', confName: '审核成功' },
{ confId: '8', confName: '审核失败' },
{ confId: '9', confName: '待确认' },
{ confId: '10', confName: '退款中' },
{ confId: '11', confName: '已退款' },
{ confId: '12', confName: '退款失败' },
{ confId: '13', confName: '待发货' },
{ confId: '14', confName: '待安装' },
{ confId: '15', confName: '已安装' }
]
const orderSourceList = [
{ confId: '1', confName: '商城订单' },
{ confId: '2', confName: '直播订单' },
{ confId: '3', confName: '活动订单' }
]
const deliveryTypeList = [
{ confId: '1', confName: '到店核销' },
{ confId: '2', confName: '快递到家' }
]
//会员中心得状态list
const statusList = [
// {
// confId: '',
// confName: '全部'
// },
{
confId: 1,
confName: '生效中'
},
{
confId: 2,
confName: '已失效'
}
]
//会员订单类型字典
const orderTypesList = [
{
confId: 1,
confName: '套餐'
},
{
confId: 2,
confName: '会员卡'
}
]
const orderStatusList = [
// 2: '待收货',
// 3: '已完成',
// 4: '售后中',
// 5: '退款失败',
// 6: '已经退款',
{
confId: 2,
confName: '待收货'
},
{
confId: 3,
confName: '已完成'
},
{
confId: 4,
confName: '售后中'
},
{
confId: 5,
confName: '退款失败'
},
{
confId: 6,
confName: '已退款'
}
]
const serviceStatusList = [
{
confId: 1,
confName: '未生效'
},
{
confId: 2,
confName: '生效中'
},
{
confId: 3,
confName: '已失效'
}
]
const memberTypeList = [
{
confId: 1,
confName: '正式会员'
},
{
confId: 2,
confName: '试用会员'
}
]
const stateList = [
{
confId: 0,
confName: '待上架'
},
{
confId: 1,
confName: '在售中'
},
{
confId: 2,
confName: '已下架'
}
]
function setMinHeight(calssName = '.edit-container') {
let height = document.querySelector('.header-wrap').clientHeight + 110 + 'px'
let minHeight = 'calc(100vh - ' + height + ')'
document.querySelector(calssName).style.minHeight = minHeight
}
export { limitPrice, orderManageStatusList, orderSourceList, deliveryTypeList, statusList, serviceStatusList, memberTypeList, stateList, orderTypesList, orderStatusList, setMinHeight }
// 获取最近n个月,默认6个月
export function getCurrentSixMonth(n = 5) {
return [new Date(new Date().setMonth(new Date().getMonth() - n)), new Date()]
}
// 新值,旧值,整数部分位数,小数部分位数,最小值,最大值,规则
export function limitPrice(
newValue,
oldValue,
intergerDigit,
pointDigit,
minValue,
maxValue,
regRule
) {
var reg = {
priceReg: /^\d[\d\.]*$/, // eslint-disable-line
numReg: /^[1-9]\d*$/
}
regRule = regRule || "priceReg"
if (
newValue &&
((minValue && newValue < minValue) || (maxValue && newValue > maxValue))
) {
return oldValue || ""
}
if (newValue && reg[regRule].test(newValue + "")) {
if (/\./.test(newValue)) {
newValue = newValue + ""
var interger = newValue.split(".")[0]
var point = newValue.split(".")[1]
var intergerNum =
interger.length > intergerDigit ? oldValue.split(".")[0] : interger
var pointNum =
point.length > pointDigit ? point.slice(0, pointDigit) : point
newValue = pointDigit
? intergerNum + "." + pointNum
: newValue.split(".")[0]
} else {
newValue =
newValue.length > intergerDigit
? oldValue.slice(0, intergerDigit)
: newValue
}
return newValue
} else {
return newValue ? oldValue : ""
}
}
/**
* 时间控件-限制月份
*/
export const rangePickerOptions = {
disabledDate(date) {
console.log(date)
console.log(new Date())
if (date > new Date()) {
return true
}
return false
}
}
/**
* 时间控件-(0-30天内的日期)
*/
export const appointDays = 35
export const afterTodayOptions = {
disabledDate(date) {
if (
date < new Date(new Date().toLocaleDateString()) ||
date >
new Date(new Date().setDate(new Date().getDate() + (appointDays - 1)))
) {
return true
}
return false
}
}
/**
* 时间控件-单年份选择时限制年份
*/
export const rangePickerOptions_year_2023 = {
disabledDate(date) {
// console.log(date)
// console.log(date.getFullYear())
// console.log(new Date())
if (
date.getFullYear() > new Date().getFullYear() ||
date.getFullYear() < 2023
) {
return true
}
return false
}
}
// import Vue from 'vue'
import { Message, MessageBox, Loading } from "element-ui"
// import moment from 'moment'
import dayjs from "dayjs"
let loadingInstance = ""
export const Util = {
/**
* 简单alert
* title 标题
* message 内容
* className 自定义class
* showCancelButton 是否展示取消按钮
* confirmButtonText 确认按钮文案
* cancelButtonText 取消按钮文案
* confirmButtonColor 确认按钮颜色
* cancelButtonColor 取消按钮颜色
*/
msg: function (options) {
MessageBox({
title: options.title || "",
type: options.type || "error",
message: options.message || "",
className: options.className || "",
showCancelButton: options.showCancelButton || false,
confirmButtonText: options.confirmButtonText || "确认",
cancelButtonText: options.cancelButtonText || "取消",
confirmButtonColor: options.confirmButtonColor || "#1989fa",
cancelButtonColor: options.cancelButtonColor || "#000",
dangerouslyUseHTMLString: true,
callback: function (action, done) {
if (action == "confirm") {
if (options.success) {
options.success(done)
}
} else {
console.log(done)
// done()
}
}
})
/* Vue.$vux.alert.show({
title: options.title||'',
content: options.message||'',
onShow() {
options.onShow?(options.onShow)():'';
},
onHide() {
options.onHide?(options.onHide)():'';
}
}) */
},
/**
* 提示框
*/
Info: function (options) {
Message({
message: options.message || "提示",
type: options.type || "error",
duration: options.time || 2000,
onClose: options.onClose || ""
})
},
/**
* 轻提示
*/
Tips: function (options) {
Message({
message: options.message || "提示",
duration: options.duration || 3000,
type: options.type || "text",
icon: options.icon || ""
})
},
/**
* loading
*/
loading: function (message) {
loadingInstance = Loading.service({
text: message || "加载中..."
})
},
/**
* 关闭loading
*/
closeLoading: function () {
loadingInstance.close()
},
/**
* 校验手机号码格式
*/
checkPhone: function (mobile) {
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) {
const reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel)
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
const reg = new RegExp(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
)
return reg.test(str)
},
/**
* 只能输入英文字母和数字,不能输入中文
*/
validationInput: function (str) {
const reg = /[^\w\.\/]/gi // eslint-disable-line
return reg.test(str)
},
/**
* 获取当前时间
*/
getCurrentDate: function () {
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) {
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) {
const date1 = new Date()
const date2 = new Date(date1)
let time = 30
if (day) {
time = day
}
date2.setDate(date1.getDate() + time)
const _date =
date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
}
},
/**
* 日期格式转换
*/
dateFormate: function (str, type) {
let txt = "YYYY-MM-DD"
if (type) {
txt = type
}
const m = dayjs(str).format(txt)
return m
},
/**
* 字段截取
*/
cutStr: function (str, num) {
if (!str) {
return ""
}
let m = 10
let n = str
if (num) {
m = num
}
if (str.length > m) {
n = str.slice(0, m) + "..."
}
return n
},
// /**
// * 深克隆 所有原型链上的对象和属性
// * 例: const bar=deepClone(foo)
// * console.log(bar===foo) false
// * @param {*} obj
// */
deepClone: function (obj) {
const clone = require("rfdc")({ proto: false, circles: false })
return clone(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
// if (obj instanceof Date) {
// const copy = new Date()
// copy.setTime(obj.getTime())
// return copy
// }
// // Handle Array or Object
// if ((obj instanceof Array) | (obj instanceof Object)) {
// const copy = obj instanceof Array ? [] : {}
// for (var attr in obj) {
// // if (Object.prototype.hasOwnProperty.call(attr)) {
// if (obj.hasOwnProperty(attr)) {
// copy[attr] = Util.deepClone(obj[attr])
// // console.log("copy[attr] ", copy[attr])
// }
// }
// return copy
// }
// throw new Error("Unable to clone obj! Its type isn't supported.")
// },
/**
* url下载文件
*
*/
downLoadFile: function (url) {
// console.log(row)
// return
const Temp = document.createElement("a")
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
Temp.href = url
// console.log(url)
// console.log(Temp.href)
document.body.append(Temp)
Temp.click()
document.body.removeChild(Temp)
},
/**
* @param {Object} json
* @param {Object} type: 默认不传 ==>全部小写;传1 ==>全部大写;传2 ==>首字母大写
* 将json的key值进行大小写转换
*/
jsonKeysToCase: function (json, type) {
if (typeof json == "object") {
var tempJson = JSON.parse(JSON.stringify(json))
toCase(tempJson)
return tempJson
} else {
return json
}
function toCase(json) {
if (typeof json == "object") {
if (Array.isArray(json)) {
json.forEach(function (item) {
toCase(item)
})
} else {
for (var key in json) {
var item = json[key]
if (typeof item == "object") {
toCase(item)
}
delete json[key]
switch (type) {
case 1:
// key值全部大写
json[key.toLocaleUpperCase()] = item
break
case 2:
// key值首字母大写,其余小写
json[
key.substring(0, 1).toLocaleUpperCase() +
key.substring(1).toLocaleLowerCase()
] = item
break
default:
// 默认key值全部小写
json[key.toLocaleLowerCase()] = item
break
}
}
}
}
}
},
// 判断字段为空时显示
fieldShow: function (field, show) {
return field || show
},
// 整数补零显示两位小数
returnFloat: function (num) {
num = num.toString()
if (num.indexOf(".") != -1) {
let newVal = num.split(".")
if (newVal[1].length == 1) {
newVal = newVal.join(".")
newVal += "0"
num = newVal
}
} else {
num += ".00"
}
return num
}
}
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
export const downLoadFile = Util.downLoadFile
export const returnFloat = Util.returnFloat
/**
* 时间控件-限制月份
*/
export const beforeRangePickerOptions = {
disabledDate(date) {
if (date > new Date()) {
return true
}
return false
}
}
export const afterRangePickerOptions = {
disabledDate(date) {
const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
if (date < yesterday) {
return true
}
return false
}
}
<template>
<div class="map-box" :style="{ height: mapHeight + 'px', width: mapWidth + 'xp' }">
<div id="container">
<el-select v-model="input" class="map-input" filterable remote reserve-keyword placeholder="请输入" :remote-method="remoteMethod" @change="handleChangeAdr" :loading="loading">
<el-option v-for="item in adrList" :key="item.id" :label="item.address" :value="item.id"></el-option>
</el-select>
</div>
<div class="map-address">
<img class="icon-map" src="./images/icon-map.png" />
{{ address }}
</div>
</div>
</template>
<script>
let map, marker, placeSearch
export default {
name: 'map',
props: {
mapHeight: {
type: Number,
default: 460
},
mapWidth: {
type: Number,
default: 740
}
},
data() {
return {
input: [],
address: '',
adrList: [],
lnglat: [],
geocoderAddress: {}
}
},
mounted() {
this.mapInit()
},
methods: {
// initMap() {
// console.log(document.getElementsByTagName('head'))
// var script = document.createElement('script')
// script.type = 'text/javascript'
// script.src = 'https://webapi.amap.com/loader.js'
// document.getElementsByTagName('head')[0].appendChild(script)
// },
mapInit() {
/* eslint-disable */
AMapLoader.load({
/* eslint-enable */
key: '44cc16e43ad7ed3358df507bd0618181', // 申请好的Web端开发者Key,首次调用 load 时必填
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
// 需要使用的的插件列表
plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.Geocoder'],
AMapUI: {
// 是否加载 AMapUI,缺省不加载
version: '1.1', // AMapUI 版本
plugins: ['overlay/SimpleMarker'] // 需要加载的 AMapUI ui插件
},
Loca: {
// 是否加载 Loca, 缺省不加载
version: '2.0' // Loca 版本
}
})
.then(AMap => {
map = new AMap.Map('container', {
zoom: 20,
autoFitView: true,
resizeEnable: true,
cursor: 'move'
})
if (this.lnglat.length) {
this.addMarker(this.lnglat)
}
map.addControl(new AMap.Scale())
map.addControl(new AMap.ToolBar())
this.geocoder = new AMap.Geocoder()
map.setDefaultCursor('pointer')
AMap.plugin(['AMap.PlaceSearch'], function () {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
pageSize: 8, // 单页显示结果条数
pageIndex: 1, // 页码
citylimit: false, //是否强制限制在设置的城市内搜索
// panel: "panel", // 结果列表将在此容器中进行展示。
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: 'default'
})
})
map.on('click', this.getAddress)
})
.catch(e => {
console.error(e) //加载错误提示
})
},
remoteMethod(query) {
if (query == '') {
return true
}
let _this = this
placeSearch.search(query, function (status, result) {
if (status === 'complete' && result.poiList.pois.length) {
_this.adrList = result.poiList.pois
}
})
},
addMarker(lnglat) {
let position
if (lnglat.lng) {
position = [lnglat.lng, lnglat.lat]
} else {
position = lnglat
}
this.lnglat = position
marker = new AMap.Marker({
map: map,
icon: new AMap.Icon({
image: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
size: new AMap.Size(27, 34), //图标大小
imageSize: new AMap.Size(27, 34)
}),
// draggable: true,
position: position,
offset: new AMap.Pixel(-10, -10)
})
map.setCenter(position)
map.add(marker)
marker.setMap(map)
// this.map.setFitView()
},
getAddress(e) {
let self = this
let position
if (e.type == 'click') {
position = e.lnglat
} else {
let { lng, lat } = e
position = [lng, lat]
}
if (marker) {
map.remove(marker)
marker.setMap(null)
marker = null
}
self.addMarker(position)
AMap.plugin('AMap.Geocoder', () => {
const geocoder = new AMap.Geocoder()
geocoder.getAddress(position, (status, result) => {
self.address = result.regeocode.formattedAddress
geocoder.getLocation(self.address, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
self.geocoderAddress = result.geocodes[0]
}
})
})
})
},
handleChangeAdr(val) {
if (val) {
var location = this.adrList.find(item => item.id == val)
this.getAddress(location.location)
this.input = ''
this.adrList = []
}
}
}
}
</script>
<style scoped lang="scss">
.map-box {
display: flex;
#container {
position: relative;
width: calc(100% - 284px - 16px);
height: 100%;
}
.map-input {
position: absolute;
top: 32px;
width: 60%;
left: 25%;
z-index: 2;
}
}
#panel {
position: absolute;
max-height: 90%;
overflow-y: auto;
top: 80px;
right: 10px;
width: 280px;
}
.map-address {
display: flex;
box-sizing: border-box;
width: 284px;
height: 100%;
background-color: #f9f9f9;
padding: 20px;
margin-left: 16px;
line-height: 20px;
.icon-map {
width: 16px;
height: 16px;
margin-right: 6px;
}
}
</style>
\ No newline at end of file
<template>
<div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" inline="true" class="province" style="padding-left: 0;">
<el-select size="small" v-model="provinceForm.provinceName" clearable :disabled="isDisabled" placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable :disabled="isDisabled" placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable :disabled="isDisabled" placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select>
</el-form>
</div>
</template>
<script>
export default {
name: 'GLProvince',
props: {
// 省市级别,2--只显示省市,3--显示省市区,默认只显示省市
subdistrict: {
type: Number,
default: 2
},
// 省市下拉组件宽度
defaultWidth: {
type: String,
default: '150px'
},
// 组件是否展示,默认展示
provinceView: {
type: Boolean,
default: true
},
isDisabled: {
type: Boolean,
default: false
}
},
data() {
return {
// 所有数据
AllData: [],
// 城市列表
cityList: [],
// 地区列表
townList: [],
provinceForm: {
// 省份名称
provinceName: '',
// 城市名称
cityName: '',
// 地区名称
townName: '',
// 省份代码
provinceCode: '',
// 城市代码
cityCode: '',
// 地区代码
townCode: ''
}
}
},
mounted() {
this.provinceList()
},
methods: {
/*
* @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
列如:this.provinceList({keywords: '山东省'}),这样就可以筛选出山东省下的市、区信息
2、subdistrict --设置显示下级行政区级数,0:不返回下级行政区;1:返回下一级行政区;2:返回下两级行政区;3:返回下三级行政区;
不传的话默认为2,可以在组件中穿,也可以在调用方法的时候传,如果需要展示省市组件,传值最小为2
3、page --最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。
例如page=2;page=3。默认page=1
4、extensions --控制行政区信息中返回行政区边界坐标点; 可选值:base、all;
base:不返回行政区边界坐标点;(默认)
all:只返回当前查询district的边界值,不返回子节点的边界值;目前不能返回乡镇/街道级别的边界值
5、filter -- 按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息,需填入adcode,为了保证数据的正确,强烈建议填入此参数
6、callback -- callback值是用户定义的函数名称,此参数只在output=JSON时有效
7、output --返回数据格式类型,可选值:JSON,XML(默认JSON)
* @return:返回的是一个promise对象,如果不需要展示组件,只需要获取值,可以直接调用方法,异步获取返回值
列如:
const p = this.$refs.provinceForm.provinceList({xxxx(可传值,传值可参考上文params描述) })
p.then(r => {
// r 为返回结果
console.log(r)
})
**/
// 获取省市信息
provinceList(params = {}) {
params ? (params.subdistrict ? '' : (params.subdistrict = this.subdistrict)) : (params.subdistrict = this.subdistrict)
let data = ''
for (let key in params) {
data += '&' + key + '=' + params[key]
}
let path = `https://restapi.amap.com/v3/config/district?key=d22348363c34c266f772ae9b635eef2a`
path = path + data
const pro = fetch(path).then(res => {
return res.json()
})
if (this.provinceView) {
pro.then(r => {
this.AllData = r.districts[0].districts
})
}
return pro
},
// 省市回显
init(province, city, town) {
this.provinceForm = {
provinceName: province,
cityName: city,
townName: town
}
if (province) {
this.AllData.map(item => {
if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode
if (city) {
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
this.townList = itm.districts
if (town) {
this.townList.map(itmx => {
if (itmx.name.indexOf(town) != -1) {
this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name
}
})
}
}
})
}
}
})
}
},
// 选择省
selectProvince(val) {
this.provinceForm.cityName = ''
this.provinceForm.townName = ''
this.cityList = val.districts
this.$emit('selectProvince', { provinceName: val.name, provinceCode: val.adcode })
},
// 选择市
selectCity(val) {
this.provinceForm.townName = ''
this.townList = val.districts
this.$emit('selectCity', { cityName: val.name, cityCode: val.adcode })
},
// 选择区
selectTown(val) {
this.$emit('selectTown', { townName: val.name, townCode: val.adcode })
}
}
}
</script>
<style lang="scss">
.province {
display: inline-flex;
.el-select .el-input {
width: auto !important;
}
}
.select-padding {
margin-right: 10px;
}
</style>
<template>
<div>
<div id="div-demo"></div>
</div>
</template>
<script>
import E from 'wangeditor'
export default {
name: 'textBox',
data() {
return {
editor: '',
content: '',
editorOption: {}
}
},
props: {
excludeMenus: {
type: Array,
default: () => ['code']
},
boxHeight: {
type: Number,
default: 240
}
},
mounted() {
this.getEdit()
},
methods: {
getEdit() {
const _this = this
this.editor = new E('#div-demo')
this.editor.config.uploadImgShowBase64 = true
this.editor.config.showMenuTooltips = true
this.editor.config.menuTooltipPosition = 'down'
this.editor.config.height = this.boxHeight
this.editor.config.width = 500
this.editor.config.excludeMenus = this.excludeMenus
this.editor.config.onchange = html => {
// console.log(html);
this.content = html // 绑定当前逐渐地值
this.$emit('change', this.content) // 将内容同步到父组件中
}
this.editor.config.onfocus = () => {
this.$emit('focus')
}
// 上传图片
this.editor.config.customUploadImg = function(resultFiles, insertImgFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传图片大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertImgFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
// 上传视频
this.editor.config.customUploadVideo = function(resultFiles, insertVideoFn) {
var file = resultFiles[0]
var reader = new FileReader()
// 默认1MB
const limitSize = 10
const isLt = file.size / 1024 / 1024 < limitSize
if (!isLt) {
_this.$message.error('上传视频大小不能超过' + limitSize + 'MB!')
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
const videoFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + videoFile.split(',')[1]
_this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) {
// console.log(res)
insertVideoFn(res)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
this.editor.config.onchangeTimeout = 5000
this.editor.create()
},
setEdit(html) {
this.$nextTick(() => {
this.editor.txt.html(html)
})
},
forbidEdit() {
// this.editor.$textElem.attr('contenteditable', false)
this.editor.disable()
}
}
}
</script>
<style lang="scss" scoped>
#div-demo {
// margin: 16px 300px 0 0;
}
.el-form .editor {
margin-top: 20px;
}
.myQuillEditor {
background-color: #fff;
height: 200px;
}
</style>
<style>
.w-e-text-container {
z-index: 1 !important;
}
.w-e-toolbar {
z-index: 2 !important;
}
</style>
<!-- 弹窗 -->
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:show-close="showClose"
:before-close="handleClose"
:close-on-click-modal="false"
:modal-append-to-body="false"
:width="width"
class="app-dialog"
>
<el-scrollbar v-if="hasScroll">
<span slot="title">
<span class="main-title"></span>
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
</el-scrollbar>
<template v-if="!hasScroll">
<span slot="title">
<span class="main-title"></span>
<span class="dialog-sub-title">
<slot name="sub-title"></slot>
</span>
</span>
<slot></slot>
</template>
<div slot="footer">
<slot name="btn-start"></slot>
<el-button
:type="typeName"
v-if="!noClose"
:size="btnSize"
@click="handleClose"
></el-button>
<el-button
type="default"
v-if="!noCancel"
:size="btnSize"
@click="handleClose"
></el-button>
<el-button
type="primary"
v-if="!noBtnOk"
:size="btnSize"
@click="handleConfirm"
></el-button>
<slot name="btn-middle"></slot>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'glsx-dialog',
data() {
return {}
},
props: {
hasScroll: {
type: Boolean,
default: true
},
title: {
type: String,
default: ''
},
isVisible: {
type: Boolean,
default: false
},
showClose: {
type: Boolean,
default: false
},
btnCloseLabel: {
type: String,
default: '关闭'
},
btnOkLabel: {
type: String,
default: '确定'
},
btnCancelLabel: {
type: String,
default: '取消'
},
noBtnOk: {
type: Boolean,
default: false
},
noCancel: {
type: Boolean,
default: false
},
noClose: {
type: Boolean,
default: true
},
typeName: {
type: String,
default: 'default'
},
width: {
type: String,
default: '580px'
},
btnSize: {
type: String,
default: 'small'
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
<style lang="scss">
.dialog-sub-title {
font-size: 12px;
color: #666666;
}
</style>
<!-- 编辑商品弹窗 -->
<template>
<GLDialog title="添加绑定升级商品" mode="mid" :visible.sync="relateProVisible" okText="关联" @onOk="handleRelateProConfirm" @onCancel="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)">
<div class="w-50">
<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-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-form-item>
</div>
<div class="w-50" />
<div class="w-50">
<el-form-item label="编号">
<el-input disabled placeholder="编号" :value="proInfo.sapCode" class="dis-in-block" />
</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-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-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-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-select>
</el-form-item>
</div>
</el-form>
</div>
</GLDialog>
</template>
<script>
// import _ from 'lodash'
import { warrantyProList } from '@/utils/constants'
import { limitPrice } from '@/common/format'
export default {
name: 'RelateProDialog',
data() {
return {
goodVal: {},
warrantyProList,
proInfo: {
thumbUrl: '',
goodsCode: '',
goodsName: '',
goodsType: '',
goodsTypeName: '',
type: '',
upgradePrice: '',
shopPrice: '',
incentiveType: 1,
shopMinPrice: '',
warrantyPeriod: ''
},
rules: {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
upgradePrice: [
{ required: true, message: '请输入建议升级价', trigger: 'blur' },
{
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' },
{
required: true,
trigger: 'blur',
validator: (rule, value, callback) => {
;+value < +this.proInfo.shopPrice ? callback(new Error('商品最低价数值小于产品成本')) : callback()
}
}
]
},
oldVal: {
upgradePrice: '',
shopPrice: '',
shopMinPrice: ''
},
separateOpt: [
{
confId: 1,
confLabel: '毛利'
},
{
confId: 2,
confLabel: '收入'
}
],
incentiveTypeList: [
{
confId: 1,
confLabel: '比例'
},
{
confId: 2,
confLabel: '金额'
}
],
warrantyPeriodList: [
{
confId: '',
confLabel: '无'
}
]
}
},
props: {
relateProVisible: {
type: Boolean,
default: false
},
proList: {
type: Array,
default: () => []
},
originProInfo: {
type: Object,
default: () => {}
}
},
mounted() {
for (var i = 1; i <= 10; i++) {
this.warrantyPeriodList.push({
confId: i,
confLabel: i
})
}
this.proInfo = this.originProInfo ? this.$common.utils.deepClone(this.originProInfo) : this.$common.utils.deepClone(this.proInfo)
!this.proInfo.incentiveType && (this.proInfo.incentiveType = 1)
},
methods: {
handleChangeGood(value) {
var targetItem = this.proList.find(item => item.goodsCode === value)
this.proInfo.goodsName = targetItem.goodsName
this.proInfo.goodsCode = targetItem.goodsCode
this.proInfo.sapCode = targetItem.sapCode
this.proInfo.thumbUrl = targetItem.thumbUrl
this.proInfo.goodsType = targetItem.goodsType
this.proInfo.goodsTypeName = targetItem.goodsTypeName
this.proInfo.warrantyPeriod = this.warrantyProList.includes(targetItem.goodsType) ? '5' : ''
},
handleRelateProConfirm() {
this.$refs.proRuleForm1.validate(valid1 => {
if (valid1) {
this.$emit('handleRelateProConfirm', this.proInfo)
}
})
},
handleRelateProClose() {
this.$emit('handleRelateProClose')
},
handleUpgradePrice(newVal) {
this.proInfo.upgradePrice = limitPrice(newVal, this.oldVal.upgradePrice, 8, 2)
this.oldVal.upgradePrice = this.proInfo.upgradePrice
},
handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
},
handleShopMinPrice(newVal) {
this.proInfo.shopMinPrice = limitPrice(newVal, this.oldVal.shopMinPrice, 6, 2)
this.oldVal.shopMinPrice = this.proInfo.shopMinPrice
},
handleShopPriceBlur() {
if (this.proInfo.upgradePrice) {
var validateObj = this.proInfo.shopPrice <= this.proInfo.upgradePrice ? 'clearValidate' : 'validateField'
this.$refs.proRuleForm1[validateObj]('upgradePrice')
}
}
}
}
</script>
<style scoped>
.relateProDialog.flex {
display: flex;
}
.relateProDialog .sub-title {
display: inline-block;
height: 52px;
line-height: 36px;
margin-right: 40px;
}
.relateProDialog .w-50 {
display: inline-block;
width: 50%;
}
.relateProDialog img {
width: 160px;
height: 160px;
margin-right: 20px;
}
.relateProDialog .dis-in-block {
/* display: inline-block; */
width: 98%;
/* margin-right: 6px; */
}
.relatePro .btn-txt {
display: inline-block;
font-size: 14px;
margin-right: 209px;
color: #606266;
}
.relatePro .select-suffix {
position: relative;
}
.relatePro .select-suffix::after {
display: inline-block;
content: '年';
position: absolute;
right: 30px;
top: 0px;
}
</style>
<!-- 关联门店弹窗 -->
<template>
<GLDialog title="关联门店"
:visible.sync="relateStoreVisible"
okText="关联"
@onOk="handleRelateStoreConfirm"
@onCancel="handleRelateStoreClose"
class="relateStore">
<slot />
<el-row class="tableCon">
<!-- <el-col :span="12"> -->
<div class="tableBox">
<el-table ref="seletingTable"
:data="selectingData"
height="464px"
class="table"
border
@select="handleChange"
@select-all="handleAll">
<el-table-column type="selection"
width="55"
align="center"
:selectable="selectable" />
<el-table-column v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center">
<template slot-scope="scope">
<span
:class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.yqMerchantName }}</span>
</template>
</el-table-column>
<el-table-column prop="merchantName"
label="4S店名称"
align="center">
<template slot-scope="scope">
<span
:class="{'red': !scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)}">{{ scope.row.merchantName }}</span>
<el-tooltip v-if="!scope.row.isSetUpgradeSettleRule"
popper-class="tooltip-class"
effect="dark"
content="该门店无配置财务分润规则,无法关联!"
placement="top">
<span v-if="!scope.row.isSetUpgradeSettleRule && needTip.includes(sourcePage)"
class="tip-icon">?</span>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total" />
</div>
<!-- </el-col> -->
<!-- <el-col :span="12"> -->
<el-table :data="selectedData"
class="table tableBox"
border
height="464px">
<el-table-column v-if="sourcePage != 'serviceStore'"
prop="yqMerchantName"
label="园区店名称"
align="center" />
<el-table-column prop="merchantName"
label="4S店名称"
align="center" />
<el-table-column label="删除"
align="center"
width="50px">
<template slot-scope="scope">
<el-button class="el-icon-delete"
@click="handleDelete(scope.row)"
type="text" />
</template>
</el-table-column>
</el-table>
<!-- </el-col> -->
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'RelateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
needTip: ['editProduct'],
// 分页
total: 0,
currentPage: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
// 页面来源
sourcePage: {
type: String,
default: ''
},
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
if (this.sourcePage === 'editProduct') {
// 不能选的判断
// console.log('??')
isSelect = row.isSetUpgradeSettleRule
}
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && (isExit === -1) && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
this.$refs.seletingTable.toggleRowSelection(row)
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style lang="scss">
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.relateStore .tableCon {
display: flex;
.tableBox {
flex: 1;
}
}
.service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-06 10:10:44
* @LastEditors: limin
* @LastEditTime: 2021-09-06 10:11:49
* @FilePath: \scrm\scrm-sub-blog\src\components\index.js
*/
import Vue from 'vue'
import glsxDialog from '@/components/glsx-dialog/index.vue'
import GlsxCombiForm from '@/components/glsx-combi-form/index.vue'
import GlsxForm from '@/components/glsx-form/index.vue'
import relateStoreDialog from '@/components/relate-store-dialog'
Vue.component('glsx-dialog', glsxDialog)
Vue.component('GlsxCombiForm', GlsxCombiForm)
Vue.component('GlsxForm', GlsxForm)
Vue.component('relate-store-dialog', relateStoreDialog)
<!-- 关联门店弹窗 -->
<template>
<GLDialog bigTitle="关联门店" mode="big" :visible.sync="relateStoreVisible" okText="关联" :before-close="handleRelateStoreClose" @onOk="handleRelateStoreConfirm" @onCancel="handleRelateStoreClose" class="relateStore">
<slot></slot>
<el-row>
<el-col :span="12">
<el-table ref="seletingTable" class="table hightline" :data="selectingData" height="464px" @select="handleChange" @select-all="handleAll">
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column type="selection" width="55" align="center" :selectable="selectable"></el-table-column>
<el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
</el-table>
<el-pagination v-if="hasPage" small background @current-change="handleCurrentChange" :current-page.sync="pageNum" :page-size="pageSize" layout="total, prev, pager, next" :total="total"></el-pagination>
</el-col>
<el-col :span="12">
<el-table :data="selectedData" class="table hightline" height="464px">
<el-table-column fixed="left" width="5">
<template slot-scope="scope">
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column prop="merchantName" label="商户名称" align="center"></el-table-column>
<el-table-column label="删除" align="center" width="70">
<template slot-scope="scope">
<el-button style="padding: 0;" class="el-icon-delete" @click="handleDelete(scope.row)" type="text"></el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</GLDialog>
</template>
<script>
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
pageNum: 1,
pageSize: 20
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
hasPage: {
type: Boolean,
default: true
},
// 页面来源
// sourcePage: {
// type: String,
// default: ''
// },
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 去掉表格中某些字段
// noTableField: {
// type: Array,
// default: () => []
// }
},
mounted() {
this.selectedData = this.storeSelected
this.selectedData.forEach(item => {
item.merchantId = item.merchantId ? item.merchantId + '' : item.merchantId
})
this.getSelectingList()
},
methods: {
selectable(row, index) {
var isSelect = row.hasOwnProperty('beServed') ? !row.beServed : true
return isSelect
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId + '')
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantId + '')) {
this.$refs.seletingTable.toggleRowSelection(item, true)
} else {
this.$refs.seletingTable.toggleRowSelection(item, false)
}
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
pageNum: this.pageNum,
currentPage: this.pageNum,
pageSize: this.hasPage ? this.pageSize : 99999
}).then(res => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => +item.merchantId === +row.merchantId)
addOrDelete ? this.selectedData.push(row) : (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
this.selectingData.forEach(item => {
let isExit = this.selectedData.findIndex(subItem => +subItem.merchantId === +item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && isExit === -1 && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => +item.merchantId !== +row.merchantId)
this.recoverySelection()
},
handleCurrentChange(val) {
this.pageNum = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
if (!this.selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true,
customClass: 'message-Z-zinde'
})
return true
}
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style>
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
/* .service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
} */
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-08 16:55:43
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
const environment = process.env.NODE_ENV || 'production'
let config = require('./env.' + environment)
module.exports = config
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-18 11:51:29
*/
// 本地环境配置
module.exports = {
title: 'scrm-sub-marketing',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
code_message_map: {}
},
request: {
// baseURL: 'http://scrm.test.glsx.com.cn/',
baseURL: 'http://192.168.2.42:8064/',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
module.exports = {
title: 'scrm-sub-marketing',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
errId_logout_value: '21',
code_message_map: {}
},
request: {
baseURL: 'http://scrm.test.glsx.com.cn/',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-07 14:38:52
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js')
let cfg = require('./conf.js')
// import { Http, utils } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true, common) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
let params = { moduleName: 'quality', mockUrl: 'http://oss-config.dev.glsx.com.cn/mock/64489a52ad0aa72e7cd2bd3d/quality/config', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return common.utils.getConfig(params)
// return new Http().get('https://oss-config.test.glsx.com.cn/mock/616d28231072f92988f059fb/home/config')
// return new Http({ Headers: { refererurl: location.href }, request: { timeout: 30000 } }).get('http://config-center-backend.test.glsx.com/glsxAdmin/config?moduleUrl=home').then(res => res)
}
export const config = {
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
import Vue from 'vue'
import { defaultStatusOptions, defaultDeliveryStatusOptions, defaultPutStatusOptions, tableData } from '@/utils/constants.js'
// 发货状态
Vue.filter('deliveryStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultDeliveryStatusOptions.length; i++) {
if (defaultDeliveryStatusOptions[i].id === id) {
return defaultDeliveryStatusOptions[i].label
}
}
return text
})
// 入库状态
Vue.filter('putStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultPutStatusOptions.length; i++) {
if (defaultPutStatusOptions[i].id === id) {
return defaultPutStatusOptions[i].label
}
}
return text
})
// 订单状态状态
Vue.filter('orderStatus', (id, formatString) => {
const text = '--'
for (let i = 0; i < defaultStatusOptions.length; i++) {
if (defaultStatusOptions[i].id === id) {
return defaultStatusOptions[i].label
}
}
return text
})
No preview for this file type
No preview for this file type
No preview for this file type
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:31
* @FilePath: \scrm\scrm-sub-blog\src\main.js
*/
import Vue from 'vue'
import apis from './api'
import { optionalChaining } from './utils/chaining'
import { setMinHeight } from '@/common/constant'
import utils from './utils/index'
import './public-path'
import '@/assets/css/public.scss'
import '@/components'
import '@/filter'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
Vue.prototype.$apis = apis
Vue.prototype.$$ = optionalChaining
Vue.prototype.$utils = utils
Vue.prototype.size = 'small'
Vue.prototype.$EventBus = new Vue()
Vue.prototype.setMinHeight = setMinHeight
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
export const http_common = params => Vue.prototype.$http_common(params)
File mode changed
import Vue from 'vue'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Card, Table, TableColumn, Pagination, Loading, Dialog, MessageBox, Upload, Tooltip, Tabs, TabPane, Container } from 'element-ui'
Vue.use(Button)
Vue.use(ButtonGroup)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Radio)
Vue.use(RadioGroup)
Vue.use(Checkbox)
Vue.use(CheckboxGroup)
Vue.use(Switch)
Vue.use(Select)
Vue.use(Option)
Vue.use(TimePicker)
Vue.use(Col)
Vue.use(DatePicker)
Vue.use(Tree)
Vue.use(Card)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Pagination)
Vue.use(Loading)
Vue.use(Dialog)
Vue.use(Upload)
Vue.use(Tooltip)
Vue.use(Tabs)
Vue.use(TabPane)
export const message = Message
export const messageBox = MessageBox
if (window.__POWERED_BY_QIANKUN__) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
}
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
// 处理重复点击同一个路由报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.compath + '.vue') })
return routes
}, [])
}
export { VueRouter, routes, getRoutes }
const staticRoutes = Object.freeze([
{
name: 'default',
path: '/',
redirect: '/qualityManage/index'
},
{
name: 'qualityManage',
path: '/qualityManage/index',
component: resolve => require([`@/views/qualityManage/index.vue`], resolve),
meta: {}
}
])
export default staticRoutes
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:31:52
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:09
* @FilePath: \scrm\scrm-sub-blog\src\setup\index.js
*/
import { bootstrap, mount, unmount } from './qiankun'
import { start } from './single'
export { bootstrap, mount, unmount, start }
import Vue from 'vue'
import { message, messageBox } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton, GLTable, GLTableButton, GLDialog } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import ElementUI from 'element-ui'
import render from './render'
import 'glsx-components/dist/glsx-components.css'
let routes = []
let router = null
let instance = null
Vue.use(ElementUI)
Vue.use(GLTable)
Vue.use(GLTableButton)
Vue.use(GLDialog)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, sign_common, request_common } = await fetchConfig(false, common)
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:04:32
* @LastEditors: limin
* @LastEditTime: 2021-10-14 16:30:47
* @FilePath: \scrm\scrm-sub-blog\src\setup\render.js
*/
import App from '../App.vue'
import Vue from 'vue'
import store from '@/store'
import { VueRouter } from '@/router'
const render = (base, routes) => {
const router = new VueRouter({
base,
routes,
mode: 'history'
})
const vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
return { router, vm }
}
export default render
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:02:23
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:17
* @FilePath: \scrm\scrm-sub-blog\src\setup\single.js
*/
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import render from './render'
import { routes } from '@/router'
export async function start() {
if (window.__POWERED_BY_QIANKUN__) return
const { response, request, sign, secret } = await fetchConfig()
var urlParams = {}
// window.location.href
// .split('?')[1]
// .split('&')
// .forEach(item => {
// urlParams[item.split('=')[0]] = item.split('=')[1]
// })
var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : 'mini-53e870b5-80d5-483e-8277-cdc4dec0ad80-rop'
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes)
}
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-08-25 14:14:44
* @FilePath: \scrm\scrm-base\src\store\index.js
*/
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce(
(result, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
result.getters[moduleName] = state => state[moduleName]
result.modules[moduleName] = value.default
return result
},
{ modules: {}, getters: {} }
)
const store = new Vuex.Store(modules)
export default store
export default {
namespaced: true,
state: {
size: 10, // 分页 页大小
token: ''
},
mutations: {
// 设置分页大小
SET_PAGE_SIZE(state, data) {
state.size = data
},
// 设置token
SET_TOKEN(state, data) {
state.token = data
}
},
actions: {
// 设置分页大小
setPageSize({ commit }, data) {
commit('SET_PAGE_SIZE', data)
},
// 设置token
setToken({ commit }, data) {
commit('SET_TOKEN', data)
}
}
}
export default {
namespaced: true,
state: {},
mutations: {},
actions: {}
}
export const optionalChaining = (obj, ...rest) => {
return rest.reduce((newObj, key) => newObj[key], obj)
}
\ No newline at end of file
// 订单状态
export const defaultStatusOptions = [
{
id: 1,
label: '待审核'
},
{
id: 2,
label: '已审核'
},
{
id: 3,
label: '已取消'
}
]
// 发货状态
export const defaultDeliveryStatusOptions = [
{
id: 1,
label: '未发货'
},
{
id: 2,
label: '已发货'
}
]
// 入库状态
export const defaultPutStatusOptions = [
{
id: 1,
label: '未入库'
},
{
id: 2,
label: '已入库'
}
]
export const membraneTypeList = [1, 4, 6, 12, 14]
// 商户类型 - 除广汇外
export const userType = {
// 1: '员工',
// 2: '门店',
// 3: '市级经销商',
// 4: '省级经销商',
// 5: '工厂',
1: '工厂',
2: '省代',
3: '市代',
4: '门店'
}
// 商户类型 - 广汇
export const ghUserType = {
1: '员工',
2: '门店',
3: '片区',
4: '大区',
5: '总部',
6: '供应商'
}
export const warrantyProList = [1, 4, 6, 12, 14]
function debounce(func, wait = 200) {
let timeout
return function(event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
}
}
function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
/**
* 校验手机号码格式
*/
function checkPhone(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)
}
/**
* 用于glsx-combi-form的select写入options
* formName String FormData的属性名
* hasAll Boolean 是否需要添加“全部”属性
* refreshSigle String 更新特定的属性的options
*/
function getOptionsList(that, formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = that[formName].find(k => k.name == refreshSigle)
var index = that[formName].findIndex(k => k.name == refreshSigle)
that.$set(that[formName][index], 'optionList', that.$common.utils.deepClone(that.baseData[item.optionsName]))
if (hasAll && that.baseData[item.optionsName].length && that.baseData[item.optionsName][0][that[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[that[formName][index].optionId] = ''
temp[that[formName][index].optionLabel] = '全部'
that[formName][index].optionList.unshift(temp)
}
} else {
that[formName].forEach((item, index) => {
if (item.type === 'select' && that.baseData[item.optionsName]?.length) {
that.$set(that[formName][index], 'optionList', that.$common.utils.deepClone(that.baseData[item.optionsName]))
if (hasAll && that.baseData[item.optionsName].length && that.baseData[item.optionsName][0][that[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[that[formName][index].optionId] = ''
temp[that[formName][index].optionLabel] = '全部'
that[formName][index].optionList.unshift(temp)
}
}
})
}
}
/** 二次确认封装 */
function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = 'warning', fn) {
that.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type,
callback: action => {
if (action == 'confirm') {
that.$apis[apiModule][apiName](apiParams).then(res => {
that.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
that.handleSearch()
}
})
}
}
})
}
function aToExport(url) {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', url)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}
export default {
debounce,
dateFormat,
checkPhone,
getOptionsList,
secondConfirm,
aToExport
}
<template>
<div class="dialogue">
<div class="record">
<audio id="audio1">
<source :src="detailObj.fileUrl" type="audio/mpeg" />
<source :src="detailObj.fileUrl" type="audio/ogg" />
您的浏览器不支持 audio 标签。
</audio>
<div class="play" v-if="isPlay" @click="handleAudio">
<img src="@/assets/play.png" />
</div>
<div class="play" v-else @click="handleAudio">
<img src="@/assets/pause.png" />
</div>
<div class="times">{{ currentTime }}/{{ totalTime }}</div>
<div id="progressBar" @mousemove="isCircle = true" @mouseout="isCircle = false">
<div id="progress">
<div class="circle" @mousemove="isCircle = true" draggable="true" v-if="isCircle"></div>
</div>
</div>
<div class="trumpet" @click="handleAudio">
<img src="@/assets/trumpet.png" />
</div>
</div>
<div class="record-info">
<div class="dialog">
<template v-for="item in dialogList">
<div class="dialog-detail" :key="item.id">
<div class="name">{{ item.role }}</div>
<div class="dig-content" @click="currentDialog(item)">
{{ item.content }}
</div>
</div>
</template>
</div>
<div class="abstract">
<div class="title">
<img class="robot" src="@/assets/robot.png" />
AI对话摘要
</div>
<div class="abText">
{{ detailObj.digest }}
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
detailObj: {
type: Object,
default: () => {}
}
},
data() {
return {
myAud: '',
isPlay: true,
dialogList: [],
totalTime: '0:00',
currentTime: '0:00',
isCircle: false
}
},
mounted() {
this.myAud = document.getElementById('audio1')
this.handleprogress()
this.conversationDetailPage()
},
methods: {
currentDialog(data) {
this.myAud.currentTime = data.mergedOffset
},
toMinutesAndSeconds(seconds) {
let minutes = Math.floor(seconds / 60)
let remainingSeconds = parseInt(seconds % 60)
minutes = minutes > 10 ? minutes : `0${minutes}`
remainingSeconds = remainingSeconds > 10 ? remainingSeconds : `0${remainingSeconds}`
return `${minutes}:${remainingSeconds}`
},
handleprogress() {
const progress = document.getElementById('progress')
const progressBar = document.getElementById('progressBar')
this.myAud.addEventListener('canplay', () => {
if (this.myAud.duration > 0) {
this.totalTime = this.toMinutesAndSeconds(this.myAud.duration)
}
})
this.myAud.addEventListener('timeupdate', () => {
if (this.myAud.duration > 0) {
this.currentTime = this.toMinutesAndSeconds(this.myAud.currentTime)
const progressDur = (this.myAud.currentTime / this.myAud.duration) * 100
progress.style.width = `${progressDur}%`
}
})
this.myAud.addEventListener('ended', () => {
this.isPlay = !this.isPlay
})
progress.addEventListener(
'click',
e => {
let x = e.offsetX / 370
let currentWidth = x * this.myAud.duration
this.myAud.currentTime = currentWidth
},
false
)
progressBar.addEventListener(
'click',
e => {
let x = e.offsetX / 370
let currentWidth = x * this.myAud.duration
this.myAud.currentTime = currentWidth
},
false
)
},
handleAudio() {
this.isPlay = !this.isPlay
if (!this.isPlay) {
this.myAud.play()
} else {
this.myAud.pause()
}
},
conversationDetailPage() {
this.$apis.quality
.conversationDetailPage({
batchId: this.detailObj.id,
currentPage: 1,
pageSize: 9999
})
.then(res => {
console.log(res)
this.dialogList = res.list
})
}
}
}
</script>
<style scoped lang="scss">
.dialogue {
margin: auto;
.record {
width: 600px;
margin: 20px auto;
height: 56px;
background: #f7f9fa;
border-radius: 32px;
display: flex;
align-items: center;
audio {
width: 600px;
height: 56px;
background: #f7f9fa;
border-radius: 32px;
}
}
.play {
width: 24px;
height: 24px;
margin: 0 20px 0 24px;
img {
width: 100%;
}
}
.trumpet {
width: 16px;
height: 16px;
margin-left: 24px;
img {
width: 100%;
}
}
.times {
font-size: 14px;
color: #666666;
min-width: 80px;
text-align: center;
margin-right: 19px;
}
#progressBar {
// position: absolute;
height: 6px;
width: 370px;
background-color: #e7e7e7; /* 进度条背景颜色 */
border-radius: 6px;
}
#progress {
width: 0; /* 初始进度为0 */
height: 6px;
background-image: linear-gradient(90deg, #9662ff 0%, #5850ff 100%); /* 进度条颜色 */
transition: width 0.5s; /* 进度条宽度变化动画 */
border-radius: 6px;
position: relative;
}
.circle {
width: 16px;
height: 16px;
background: #5850ff;
border: 4.5px solid #ffffff;
border-radius: 50%;
position: absolute;
right: -14px;
top: -4px;
box-sizing: border-box;
}
.record-info {
width: 100%;
float: left;
position: relative;
padding-right: 354px;
box-sizing: border-box;
height: 544px;
margin: 20px 0;
// display: flex;
// align-items: center;
.dialog {
width: 100%;
height: 544px;
background: #f7f9fa;
border-radius: 4px;
overflow-y: scroll;
padding: 20px;
box-sizing: border-box;
.dialog-detail {
margin-bottom: 8px;
text-align: left;
.name {
font-size: 12px;
color: #666666;
letter-spacing: 0;
line-height: 16px;
}
.dig-content {
margin-top: 4px;
width: 404px;
background: #ffffff;
border-radius: 4px;
font-size: 14px;
color: #333333;
padding: 10px 12px;
white-space: pre-wrap;
text-align: left;
}
}
:nth-child(2n) {
text-align: right;
.dig-content {
display: inline-block;
background: #ebebff;
}
}
}
.abstract {
width: 334px;
height: 544px;
padding: 12px 20px;
position: absolute;
right: 0;
top: 0;
background-image: linear-gradient(180deg, #f6f4ff 0%, #f0f3ff 100%);
border: 1px solid #5850ff80;
border-radius: 4px;
box-sizing: border-box;
.title {
font-weight: 700;
font-size: 16px;
color: #333333;
.robot {
width: 28px;
height: 28px;
margin-right: 8px;
display: inline-block;
vertical-align: middle;
}
}
.abText {
margin-top: 14px;
width: 294px;
height: 472px;
padding: 12px;
box-sizing: border-box;
background: #ffffff;
border-radius: 4px;
overflow: scroll;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="range">
<div
:class="[
' el-date-editor',
'el-range-editor',
'el-input__inner',
'el-date-editor--daterange',
'el-range-editor--small',
pickerVisible ? 'is-active' : ''
]"
@click="handleRangeClick"
@mouseleave="showClose = false"
@mousemove="handleMove"
ref="reference"
>
<el-input
v-model="userInput[0]"
:placeholder="startPlaceholder"
@blur="handleBlur"
@input="handleStartInput"
class="el-range-input"
@keydown="handleKeydown"
></el-input>
<span class="el-range-separator">至</span>
<el-input
v-model="userInput[1]"
:placeholder="endPlaceholder"
@input="handleEndInput"
@focus="handleFocus"
@blur="handleBlur"
class="el-range-input"
@keydown="handleKeydown"
></el-input>
<i
v-show="showClose"
@click="handleClickIcon"
class="el-icon-circle-close"
></i>
</div>
<!----><!---->
</div>
</template>
<script>
export default {
data() {
return {
pickerVisible: false,
showClose: false,
userInput: this.displayValue
}
},
props: {
displayValue: Array,
placeholder: String,
startPlaceholder: String,
endPlaceholder: String
},
watch: {
displayValue(val) {
if (val) {
this.userInput = val
}
}
},
methods: {
handleStartInput(event) {
console.log(event)
if (this.userInput) {
this.userInput = [event, this.userInput[1]]
} else {
this.userInput = [event, null]
}
},
handleEndInput(event) {
if (this.userInput) {
this.userInput = [this.userInput[0], event]
} else {
this.userInput = [null, event]
}
},
handleClickIcon(event) {
this.userInput[0]=null
this.userInput[1]=null
},
valueIsEmpty() {
const val = this.userInput
if (Array.isArray(val)) {
for (let i = 0, len = val.length; i < len; i++) {
if (val[i]) {
return false
}
}
}
return true
},
handleRangeClick() {
this.pickerVisible = true
},
handleMove() {
if (this.valueIsEmpty()) {
this.showClose = false
} else {
this.showClose = true
}
},
handleFocus() {
if (!this.pickerVisible) {
this.pickerVisible = true
this.$emit("focus", this)
}
},
handleBlur() {
this.pickerVisible = false
this.contrastValue()
},
contrastValue() {
let val = this.userInput
if (Array.isArray(val)) {
if (val[0] > val[1]) {
val[1] =null
console.log(val)
}
}
}
}
}
</script>
<style scoped lang="scss">
.range {
.el-range-input {
::v-deep {
input {
border: 0;
margin-top: -2px;
height: 28px;
}
}
}
.el-icon-circle-close {
color: #dcdfe6;
margin-left: 10px;
}
}
</style>
\ No newline at end of file
<template>
<div class="analyse">
<div class="statistics">
<div class="s-item" v-for="(item, index) in sList" :key="index">
<div class="title">{{ item.text }}</div>
<div class="content" v-html="item.formatter && item.formatter(detailObj)"></div>
</div>
</div>
<GLCombiForm ref="showSearch" class="show-search" :formObj="searchForm" :form-data="showFormData" @handleOk="handleSearch" @handleRest="handleReset">
<div slot="firstClassify">
<el-select v-model="searchForm.firstClassify" clearable placeholder="请选择" @change="changeClassify">
<el-option v-for="item in baseData.firstClassifyList" :key="item" :label="item" :value="item"></el-option>
</el-select>
</div>
<div slot="secondClassify">
<el-select v-model="searchForm.secondClassify" clearable placeholder="请选择">
<el-option v-for="item in baseData.secondClassifyList" :key="item" :label="item" :value="item"></el-option>
</el-select>
</div>
<template slot="score">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.qualityTestScore"></el-input-range>
</template>
</GLCombiForm>
<div class="theader">
<div class="title">话术列表</div>
<el-radio-group v-model="searchForm.hitResult">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button label="1">命中</el-radio-button>
<el-radio-button label="2">未命中</el-radio-button>
</el-radio-group>
</div>
<GLTable ref="analyseTable" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams" :before-search-fn="beforeSearchFn" :pageConf="pageConf" :noDataImg="url">
<template slot="hitResult" slot-scope="scope">
<div :class="['tag', scope.scope.hitResult == 1 ? 'gre' : 'red']">
{{ scope.scope.hitResult == 1 ? '是' : '否' }}
</div>
</template>
</GLTable>
</div>
</template>
<script>
import ElInputRange from './el-input-range'
import url from '@/assets/empty.png'
import { Util, deepClone } from '@/common/util'
export default {
components: {
ElInputRange
},
props: {
detailObj: {
type: Object,
default: ()=>{}
}
},
data() {
return {
url: url,
sList: [
{
text: '话术评分',
formatter: data => {
console.log(data)
return `<span style="font-weight:700;font-size:26px;">${data.averageQualityTestScore ? data.score : '0'}</span>分`
}
},
{
text: '预计营销结果',
formatter: data => {
return `<span style="font-weight:700;font-size:22px;">${data.estimatedResult ? data.estimatedResult : '--'}</span>`
}
},
{
text: '开始录音时间',
formatter: data => {
return `<span style="font-weight:700;font-size:20px;">${data.startTime ? data.startTime : '--'}</span>`
}
},
{
text: '对话时长',
formatter: data => {
return `<span style="font-weight:700;font-size:26px;">${data.duration}</span>
`
}
}
],
searchForm: {
firstClassify: '',
secondClassify: '',
qualityTestScore: [],
hitResult: ''
},
searchFormSearch: {},
showFormData: [
{
label: '一级分类',
name: 'firstClassify',
addHtml: 'firstClassify'
},
{
label: '二级分类',
name: 'secondClassify',
addHtml: 'secondClassify'
},
{
label: '质检评分',
name: 'qualityTestScore',
addHtml: 'score'
}
],
select: '全部',
getListApi: this.$apis.quality.conversationCheckList,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '一级分类',
prop: 'firstClassify',
width: '120px'
},
{
label: '二级分类',
prop: 'secondClassify',
width: '140px'
},
{
label: '质检得分',
prop: 'score',
width: '100px'
},
{
label: '是否命中',
prop: 'hitResult',
width: '100px',
addHtml: 'hitResult'
},
{
label: '命中文本',
prop: 'hitText'
},
{
label: '话术建议',
prop: 'suggestions'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
firstClassifyList: [],
secondClassifyList: []
}
}
},
watch: {
'searchForm.hitResult'() {
this.$refs.analyseTable.refreshTable(true, true)
}
},
mounted() {
this.getPointCategory()
},
methods: {
toMinutesAndSeconds(hourse) {
const h = Math.floor(hourse / 60)
const m = parseInt(hourse % 60)
return {
h,
m
}
},
getPointCategory() {
this.classifyMap = new Map()
this.$apis.quality.getPointCategory().then(res => {
console.log(res)
this.baseData.firstClassifyList = Object.keys(res)
for (let item in res) {
this.classifyMap.set(item, res[item])
}
})
},
changeClassify() {
this.searchForm.secondClassify = ''
this.baseData.secondClassifyList = this.classifyMap.get(this.searchForm.firstClassify)
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
this.searchFormSearch.batchId = this.detailObj.id
if (this.searchFormSearch.qualityTestScore) {
this.searchFormSearch.qualityTestScoreBegin = this.searchFormSearch.qualityTestScore[0]
this.searchFormSearch.qualityTestScoreEnd = this.searchFormSearch.qualityTestScore[1]
}
delete this.searchFormSearch.qualityTestScore
resolve()
})
},
handleSearch() {
this.$refs.analyseTable.refreshTable(true, true)
},
handleReset() {
this.searchForm = {
firstClassify: '',
secondClassify: '',
qualityTestScore: [],
hitResult: ''
}
this.baseData.secondClassifyList = []
this.$refs.analyseTable.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
.analyse {
.statistics {
display: flex;
align-items: center;
justify-content: space-between;
.s-item {
flex: 1;
// min-width: 248px;
height: 84px;
background: #f7f9fa;
border-radius: 4px;
padding: 12px 20px;
box-sizing: border-box;
margin-right: 16px;
.title {
font-size: 14px;
color: #333333;
margin-bottom: 8px;
}
.content {
color: #333333;
}
}
}
.theader {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.title {
font-size: 16px;
color: #333333;
font-weight: 600;
}
}
.tag {
width: 30px;
height: 24px;
border-radius: 2px;
padding: 0 8px;
line-height: 24px;
box-sizing: border-box;
font-size: 14px;
margin:0 auto;
}
.gre {
color: #2cca74;
background: #e9f9f1;
}
.red {
color: #eb4e4e;
background: #fdeded;
}
}
</style>
\ No newline at end of file
<!-- 关联活动订单弹窗 -->
<template>
<GLDialog big-title="质检详情" mode="big" :visible.sync="isQualityVisible" class="qualityDailog" width="80%" :close-on-click-modal="false" @onOk="handleClose" @onCancel="handleClose">
<div>
<el-tabs v-model="activeName" @tab-click="handleReset">
<el-tab-pane label="质检分析" name="analyse">
<quality-analyse v-if="activeName == 'analyse'" v-bind="$attrs" ref="analyseList" />
</el-tab-pane>
<el-tab-pane label="对话详情" name="dialogue">
<dialogue-detail v-if="activeName == 'dialogue'" ref="dialogueDetail" v-bind="$attrs" />
</el-tab-pane>
</el-tabs>
</div>
</GLDialog>
</template>
<script>
import QualityAnalyse from './qualityAnalyse'
import DialogueDetail from './dialogueDetail'
export default {
name: 'RelatActivityOrderDialog',
components: {
QualityAnalyse,
DialogueDetail
},
data() {
return {
activeName: 'analyse',
}
},
props: {
isQualityVisible: {
type: Boolean,
default: false
}
},
computed: {},
mounted() {
},
methods: {
handleReset() {},
handleClose() {
this.$emit('closeDialog', false)
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div class="recep-wrap">
<div class="header">
<h2>基础信息</h2>
<div class="info-wrap">
<div class="info-item flex">
<label>员工:</label>
<span>{{ queryData.employeeName }}</span>
</div>
<div class="info-item flex">
<label>门店:</label>
<span>{{ queryData.storeList && queryData.storeList.join('、') }}</span>
</div>
<div class="info-item flex">
<label>服务商:</label>
<span>{{ queryData.serviceList && queryData.serviceList.join('、') }}</span>
</div>
<div class="info-item flex">
<label>质检日期:</label>
<span>{{ queryData.searchdate }}</span>
</div>
<div class="info-item flex">
<label>接待批次/批:</label>
<span>{{ queryData.batchNum }}</span>
</div>
</div>
</div>
<div class="content">
<GLCombiForm ref="showSearch" class="show-search" labelWidth="110px" :formObj="searchForm" :form-data="showFormData" @handleOk="handleSearch" @handleRest="handleReset">
<template slot="score">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.qualityTestScore"></el-input-range>
</template>
</GLCombiForm>
<GLTable ref="recepDetail" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams" :before-search-fn="beforeSearchFn" :pageConf="pageConf">
<template slot="auth-button" slot-scope="scope">
<el-button type="text" @click="qualitDetail(scope.scope)">质检详情</el-button>
</template>
</GLTable>
</div>
<quality-detail :isQualityVisible="isQualityVisible" v-if="isQualityVisible" :detailObj="detailObj" @closeDialog="closeDialog"></quality-detail>
</div>
</template>
<script>
import { Util, deepClone } from '@/common/util'
import ElInputRange from './el-input-range'
import QualityDetail from './qualityDetail.vue'
export default {
data() {
return {
queryData: JSON.parse(this.$route.query.data),
isQualityVisible: false,
searchForm: {
recepTime: [],
qualityTestScore: [],
estimatedResultId: ''
},
detailObj: {},
searchFormSearch: {},
getListApi: this.$apis.quality.conversationPage,
showFormData: [
{
label: '接待时间',
type: 'datePicker',
name: 'recepTime',
// addHtml:'recepTime',
isClear: true,
pickerOptions: 'rangePickerOptions'
},
{
label: '质检评分',
name: 'qualityTestScore',
addHtml: 'score'
},
{
label: '预计营销结果',
name: 'estimatedResultId',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'estimatedResultList'
}
],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '开始接待时间',
prop: 'startTime'
},
{
label: '结束接待时间',
prop: 'endTime'
},
{
label: '录音时长/分钟',
prop: 'duration'
},
{
label: '预计营销结果',
prop: 'estimatedResult'
},
{
label: '话术质检评分/分',
prop: 'score'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
baseData: {
estimatedResultList: [
{
confId: '1',
confLabel: '成交'
},
{
confId: '2',
confLabel: '战败'
},
{
confId: '3',
confLabel: '未知'
}
]
}
}
},
components: {
ElInputRange,
QualityDetail
},
mounted() {
this.getOptionsList()
},
methods: {
handleSearch() {
this.$refs.recepDetail.refreshTable(true, true)
},
handleReset() {
this.searchForm = {
recepTime: [],
qualityTestScore: [],
estimatedResultId: ''
}
this.$refs.recepDetail.refreshTable()
},
closeDialog() {
console.log(this.isQualityVisible)
this.isQualityVisible = false
},
qualitDetail(row) {
this.detailObj = row
this.isQualityVisible = true
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
this.searchFormSearch.conversationDateId = this.queryData.id
this.searchFormSearch.pageNum = this.searchFormSearch.currentPage
if (this.searchFormSearch.qualityTestScore) {
this.searchFormSearch.qualityTestScoreBegin = this.searchFormSearch.qualityTestScore[0]
this.searchFormSearch.qualityTestScoreEnd = this.searchFormSearch.qualityTestScore[1]
}
if (this.searchFormSearch.recepTime.length > 0) {
this.searchFormSearch.startTime = Util.dateFormate(this.searchFormSearch.recepTime[0], 'YYYY-MM-DD HH:mm:ss')
this.searchFormSearch.endTime = Util.dateFormate(this.searchFormSearch.recepTime[1], 'YYYY-MM-DD') + ' 23:59:59'
}
if (this.searchFormSearch.estimatedResult) {
this.searchFormSearch.estimatedResult = this.baseData.estimatedResultList.find(item => item.confId == this.searchFormSearch.estimatedResultId).confLabel
}
delete this.searchFormSearch.qualityTestScore
delete this.searchFormSearch.recepTime
delete this.searchFormSearch.estimatedResultId
delete this.searchFormSearch.currentPage
resolve()
})
},
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])
}
})
}
}
}
</script>
<style lang="scss" scoped>
.recep-wrap {
margin: 0 16px;
.header {
width: 100%;
background: #ffffff;
h2 {
font-size: 16px;
font-weight: 600;
color: #333333;
text-align: left;
line-height: 56px;
height: 56px;
border-bottom: 1px solid #e5e5e5;
padding-left: 20px;
box-sizing: border-box;
}
.info-wrap {
display: flex;
flex-wrap: wrap;
padding: 32px 20px 12px 20px;
.info-item {
width: 50%;
margin-bottom: 20px;
display: flex;
align-items: flex-start;
label {
width: 154px;
text-align: right;
font-size: 14px;
color: #666666;
display: inline-block;
}
span {
font-size: 14px;
color: #1d1d1d;
display: inline-block;
max-width: 300px;
overflow: hidden;
/* 防止文本换行 */
white-space: nowrap;
/* 使用省略号表示被截断的文本 */
text-overflow: ellipsis;
}
}
}
}
.content {
background: #ffffff;
padding: 20px;
box-sizing: border-box;
margin-top: 16px;
width: 100%;
height: auto;
}
}
</style>
\ No newline at end of file
const path = require('path')
const packageName = require('./package.json').name
const node_env = process.env.NODE_ENV === 'production'
const publicPath = node_env ? `/child/${packageName}/` : '/'
const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
const cdn = {
css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`],
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`, 'https://webapi.amap.com/loader.js']
}
module.exports = {
outputDir: `dist`,
publicPath,
assetsDir: 'static',
productionSourceMap: false,
configureWebpack: {
resolve: {
alias: {
'@': resolve('src'),
assets: resolve('src/assets'),
views: resolve('src/views'),
components: resolve('src/components')
}
},
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}`
},
externals: {
vue: 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
vuex: 'Vuex',
axios: 'axios',
echarts: 'echarts',
AMap: 'AMap'
}
},
devServer: {
hot: true,
disableHostCheck: true,
host: process.env.VUE_APP_HOST,
port: process.env.VUE_APP_PORT,
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
}
},
chainWebpack: config => {
config.plugin('html').tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('fonts')
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use('url-loader')
.loader('url-loader')
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]'
}
return options
})
.end()
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!