From 38eb77cbc82612ce5ec059bf506744a556d540cc Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 10 四月 2024 14:25:30 +0800
Subject: [PATCH] buttonList判空
---
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue | 154 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 104 insertions(+), 50 deletions(-)
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index 5ef90db..3104d06 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,5 +1,5 @@
<template>
- <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
+ <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic">
<avue-form v-model="form" :option="option">
<template v-for="item in slotData" :slot="item.prop + 'Label'">
<span>
@@ -16,13 +16,13 @@
</span>
</template>
<template slot="menuForm">
- <dynamic-button type="form" :butttonList="componentVO.buttons" @buttonClick="buttonClick"></dynamic-button>
+ <dynamic-button :butttonList="componentVO.buttons" type="form" @buttonClick="buttonClick"></dynamic-button>
</template>
<template v-for="item in slotData" :slot="item.prop + ''">
<vciWebRefer v-if="item.type == 'refer'"
:key="item.prop"
- referType="master"
+ :ref="'referFormRef'+item.prop"
:data-key="item.prop"
:disabled="item.disabled || false"
:display="item.display || true"
@@ -30,10 +30,12 @@
:reloadFormKey="(item.referConfig.useFormKey && item.referConfig.formValues && item.referConfig.formValues[item.referConfig.useFormKey]) || ''"
:text="item.referConfig.showProp"
:value="item.prop || item.value"
- @setReferValue="setReferValue"
- :ref="'referFormRef'+item.prop">
+ referType="master"
+ @setReferValue="setReferValue">
</vciWebRefer>
+ <quill-editor ref="customQuillEditor" v-model="content" :options="editorOption" class="editor">
+ </quill-editor>
</template>
</avue-form>
</div>
@@ -43,6 +45,26 @@
import vciWebRefer from '@/components/refer/vciWebRefer'
import VciWebRefer from "@/components/refer/vciWebRefer";
import {verifyNull, verifySlash} from "@/util/validate";
+
+const toolbarOptions = [
+ ['bold', 'italic', 'underline', 'strike'], // toggled buttons
+ ['blockquote', 'code-block'],
+
+ [{'header': 1}, {'header': 2}], // custom button values
+ [{'list': 'ordered'}, {'list': 'bullet'}],
+ [{'script': 'sub'}, {'script': 'super'}], // superscript/subscript
+ [{'indent': '-1'}, {'indent': '+1'}], // outdent/indent
+ [{'direction': 'rtl'}], // text direction
+
+ [{'size': ['small', false, 'large', 'huge']}], // custom dropdown
+ [{'header': [1, 2, 3, 4, 5, 6, false]}],
+
+ [{'color': []}, {'background': []}], // dropdown with defaults from theme
+ [{'font': []}],
+ [{'align': []}],
+ ['link', 'image', 'video'],
+ ['clean'] // remove formatting button
+];
export default {
name: "dynamic-form",
components: {VciWebRefer},
@@ -59,14 +81,14 @@
type: String,
default: ''
},
- sourceData:{
- //鑿滃崟婧愭暟鎹垨鑰呭脊绐楁椂鎸夐挳鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
- type:Object,
+ sourceData: {
+ //鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
+ type: Object,
default: {}
},
- dataStore:{
+ dataStore: {
//寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁
- type:Array,
+ type: Array,
default: []
},
paramVOS: {
@@ -82,7 +104,39 @@
data() {
return {
form: {},
- ruleForm:{}
+ content: '',
+ editorOption: {
+ placeholder: '浣犳兂璇翠粈涔堬紵',
+ modules: {
+ imageResize: {
+ displayStyles: {
+ backgroundColor: 'black',
+ border: 'none',
+ color: 'white'
+ },
+ modules: ['Resize', 'DisplaySize', 'Toolbar']
+ },
+ toolbar: {
+ container: toolbarOptions, // 宸ュ叿鏍�
+ handlers: {
+ 'image': function (value) {
+ if (value) {
+ document.querySelector('#quillEditorQiniu .avatar-uploader input').click()
+ } else {
+ this.quill.format('image', false);
+ }
+ },
+ 'video': function (value) {
+ if (value) {
+ document.querySelector('#quillEditorQiniu .avatar-uploader input').click()
+ } else {
+ this.quill.format('video', false);
+ }
+ },
+ }
+ }
+ }
+ }
}
},
mounted() {
@@ -100,14 +154,14 @@
return this.getColumnData()
}
},
- watch:{
- slotData:{
- handler(newV){
- this.getDictList(newV)
+ watch: {
+ slotData: {
+ handler(newV) {
+ this.getDictList(newV)
},
immediate: true,
},
- ruleForm: {
+ form: {
handler(val) {
if (val) {
if (Array.isArray(val)) { // 妫�鏌� val 鏄惁涓烘暟缁�
@@ -130,7 +184,7 @@
deep: true,
immediate: true,
},
- sourceData:{
+ sourceData: {
handler(newval) {
//婧愭暟鎹湁鍙樺寲鏃跺彉鏇村綋鍓嶅尯鍩熸暟鎹�
console.log(this.areasName);
@@ -141,39 +195,39 @@
methods: {
//杞寲鏁版嵁
formColumn(formList) {
- return formList.map(item => {
- const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
+ return formList.map(item => {
+ const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
- const focusFunc = item.type === 'refer' ? (i) => {
+ const focusFunc = item.type === 'refer' ? (i) => {
- } : undefined;
+ } : undefined;
- return {
- label: item.text,
- prop: item.field,
- type: typeValue,
- labelWidth:item.text.length >= 6 ? 115 : 90,
- value: item.defaultValue,
- dicData: item.type === 'combox' ? item.dicData : item.dicUrl,
- readonly: item.readOnly,
- disabled: item.disabled,
- display: !item.hidden,
- labelSuffix: item.suffix,
- suffixIcon: item.prefix,
- placeholder: item.placeholder,
- clearable: item.clearable,
- tip: item.tooltips,
- keyAttr: item.keyAttr,
- focus:focusFunc,
- referConfig:item.referConfig,
- rules: [{
- required: item.required,
- message: `璇疯緭鍏�${item.text}!`,
- trigger: "blur"
- }]
- };
- });
+ return {
+ label: item.text,
+ prop: item.field,
+ type: typeValue,
+ labelWidth: item.text.length >= 6 ? 115 : 90,
+ value: item.defaultValue,
+ dicData: item.type === 'combox' ? item.dicData : item.dicUrl,
+ readonly: item.readOnly,
+ disabled: item.disabled,
+ display: !item.hidden,
+ labelSuffix: item.suffix,
+ suffixIcon: item.prefix,
+ placeholder: item.placeholder,
+ clearable: item.clearable,
+ tip: item.tooltips,
+ keyAttr: item.keyAttr,
+ focus: focusFunc,
+ referConfig: item.referConfig,
+ rules: [{
+ required: item.required,
+ message: `璇疯緭鍏�${item.text}!`,
+ trigger: "blur"
+ }]
+ };
+ });
},
//鏁版嵁鍒ょ┖
@@ -228,7 +282,7 @@
if (code.type == "refer") {
if (code.referConfig && code.referConfig.useFormKey) {
if (verifyNull(code.referConfig.formValuesKey)) {
- code.referConfig.formValuesKey = "ruleForm";
+ code.referConfig.formValuesKey = "form";
}
code.referConfig.formValues = this[code.referConfig.formValuesKey];
}
@@ -249,8 +303,8 @@
},
setReferValue(data) {
if (data && data.prop) {
- this.ruleForm[data.prop] = data.value || "";
- this.ruleForm[data.showProp] = data.text || "";
+ this.form[data.prop] = data.value || "";
+ this.form[data.showProp] = data.text || "";
if (data.propMap) {
//璇存槑闇�瑕佹槧灏�
for (let key in data.propMap) {
@@ -278,7 +332,7 @@
value.push(temp);
}
});
- this.ruleForm[key] = value.join(",");
+ this.form[key] = value.join(",");
}
}
}
--
Gitblit v1.9.3