Commit f4c06e68 by 李伟康

```

refactor(api): 调整earlyWarningManager函数参数格式

调整了earlyWarningManager.js中所有函数的参数格式,
统一在函数名和参数之间添加空格,保持代码风格一致性。

fix(style): 修改tooltip样式限制最大宽度

修改public.scss中el-tooltip__popper样式,将固定width改为max-width,
并添加fit-content属性,防止内容过长时出现溢出问题。

feat(componets): 增强textBox编辑器功能

向textBox.vue组件中添加set方法导入,增加focus配置选项,
并在setEdit方法中添加html参数验证,提升编辑器稳定性。
```
1 parent 8dfc7750
...@@ -334,10 +334,11 @@ $prefix: d2; ...@@ -334,10 +334,11 @@ $prefix: d2;
height: 95px !important; height: 95px !important;
} }
.el-tooltip__popper.is-light { .el-tooltip__popper.is-light {
width: 177px; max-width: 400px;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08) !important; box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08) !important;
border: 1px solid #e4e7ed !important; border: 1px solid #e4e7ed !important;
color: #666; color: #666;
width: fit-content;
} }
.el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow { .el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow {
......
<template> <template>
<div> <div>
<div id="div-demo"></div> <div id="div-demo"></div>
</div> </div>
</template> </template>
<script> <script>
import { uploadImg, syncUploadVideo, uploadVideo } from "@/api/sys.base" import { uploadImg, syncUploadVideo, uploadVideo } from "@/api/sys.base"
import E from "wangeditor" import { set } from "nprogress";
export default { import E from "wangeditor"
name: "TextBox", export default {
data() { name: "TextBox",
return { data () {
editor: "", return {
content: "", editor: "",
editorOption: {} content: "",
} editorOption: {}
}, }
props: { },
excludeMenus: { props: {
type: Array, excludeMenus: {
default: () => ["code"] type: Array,
}, default: () => ["code"]
boxHeight: { },
type: Number, boxHeight: {
default: 240 type: Number,
} default: 240
}, }
mounted() { },
this.getEdit() mounted () {
}, this.getEdit()
methods: { },
getEdit() { methods: {
const _this = this getEdit () {
this.editor = new E("#div-demo") const _this = this
this.editor.config.uploadImgShowBase64 = true this.editor = new E("#div-demo")
this.editor.config.showMenuTooltips = true this.editor.config.uploadImgShowBase64 = true
this.editor.config.menuTooltipPosition = "down" this.editor.config.showMenuTooltips = true
this.editor.config.height = this.boxHeight this.editor.config.menuTooltipPosition = "down"
this.editor.config.width = "500px" this.editor.config.height = this.boxHeight
this.editor.config.excludeMenus = this.excludeMenus this.editor.config.width = "500px"
this.editor.config.onchange = (html) => { this.editor.config.excludeMenus = this.excludeMenus
// console.log(html); this.editor.config.onchange = (html) => {
this.content = html // 绑定当前逐渐地值 // console.log(html);
this.$emit("change", this.content) // 将内容同步到父组件中 this.content = html // 绑定当前逐渐地值
} this.$emit("change", this.content) // 将内容同步到父组件中
this.editor.config.onfocus = () => { }
this.$emit("focus") this.editor.config.onfocus = () => {
} this.$emit("focus")
// 上传图片 }
this.editor.config.customUploadImg = function (resultFiles, insertImgFn) { // 上传图片
var file = resultFiles[0] this.editor.config.customUploadImg = function (resultFiles, insertImgFn) {
var reader = new FileReader() var file = resultFiles[0]
// 默认1MB var reader = new FileReader()
const limitSize = 10 // 默认1MB
const isLt = file.size / 1024 / 1024 < limitSize const limitSize = 10
if (!isLt) { const isLt = file.size / 1024 / 1024 < limitSize
_this.$message.error("上传图片大小不能超过" + limitSize + "MB!") if (!isLt) {
return true _this.$message.error("上传图片大小不能超过" + limitSize + "MB!")
} return true
reader.readAsDataURL(file) }
reader.onload = (e) => { reader.readAsDataURL(file)
const imgFile = e.target.result reader.onload = (e) => {
const base64 = const imgFile = e.target.result
file.name.split(".")[file.name.split(".").length - 1] + const base64 =
"@" + file.name.split(".")[file.name.split(".").length - 1] +
imgFile.split(",")[1] "@" +
// _this.$apis.common.pictureUpload({ file: base64 }).then(res => { imgFile.split(",")[1]
uploadImg({ file: base64, compress: 0 }).then((res) => { // _this.$apis.common.pictureUpload({ file: base64 }).then(res => {
if (res) { uploadImg({ file: base64, compress: 0 }).then((res) => {
// console.log(res) if (res) {
insertImgFn(res) // console.log(res)
} insertImgFn(res)
}) }
// resultFiles 是 input 中选中的文件列表 })
// insertImgFn 是获取图片 url 后,插入到编辑器的方法 // resultFiles 是 input 中选中的文件列表
// 上传图片,返回结果,将图片插入到编辑器中 // insertImgFn 是获取图片 url 后,插入到编辑器的方法
} // 上传图片,返回结果,将图片插入到编辑器中
} }
// 上传视频 }
this.editor.config.customUploadVideo = function ( // 上传视频
resultFiles, this.editor.config.customUploadVideo = function (
insertVideoFn resultFiles,
) { insertVideoFn
var file = resultFiles[0] ) {
var reader = new FileReader() var file = resultFiles[0]
// 默认1MB var reader = new FileReader()
const limitSize = 10 // 默认1MB
const isLt = file.size / 1024 / 1024 < limitSize const limitSize = 10
if (!isLt) { const isLt = file.size / 1024 / 1024 < limitSize
_this.$message.error("上传视频大小不能超过" + limitSize + "MB!") if (!isLt) {
return true _this.$message.error("上传视频大小不能超过" + limitSize + "MB!")
} return true
reader.readAsDataURL(file) }
reader.onload = (e) => { reader.readAsDataURL(file)
const videoFile = e.target.result reader.onload = (e) => {
const base64 = const videoFile = e.target.result
file.name.split(".")[file.name.split(".").length - 1] + const base64 =
"@" + file.name.split(".")[file.name.split(".").length - 1] +
videoFile.split(",")[1] "@" +
_this.$apis.common.pictureUpload({ file: base64 }).then((res) => { videoFile.split(",")[1]
if (res) { _this.$apis.common.pictureUpload({ file: base64 }).then((res) => {
// console.log(res) if (res) {
insertVideoFn(res) // console.log(res)
} insertVideoFn(res)
}) }
// resultFiles 是 input 中选中的文件列表 })
// insertImgFn 是获取图片 url 后,插入到编辑器的方法 // resultFiles 是 input 中选中的文件列表
// 上传图片,返回结果,将图片插入到编辑器中 // insertImgFn 是获取图片 url 后,插入到编辑器的方法
} // 上传图片,返回结果,将图片插入到编辑器中
} }
this.editor.config.onchangeTimeout = 5000 }
this.editor.create() this.editor.config.onchangeTimeout = 5000
},
setEdit(html) { this.editor.config.focus = false // 解决编辑器内输入框获取焦点
this.$nextTick(() => {
this.editor.txt.html(html) this.editor.create()
}) },
}, setEdit (html) {
forbidEdit() { if (html) this.$nextTick(() => {
// this.editor.$textElem.attr('contenteditable', false) this.editor.txt.html(html)
this.editor.disable() })
} },
} forbidEdit () {
} // this.editor.$textElem.attr('contenteditable', false)
</script> this.editor.disable()
}
<style lang="scss" scoped> }
#div-demo { }
width: 575px; </script>
// margin: 16px 300px 0 0;
} <style lang="scss" scoped>
.el-form .editor { #div-demo {
margin-top: 20px; width: 575px;
} // margin: 16px 300px 0 0;
.myQuillEditor { }
background-color: #fff; .el-form .editor {
height: 200px; margin-top: 20px;
} }
</style> .myQuillEditor {
<style> background-color: #fff;
.w-e-text-container { height: 200px;
z-index: 1 !important; }
} </style>
.w-e-toolbar { <style>
z-index: 2 !important; .w-e-text-container {
} z-index: 1 !important;
</style> }
.w-e-toolbar {
z-index: 2 !important;
}
</style>
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
@handleClick="submit" @handleClick="submit"
:config="config" :config="config"
> >
<div class="content"> <div
class="content"
:key="viewKey"
>
<div class="left"> <div class="left">
<div class="title flex">录音列表</div> <div class="title flex">录音列表</div>
<div class="left-content"> <div class="left-content">
...@@ -38,7 +41,7 @@ ...@@ -38,7 +41,7 @@
</div> </div>
<div class="table"> <div class="table">
<d2-table <d2-table
ref="multipleStaffTable" ref="multipleTable"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
...@@ -55,7 +58,7 @@ ...@@ -55,7 +58,7 @@
</div> </div>
<div class="right"> <div class="right">
<div class="title flex"> <div class="title flex">
已选录音<div class="num">{{ chooseList.length }}</div>条 已选录音<div class="num">{{ count }}</div>条
<el-button <el-button
class="clear" class="clear"
type="text" type="text"
...@@ -69,7 +72,7 @@ ...@@ -69,7 +72,7 @@
<el-tag <el-tag
closable closable
:key="ind" :key="ind"
@close="removeStaff(i,index)" @close="remove(i,ind)"
disable-transitions disable-transitions
>{{ i.id }}</el-tag> >{{ i.id }}</el-tag>
</template> </template>
...@@ -82,44 +85,13 @@ ...@@ -82,44 +85,13 @@
</template> </template>
<script> <script>
import { getUsedCarPaymentList } from "@api/usedCarManagement" import {
getRecordPageListByCondition,
} from '@/api/earlyWarningManager'
import multipleMinxin from "./multipleMinxin";
export default { export default {
name: "ChangeMerchantDialog", name: "MultipleRecording",
props: { mixins: [multipleMinxin],
visible: {
type: Boolean,
default: false
},
chooseData: {
type: Object,
default: () => {}
}
},
inject: ['deepClone'],
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.close()
}
},
},
watch: {
visible: {
handler (val) {
if (val) {
this.pageChooseList = this.chooseData
this.handleReset()
}
},
immediate: true,
deep: true
},
},
mounted () { mounted () {
}, },
data () { data () {
...@@ -130,15 +102,9 @@ export default { ...@@ -130,15 +102,9 @@ export default {
width: "1092px" width: "1092px"
} }
}, },
config: { targetId: 'id',
appendToBody: true, getListApi: getRecordPageListByCondition,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "确定",
},
getListApi: getUsedCarPaymentList,
searchForm: {}, searchForm: {},
searchFormSearch: {},
tableParams: { tableParams: {
listName: "list", listName: "list",
mutiSelectUniqueKey: "id", mutiSelectUniqueKey: "id",
...@@ -146,118 +112,44 @@ export default { ...@@ -146,118 +112,44 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: "员工姓名", label: "员工姓名",
prop: "licensePlate", prop: "employeeName",
minWidth: 90 minWidth: 90
}, },
{ {
label: "接待时间", label: "接待时间",
prop: "vin", prop: "receptionStartTime",
minWidth: 90 minWidth: 90
}, },
{ {
label: "客户姓名", label: "客户姓名",
prop: "licensePlate", prop: "customerName",
minWidth: 90 minWidth: 90
}, },
{ {
label: "车型", label: "车型",
prop: "licensePlate", prop: "carBrand",
minWidth: 90 minWidth: 90
}, },
{ {
label: "接待时长", label: "接待时长",
prop: "licensePlate", prop: "duration",
minWidth: 90 minWidth: 90
}, },
{ {
label: "质检评分/分", label: "质检评分/分",
prop: "licensePlate", prop: "score",
minWidth: 90 minWidth: 90
}, },
{ {
label: "攻防得分/分", label: "攻防得分/分",
prop: "licensePlate", prop: "defencePoint",
minWidth: 90 minWidth: 90
}, },
] ]
}, },
pageChooseList: {},
chooseList: [],
delList: []
} }
}, },
methods: { methods: {
getParams () {
const params = this.deepClone(this.searchForm)
return params
},
beforeSearchFn () {
return new Promise((resolve) => {
this.searchFormSearch = this.getParams()
resolve()
})
},
close () {
this.$emit('dialogClose')
},
removeStaff (i, index) {
this.delList.push(i)
this.chooseList.splice(index, 1)
this.multipleStaffTable().tableRef.toggleRowSelection(i, false)
},
async submit () {
this.$emit('choose', this.pageChooseList)
this.close()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.multipleStaffTable().page.currentPage = 1
this.handleSearch()
},
handleSearch () {
this.multipleStaffTable().refreshTable()
},
setTableFinishFun (data, listIndex) {
this.$nextTick(() => {
let { pageChooseList, delList } = this
pageChooseList[listIndex] && pageChooseList[listIndex].map(item => {
let index = data.findIndex(i => i.id === item.id)
if (index > -1) this.multipleStaffTable().tableRef.toggleRowSelection(data[index], true)
})
if (delList.length) {
data.map(item => {
let index = delList.findIndex(i => i.id === item.id)
if (index > -1) {
this.multipleStaffTable().tableRef.toggleRowSelection(item, false)
delList.splice(index, 1)
}
})
}
})
},
selectionTable (list, listIndex) {
this.$nextTick(() => {
this.pageChooseList[listIndex] = list
let { pageChooseList } = this,
chooseList = []
Object.keys(pageChooseList).map(key => {
if (pageChooseList[key]) {
pageChooseList[key].map(item => {
chooseList.push(item)
})
}
})
this.chooseList = chooseList
})
},
multipleStaffTable () {
return this.$refs.multipleStaffTable
},
clearChooseList(){
this.delList = this.chooseList
this.pageChooseList = {}
this.multipleStaffTable().clearMutiSelect()
}
} }
} }
</script> </script>
...@@ -267,8 +159,11 @@ export default { ...@@ -267,8 +159,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.detail-content { ::v-deep.el-dialog__wrapper {
::v-deep .el-dialog { overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
...@@ -284,6 +179,8 @@ export default { ...@@ -284,6 +179,8 @@ export default {
padding: 0; padding: 0;
} }
} }
}
.detail-content {
.content { .content {
display: flex; display: flex;
height: 588px; height: 588px;
...@@ -296,6 +193,8 @@ export default { ...@@ -296,6 +193,8 @@ export default {
height: 100%; height: 100%;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
box-sizing: border-box; box-sizing: border-box;
border-radius: 2px;
overflow: hidden;
.title { .title {
font-weight: 700; font-weight: 700;
color: #333333; color: #333333;
...@@ -335,6 +234,7 @@ export default { ...@@ -335,6 +234,7 @@ export default {
margin-top: auto; margin-top: auto;
} }
.el-table { .el-table {
margin: 0 !important;
border-left: none; border-left: none;
overflow-y: auto; overflow-y: auto;
&::before, &::before,
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
@handleClick="submit" @handleClick="submit"
:config="config" :config="config"
> >
<div class="content"> <div
class="content"
:key="viewKey"
>
<div class="left"> <div class="left">
<div class="title flex">人员列表</div> <div class="title flex">人员列表</div>
<div class="left-content"> <div class="left-content">
...@@ -30,7 +33,7 @@ ...@@ -30,7 +33,7 @@
</div> </div>
<div class="table"> <div class="table">
<d2-table <d2-table
ref="multipleStaffTable" ref="multipleTable"
:search-form="searchFormSearch" :search-form="searchFormSearch"
:table-params="tableParams" :table-params="tableParams"
:get-list-api="getListApi" :get-list-api="getListApi"
...@@ -47,11 +50,11 @@ ...@@ -47,11 +50,11 @@
</div> </div>
<div class="right"> <div class="right">
<div class="title flex"> <div class="title flex">
已选人员<div class="num">{{ chooseList.length }}</div>人 已选人员<div class="num">{{ count }}</div>人
<el-button <el-button
class="clear" class="clear"
type="text" type="text"
@click="chooseList = []" @click="clearChooseList"
>清空</el-button> >清空</el-button>
</div> </div>
<div class="right-content"> <div class="right-content">
...@@ -61,8 +64,9 @@ ...@@ -61,8 +64,9 @@
<el-tag <el-tag
closable closable
:key="ind" :key="ind"
@close="removeStaff(ind)" @close="remove(i,ind)"
>{{ i.userName }}</el-tag> disable-transitions
>{{ i.id }}</el-tag>
</template> </template>
</div> </div>
</el-scrollbar> </el-scrollbar>
...@@ -73,42 +77,15 @@ ...@@ -73,42 +77,15 @@
</template> </template>
<script> <script>
import { getUsedCarPaymentList } from "@api/usedCarManagement" import {
getStrategyStaffList,
} from "@api/earlyWarningManager"
import multipleMinxin from "./multipleMinxin";
export default { export default {
name: "ChangeMerchantDialog", name: "MultipleStaff",
props: { mixins: [multipleMinxin],
visible: {
type: Boolean,
default: false
},
chooseData: {
type: Object,
default: () => { }
}
},
inject: ['deepClone'],
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.close()
}
},
},
watch: {
visible: {
handler (val) {
if (val) {
this.chooseList = this.chooseData
}
},
immediate: true,
deep: true
}
},
mounted () { mounted () {
}, },
data () { data () {
...@@ -119,15 +96,9 @@ export default { ...@@ -119,15 +96,9 @@ export default {
width: "1092px" width: "1092px"
} }
}, },
config: { targetId: 'id',
appendToBody: true, getListApi: getStrategyStaffList,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "确定",
},
getListApi: getUsedCarPaymentList,
searchForm: {}, searchForm: {},
searchFormSearch: {},
tableParams: { tableParams: {
listName: "list", listName: "list",
mutiSelectUniqueKey: "id", mutiSelectUniqueKey: "id",
...@@ -150,39 +121,10 @@ export default { ...@@ -150,39 +121,10 @@ export default {
}, },
] ]
}, },
pageChooseList: {},
chooseList: [],
delList: []
} }
}, },
methods: { methods: {
getParams () {
const params = this.deepClone(this.searchForm)
return params
},
beforeSearchFn () {
return new Promise((resolve) => {
this.searchFormSearch = this.getParams()
resolve()
})
},
close () {
this.$emit('dialogClose')
},
removeStaff (index) {
this.chooseList.splice(index, 1)
},
async submit () {
this.$emit('choose', this.chooseList)
this.close()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
handleSearch () {
this.$refs.multipleStaffTable.refreshTable(true)
},
} }
} }
</script> </script>
...@@ -192,8 +134,11 @@ export default { ...@@ -192,8 +134,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.detail-content { ::v-deep.el-dialog__wrapper {
::v-deep .el-dialog { overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body { .el-dialog__body {
padding: 0; padding: 0;
// padding-bottom: 24px; // padding-bottom: 24px;
...@@ -209,6 +154,8 @@ export default { ...@@ -209,6 +154,8 @@ export default {
padding: 0; padding: 0;
} }
} }
}
.detail-content {
.content { .content {
display: flex; display: flex;
height: 588px; height: 588px;
...@@ -222,6 +169,8 @@ export default { ...@@ -222,6 +169,8 @@ export default {
height: 100%; height: 100%;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
box-sizing: border-box; box-sizing: border-box;
border-radius: 2px;
overflow: hidden;
.title { .title {
font-weight: 700; font-weight: 700;
color: #333333; color: #333333;
...@@ -260,6 +209,7 @@ export default { ...@@ -260,6 +209,7 @@ export default {
margin-top: auto; margin-top: auto;
} }
.el-table { .el-table {
margin: 0 !important;
border-left: none; border-left: none;
overflow-y: auto; overflow-y: auto;
&::before, &::before,
......
...@@ -14,10 +14,8 @@ const STRATEGY_FORM_0 = [ ...@@ -14,10 +14,8 @@ const STRATEGY_FORM_0 = [
label: '标题', label: '标题',
type: 'input', type: 'input',
key: 'title', key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20, maxLength: 20,
key: 'title' key: 'title',
}, },
{ {
label: '学习人员', label: '学习人员',
...@@ -25,7 +23,6 @@ const STRATEGY_FORM_0 = [ ...@@ -25,7 +23,6 @@ const STRATEGY_FORM_0 = [
btnText: '选择人员', btnText: '选择人员',
componentName: 'staffTag', componentName: 'staffTag',
key: 'staffList', key: 'staffList',
required: true,
}, },
{ {
label: '学习内容', label: '学习内容',
...@@ -33,22 +30,19 @@ const STRATEGY_FORM_0 = [ ...@@ -33,22 +30,19 @@ const STRATEGY_FORM_0 = [
btnText: '选择课程', btnText: '选择课程',
componentName: 'courseTag', componentName: 'courseTag',
key: 'courseList', key: 'courseList',
required: true, tagKey: 'courseId',
tagNameKey: 'title'
}, },
{ {
label: '执行周期', label: '执行周期',
type: 'daterange', type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange', key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions' pickerOptions: 'afterPickerOptions'
}, },
{ {
label: '策略说明', label: '策略说明',
type: 'textarea', type: 'textarea',
key: 'description', key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200 maxLength: 200
} }
] ]
...@@ -57,8 +51,6 @@ const STRATEGY_FORM_1 = [ ...@@ -57,8 +51,6 @@ const STRATEGY_FORM_1 = [
label: '标题', label: '标题',
type: 'input', type: 'input',
key: 'title', key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20, maxLength: 20,
key: 'title' key: 'title'
}, },
...@@ -68,7 +60,6 @@ const STRATEGY_FORM_1 = [ ...@@ -68,7 +60,6 @@ const STRATEGY_FORM_1 = [
btnText: '选择人员', btnText: '选择人员',
componentName: 'staffTag', componentName: 'staffTag',
key: 'staffList', key: 'staffList',
required: true,
}, },
{ {
...@@ -77,7 +68,6 @@ const STRATEGY_FORM_1 = [ ...@@ -77,7 +68,6 @@ const STRATEGY_FORM_1 = [
btnText: '选择录音', btnText: '选择录音',
componentName: 'recordingTag', componentName: 'recordingTag',
key: 'recordingList', key: 'recordingList',
required: true,
tagKey: 'id', tagKey: 'id',
tagNameKey: 'name' tagNameKey: 'name'
...@@ -85,29 +75,23 @@ const STRATEGY_FORM_1 = [ ...@@ -85,29 +75,23 @@ const STRATEGY_FORM_1 = [
{ {
label: '执行周期', label: '执行周期',
type: 'daterange', type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange', key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions' pickerOptions: 'afterPickerOptions'
}, },
{ {
label: '策略说明', label: '策略说明',
type: 'textarea', type: 'textarea',
key: 'description', key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200 maxLength: 200
} }
] ]
const STRATEGY_FORM_2456 = [ const STRATEGY_FORM_2456 = [
{ {
label: '执行人员:', label: '执行人员',
type: 'multipleTag', type: 'multipleTag',
btnText: '选择人员', btnText: '选择人员',
componentName: 'staffTag', componentName: 'staffTag',
key: 'staffList', key: 'staffList',
required: true,
hideKey: 'strategyInfo',
hide: (val) => { hide: (val) => {
let { strategyType } = val let { strategyType } = val
return [5, 6].includes(strategyType) return [5, 6].includes(strategyType)
...@@ -116,17 +100,13 @@ const STRATEGY_FORM_2456 = [ ...@@ -116,17 +100,13 @@ const STRATEGY_FORM_2456 = [
{ {
label: '执行周期', label: '执行周期',
type: 'daterange', type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange', key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions' pickerOptions: 'afterPickerOptions'
}, },
{ {
label: '策略说明', label: '策略说明',
type: 'textarea', type: 'textarea',
key: 'description', key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200 maxLength: 200
} }
] ]
...@@ -135,8 +115,6 @@ const STRATEGY_FORM_3 = [ ...@@ -135,8 +115,6 @@ const STRATEGY_FORM_3 = [
label: '标题', label: '标题',
type: 'input', type: 'input',
key: 'title', key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20, maxLength: 20,
key: 'title' key: 'title'
}, },
...@@ -144,8 +122,6 @@ const STRATEGY_FORM_3 = [ ...@@ -144,8 +122,6 @@ const STRATEGY_FORM_3 = [
label: '副标题', label: '副标题',
type: 'input', type: 'input',
key: 'title', key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 200, maxLength: 200,
key: 'subTitle' key: 'subTitle'
}, },
...@@ -153,15 +129,11 @@ const STRATEGY_FORM_3 = [ ...@@ -153,15 +129,11 @@ const STRATEGY_FORM_3 = [
label: '内容', label: '内容',
type: 'richText', type: 'richText',
key: 'content', key: 'content',
parentKey: 'strategyInfo',
required: true,
}, },
{ {
label: '处理人', label: '处理人',
type: 'checkbox', type: 'checkbox',
key: 'handlerType', key: 'handlerType',
parentKey: 'strategyInfo',
required: true,
options: [ options: [
{ label: '区域运营', value: 0 }, { label: '区域运营', value: 0 },
{ label: '驻店人员', value: 1 }, { label: '驻店人员', value: 1 },
...@@ -173,8 +145,6 @@ const STRATEGY_FORM_3 = [ ...@@ -173,8 +145,6 @@ const STRATEGY_FORM_3 = [
btnText: '选择人员', btnText: '选择人员',
componentName: 'staffTag', componentName: 'staffTag',
key: 'staffList', key: 'staffList',
required: true,
hideKey: 'strategyInfo',
hide: (val) => { hide: (val) => {
let { handlerType } = val let { handlerType } = val
return !handlerType.includes(0) return !handlerType.includes(0)
...@@ -184,10 +154,8 @@ const STRATEGY_FORM_3 = [ ...@@ -184,10 +154,8 @@ const STRATEGY_FORM_3 = [
label: '驻店人员', label: '驻店人员',
type: 'multipleTag', type: 'multipleTag',
btnText: '选择人员', btnText: '选择人员',
componentName: 'staffTag', componentName: 'staffTag1',
key: 'staffList', key: 'staffList_1',
required: true,
hideKey: 'strategyInfo',
hide: (val) => { hide: (val) => {
let { handlerType } = val let { handlerType } = val
return !handlerType.includes(1) return !handlerType.includes(1)
...@@ -196,9 +164,7 @@ const STRATEGY_FORM_3 = [ ...@@ -196,9 +164,7 @@ const STRATEGY_FORM_3 = [
{ {
label: '执行时间', label: '执行时间',
type: 'radioTime', type: 'radioTime',
parentKey: 'strategyInfo',
key: 'pushType', key: 'pushType',
required: true,
pickerOptions: 'afterPickerOptions', pickerOptions: 'afterPickerOptions',
timeKey: 'pushTime', timeKey: 'pushTime',
options: [ options: [
...@@ -215,8 +181,6 @@ const STRATEGY_FORM_3 = [ ...@@ -215,8 +181,6 @@ const STRATEGY_FORM_3 = [
label: '策略说明', label: '策略说明',
type: 'textarea', type: 'textarea',
key: 'description', key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200 maxLength: 200
} }
] ]
...@@ -245,13 +209,51 @@ const STRATEGY_0 = { ...@@ -245,13 +209,51 @@ const STRATEGY_0 = {
} }
] ]
} }
const TITLE_RULES = [{ required: true, message: '请输入标题', trigger: 'blur' }]
const STAFF_LIST_RULES = { required: true, message: '请选择学习人员' }
const STUDY_LIST_RULES = { required: true, message: '请选择学习内容' }
const RANGE_DATE = [{ required: true, message: '请选择执行周期', trigger: 'blur' }]
const DESCRIPTION_RULES = [{ required: true, message: '请输入策略说明', trigger: 'blur' }]
const STRATEGY_FORM_RULES_0 = {
title: TITLE_RULES,
staffList: STAFF_LIST_RULES,
courseList: STUDY_LIST_RULES,
dateRange: RANGE_DATE,
description: DESCRIPTION_RULES
}
const STRATEGY_FORM_RULES_1 = {
title: TITLE_RULES,
staffList: STAFF_LIST_RULES,
recordingList: STUDY_LIST_RULES,
dateRange: RANGE_DATE,
description: DESCRIPTION_RULES
}
const STRATEGY_FORM_RULES_2456 = {
dateRange: RANGE_DATE,
description: DESCRIPTION_RULES
}
const STRATEGY_FORM_RULES_3 = {
title: TITLE_RULES,
subTitle: [{ required: true, message: '请输入副标题', trigger: 'blur' }],
content: [
{ required: true, message: '请输入内容', trigger: 'blur' }
],
handlerType: [
{ required: true, message: '请选择处理人', trigger: 'change' }
],
staffList: [{ required: true, message: '请选择区域运营' }],
staffList_1: [{ required: true, message: '请选择驻店人员' }],
description: DESCRIPTION_RULES
}
export { export {
STRATEGYTYPEOPTIONS, STRATEGYTYPEOPTIONS,
STRATEGY_FORM_0, STRATEGY_FORM_0,
STRATEGY_FORM_1, STRATEGY_FORM_1,
STRATEGY_FORM_2456, STRATEGY_FORM_2456,
STRATEGY_FORM_3, STRATEGY_FORM_3,
STRATEGY_0 STRATEGY_0,
STRATEGY_FORM_RULES_0,
STRATEGY_FORM_RULES_1,
STRATEGY_FORM_RULES_2456,
STRATEGY_FORM_RULES_3
} }
\ No newline at end of file \ No newline at end of file
export default {
props: {
visible: {
type: Boolean,
default: false
},
chooseData: {
type: Object,
default: () => { }
}
},
inject: ['deepClone'],
computed: {
dialogShow: {
get () {
return this.visible
},
set (val) {
this.pageChooseList = {}
this.delList = []
this.chooseList = []
this.close()
}
},
count () {
return this.chooseList.length
}
},
watch: {
visible: {
handler (val) {
if (val) {
this.chooseList = []
this.delList = []
this.searchForm = this.$options.data.call(this).searchForm
let multipleTable = this.multipleTable()
if (multipleTable) multipleTable.page.currentPage = 1
this.pageChooseList = this.deepClone(this.chooseData)
this.viewKey = Date.now()
// if (Object.keys(this.chooseData).length) this.$nextTick(() => this.handleReset())
}
},
immediate: true,
deep: true
},
},
mounted () {
},
data () {
return {
viewKey: Date.now(),
config: {
appendToBody: true,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "确定",
},
searchFormSearch: {},
pageChooseList: {},
chooseList: [],
delList: []
}
},
methods: {
getParams () {
const params = this.deepClone(this.searchForm)
return params
},
beforeSearchFn () {
return new Promise((resolve) => {
this.searchFormSearch = this.getParams()
resolve()
})
},
close () {
this.$emit('dialogClose')
},
remove (i, index) {
this.delList.push(i)
this.chooseList.splice(index, 1)
this.multipleTable().tableRef.toggleRowSelection(i, false)
},
async submit () {
this.$emit('choose', this.pageChooseList)
this.close()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.multipleTable().page.currentPage = 1
this.handleSearch()
},
handleSearch () {
this.multipleTable().refreshTable()
},
setTableFinishFun (data, listIndex) {
this.$nextTick(() => {
let { pageChooseList, delList, targetId } = this
pageChooseList[listIndex] && pageChooseList[listIndex].map(item => {
let index = data.findIndex(i => i[targetId] === item[targetId])
if (index > -1) this.multipleTable().tableRef.toggleRowSelection(data[index], true)
})
if (delList.length) {
data.map(item => {
let index = delList.findIndex(i => i[targetId] === item[targetId])
if (index > -1) {
this.multipleTable().tableRef.toggleRowSelection(item, false)
delList.splice(index, 1)
}
})
}
})
},
selectionTable (list, listIndex) {
this.$nextTick(() => {
this.pageChooseList[listIndex] = list
let { pageChooseList } = this,
chooseList = []
Object.keys(pageChooseList).map(key => {
if (pageChooseList[key]) {
pageChooseList[key].map(item => {
chooseList.push(item)
})
}
})
this.chooseList = chooseList
})
},
multipleTable () {
return this.$refs.multipleTable
},
clearChooseList () {
this.delList = this.chooseList
this.pageChooseList = {}
this.multipleTable().clearMutiSelect()
}
}
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!