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;
height: 95px !important;
}
.el-tooltip__popper.is-light {
width: 177px;
max-width: 400px;
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08) !important;
border: 1px solid #e4e7ed !important;
color: #666;
width: fit-content;
}
.el-tooltip__popper.is-light[x-placement^="top"] .popper__arrow {
......
<template>
<div>
<div id="div-demo"></div>
</div>
</template>
<script>
import { uploadImg, syncUploadVideo, uploadVideo } from "@/api/sys.base"
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 = "500px"
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 => {
uploadImg({ file: base64, compress: 0 }).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 {
width: 575px;
// 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>
<div id="div-demo"></div>
</div>
</template>
<script>
import { uploadImg, syncUploadVideo, uploadVideo } from "@/api/sys.base"
import { set } from "nprogress";
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 = "500px"
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 => {
uploadImg({ file: base64, compress: 0 }).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.config.focus = false // 解决编辑器内输入框获取焦点
this.editor.create()
},
setEdit (html) {
if (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 {
width: 575px;
// 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>
......@@ -6,7 +6,10 @@
@handleClick="submit"
:config="config"
>
<div class="content">
<div
class="content"
:key="viewKey"
>
<div class="left">
<div class="title flex">录音列表</div>
<div class="left-content">
......@@ -38,7 +41,7 @@
</div>
<div class="table">
<d2-table
ref="multipleStaffTable"
ref="multipleTable"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
......@@ -55,7 +58,7 @@
</div>
<div class="right">
<div class="title flex">
已选录音<div class="num">{{ chooseList.length }}</div>条
已选录音<div class="num">{{ count }}</div>条
<el-button
class="clear"
type="text"
......@@ -69,7 +72,7 @@
<el-tag
closable
:key="ind"
@close="removeStaff(i,index)"
@close="remove(i,ind)"
disable-transitions
>{{ i.id }}</el-tag>
</template>
......@@ -82,44 +85,13 @@
</template>
<script>
import { getUsedCarPaymentList } from "@api/usedCarManagement"
import {
getRecordPageListByCondition,
} from '@/api/earlyWarningManager'
import multipleMinxin from "./multipleMinxin";
export default {
name: "ChangeMerchantDialog",
props: {
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
},
},
name: "MultipleRecording",
mixins: [multipleMinxin],
mounted () {
},
data () {
......@@ -130,15 +102,9 @@ export default {
width: "1092px"
}
},
config: {
appendToBody: true,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "确定",
},
getListApi: getUsedCarPaymentList,
targetId: 'id',
getListApi: getRecordPageListByCondition,
searchForm: {},
searchFormSearch: {},
tableParams: {
listName: "list",
mutiSelectUniqueKey: "id",
......@@ -146,118 +112,44 @@ export default {
tableColumns: [
{
label: "员工姓名",
prop: "licensePlate",
prop: "employeeName",
minWidth: 90
},
{
label: "接待时间",
prop: "vin",
prop: "receptionStartTime",
minWidth: 90
},
{
label: "客户姓名",
prop: "licensePlate",
prop: "customerName",
minWidth: 90
},
{
label: "车型",
prop: "licensePlate",
prop: "carBrand",
minWidth: 90
},
{
label: "接待时长",
prop: "licensePlate",
prop: "duration",
minWidth: 90
},
{
label: "质检评分/分",
prop: "licensePlate",
prop: "score",
minWidth: 90
},
{
label: "攻防得分/分",
prop: "licensePlate",
prop: "defencePoint",
minWidth: 90
},
]
},
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')
},
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>
......@@ -267,8 +159,11 @@ export default {
display: flex;
align-items: center;
}
.detail-content {
::v-deep .el-dialog {
::v-deep.el-dialog__wrapper {
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
......@@ -284,6 +179,8 @@ export default {
padding: 0;
}
}
}
.detail-content {
.content {
display: flex;
height: 588px;
......@@ -296,6 +193,8 @@ export default {
height: 100%;
border: 1px solid #e5e5e5;
box-sizing: border-box;
border-radius: 2px;
overflow: hidden;
.title {
font-weight: 700;
color: #333333;
......@@ -335,6 +234,7 @@ export default {
margin-top: auto;
}
.el-table {
margin: 0 !important;
border-left: none;
overflow-y: auto;
&::before,
......
......@@ -6,7 +6,10 @@
@handleClick="submit"
:config="config"
>
<div class="content">
<div
class="content"
:key="viewKey"
>
<div class="left">
<div class="title flex">人员列表</div>
<div class="left-content">
......@@ -30,7 +33,7 @@
</div>
<div class="table">
<d2-table
ref="multipleStaffTable"
ref="multipleTable"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
......@@ -47,11 +50,11 @@
</div>
<div class="right">
<div class="title flex">
已选人员<div class="num">{{ chooseList.length }}</div>人
已选人员<div class="num">{{ count }}</div>人
<el-button
class="clear"
type="text"
@click="chooseList = []"
@click="clearChooseList"
>清空</el-button>
</div>
<div class="right-content">
......@@ -61,8 +64,9 @@
<el-tag
closable
:key="ind"
@close="removeStaff(ind)"
>{{ i.userName }}</el-tag>
@close="remove(i,ind)"
disable-transitions
>{{ i.id }}</el-tag>
</template>
</div>
</el-scrollbar>
......@@ -73,42 +77,15 @@
</template>
<script>
import { getUsedCarPaymentList } from "@api/usedCarManagement"
import {
getStrategyStaffList,
} from "@api/earlyWarningManager"
import multipleMinxin from "./multipleMinxin";
export default {
name: "ChangeMerchantDialog",
props: {
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
}
},
name: "MultipleStaff",
mixins: [multipleMinxin],
mounted () {
},
data () {
......@@ -119,15 +96,9 @@ export default {
width: "1092px"
}
},
config: {
appendToBody: true,
isShowFooter: true,
cancel_name: "取消",
confirm_name: "确定",
},
getListApi: getUsedCarPaymentList,
targetId: 'id',
getListApi: getStrategyStaffList,
searchForm: {},
searchFormSearch: {},
tableParams: {
listName: "list",
mutiSelectUniqueKey: "id",
......@@ -150,39 +121,10 @@ export default {
},
]
},
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')
},
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>
......@@ -192,8 +134,11 @@ export default {
display: flex;
align-items: center;
}
.detail-content {
::v-deep .el-dialog {
::v-deep.el-dialog__wrapper {
overflow: hidden !important;
.el-dialog {
margin: 50vh auto 0 !important;
transform: translateY(-50%);
.el-dialog__body {
padding: 0;
// padding-bottom: 24px;
......@@ -209,6 +154,8 @@ export default {
padding: 0;
}
}
}
.detail-content {
.content {
display: flex;
height: 588px;
......@@ -222,6 +169,8 @@ export default {
height: 100%;
border: 1px solid #e5e5e5;
box-sizing: border-box;
border-radius: 2px;
overflow: hidden;
.title {
font-weight: 700;
color: #333333;
......@@ -260,6 +209,7 @@ export default {
margin-top: auto;
}
.el-table {
margin: 0 !important;
border-left: none;
overflow-y: auto;
&::before,
......
......@@ -14,10 +14,8 @@ const STRATEGY_FORM_0 = [
label: '标题',
type: 'input',
key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20,
key: 'title'
key: 'title',
},
{
label: '学习人员',
......@@ -25,7 +23,6 @@ const STRATEGY_FORM_0 = [
btnText: '选择人员',
componentName: 'staffTag',
key: 'staffList',
required: true,
},
{
label: '学习内容',
......@@ -33,22 +30,19 @@ const STRATEGY_FORM_0 = [
btnText: '选择课程',
componentName: 'courseTag',
key: 'courseList',
required: true,
tagKey: 'courseId',
tagNameKey: 'title'
},
{
label: '执行周期',
type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions'
},
{
label: '策略说明',
type: 'textarea',
key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200
}
]
......@@ -57,8 +51,6 @@ const STRATEGY_FORM_1 = [
label: '标题',
type: 'input',
key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20,
key: 'title'
},
......@@ -68,7 +60,6 @@ const STRATEGY_FORM_1 = [
btnText: '选择人员',
componentName: 'staffTag',
key: 'staffList',
required: true,
},
{
......@@ -77,7 +68,6 @@ const STRATEGY_FORM_1 = [
btnText: '选择录音',
componentName: 'recordingTag',
key: 'recordingList',
required: true,
tagKey: 'id',
tagNameKey: 'name'
......@@ -85,29 +75,23 @@ const STRATEGY_FORM_1 = [
{
label: '执行周期',
type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions'
},
{
label: '策略说明',
type: 'textarea',
key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200
}
]
const STRATEGY_FORM_2456 = [
{
label: '执行人员:',
label: '执行人员',
type: 'multipleTag',
btnText: '选择人员',
componentName: 'staffTag',
key: 'staffList',
required: true,
hideKey: 'strategyInfo',
hide: (val) => {
let { strategyType } = val
return [5, 6].includes(strategyType)
......@@ -116,17 +100,13 @@ const STRATEGY_FORM_2456 = [
{
label: '执行周期',
type: 'daterange',
parentKey: 'strategyInfo',
key: 'dateRange',
required: true,
pickerOptions: 'afterPickerOptions'
},
{
label: '策略说明',
type: 'textarea',
key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200
}
]
......@@ -135,8 +115,6 @@ const STRATEGY_FORM_3 = [
label: '标题',
type: 'input',
key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 20,
key: 'title'
},
......@@ -144,8 +122,6 @@ const STRATEGY_FORM_3 = [
label: '副标题',
type: 'input',
key: 'title',
parentKey: 'strategyInfo',
required: true,
maxLength: 200,
key: 'subTitle'
},
......@@ -153,15 +129,11 @@ const STRATEGY_FORM_3 = [
label: '内容',
type: 'richText',
key: 'content',
parentKey: 'strategyInfo',
required: true,
},
{
label: '处理人',
type: 'checkbox',
key: 'handlerType',
parentKey: 'strategyInfo',
required: true,
options: [
{ label: '区域运营', value: 0 },
{ label: '驻店人员', value: 1 },
......@@ -173,8 +145,6 @@ const STRATEGY_FORM_3 = [
btnText: '选择人员',
componentName: 'staffTag',
key: 'staffList',
required: true,
hideKey: 'strategyInfo',
hide: (val) => {
let { handlerType } = val
return !handlerType.includes(0)
......@@ -184,10 +154,8 @@ const STRATEGY_FORM_3 = [
label: '驻店人员',
type: 'multipleTag',
btnText: '选择人员',
componentName: 'staffTag',
key: 'staffList',
required: true,
hideKey: 'strategyInfo',
componentName: 'staffTag1',
key: 'staffList_1',
hide: (val) => {
let { handlerType } = val
return !handlerType.includes(1)
......@@ -196,9 +164,7 @@ const STRATEGY_FORM_3 = [
{
label: '执行时间',
type: 'radioTime',
parentKey: 'strategyInfo',
key: 'pushType',
required: true,
pickerOptions: 'afterPickerOptions',
timeKey: 'pushTime',
options: [
......@@ -215,8 +181,6 @@ const STRATEGY_FORM_3 = [
label: '策略说明',
type: 'textarea',
key: 'description',
parentKey: 'strategyInfo',
required: true,
maxLength: 200
}
]
......@@ -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 {
STRATEGYTYPEOPTIONS,
STRATEGY_FORM_0,
STRATEGY_FORM_1,
STRATEGY_FORM_2456,
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
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!