Commit 19e2aecd by 前端

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

上线合并

See merge request !7
2 parents 5756c0ef 0bec0f94
Showing 77 changed files with 6836 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">
<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.queryShopRefByPartnerShopPage`
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
}
.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;
}
.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;
}
.el-popover{
overflow:hidden;
}
.scrollHeight{
max-height:200px!important;
overflow-y: scroll;
}
\ No newline at end of file
/**
* 根据路由匹配地址
* @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="['glsx-combi-form', isEdit ? 'gl-form-page' : '']">
<el-form :ref="formRef" :inline="true" :model="formObj" :rules="formRules" size="small" class="glsx-combi-form-block">
<template v-for="(item, index) in formData">
<el-form-item v-if="!item.isHide" :key="index" :id="item.name" :label-width="isEdit ? '154px' : labelWidth" :class="[{ 'no-label': !item.label, isBlock: isBlock }, { 'textBox': item.type == 'textBox' }]" :style="{ 'margin-bottom': isEdit ? '24px' : '', 'margin-right': isEdit ? '0px' : '30px', ...item.style }" :label="item.label" :prop="item.name">
<span v-if="!item.isHide && item.tips" class="tips-block" slot="label">
<span class="tips-label">{{ item.label }}</span>
<el-popover placement="top" width="200" trigger="hover" :content="item.tips">
<img slot="reference" class="tips-icon" src="./images/icon-tip.png" />
</el-popover>
:
</span>
<span v-else-if="!item.isHide && item.label && !item.tips" slot="label">
<span class="combi-form-label" :style="{ width: item.labelWidth || labelWidth }">{{ item.label }}:</span>
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{ formObj[item.name] }}</span>
<div v-else-if="item.type === 'input'">
<el-input :placeholder="item.placeholder || '请输入' + item.label" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :prefix-icon="item.prefixIcon" v-model.trim="formObj[item.name]" :disabled="item.isDisabled" :maxlength="item.maxlength" :clearable="item.isClear || false" :type="item.inputType || 'text'" :autosize="item.inputType == 'textarea'" :rows="item.rows || 2" :style="{ width: item.width || defaultWidth }" :show-word-limit="item.showLimit || false" :show-password="item.showPass || false" @keydown.native="e => handleInputDown(e, item)">
<span v-if="item.prepend" slot="prepend">{{ item.prepend }}</span>
<span v-if="item.append" slot="suffix">{{ item.append }}</span>
</el-input>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- 选择框 -->
<div v-else-if="item.type === 'select'">
<el-select :style="{ width: item.width || defaultWidth }" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :clearable="item.isClear || false" :placeholder="item.placeholder || '请选择' + item.label" :filterable="!item.noFilter" :disabled="item.isDisabled" :no-data-text="item.noDataText || '无数据'" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, item)">
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]" :label="subItem[item.optionLabel]" :value="subItem[item.optionId]" :disabled="subItem.isDisabled || false"></el-option>
</el-select>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<!-- radio -->
<div v-else-if="item.type === 'radio'">
<el-radio-group v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :disabled="item.isDisabled" @change="item.handleRadioChange">
<el-radio v-for="subItem in item.optionList" :key="subItem[item.optionId]" :disabled="subItem.isDisabled" :label="subItem[item.optionId]">
{{ subItem[item.optionLabel] }}
<slot :name="subItem.suffixSonSlot" :scope="subItem"></slot>
</el-radio>
</el-radio-group>
<slot :name="item.suffixSlot" :scope="item"></slot>
</div>
<el-date-picker v-else-if="item.type === 'datePicker'" v-model="formObj[item.name]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" :type="item.dateType || 'daterange'" :disabled="item.isDisabled" :value-format="item.valueFormat" :style="{ width: item.width || defaultWidth }" :clearable="item.isClear || false" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="item.customPickerOptions || pickerOption[item.pickerOptions]">
</el-date-picker>
<template v-else-if="item.type === 'upload'">
<p class="photo-top-tips">{{ item.topTips }}</p>
<slot :name="item.prefixSlot" :scope="item"></slot>
<div v-if="!item.isDisabled" :style="{ width: item.width || defaultWidth }">
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length < item.maxPhotoNum : !formObj[item.name]" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<div class="add" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('addStyle') ? item.uploadStyle.addStyle : ''">
+</div>
<!-- <span v-if="item.maxPhotoNum > 1" class="number">{{ formObj[item.name].length }}/{{ item.maxPhotoNum }}</span> -->
<span class="number" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('fontSize') ? item.uploadStyle.fontSize : ''">上传{{
item.uploadType == 'video' ? '视频' : '图片' }}</span>
<input v-if="item.uploadType == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="video/mp4" @change="e => handleUploadChange(e, item)" />
<input v-else type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="activity-img img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" accept="image/png, image/jpeg, image/gif, image/jpg" @change="e => handleUploadChange(e, item)" />
</div>
</div>
<template>
<div v-if="Array.isArray(formObj[item.name]) ? formObj[item.name].length : formObj[item.name]">
<span v-if="Array.isArray(formObj[item.name])">
<span v-for="(subItem, subIndex) in formObj[item.name]" :key="subIndex" class="muti-imgs img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item, subIndex)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(typeof subItem == 'object' ? subItem.content : subItem, item)"></i>
</span>
</span>
</span>
</span>
<span v-else class="muti-imgs">
<video v-if="item.uploadType == 'video'" class="img-w-h activity-img" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]"></video>
<img v-else class="img-w-h" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''" :src="formObj[item.name]" />
<span class="img-btns" :style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''">
<span class="btn-item">
<i v-show="!item.isDisabled" class="el-icon-delete" @click="handleImgDelete(item)"></i>
<i class="el-icon-zoom-in" @click="handleImgLook(formObj[item.name], item)"></i>
</span>
</span>
</span>
</div>
</template>
<slot :name="item.suffixSlot" :scope="item"></slot>
</template>
<!-- 图文编辑器 -->
<!-- <textBox v-else-if="item.type === 'textBox'" :ref="item.name + 'TextBox'" :excludeMenus="item.excludeMenus || ['code']" @change="e => handleTextBoxChange(e, item)" @focus="handleTextBoxFocus(item)" :boxHeight="item.boxHeight"></textBox> -->
<!-- 地图 -->
<div v-else-if="item.type === 'map'" class="flex">
<Province ref="provinceForm" :subdistrict="subdistrict" :is-disabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)" :province-view="item.provinceView"></Province>
<el-input style="flex: 1;" v-model="formObj[item.name]" placeholder="请选择商户地址" :readonly="item.isReadonly"></el-input>
<el-button class="m-l-10" v-show="!item.isDisabled" @click="handleSelectMap(item)" type="primary">选择地址</el-button>
</div>
</el-form-item>
</template>
<slot name="footer"></slot>
</el-form>
<GLDialog v-if="isImgVisible" big-title="查看" mode="big" :visible.sync="isImgVisible" :close-on-click-modal="false" @onOk="isImgVisible = false" @onCancel="isImgVisible = false">
<div class="dialog-look">
<video v-if="dialogObj.uploadType == 'video'" class="dialog-video" controls>
<source :src="dialogObj.url" type="video/mp4" />
</video>
<img v-else class="dialog-img" width="100%" :src="dialogObj.url" alt="" />
</div>
</GLDialog>
<GLDialog big-title="选择地址" mode="big" :visible.sync="dialogMapVisible" @onOk="getAddress" @onCancel="dialogMapVisible = false">
<map-view v-if="dialogMapVisible" ref="mapForm"></map-view>
<!-- <span slot="footer" class="dialog-footer">
<el-button @click="">取 消</el-button>
<el-button type="primary" @click="getAddress">确 定</el-button>
</span> -->
</GLDialog>
</div>
</template>
<script>
// import textBox from '@/views/material/components/textBox'
import Province from './provinceCity.vue'
// import mapView from './mapView.vue'
import GLDialog from '../glsx-dialog/index.vue'
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'GlsxCombiForm',
components: {
// textBox,
Province,
// mapView,
GLDialog
},
data() {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
afterRangePickerOptions: afterRangePickerOptions
},
subdistrict: 2,
dialogMapVisible: false,
targetItem: {},
isImgVisible: false,
dialogObj: {
url: '',
uploadType: 'img'
}
}
},
props: {
isBlock: {
type: Boolean,
default: false
},
defaultWidth: {
type: String,
default: '432px'
},
formRef: {
type: String,
default: 'formRef'
},
isEdit: {
type: Boolean,
default: false
},
labelWidth: {
type: String,
// 默认是四个字符长度
default: '154px'
},
formData: {
type: Array,
default: () => []
},
formObj: {
type: Object,
default: () => { }
},
hasTitle: {
type: Boolean,
default: true
},
formRules: {
type: Object,
default: () => { }
},
// 搜索+输入框/搜索组合组件,搜索栏绑值
searchSelectObj: {
type: Object,
default: () => { }
},
pageThat: {
type: Object,
default: () => { }
}
},
mounted() { },
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem, this.pageThat)
},
handleInputDown(e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
handleInputBlur(e, item) {
item.inputBlur && item.inputBlur(e, item)
},
// 图片
handleUploadChange(e, targetItem) {
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = targetItem.uploadType || 'img'
var IMGTYPE = ['image/jpeg', 'image/png', 'image/jpg']
if (targetItem.supportGif) IMGTYPE.push('image/gif')
// 默认1MB
const limitSize = targetItem.limitSize || 1
const isLt = file.size / 1024 / 1024 < limitSize
const isType = uploadType == 'img' ? IMGTYPE.includes(file.type) : ['video/mp4'].includes(file.type)
const maxPhotoNum = targetItem.maxPhotoNum || 1
const wdithLt = targetItem.wdithLt || 300
const heightLt = targetItem.heightLt || 300
if (Array.isArray(this.formObj[targetItem.name]) && maxPhotoNum == this.formObj[targetItem.name].length) {
this.$message.error('只能上传' + maxPhotoNum + (uploadType == 'img' ? '张图片' : '个视频'))
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isType) {
this.$message.error(uploadType == 'img' ? '上传图片不是jpg、jpeg或png的格式!' : '上传视频不是MP4的格式!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
if (!isLt) {
this.$message.error('上传' + (uploadType == 'img' ? '图片' : '视频') + '大小不能超过' + limitSize + 'MB!')
document.getElementById(targetItem.name + 'file').value = ''
return true
}
reader.readAsDataURL(file)
reader.onload = e => {
if (uploadType == 'img') {
var image = new Image()
image.src = e.target.result
image.onload = () => {
var imgWidth = image.width
var imgHeight = image.height
if (targetItem.hasPixel && (imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
}
}
document.getElementById(targetItem.name + 'file').value = ''
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formObj[targetItem.name]) ? this.formObj[targetItem.name].splice(subIndex, 1) : (this.formObj[targetItem.name] = '')
targetItem.handleDelete && targetItem.handleDelete(subIndex)
// this.$emit('handleImgDelete', targetItem)
},
// 图片查看
handleImgLook(src, targetItem) {
this.isImgVisible = true
this.dialogObj = {
url: src,
uploadType: targetItem.uploadType || 'img'
}
},
// 获取富文本框内容
handleTextBoxChange(val, targetItem) {
this.formObj[targetItem.name] = val
},
handleTextBoxFocus(targetItem) {
this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
},
// 禁用富文本
forbidEdit() {
this.$refs.textBox.forbidEdit()
},
// 地图
handleSelectMap(targetItem) {
this.targetItem = targetItem
this.dialogMapVisible = true
this.$nextTick(() => {
if (this.formObj[targetItem.attrObj.fullAddress] && !this.$refs.mapForm.address) {
this.$refs.mapForm.address = this.formObj[targetItem.attrObj.fullAddress]
this.$refs.mapForm.lnglat = this.formObj[targetItem.attrObj.lng] ? [this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]] : []
// this.$refs.mapForm.addMarker([this.formObj[targetItem.attrObj.lng], this.formObj[targetItem.attrObj.lat]])
}
})
},
getAddress() {
const mapInfo = this.$refs.mapForm
if (!mapInfo.address) {
this.$message({
message: '请选择地址',
type: 'error',
customClass: 'message-Z-zinde'
})
return
}
this.formObj[this.targetItem.attrObj.fullAddress] = mapInfo.address
this.formObj[this.targetItem.attrObj.lat] = mapInfo.lnglat[1]
this.formObj[this.targetItem.attrObj.lng] = mapInfo.lnglat[0]
// var fullAddress = mapInfo.geocoderAddress.addressComponent || this.formObj[this.targetItem.attrObj.fullAddress]
var fullAddress = mapInfo.geocoderAddress.addressComponent
// if (!fullAddress) {
// this.dialogMapVisible = false
// return
// }
var provincecode = mapInfo.geocoderAddress.adcode || this.formObj[this.targetItem.attrObj.provinceCode]
this.formObj[this.targetItem.attrObj.provinceCode] = provincecode
// 获取省市
var province = ''
var city = ''
province = fullAddress.province
city = fullAddress.city ? fullAddress.city : fullAddress.district
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == province)
if (municipality) {
city = city.slice(0, 2) + '城区'
if (municipality === '重庆市') {
provincecode = provincecode.slice(0, 4)
provincecode == 5001 ? (city = city.slice(0, 2) + '城区') : (city = city.slice(0, 2) + '郊县')
}
}
// 判断省市是否匹配
if (this.formObj[this.targetItem.attrObj.provinceName]) {
if (this.formObj[this.targetItem.attrObj.provinceName] !== province && this.formObj[this.targetItem.attrObj.cityName] !== city) {
this.$message({
message: '您选择的地址错误,请重新选择',
type: 'error',
customClass: 'message-Z-zinde'
})
this.formObj[this.formObj[this.targetItem.attrObj.fullAddress]] = ''
return
}
}
this.dialogMapVisible = false
this.formObj[this.targetItem.attrObj.provinceName] = province
this.formObj[this.targetItem.attrObj.cityName] = city
// 当直接点击选择地址时,获取省市ID
this.$refs.provinceForm[0].init(province, city)
},
// 获取省
handleSelectProvince(val, targetItem) {
this.formObj[targetItem.attrObj.fullAddress] = ''
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.provinceName] = val.provinceName
this.formObj[targetItem.attrObj.provinceCode] = val.provinceCode
},
// 获取市
handleSelectCity(val, targetItem) {
if (val.cityName) {
this.formObj[targetItem.attrObj.cityName] = val.cityName
this.formObj[targetItem.attrObj.cityCode] = val.cityCode
} else {
this.formObj[targetItem.attrObj.cityName] = ''
this.formObj[targetItem.attrObj.cityCode] = ''
}
this.formObj[targetItem.attrObj.fullAddress] = ''
}
}
}
</script>
<style>
/* .glsx-combi-form {
min-width: 922px;
} */
/* .glsx-combi-form .glsx-combi-form-block {
padding: 16px 40px 0;
} */
.glsx-combi-form .isBlock {
display: block !important;
}
/* .glsx-combi-form .el-form-item {
width: 65%;
} */
.glsx-combi-form .no-label.el-form-item--small .el-form-item__content {
width: 100%;
}
.glsx-combi-form .el-form-item--small.el-form-item {
margin: 0 30px 20px 0;
}
.glsx-combi-form .el-form-item--small .el-form-item__label {
padding: 0;
}
/* .glsx-combi-form .el-form-item--small .el-form-item__content {
width: calc(100% - 85px);
} */
.glsx-combi-form .el-col {
margin-bottom: 10px;
}
.glsx-combi-form .el-select {
width: 100%;
}
.glsx-combi-form .item-height {
height: 37px;
}
.glsx-combi-form input::-webkit-outer-spin-button,
.glsx-combi-form input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.glsx-combi-form input[type='number'] {
-moz-appearance: textfield !important;
}
.glsx-combi-form .input-with-select .el-input-group__prepend {
background-color: #fff;
}
/* 提示图标 */
/* .glsx-combi-form .tips-block {
position: relative;
} */
.glsx-combi-form .tips-label {
margin-right: 2px;
}
.glsx-combi-form .tips-icon {
display: inline-block;
width: 14px;
height: 14px;
margin-right: 0px !important;
vertical-align: middle;
cursor: pointer;
}
.glsx-combi-form .combi-form-label {
/* display: inline-block; */
box-sizing: border-box;
}
/* 图片上传 */
.glsx-combi-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.glsx-combi-form .img-w-h {
width: 80px;
height: 80px;
}
.glsx-combi-form .activity-img {
position: relative;
color: #999999;
background-color: #f7f7f7;
border: 1px dotted #d9d9d9;
cursor: pointer;
margin-top: 10px;
}
.glsx-combi-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.glsx-combi-form .muti-imgs {
display: inline-block;
position: relative;
margin: 10px 8px 0 0;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 14px;
width: 100%;
text-align: center;
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 80px;
height: 80px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.glsx-combi-form .el-icon-delete,
.glsx-combi-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.glsx-combi-form .dialog-img {
width: 100%;
height: 100%;
}
.glsx-combi-form .dialog-look {
text-align: center;
}
.glsx-combi-form .dialog-video {
width: 50%;
height: 50%;
}
/* 图片上传 */
.glsx-combi-form .el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: #5850ff !important;
}
.glsx-combi-form .el-tag.el-tag--info {
border-color: #5850ff;
}
.glsx-combi-form .el-tag--plain.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.glsx-combi-form .el-tag.el-tag--info .el-tag__close:hover {
background-color: #e8e8ea;
}
.textBox .el-form-item__content {
width: 62%;
/* background: #096; */
}
</style>
<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>
<div class="d2-form d2-container-content">
<el-form :model="formData"
:rules="rules"
:ref="formRef + 'd2FormRuleForm'">
<slot name="title" />
<div v-for="(i, idx) in formList"
:key="idx"
class="d2-form-block">
<p v-show="i.title"
class="edit-sub-title">
{{ i.title }}
</p>
<span v-if="i.headImg">
<img v-show="formData[i.headImg.attr]"
class="commodity-img"
:src="formData[i.headImg.attr]"
alt="图片">
<span v-show="!formData[i.headImg.attr]">
<img class="commodity-img"
src="./image/no-choice.png">
</span>
</span>
<div
:style="{'width': i.headImg ? 'calc(100% - 220px)' : '100%', 'display': 'inline-block'}">
<div v-for="(item, index) in i.formBlock"
:key="index"
:style="{'width': i.width || '100%', 'display': 'inline-block'}">
<el-form-item :prop="item.name"
:label="item.label ? item.label + ':' : ''"
:id="item.name"
:label-width="item.label ? '120px' : '0px'"
class="dis-in-block"
:style="{'margin-bottom': !item.type ? '0px' : '22px'}">
<el-input v-if="item.type === 'input'"
v-model.trim="formData[item.name]"
:placeholder="item.label"
:maxlength="item.maxlength"
:style="{'width': item.width || formItemWidth}"
:disabled="item.isDisabled"
clearable
@input="input($event,item)"
@blur="blur(item)">
<!-- @blur="item.handleBlur" -->
<i slot="suffix"
class="suffix">{{ item.unit }}</i>
</el-input>
<el-input class="desc-input"
v-if="item.type === 'textarea'"
type="textarea"
v-model.trim="formData[item.name]"
:placeholder="item.label"
:rows="4"
:maxlength="item.maxlength"
show-word-limit />
<!-- 选择框 -->
<el-select v-else-if="item.type === 'select'"
v-model="formData[item.name]"
:clearable="item.isClear"
:placeholder="'请选择' + item.label"
@change="selectAddAttr($event, item)"
:style="{'width': item.width || formItemWidth}"
filterable
:disabled="item.isDisabled">
<el-option v-for="subItem in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]" />
</el-select>
<!-- 可添加选项选择框 -->
<el-select v-else-if="item.type === 'special-select'"
v-model="formData[item.name]"
:clearable="item.isClear"
:placeholder="'请选择' + item.label"
:style="{'width': item.width || formItemWidth}"
@change="selectAddAttr($event, item)"
@blur="selectBlur"
@focus="selectFocus"
filterable
:disabled="item.isDisabled">
<el-option v-for="(subItem, subIndex) in item.optionList"
:key="subItem[item.optionId]"
:label="subItem[item.optionLabel]"
:value="subItem[item.optionId]">
<!-- 供应方 -->
<div class="flex-option"
v-if="item.partitionFlag == 1">
<el-input v-show="editOptionIndex == subIndex"
:maxlength="10"
class="add-option-input"
:autofocus="true"
@click.stop.native="editOptionFocus"
v-model.trim="editOptionValue"
size="small"
placeholder="请输入" />
<span v-show="editOptionIndex == -1 || editOptionIndex != subIndex"
class="add-option-input">{{ subItem[item.optionLabel] }}</span>
<div>
<i v-show="item.optionList.length > 1 && (editOptionIndex != subIndex)"
class="el-icon-edit edit_icon"
@click.stop="editOption(subIndex, subItem[item.optionLabel], item.partitionFlag)" />
<i v-show="item.optionList.length > 1 && editOptionIndex == subIndex"
class="el-icon-check option_icon add_icon"
@click.stop="editOptionConfirm(subItem[item.optionId], index, item.partitionFlag)" />
<i v-if="item.optionList.length > 1"
class="el-icon-close del_icon"
@click.stop="delOption(subItem[item.optionId], index, item.partitionFlag, item)" />
</div>
</div>
<!-- 服务方 -->
<div class="flex-option"
v-else>
<el-input v-show="editOptionIndex == subIndex"
:maxlength="10"
class="add-option-input"
:autofocus="true"
@click.stop.native="editOptionFocus"
v-model.trim="editOptionValue"
size="small"
placeholder="请输入" />
<span v-show="editOptionIndex == -1 || editOptionIndex != subIndex"
class="add-option-input">{{ subItem[item.optionLabel] }}</span>
<div>
<i v-show="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13 && (editOptionIndex != subIndex)"
class="el-icon-edit edit_icon"
@click.stop="editOption(subIndex, subItem[item.optionLabel], item.partitionFlag)" />
<i v-show="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13 && editOptionIndex == subIndex"
class="el-icon-check option_icon add_icon"
@click.stop="editOptionConfirm(subItem[item.optionId], index, item.partitionFlag)" />
<i v-if="subItem[item.optionId] !== 12 && subItem[item.optionId] !== 13"
class="el-icon-close del_icon"
@click.stop="delOption(subItem[item.optionId], index, item.partitionFlag, item)" />
</div>
</div>
</el-option>
<div class="add-option">
<div v-if="showOptionInput"
class="flex-option">
<el-input class="add-option-input"
:maxlength="10"
v-model.trim="addOptionValue"
size="small"
placeholder="请输入" />
<div>
<i v-if="addOptionValue"
class="el-icon-check option_icon add_icon"
@click.stop="addOptionConfirm(item.partitionFlag)" />
<i class="el-icon-close option_icon del_icon"
@click.stop="delOption(undefined)" />
</div>
</div>
<div style="display: flex;align-items: center;">
<i class="el-icon-circle-plus-outline"
style="color: #2A58AD;font-size: 20px;margin-right: 3px;" />
<el-button type="text"
@click.stop="addOption">新增一项</el-button>
</div>
</div>
</el-select>
<template v-else-if="item.type === 'button'">
<div v-if="item.name === 'linkMerchants'">
<div class="add-btns">
<el-button type="primary"
@click="handleClick(item.handleName)">
{{ item.btnTxt }}
</el-button>
<span>已为该商品组合分配<span
class="relate-btn-txt">{{ formData[item.name] ? formData[item.name].length : 0 }}</span>家可见店铺</span>
</div>
<el-table :data="formData[item.name]"
style="width: 690px"
border
class="store-table">
<el-table-column label="序号"
align="center"
type="index"
width="64px" />
<el-table-column prop="yqMerchantName"
label="园区店名称"
align="center" />
<el-table-column prop="merchantName"
label="4s店名称"
align="center" />
<el-table-column prop="merchantId"
label="商户编号"
align="center" />
<el-table-column prop="userType"
label="商户类型"
align="center">
<template slot-scope="scope">
<span>{{ baseData[scope.row.channelType === 2 ? 'ghUserTypeList' : 'userTypeList'][scope.row.userType] }}</span>
</template>
</el-table-column>
<el-table-column label="删除"
align="center">
<template slot-scope="scope">
<el-button class="el-icon-delete"
@click="handleDelete(item, scope.row)"
type="text" />
</template>
</el-table-column>
</el-table>
</div>
</template>
<template v-else-if="item.type === 'relatePro'">
<div class="add-btns">
<el-button type="primary"
:disabled="!formData.goodsCode"
@click="handleAddPro(item)">
添加绑定
</el-button>
<span>已将基础商品绑定<span
class="relate-btn-txt">{{ formData[item.name] ? formData[item.name].length : 0 }}</span>件升级商品</span>
</div>
<div v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
style="margin-bottom: 30px;">
<p class="pro-block">
<span class="el-icon-delete pro-delete"
@click="handleDelete(item, subItem, subIndex)" />
<span class="el-icon-edit-outline pro-edit"
@click="handleProChange(item, subItem, subIndex)" />
<img :src="subItem.thumbUrl">
<span class="pro-detail pro-detail-txt">
<p class="pro-name"
:title="subItem.goodsName">{{ subItem.goodsName }}</p>
<div class="pro-type">
<span>{{ subItem.goodsTypeName }}</span>
<span class="pro-sap">{{ subItem.sapCode }}</span>
<div class="pro-price-block">
<p>建议升级价格:<span class="pro-price">{{ subItem.upgradePrice }}</span>元</p>
<p v-show="warrantyProList.includes(subItem.goodsType)">质保年限:<span
class="pro-price">{{ subItem.warrantyPeriod ? (subItem.warrantyPeriod + '年') : '无' }}</span>
</p>
</div>
</div>
</span>
</p>
</div>
</template>
<template v-else-if="item.type === 'photo'">
<p class="photo-top-tips">
{{ item.topTips }}
</p>
<div v-if="(formData[item.name] && formData[item.name].length) < item.maxPhotoNum"
class="activity-img img-w-h">
<div class="add">
+
</div>
<span
class="number">{{ formData[item.name].length }}/{{ item.maxPhotoNum }}</span>
<input type="file"
name="thumbUrl"
:id="item.name + 'file'"
ref="file"
class="activity-img img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="e => handleImgChange(e, item)"
style="opacity: 0;">
</div>
<template>
<div v-if="formData[item.name] && formData[item.name].length">
<span v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
class="muti-imgs img-w-h">
<img class="img-w-h"
:src="subItem.content">
<span class="img-btns">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content, item)"
class="el-icon-zoom-in" />
</span>
</span>
</span>
</div>
</template>
</template>
<template v-else-if="item.type === 'video'">
<p class="photo-top-tips">
{{ item.topTips }}
</p>
<div v-if="(formData[item.name] && formData[item.name].length) < item.maxPhotoNum"
class="activity-img img-w-h">
<div class="add">
+
</div>
<span
class="number">{{ formData[item.name].length }}/{{ item.maxPhotoNum }}</span>
<input type="file"
style="opacity: 0"
:id="item.name + 'file'"
ref="file"
class="activity-img img-w-h"
:style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''"
accept="video/mp4"
@change="e => handleVideoChange(e, item)">
</div>
<template>
<div v-if="formData[item.name] && formData[item.name].length">
<span v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
class="muti-imgs img-w-h">
<video class="img-w-h activity-img"
:style="item.uploadStyle && item.uploadStyle.hasOwnProperty('imgWH') ? item.uploadStyle.imgWH : ''"
:src="typeof subItem == 'object' ? subItem.content : subItem" />
<span class="img-btns">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content, item)"
class="el-icon-zoom-in" />
</span>
</span>
</span>
</div>
</template>
</template>
<template v-else-if="item.type === 'descList'">
<el-row class="desc-btns">
<el-button size="small"
@click="handleAddDesc(2, item)">
添加文字
</el-button>
<el-button size="small"
@click="handleAddDesc(1, item)">
添加图片
</el-button>
</el-row>
<el-row v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex">
<div style="position: relative;"
v-if="subItem.resType === 2">
<el-input class="desc-input"
type="textarea"
v-model.trim="subItem.content"
:rows="4"
maxlength="256"
placeholder="请输入详情内容" />
<i class="el-icon-delete desc-txt-delete"
@click="handleImgDelete(item, subIndex)" />
</div>
<div class="activity-img muti-imgs img-w-h"
v-else-if="subItem.resType === 1">
<div v-show="!subItem.content"
class="add">
+
</div>
<img v-show="subItem.content"
class="img-w-h"
:src="subItem.content">
<span class="img-btns"
v-show="subItem.content">
<span class="btn-item">
<i @click="handleImgDelete(item, subIndex)"
class="el-icon-delete" />
<i @click="handleImgLook(subItem.content)"
class="el-icon-zoom-in" />
</span>
</span>
<input type="file"
class="activity-Input img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@change="e => handleImgChange(e, item, subIndex)"
style="opacity: 0;">
</div>
</el-row>
</template>
<span v-else>{{ item.name ? formData[item.name] : item.value }}</span>
</el-form-item>
<div v-show="item.tips"
class="item-tips">
<template v-if="Array.isArray(item.tips)">
<p v-for="(x, y) in item.tips"
:key="y">
{{ x }}
</p>
</template>
<span v-else>{{ item.tips }}</span>
</div>
</div>
</div>
</div>
<el-form-item style="margin-top: 40px;text-align: center;">
<el-button type="primary"
@click="handleUp"
class="ok-btn">
提交
</el-button>
<el-button class="cancel-btn"
@click="handleClose">
取消
</el-button>
</el-form-item>
</el-form>
<relate-pro-dialog v-if="relateProVisible"
:relate-pro-visible="relateProVisible"
:pro-list="proList"
:origin-pro-info="originProInfo"
@handleRelateProConfirm="handleRelateProConfirm"
@handleRelateProClose="handleRelateProClose" />
<relate-store-dialog v-if="relateStoreVisible"
ref="formRelateStore"
:relate-store-visible="relateStoreVisible"
:source-page="sourcePage"
:store-api="storeApi"
:store-search-form="storeSearchForm"
:store-selected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose">
<el-row slot>
<el-form :model="storeSearchForm"
:rules="rules"
ref="relate"
:inline="true">
<el-form-item label="园区店:">
<el-input v-model.trim="storeSearchForm.yqMerchantName"
placeholder="园区店名称"
@keydown.native="handleStoreInput"
clearable />
</el-form-item>
<el-form-item label="4S店:">
<el-input v-model.trim="storeSearchForm.merchantName"
placeholder="4S店名称"
@keydown.native="handleStoreInput"
clearable />
</el-form-item>
<el-button type="primary"
@click="handleSearchStore">
搜索
</el-button>
</el-form>
</el-row>
</relate-store-dialog>
<el-dialog :visible.sync="lookImgVisible">
<video v-if="dialogObj.uploadType == 'video'"
class="dialog-video"
style="width: 100%;height: 100%;"
controls>
<source :src="dialogObj.url"
type="video/mp4">
</video>
<img v-else
width="100%"
:src="dialogObj.url"
alt="图片">
</el-dialog>
</div>
</template>
<script>
import relateProDialog from './relateProDialog'
import relateStoreDialog from './relateStoreDialog'
import { userType, ghUserType, warrantyProList } from '@/utils/constants'
import { limitPrice } from '@/common/format'
const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-info`
export default {
name: 'D2Form',
data() {
return {
userInfo:{detail:{}},
warrantyProList,
merchantDisable: false,
storeSearchForm: {
yqMerchantName: '',
merchantName: ''
},
// 关联商品弹窗
relateProVisible: false,
relateStoreVisible: false,
lookImgVisible: false,
imageUrl: '',
storeSelected: [],
sourcePage: 'editProduct',
proIndex: -1,
proList: [],
formData: {},
separateOpt: [{
confId: 1,
confLabel: '毛利'
}, {
confId: 2,
confLabel: '收入'
}],
profitOldVal: [],
// parkServiceList: [],
baseData: {
userTypeList: userType,
ghUserTypeList: ghUserType
},
showOptionInput: false,
addOptionValue: '',
editOptionValue: '',
editOptionIndex: -1,
selectedValue: '',
dialogObj: {
url: '',
uploadType: ''
}
}
},
props: {
// add - 新增;edit - 编辑
addOrEdit: {
type: String,
default: 'add'
},
headImg: {
type: Object,
default: () => {
return {
isHas: false,
attr: ''
}
}
},
formItemWidth: {
type: String,
default: '100%'
},
rules: {
type: Object,
default: () => { }
},
formRef: {
type: String,
default: ''
},
originData: {
type: Object,
default: () => {
return {}
}
},
formList: {
type: Array,
default: () => { }
},
storeApi: {
type: Function,
default: () => { }
},
formName: {
type: String,
default: () => { }
}
},
components: {
relateProDialog,
relateStoreDialog
},
watch: {
originData: {
handler(newVal) {
if (newVal) {
this.formData = this.$common.utils.deepClone(this.originData)
}
},
deep: true
}
},
mounted() {
this.formData = this.$common.utils.deepClone(this.originData)
// if (this.userInfo.beSuper) {
// getParkStore({}).then(res => {
// this.parkServiceList = res
// })
// } else {
this.formData.merchantId = this.userInfo.detail.merchantId
// }
if (this.formData.hasOwnProperty('upgradeGoods')) {
this.merchantDisable = this.addOrEdit === 'edit'
this.profitOldVal = this.formData.upgradeGoods.map(item => item.profitValue)
// this.getGoodsList()
}
this.$nextTick(() => {
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate()
})
},
methods: {
selectBlur() {
this.editOptionIndex = -1
this.showOptionInput = false
},
selectFocus() {
this.editOptionIndex = -1
this.showOptionInput = false
},
addOption() {
this.showOptionInput = true
this.addOptionValue = ''
},
addOptionConfirm(partitionFlag) {
const data = {
relatedPartyName: this.addOptionValue,
partitionFlag: partitionFlag,
createdBy: JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))).loginAccount.userName,
updatedBy: JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))).loginAccount.userName
}
this.$emit('handleAddBrandSupplyConfirm', data)
this.addOptionValue = ''
this.showOptionInput = false
},
editOption(e, value) {
this.editOptionValue = value
this.editOptionIndex = e
},
editOptionFocus(event) {
event.stopPropagation()
},
editOptionConfirm(e, index, partitionFlag) {
const data = {
relatedPartyName: this.editOptionValue,
id: e,
partitionFlag: partitionFlag
}
this.$emit('handleEditBrandSupplyConfirm', data)
this.editOptionIndex = -1
this.editOptionValue = ''
},
delOption(e, index, partitionFlag, item) {
if (e) {
const data = {
relatedPartyName: this.editOptionValue,
id: e,
partitionFlag: partitionFlag,
deletedFlag: 'Y'
}
this.formData[item.name] = ''
this.$emit('handleEditBrandSupplyConfirm', data)
} else {
this.showOptionInput = false
this.addOptionValue = ''
}
},
// 修复直接调用可以会因为没有对应方法报错的问题
input(event, item) {
// console.log(event)
// console.log(item)
item.handleInput && item.handleInput(event)
// item.handleInput()
},
blur(item) {
item.handleBlur && item.handleBlur()
},
getGoodsList() {
return new Promise(resolve => {
this.$apis.product.getGoodsList({}).then(res => {
this.proList = res
resolve()
})
})
},
clearGoodsType(item) {
this.formData[item.name] = ''
},
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
if (targetItem.name === 'goodsCode') {
var tempVal = targetItem.optionList.find(item => item.goodsCode === value)
this.formData.goodsTypeName = tempVal.goodsTypeName
this.formData.thumbUrl = tempVal.thumbUrl
this.formData.sapCode = tempVal.sapCode
}
this.selectedValue = value
this.editOptionIndex = -1
if (targetItem.name == 'sceneType') {
this.$emit('handleChangeSelect', value)
}
},
handleAddPro(targetItem) {
this.getGoodsList().then(res => {
if (!this.formData[targetItem.relateAttr]) {
this.$message({
message: '请选择基础商品',
type: 'warning',
showClose: true
})
this.jumpScroll(targetItem.relateAttr)
return true
}
this.markTarget = targetItem
var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode)
proSelectedIds.push(this.formData[targetItem.relateAttr])
this.proList.forEach(item => {
item.disabled = proSelectedIds.includes(item.goodsCode)
})
this.relateProVisible = true
})
},
handleProChange(item, targetItem, targetIndex) {
this.getGoodsList().then(res => {
var proSelectedIds = this.formData.upgradeGoods.map(item => item.goodsCode)
proSelectedIds.push(this.formData[item.relateAttr])
this.proList.forEach(item => {
if (proSelectedIds.includes(item.goodsCode) && (item.goodsCode !== targetItem.goodsCode)) {
item.disabled = true
} else {
item.disabled = false
}
})
this.proIndex = targetIndex
this.originProInfo = targetItem
this.relateProVisible = true
})
},
judgeIsDisable() {
if (this.addOrEdit === 'add') {
this.formList[0].formBlock[0].isDisabled = this.formData[this.markTarget.name].length
this.merchantDisable = this.formData[this.markTarget.name].length
}
},
handleRelateProConfirm(proInfo) {
if (this.proIndex !== -1) {
this.formData.upgradeGoods[this.proIndex] = proInfo
} else {
this.profitOldVal.push('0')
this.formData.upgradeGoods.push(proInfo)
this.judgeIsDisable()
}
this.handleRelateProClose()
},
handleRelateProClose() {
this.originProInfo = ''
this.proIndex = -1
this.relateProVisible = false
},
handleStoreInput(e) {
(e.keyCode === 13) && this.handleSearchStore()
},
// 门店搜索
handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1)
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate('linkMerchants')
this.relateStoreVisible = false
this.formData.linkMerchants = selectedData
},
handleRelateStoreClose() {
this.relateStoreVisible = false
},
handleClick(handleName) {
switch (handleName) {
case 'relateStore':
this.storeSelected = this.$common.utils.deepClone(this.formData.linkMerchants)
// this.storeSearchForm = {
// yqMerchantId: this.formData.yqMerchantId
// }
this.relateStoreVisible = true
break
}
},
handleDelete(formItem, item, index) {
this.$confirm('是否确认解绑该关联商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var formDataName = formItem.name
var filterArr = this.formData[formDataName].filter(i => i[formItem.optionValue] !== item[formItem.optionValue])
this.formData[formDataName] = filterArr
if (formItem.name === 'upgradeGoods') {
this.profitOldVal.splice(index, 1)
}
this.judgeIsDisable()
})
},
// 图片
handleImgChange(e, targetItem, subIndex = 0) {
var reader = new FileReader()
var fileInfo = e.srcElement.files[0]
reader.readAsDataURL(fileInfo)
reader.onload = e => {
const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.sysBase.uploadImg({ file: base64 }).then(res => {
this.$refs[this.formRef + 'd2FormRuleForm'].clearValidate(targetItem.name)
if (targetItem.maxPhotoNum === 1) {
this.formData[targetItem.name] = [{
content: res
}]
return true
}
if (targetItem.name === 'goodsImgList') {
this.formData[targetItem.name].push({ content: res })
} else {
this.formData[targetItem.name][subIndex].content = res
}
})
}
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
Array.isArray(this.formData[targetItem.name]) ? this.formData[targetItem.name].splice(subIndex, 1) : (this.formData[targetItem.name] = '')
},
// 图片查看
handleImgLook(src, targetItem) {
this.lookImgVisible = true
this.dialogObj = {
url: src,
uploadType: targetItem.type || 'photo'
}
},
// 视频
handleVideoChange(e, targetItem) {
var reader = new FileReader()
var fileInfo = e.srcElement.files[0]
reader.readAsDataURL(fileInfo)
reader.onload = e => {
if ((e.total / 1024 / 1024) > 20) {
return this.$message({
message: '视频内容大于20M',
type: 'error'
})
}
const imgFile = e.target.result
const base64 = fileInfo.name.split('.')[1] + '@' + imgFile.split(',')[1]
this.$apis.sysBase.uploadVideo({ file: base64 }).then(res => {
this.formData[targetItem.name] = [{
content: res
}]
})
}
},
// 园区店更改
handleMerchantChange(value) {
if (this.formName === 'commodity') {
this.$emit('ydMerchantChange', value)
this.formData.goodsCode && (this.formData.goodsCode = '')
this.formData.upgradeGoods = []
this.formData.linkMerchants = []
}
},
// 验证分账比例
handleProfitInput(value, index) {
this.formData.upgradeGoods[index].profitValue = limitPrice(value, this.profitOldVal[index], 3, 0, 0, 100)
this.profitOldVal[index] = this.formData.upgradeGoods[index].profitValue
},
// 描述 1-图片;2-文字
handleAddDesc(resType, targetItem) {
const orderNo = this.formData[targetItem.name].length
this.formData[targetItem.name].push({
resType: resType,
orderNo: orderNo,
content: ''
})
},
handleClose() {
this.$emit('handleClose')
},
jumpScroll(idName) {
document.getElementById(idName).scrollIntoView()
},
handleUp() {
if (this.formData.sapCode && (!/^[0-9A-Za-z]+$/.test(this.formData.sapCode))) {
this.jumpScroll('sapCode')
return true
}
this.$refs[this.formRef + 'd2FormRuleForm'].validate((valid, options) => {
if (valid) {
// const flag = true
if (this.formData.hasOwnProperty('upgradeGoods')) {
// for (var i in this.formData.upgradeGoods) {
// const item = this.formData.upgradeGoods[i]
// if (!item.profitValue) {
// return true
// }
// }
if (!this.formData.linkMerchants.length) {
// flag = false
return true
}
}
this.$emit('handleAddConfirm', this.formData)
} else {
var needRuleList = Object.keys(options)
this.jumpScroll(needRuleList[0])
return true
}
})
}
}
}
</script>
<style>
.d2-form .d2-form-block {
border-bottom: 1px solid #e7eaec;
padding: 20px 0px;
}
.d2-form .dis-in-block {
display: inline-block;
}
.d2-form .item-tips {
position: absolute;
left: 252px;
display: inline-block;
font-size: 12px;
color: #999999;
margin-left: 10px;
vertical-align: top;
}
.d2-form .item-tips p {
margin: 0 0;
}
.d2-form .icon-delete {
margin-left: 10px;
cursor: pointer;
}
.d2-form .pro-item {
width: 30px;
display: inline-block;
margin: 0 6px;
}
.d2-form .photo-top-tips {
/* height: 36px; */
margin: 0 0;
color: #999999;
}
.d2-form .img-w-h {
width: 88px;
height: 88px;
}
.d2-form .activity-img {
position: relative;
/* width: 88px;
height: 74px; */
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
/* margin-right: 10px; */
}
.d2-form .activity-Input {
position: absolute;
top: 0;
left: 0;
}
.d2-form .muti-imgs {
display: inline-block;
position: relative;
}
.activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.muti-imgs .img-btns {
display: none;
height: 100%;
position: absolute;
width: 88px;
height: 74px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.d2-form .el-icon-delete,
.d2-form .el-icon-zoom-in {
cursor: pointer;
}
.muti-imgs .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.d2-form .input-bg {
/* background-color: #eee; */
}
.d2-form .desc-btns {
margin-bottom: 15px;
}
.d2-form .desc-input {
width: 155%;
margin-bottom: 15px;
}
.d2-form .desc-txt-delete {
position: absolute;
left: 160%;
bottom: 15px;
}
.d2-form .add-btns .el-button {
width: 140px;
margin: 0 40px 30px 0;
}
.d2-form .add-btns .relate-btn-txt {
font-weight: bold;
color: #0947c6;
padding: 0 8px;
}
.d2-form .pro-block {
position: relative;
display: flex;
height: 160px;
width: 100%;
border: 1px solid #999999;
}
.d2-form .pro-block .pro-detail-txt {
font-size: 12px;
line-height: 30px;
color: #6c6f71;
}
.d2-form .pro-block .pro-detail {
width: 346px;
padding: 0px 40px;
margin: 20px 0;
/* border-right: 1px solid #999999; */
box-sizing: border-box;
}
.d2-form .pro-block .pro-detail .pro-type {
padding-left: 40px;
}
.d2-form .pro-block .pro-detail .pro-type .pro-sap {
display: inline-block;
padding-left: 20px;
}
.d2-form .pro-block .pro-allocate .el-input.is-disabled .el-input__inner {
text-align: center;
}
.d2-form .pro-block p {
margin: 0 0;
}
.d2-form .pro-block .pro-allocate {
width: 372px;
padding: 40px 0 0 84px;
}
.d2-form .pro-block img {
width: 160px;
height: 160px;
}
.d2-form .pro-name {
width: 256px;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: bold;
}
.d2-form .pro-price-block {
text-align: right;
}
.d2-form .pro-price {
display: inline-block;
width: 62px;
text-align: center;
border-bottom: 1px solid #999999;
height: 23px;
padding-right: 2px;
color: #999999;
}
.d2-form .pro-delete {
position: absolute;
left: 0;
top: 0;
width: 16px;
height: 16px;
background-color: #ffffff;
}
.d2-form .pro-edit {
position: absolute;
right: 0;
top: 0;
width: 16px;
height: 16px;
cursor: pointer;
background-color: #ffffff;
}
.d2-form .pro-item.el-input--medium .el-input__inner,
.d2-form .pro-item .el-input--medium .el-input__inner {
padding: 0 2px;
border-width: 0 0 1px;
height: 16px;
line-height: 16px;
}
.d2-form .error {
color: red;
}
.d2-form .el-table--medium th {
background-color: #f7f7f7;
}
.d2-form .el-table--medium td {
padding: 20px 10px !important;
}
.d2-form .commodity-img {
width: 160px;
height: 160px;
margin-right: 60px;
vertical-align: top;
}
.d2-form .seat-img {
display: inline-block;
background: #f3f3f3;
border: 1px solid #e5e6e7;
box-sizing: border-box;
}
.flex-option {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.add-option {
padding: 0 20px;
display: flex;
flex-flow: column;
align-items: flex-start;
}
.add-option-input {
width: 285px;
display: inline-block;
}
.add-option-input .el-input__inner {
border: none;
padding: 0;
}
.option_icon {
font-size: 14px;
cursor: pointer;
}
.del_icon {
margin-left: 15px;
color: #eb4e4e;
}
.add_icon {
color: #3fcf77;
}
</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) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
let params = { moduleName: 'quality', mockUrl: 'https://oss-config.glsx.com.cn/mock/64560a989bfdc8942feaa6f1/ordermanage/config', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return 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
}
}
/*
* @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 { setMinHeight } from '@/common/constant'
import utils from './utils/index'
import './public-path'
import '@/assets/css/public.scss'
import '@/components'
// import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
Vue.prototype.$apis = apis
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)
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 } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import ElementUI from 'element-ui'
import render from './render'
let routes = []
let router = null
let instance = null
Vue.use(ElementUI)
Vue.use(GLTable)
import 'glsx-components/dist/glsx-components.css'
export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, sign_common, request_common } = await fetchConfig()
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 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="https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/file.mp3" type="audio/mpeg" /> -->
<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="handleMute">
<img src="@/assets/trumpet.png" v-if="isMuted" />
<img src="@/assets/mute.png" v-if="!isMuted" />
</div>
</div>
<div class="record-info">
<div class="dialog">
<template v-for="item in dialogList">
<div :class="{ 'dialog-detail': true, 'nth-child': item.role % 2 === 1 }" :key="item.id">
<div class="name">
<img class="role" src="@/assets/role-one.png" v-if="item.role % 2 === 0" />
角色{{ (item.role % 2) + 1 }}
<img class="role" src="@/assets/role-two.png" v-if="item.role % 2 === 1" />
</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" v-html="formatSrt(detailObj.digest)">
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
detailObj: {
type: Object,
default: () => {}
}
},
data() {
return {
myAud: '',
isPlay: true,
isMuted:true,
dialogList: [],
totalTime: '0:00',
currentTime: '0:00',
isCircle: false
}
},
mounted() {
this.myAud = document.getElementById('audio1')
this.handleprogress()
this.conversationDetailPage()
},
methods: {
formatSrt(str) {
return str.replace(/\n/g, "<br/>")
},
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()
}
},
handleMute() {
this.isMuted = !this.isMuted
console.log(this.isMuted)
this.myAud.muted=!this.isMuted
},
conversationDetailPage() {
this.$apis.quality
.conversationDetailPage({
batchId: this.detailObj.id,
currentPage: 1,
pageSize: 9999
})
.then(res => {
this.dialogList = res.list
})
}
}
}
</script>
<style scoped lang="scss">
.dialogue {
margin: auto;
.record {
width: 600px;
margin: 5px auto 0px;
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%;
min-width: 588px;
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;
.role {
width: 40px;
height: 40px;
vertical-align: top;
margin-right: 10px;
}
}
.dig-content {
width: 404px;
background: #ffffff;
border-radius: 4px;
font-size: 14px;
color: #333333;
padding: 10px 12px;
white-space: pre-wrap;
text-align: left;
margin-left: 50px;
margin-top: -20px;
line-height: 20px;
}
}
.nth-child {
text-align: right;
.dig-content {
display: inline-block;
background: #ebebff;
margin-right: 56px;
}
}
}
.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;
line-height: 20px;
}
}
}
}
</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(0)"
@input="handleStartInput"
class="el-range-input"
></el-input>
<span class="el-range-separator">至</span>
<el-input
v-model="userInput[1]"
:placeholder="endPlaceholder"
@input="handleEndInput"
@focus="handleFocus"
@blur="handleBlur(1)"
class="el-range-input"
></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) {
let isNumber = /^\d+$/.test(event)
if (!isNumber) {
event = null
}
if (event > 100) event = 100
this.userInput[0] = event
},
handleEndInput(event) {
let isNumber = /^\d+$/.test(event)
if (!isNumber) {
event = null
}
if (event > 100) event = 100
this.userInput[1] = 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(index) {
this.pickerVisible = false
this.contrastValue()
},
contrastValue() {
let val = this.userInput
if (Array.isArray(val)) {
if (val[0] > val[1]) {
val[1] = null
}
}
}
}
}
</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="quality-control">
<div class="header">
<div class="item" v-for="(i, index) in infoList" :key="index">
<div class="icon">
<img :src="require(`@/assets/${i.icon}.png`)" />
</div>
<div class="info">
<div>
{{ i.text }}
<el-tooltip effect="dark" :content="i.tooltip" placement="top" v-if="i.tooltip">
<img class="mark" src="@/assets/mark.png" />
</el-tooltip>
</div>
<div class="time" v-html="i.formatter && i.formatter(statistics)"></div>
</div>
</div>
</div>
<div class="container">
<GLCombiForm ref="showSearch" class="show-search" labelWidth="110px" :formObj="searchForm" :formData="showFormData" @handleOk="handleSearch" @handleRest="handleReset">
<div slot="searchdate">
<el-date-picker v-model="searchForm.searchdate" type="date" placeholder="选择日期" :picker-options="rangePickerOptions"></el-date-picker>
</div>
<!-- 质检评分 -->
<div slot="score">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.qualityTestScore"></el-input-range>
</div>
<!-- 当日到店量 -->
<!-- <div slot="toStoreCount">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.toStoreCount"></el-input-range>
</div> -->
<div slot="AbnormalProportion">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.AbnormalProportion"></el-input-range>
</div>
</GLCombiForm>
<GLTable ref="qualityTable" :getListApi="getListApi" :searchForm="searchFormSearch" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :pageConf="pageConf" :noDataImg="url" @setTableFinishFun="setTableFinishFun">
<div slot="store" slot-scope="scope">
<template v-if="scope.scope.storeList && scope.scope.storeList.length > 1">
<span>{{ scope.scope.storeList.slice(0, 1).join('') }}</span>
<el-popover placement="top" width="fit-content" trigger="hover">
<div :class="{ scrollHeight: scope.scope.storeList.length >= 10 }">
<div v-for="(item, index) in scope.scope.storeList" :key="index">{{ item }}</div>
</div>
<span class="more-info" slot="reference">...({{ scope.scope.storeList.length }})</span>
</el-popover>
</template>
<template v-else>
<span v-if="!scope.scope.storeList || !scope.scope.storeList.length">--</span>
<span v-else>{{ scope.scope.storeList.join('') }}</span>
</template>
</div>
<div slot="seconds" slot-scope="scope">
<template v-if="scope.scope.seconds">
{{ toMinutesAndSeconds(scope.scope.seconds) }}
</template>
<template v-else>--</template>
</div>
<div slot="service" slot-scope="scope">
<template v-if="scope.scope.serviceList && scope.scope.serviceList.length > 1">
<span>{{ scope.scope.serviceList.slice(0, 1).join('') }}</span>
<el-popover placement="top" width="fit-content" trigger="hover">
<div v-for="(item, index) in scope.scope.serviceList" :key="index">
{{ item }}
</div>
<span class="more-info" slot="reference">...({{ scope.scope.serviceList.length }})</span>
</el-popover>
</template>
<template v-else>
<span v-if="!scope.scope.serviceList || !scope.scope.serviceList.length">--</span>
<span v-else>{{ scope.scope.serviceList.join('') }}</span>
</template>
</div>
<div slot="abnormalProportionHtml" slot-scope="scope">
<template v-if="scope.scope.abnormalProportion">
{{ scope.scope.abnormalProportion + '%' }}
</template>
<template v-else-if="scope.scope.abnormalProportion==0">
{{ scope.scope.abnormalProportion+ '%' }}
</template>
<template v-else>--</template>
</div>
<div slot="scoreHtml" slot-scope="scope">
<template v-if="scope.scope.score || scope.scope.score === 0">
{{ scope.scope.score }}
</template>
<template v-else>--</template>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="recepDetail(scope.scope)" v-if="scope.scope.score || scope.scope.score == 0" >接待明细</el-button>
<span v-else class="dis-class" @click="recepDetail()">接待明细</span>
</div>
</GLTable>
</div>
</div>
</template>
<script>
import { Util, deepClone } from '@/common/util'
import url from '@/assets/empty.png'
import ElInputRange from './el-input-range'
import { rangePickerOptions } from '@/common/format'
export default {
components: {
ElInputRange
},
data() {
return {
url: url,
rangePickerOptions: rangePickerOptions,
infoList: [
{
icon: 'record',
text: '录音时长',
value: 'totalRecordingDuration',
formatter: data => {
return `<span style="font-weight:700;font-size:26px;">${data.totalRecordingDuration ? this.toMinutesAndSeconds(data.totalRecordingDuration) : '--'}</span>`
}
// formatter: data => {
// let strHtml = this.toMinutesAndSeconds(data.totalRecordingDuration).h
// ? `<span style="font-weight:700;font-size:26px">${this.toMinutesAndSeconds(data.totalRecordingDuration).h}</span>小时
// <span style="font-weight:700;font-size:26px;">${this.toMinutesAndSeconds(data.totalRecordingDuration).m}</span>分钟
// `
// : ` <span style="font-weight:700;font-size:26px;">${this.toMinutesAndSeconds(data.totalRecordingDuration).m}</span>分钟`
// return strHtml
// }
},
{
icon: 'facility',
text: '上传录音设备占比',
formatter: data => {
return `<span style="font-weight:700;font-size:26px;">${data.uploadBadgeCount}</span>/${data.totalBadgeCount}`
}
},
{
icon: 'score',
text: '话术平均质检评分',
formatter: data => {
let strHtml = data.averageQualityTestScore || data.averageQualityTestScore == 0 ? `<span style="font-weight:700;font-size:26px;">${data.averageQualityTestScore}</span>分` : `<span style="font-weight:700;font-size:22px;">统计中</span>`
return strHtml
},
tooltip: '统计当日所有员工的质检平均分,分值越高整体表现越好'
}
],
statistics: {
totalBadgeCount: '',
uploadBadgeCount: ''
},
showFormData: [
{
label: '质检日期',
name: 'searchdate',
addHtml: 'searchdate'
},
{
label: '质检评分',
name: 'qualityTestScore',
addHtml: 'score'
},
// {
// label: '归属服务商',
// // label: '园区店',
// name: 'serviceMerchantNo',
// type: 'select',
// optionList: [],
// optionId: 'merchantId',
// optionLabel: 'merchantName',
// optionsName: 'parkServiceList'
// },
{
label: '归属门店',
name: 'storeMerchantNo',
type: 'select',
optionList: [],
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'storeIdList'
},
{
label: '员工姓名',
name: 'employeeName',
type: 'input',
maxlength: '40',
isClear: true
},
{
label: '手机号',
name: 'phoneNumber',
placeholder: '请输入手机号(至少4位)',
type: 'input',
maxlength: '20',
isClear: true
},
// {
// label: '当日到店量',
// name: 'toStoreCount',
// addHtml: 'toStoreCount'
// },
{
label: '异常占比',
name: 'AbnormalProportion',
addHtml: 'AbnormalProportion'
}
],
searchForm: {
searchdate: '',
serviceMerchantNo: '',
storeMerchantNo: '',
employeeName: '',
phoneNumber: '',
// toStoreCount: [],
qualityTestScore: [],
AbnormalProportion: []
},
searchFormSearch: {},
getListApi: this.$apis.quality.getReclistWithPage,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '录音日期',
prop: 'searchdate',
width: '120px'
},
{
label: '员工',
prop: 'employeeName',
width:150,
line:1
},
{
label: '手机号',
prop: 'phoneNumber',
width: '125px'
},
{
label: '归属门店',
prop: 'storeMerchantNo',
addHtml: 'store',
width: '180px'
},
{
label: '归属服务商',
// addHtml: 'service',
width: '180px',
prop: 'serviceMerchantNo'
},
{
label: '工牌编号',
prop: 'badgeId',
width: '140px'
},
{
label: '录音时长',
prop: 'seconds',
addHtml: 'seconds',
width: '150px'
},
{
label: '预计接待批次/批',
prop: 'batchNum',
width: '170px',
renderHeader: createElement => {
return createElement('div', { style: 'margin-left:-10px' }, [
'预计接待批次/批',
createElement(
'el-tooltip',
{
attrs: {
effect: 'dark',
content: 'AI对当日提交的营销录音进行分析得出的接待批次',
placement: 'top'
}
},
[createElement('img', { style: { width: '16px', height: '16px', display: 'inline-block', verticalAlign: 'middle' }, attrs: { src: require('@/assets/mark.png') } })]
)
])
}
},
{
label: '当日到店量/人',
// prop: 'toStoreCount',
prop: 'enterReceptionBatch',
width: '150px',
renderHeader: createElement => {
return createElement('div', { style: 'margin-left:-10px' }, [
'当日到店量/人',
createElement(
'el-tooltip',
{
attrs: {
effect: 'dark',
content: '员工通过日报提报的当日触客数',
placement: 'top'
}
},
[createElement('img', { style: { width: '16px', height: '16px', display: 'inline-block', verticalAlign: 'middle' }, attrs: { src: require('@/assets/mark.png') } })]
)
])
}
},
{
label: '异常占比',
prop: 'abnormalProportion',
addHtml: 'abnormalProportionHtml',
width: '150px',
renderHeader: createElement => {
return createElement('div', { style: 'margin-left:-10px' }, [
'异常占比',
createElement(
'el-tooltip',
{
attrs: {
effect: 'dark',
content: '异常占比= (预计接待批次 - 当日到店量)/ 预计接待批次数,建议重点关注异常占比超过20%的员工',
placement: 'top'
}
},
[createElement('img', { style: { width: '16px', height: '16px', display: 'inline-block', verticalAlign: 'middle' }, attrs: { src: require('@/assets/mark.png') } })]
)
])
}
},
{
label: '话术质检评分/分',
prop: 'score',
addHtml: 'scoreHtml',
width: '170px',
renderHeader: createElement => {
return createElement('div', { style: 'margin-left:-10px' }, [
'话术质检评分/分',
createElement(
'el-tooltip',
{
attrs: {
effect: 'dark',
content: 'AI通过分析营销录音对驻店人员当日表现进行整体打分。',
placement: 'top'
}
},
[createElement('img', { style: { width: '16px', height: '16px', display: 'inline-block', verticalAlign: 'middle' }, attrs: { src: require('@/assets/mark.png') } })]
)
])
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
parkServiceList: [], //服务商
storeIdList: []
}
}
},
created() {
this.searchForm.searchdate = new Date().getTime() - 3600 * 1000 * 24
},
watch: {
'searchForm.searchdate'(newVal) {
this.statisticsEmployeeBadge(newVal)
this.$refs.qualityTable.refreshTable(true, true)
}
},
mounted() {
this.getServiceStore()
},
methods: {
getServiceStore() {
this.$apis.quality
.listShop4sByRef({
currentPage: 1,
pageSize: 99999,
partnerMerchantId: this.$globalState.session.merchantId
})
.then(res => {
this.baseData.storeIdList = res.list || []
this.getOptionsList()
})
},
statisticsEmployeeBadge(val) {
let searchdate = Util.dateFormate(val, 'YYYY-MM-DD')
this.$apis.quality
.statisticsEmployeeBadge({
searchdate,
serviceMerchantNo: this.$globalState.session.merchantId
})
.then(res => {
this.statistics = res
})
},
recepDetail(row) {
if (!row) {
this.$confirm('质检分析中,请耐心等待', '提示', {
type: 'warning',
showCancelButton:false,
showConfirmButton:false
})
return
}
this.$router.push({
path: '/qualityManage/recepDetail',
query: {
data: JSON.stringify(row)
}
})
},
// toMinutesAndSeconds(time) {
// const h = Math.floor(time / 3600)
// const m = parseInt((time % 3600) / 60)
// return {
// h,
// m
// }
// },
toMinutesAndSeconds(seconds) {
// seconds = Math.floor(seconds / 1000)
let formattedTime = ''
if (seconds < 60) return seconds + '秒'
else if (seconds > 3600) {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60)
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
return formattedTime
} else {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
remainingSeconds = seconds % 60
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
if (remainingSeconds > 0) formattedTime += remainingSeconds + '秒'
return formattedTime
}
},
setTableFinishFun(data) {
for (let i = 0; i < data.length; i++) {
data[i].serviceMerchantNo = this.$globalState.session.merchantName
}
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchForm.searchdate) {
this.searchFormSearch.searchdate = Util.dateFormate(this.searchForm.searchdate, 'YYYY-MM-DD')
}
this.searchFormSearch.serviceMerchantNo = this.$globalState.session.merchantId
if (this.searchFormSearch.qualityTestScore) {
this.searchFormSearch.qualityTestScoreBegin = this.searchFormSearch.qualityTestScore[0]
this.searchFormSearch.qualityTestScoreEnd = this.searchFormSearch.qualityTestScore[1]
}
// if (this.searchFormSearch.toStoreCount) {
// this.searchFormSearch.toStoreCountBeg = this.searchFormSearch.toStoreCount[0]
// this.searchFormSearch.toStoreCountEnd = this.searchFormSearch.toStoreCount[1]
// }
if (this.searchFormSearch.AbnormalProportion) {
this.searchFormSearch.AbnormalProportionBeg = this.searchFormSearch.AbnormalProportion[0]
this.searchFormSearch.AbnormalProportionEnd = this.searchFormSearch.AbnormalProportion[1]
}
delete this.searchFormSearch.qualityTestScore
// delete this.searchFormSearch.toStoreCount
delete this.searchFormSearch.AbnormalProportion
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])
}
})
},
handleSearch() {
if (this.searchForm.phoneNumber && this.searchForm.phoneNumber.length < 4) {
return
}
this.$refs.qualityTable.refreshTable(true, true)
// this.stockMonthReportCount()
},
handleReset() {
this.searchForm = {
searchdate: '',
serviceMerchantNo: '',
storeMerchantNo: '',
employeeName: '',
phoneNumber: '',
// toStoreCount: [],
qualityTestScore: [],
AbnormalProportion: []
}
this.searchForm.searchdate = new Date().getTime() - 3600 * 1000 * 24
this.$refs.qualityTable.refreshTable()
// this.stockMonthReportCount()
}
}
}
</script>
<style scoped lang="scss">
.quality-control {
.header {
display: flex;
align-items: center;
background: #ffffff;
padding: 16px 20px;
box-sizing: border-box;
border-bottom: 16px solid #f0f1f7;
.item {
width: 274px;
height: 104px;
padding: 20px;
box-sizing: border-box;
display: flex;
align-items: center;
margin-right: 16px;
background: #f7f9fa;
border-radius: 4px;
.icon {
width: 40px;
height: 40px;
margin-right: 20px;
img {
width: 100%;
height: 100%;
}
}
.info {
font-size: 14px;
color: #333333;
.time {
color: #333333;
margin-top: 12px;
.fw {
font-weight: 700;
font-size: 26px;
}
}
}
}
.mark {
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
}
img {
width: 100%;
}
}
.el-range-input {
appearance: none;
border: none;
outline: none;
display: inline-block;
height: 100%;
margin: 0;
padding: 0;
width: 39%;
text-align: center;
font-size: 14px;
color: #606266;
}
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
.dis-class{
color:#666;
cursor: pointer;
}
}
</style>
<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="0">未命中</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="suggestions" slot-scope="scope">
<div v-html="formatSrt(scope.scope.suggestions)"></div>
</template>
<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 => {
return `<span style="font-weight:700;font-size:20px;">${data.score ? data.score : '0'}</span>分`
}
},
{
text: '预计营销结果',
formatter: data => {
let classStr = data.estimatedResult == '成交' ? (data.estimatedResult == '战败' ? 'redStr' : 'greenStr') : 'grayStr'
return `<span class="${classStr}" style="font-weight:700;font-size:20px;">${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:20px;">${data.duration?this.toMinutesAndSeconds(data.duration):'--'}</span>`
}
// formatter: data => {
// let strHtml = this.toMinutesAndSeconds(data.duration).h
// ? `<span style="font-weight:700;font-size:20px">${this.toMinutesAndSeconds(data.duration).h}</span>小时
// <span style="font-weight:700;font-size:20px;">${this.toMinutesAndSeconds(data.duration).m}</span>分钟
// `
// : ` <span style="font-weight:700;font-size:20px;">${this.toMinutesAndSeconds(data.duration).m}</span>分钟`
// return strHtml
// }
}
],
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',
addHtml:'suggestions'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
firstClassifyList: [],
secondClassifyList: []
}
}
},
watch: {
'searchForm.hitResult'() {
this.$refs.analyseTable.refreshTable(true, true)
}
},
mounted() {
// this.getPointCategory()
},
methods: {
formatSrt(str) {
return str.replace(/\n/g, "<br/>")
},
toMinutesAndSeconds(seconds) {
seconds = Math.floor(seconds / 1000)
let formattedTime = ''
if (seconds < 60) return seconds + '秒'
else if (seconds > 3600) {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60)
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
return formattedTime
} else {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
remainingSeconds = seconds % 60
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
if (remainingSeconds > 0) formattedTime += remainingSeconds + '秒'
return formattedTime
}
},
// toMinutesAndSeconds(time) {
// time = time / 1000
// const h = Math.floor(time / 3600)
// const m = parseInt((time % 3600) / 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;
margin-bottom: 20px;
.s-item {
flex: 1;
// min-width: 248px;
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;
line-height: 32px;
}
.greenStr {
color: #2cca74;
}
.redStr {
color: #eb4e4e;
}
.grayStr {
color: #999999;
}
}
}
.show-search{
margin-bottom:-68px;
}
.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;
}
}
</style>
<style>
.redStr {
color: #eb4e4e;
}
.greenStr {
color: #2cca74;
}
.grayStr{
color: #999999;
}
</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" @close="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>
.el-tabs{
margin-top:-10px;
}
</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>
<template v-if="queryData.storeList">
<el-tooltip effect="dark" :content="queryData.storeList.join('、')" placement="top-start">
<span>{{ queryData.storeList.join('、') }}</span>
</el-tooltip>
</template>
<span v-else>-</span>
</div>
<div class="info-item flex">
<label>服务商:</label>
<template v-if="queryData.serviceList">
<el-tooltip effect="dark" :content="queryData.serviceList.join('、')" placement="top-start">
<span>{{ queryData.serviceList.join('、') }}</span>
</el-tooltip>
</template>
<span v-else>-</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" :hasNum="false" :search-form="searchFormSearch" :table-params="tableParams" :before-search-fn="beforeSearchFn" @setTableFinishFun="setTableFinishFun" :pageConf="pageConf">
<div slot="durationHtml" slot-scope="scope">
<template v-if="scope.scope.duration">
{{ toMinutesAndSeconds(scope.scope.duration) }}
</template>
<template v-else>--</template>
</div>
<div slot="scoreHtml" slot-scope="scope">
<template v-if="scope.scope.score || scope.scope.score === 0">
{{ scope.scope.score }}
</template>
<template v-else>--</template>
</div>
<div slot="estimatedResult" slot-scope="scope" :class="['tag', scope.scope.estimatedResult == '成交' ? (scope.scope.estimatedResult == '战败' ? 'redBg' : 'greenBg') : 'grayBg']">
{{ scope.scope.estimatedResult }}
</div>
<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: 'afterRangePickerOptions'
},
{
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: 'key'
},
{
label: '开始接待时间',
prop: 'startTime'
},
{
label: '结束接待时间',
prop: 'endTime'
},
{
label: '录音时长',
prop: 'duration',
addHtml: 'durationHtml'
},
{
label: '预计营销结果',
prop: 'estimatedResult',
addHtml: 'estimatedResult'
},
{
label: '话术质检评分/分',
prop: 'score',
addHtml: 'scoreHtml'
}
]
},
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: {
toMinutesAndSeconds(seconds) {
seconds = Math.floor(seconds / 1000)
let formattedTime = ''
if (seconds < 60) {
return seconds + '秒'
} else if (seconds > 3600) {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60)
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
return formattedTime
} else {
let hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
remainingSeconds = seconds % 60
if (hours > 0) formattedTime += hours + '小时'
if (minutes > 0 || hours > 0) formattedTime += minutes + '分'
if (remainingSeconds > 0) formattedTime += remainingSeconds + '秒'
return formattedTime
}
},
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) {
console.log(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.estimatedResultId) {
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()
})
},
setTableFinishFun(data) {
for (let i = 0; i < data.length; i++) {
data[i].key = i + 1
}
},
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;
cursor: pointer;
max-width: 500px;
overflow: hidden;
/* 防止文本换行 */
white-space: nowrap;
/* 使用省略号表示被截断的文本 */
text-overflow: ellipsis;
}
}
}
}
.show-search{
margin-bottom:-52px;
}
.content {
background: #ffffff;
padding: 20px;
box-sizing: border-box;
margin-top: 16px;
width: 100%;
height: auto;
}
.tag {
padding: 0 8px;
height: 24px;
background: #e9f9f1;
border-radius: 2px;
font-size: 14px;
color: #2cca74;
line-height: 24px;
display: inline-block;
}
.greenbg {
background: #e9f9f1;
color: #2cca74;
}
.redBg {
background: #fdeded;
color: #eb4e4e;
}
.grayBg {
background: #f2f2f2;
color: #999999;
}
}
</style>
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!