Commit d89cea08 by 李伟康

Merge branch 'dev_lwk' into 'v3.24.0'

提交接龙

See merge request !27
2 parents 67ae498d d3a43214
<!-- 搜索 -->
<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">
<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" :labelWidth="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">
<el-form-item
v-if="!item.isHide"
:key="index"
:id="item.name"
:labelWidth="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
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
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>
<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'" :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
: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'"
: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>
<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
: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>
<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]">
<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>
<slot
:name="subItem.suffixSonSlot"
:scope="subItem"
></slot>
</el-radio>
</el-radio-group>
<slot :name="item.suffixSlot" :scope="item"></slot>
<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>
<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>
<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)" />
<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
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>
<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
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>
<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>
<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>
<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" :isDisabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)" :provinceView="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
v-else-if="item.type === 'map'"
class="flex"
>
<Province
ref="provinceForm"
:subdistrict="subdistrict"
:isDisabled="item.isDisabled"
@selectProvince="e => handleSelectProvince(e, item)"
@selectCity="e => handleSelectCity(e, item)"
:provinceView="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" bigTitle="查看" mode="big" :visible.sync="isImgVisible" :close-on-click-modal="false" @onOk="isImgVisible = false" @onCancel="isImgVisible = false">
<GLDialog
v-if="isImgVisible"
bigTitle="查看"
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
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="" />
<img
v-else
class="dialog-img"
width="100%"
:src="dialogObj.url"
alt=""
/>
</div>
</GLDialog>
<GLDialog bigTitle="选择地址" mode="big" :visible.sync="dialogMapVisible" @onOk="getAddress" @onCancel="dialogMapVisible = false">
<map-view v-if="dialogMapVisible" ref="mapForm"></map-view>
<GLDialog
bigTitle="选择地址"
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>
......@@ -118,7 +378,7 @@ import mapView from './mapView.vue'
import { beforeRangePickerOptions, afterRangePickerOptions } from './common'
export default {
name: 'glsx-combi-form',
data() {
data () {
return {
pickerOption: {
beforeRangePickerOptions: beforeRangePickerOptions,
......@@ -186,23 +446,24 @@ export default {
mapView
},
mounted() { },
mounted () { },
methods: {
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
selectAddAttr (value, targetItem) {
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
handleInputDown (e, item) {
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
handleInputBlur(e, item) {
handleInputBlur (e, item) {
item.inputBlur && item.inputBlur(e, item)
},
// 图片
handleUploadChange(e, targetItem) {
handleUploadChange (e, targetItem) {
if (targetItem.beforeLoading) this.$loading()
var reader = new FileReader()
var file = e.srcElement.files[0]
var uploadType = targetItem.uploadType || 'img',
......@@ -241,23 +502,23 @@ export default {
if (targetItem.hasPixel && (imgWidth > wdithLt || imgHeight > heightLt)) {
this.$message.error('图片尺寸最大为' + wdithLt + '像素*' + heightLt + '像素')
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
targetItem.handleUpload(e, file, targetItem, this.formObj, this)
}
}
} else {
targetItem.handleUpload(e, file, targetItem, this.formObj)
targetItem.handleUpload(e, file, targetItem, this.formObj, this)
}
}
document.getElementById(targetItem.name + 'file').value = ''
},
// 图片删除
handleImgDelete(targetItem, subIndex = -1) {
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) {
handleImgLook (src, targetItem) {
this.isImgVisible = true
this.dialogObj = {
url: src,
......@@ -265,18 +526,18 @@ export default {
}
},
// 获取富文本框内容
handleTextBoxChange(val, targetItem) {
handleTextBoxChange (val, targetItem) {
this.formObj[targetItem.name] = val
},
handleTextBoxFocus(targetItem) {
handleTextBoxFocus (targetItem) {
this.$refs[targetItem.name + 'TextBox'][0].setEdit(this.formObj[targetItem.name])
},
// 禁用富文本
forbidEdit() {
forbidEdit () {
this.$refs.textBox.forbidEdit()
},
// 地图
handleSelectMap(targetItem) {
handleSelectMap (targetItem) {
this.targetItem = targetItem
this.dialogMapVisible = true
this.$nextTick(() => {
......@@ -287,7 +548,7 @@ export default {
}
})
},
getAddress() {
getAddress () {
let mapInfo = this.$refs.mapForm
if (!mapInfo.address) {
this.$message({
......@@ -341,14 +602,14 @@ export default {
this.$refs.provinceForm[0].init(province, city)
},
// 获取省
handleSelectProvince(val, targetItem) {
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) {
handleSelectCity (val, targetItem) {
if (val.cityName) {
this.formObj[targetItem.attrObj.cityName] = val.cityName
this.formObj[targetItem.attrObj.cityCode] = val.cityCode
......
<template>
<div class="box">
<div class="title">{{title}}</div>
<glsx-combi-form
ref="formRef"
:isEdit="true"
:isBlock="true"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
</glsx-combi-form>
<div class="content">
<div class="title">{{title}}</div>
<el-scrollbar
class="form-box"
>
<glsx-combi-form
class="from"
ref="formRef"
:isEdit="true"
:isBlock="true"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
<div
slot="posterImg"
class="edit-tips"
>图片大小10M</div>
<template #endTimeType>
<div
v-if="configForm.endTimeType == 1"
class="item-box"
>
<el-date-picker
v-model="configForm.endTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</div>
</template>
<template #showTime>
<el-date-picker
v-model="configForm.winningTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</template>
<template #groupType>
<div
v-if="configForm.groupType == 1"
class="item-box"
>
<div class="label">群聊列表:</div>
<el-select
v-model="configForm.groupList"
multiple
placeholder="请选择"
filterable
multiple-limit="5"
class="options"
collapse-tags
>
<el-option
v-for="item in groupList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</template>
</glsx-combi-form>
</el-scrollbar>
</div>
<GLFooter>
<el-button
@click="$router.go(-1)"
size="medium"
>取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
size="medium"
>确定</el-button>
</GLFooter>
</div>
</template>
<script type='text/ecmascript-6'>
import { formData, rule, afterRangePickerOptions } from './addJS/add.js'
export default {
name: '',
data () {
return {
afterRangePickerOptions,
title: this.$route.query.$title,
configForm: {
filtration: 1,
activityDetail: ''
},
rule: {
name: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
merchantId: [{ required: true, message: '请选择所属渠道', trigger: 'change' }],
cardTitle: [{ required: true, message: '请输入卡片标题', trigger: 'change' }],
cardCover: [{ required: true, message: '请上传卡片封面', trigger: 'change' }],
activityDetail: '',
merchantId: '',
posterImg: '',
maxNumber: 9,
winningNumber: 0,
endTimeType: 0,
endTime: '',
winningTime: '',
groupType: 0,
groupList: []
},
formData: [
{
label: '群接龙种类',
type: 'radio',
name: 'filtration',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
{
label: '群接龙说明',
name: 'activityDetail',
type: 'textBox',
excludeMenus: ['video', 'code'],
boxHeight: 240
},
{
label: '群接龙种类',
type: 'radio',
name: 'filtration',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
],
rule,
formData,
groupList: [],
}
},
watch: {
'configForm.maxNumber' (n) {
this.configForm.winningNumber = 0
this.formData.find(e => e.name == 'winningNumber').optionList.map(i => {
i.isDisabled = i.optionId > n
})
},
'configForm.groupType' (n) {
if (n == 1 && !this.configForm.merchantId) {
this.configForm.groupType = 0
this.showError()
}
}
},
mounted () {
console.log()
},
methods: {
handleConfirm () {
},
showError (message) {
this.$message.error(message || '请先选择所属渠道!')
}
}
}
</script>
<style scoped lang='scss'>
.box{
background-color: #fff;
.box {
position: absolute;
width: 100%;
height: calc(100vh - 48px);
top: 0;
left: 0;
.content {
height: calc(100% - 88px);
background-color: #fff;
border-radius: 0 4px 4px 4px;
margin: 16px;
.form-box {
width: 100%;
height: calc(100% - 59px);
box-sizing: border-box;
.from {
margin-top: 30px;
/deep/.activity-img {
width: 104px;
height: 104px;
}
/deep/.muti-imgs {
.img-w-h,
.img-btns {
width: 106px;
height: 106px;
}
}
}
/deep/.el-scrollbar__wrap {
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
}
}
}
.title {
font-weight: 500;
font-size: 16px;
color: #333333;
line-height: 28px;
padding: 15px 20px;
border-bottom: 1px solid #e5e5e5;
background-color: #fff;
}
.edit-tips {
font-size: 14px;
color: #999999;
}
.item-box {
width: 480px;
height: 52px;
background: #f9f9f9;
display: flex;
align-items: center;
padding-left: 20px;
box-sizing: border-box;
.end-time,
.options {
width: 284px;
/deep/.el-input {
width: 100% !important;
}
/deep/.el-tag--info {
max-width: 50%;
}
}
}
}
</style>
\ No newline at end of file
const generateOptionsArray = function (count = 9) {
return Array.from({ length: count }, (_, index) => ({
optionId: Number(index + 1),
optionLabel: Number(index + 1)
}))
}
export const formData = [
{
label: '群接龙种类',
type: 'radio',
name: 'filtration',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
{
label: '群接龙说明',
name: 'activityDetail',
type: 'textBox',
excludeMenus: ['video', 'code', 'table'],
boxHeight: 240
},
{
label: '所属渠道',
name: 'merchantId',
type: 'select',
width: '432px',
// multiple: true,
// attrs: {
// multipleLimit: 10
// },
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '卡片标题',
name: 'name',
type: 'input',
maxlength: 100
},
{
label: '海报图片',
name: 'posterImg',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
suffixSlot: 'posterImg',
beforeLoading: true,
handleUpload: async (e, file, targetItem, config, _this) => {
try {
const { result: imgFile } = e.target,
arrBase64 = imgFile.split(',')[1],
str = file.name.split('.'),
base64 = str.at(-1) + '@' + arrBase64,
res = await _this.$apis.common.pictureUpload({ file: base64, fileType: 'image' })
_this.$loading().close()
if (res) {
config[targetItem.name] = res
_this.formRef().validateField(targetItem.name)
} else throw '上传失败'
} catch (error) {
_this.$loading().close()
_this.$message(error)
}
}
},
{
label: '数字上限',
name: 'maxNumber',
type: 'select',
optionList: generateOptionsArray(),
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '中奖数字',
name: 'winningNumber',
type: 'select',
optionList: [
{
optionId: 0,
optionLabel: '随机'
},
...generateOptionsArray()
],
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '接龙结束时间',
type: 'radio',
name: 'endTimeType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '选择时间',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'endTimeType',
},
{
label: '接龙开奖时间',
addHtml: 'showTime'
},
{
label: '转发群限制',
type: 'radio',
name: 'groupType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '限制群',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'groupType',
},
]
export const rule = {
name: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
merchantId: [{ required: true, message: '请选择所属渠道', trigger: 'change' }],
cardTitle: [{ required: true, message: '请输入卡片标题', trigger: 'change' }],
cardCover: [{ required: true, message: '请上传卡片封面', trigger: 'change' }],
}
export const afterRangePickerOptions = {
disabledDate (time) {
let oneDay = 60 * 60 * 24 * 1000;
return time.getTime() < Date.now() - oneDay
},
}
// computed: {
// afterRangePickerOptions () {
// //这里判断是不是今天
// let newVal = new Date(this.configForm.endTime)
// let selectableRange = '00:00:00 - 23:59:59' //默认的时间范围
// if (
// newVal &&
// newVal.getFullYear() == new Date().getFullYear() &&
// newVal.getMonth() == new Date().getMonth() &&
// newVal.getDate() == new Date().getDate()
// ) {
// //如果为今天,则限制当前时间前的时间+1分钟不能选择。
// selectableRange = new Date().getHours() + ':' + (new Date().getMinutes() + 1) + ':00 - 23:59:59'
// }
// return {
// selectableRange,
// disabledDate (time) {
// // 只能选大于当前截止时间的
// return time.getTime() < Date.now() - 8.64e7
// }
// }
// }
// }
\ No newline at end of file
......@@ -145,8 +145,8 @@ export default {
},
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName'
optionId: 'value',
optionLabel: 'label'
},
{
label: '创建时间',
......@@ -155,7 +155,7 @@ export default {
isClear: true,
valueFormat: 'yyyy-MM-dd',
customPickerOptions: {
disabledDate(date) {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
return date > yesterday
}
......@@ -341,6 +341,9 @@ export default {
.sticky {
position: relative;
z-index: 2;
/deep/.el-tag--info {
max-width: 50%;
}
&-btns {
position: absolute;
right: 0;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!