Vue3新版本和Vite新版本疑似冲突,原因待查,暂时使用指定版本。

This commit is contained in:
vdpAdmin 2022-04-14 08:57:51 +08:00
parent f9e4538f10
commit dca013e56b
8 changed files with 65 additions and 9 deletions

View File

@ -18,7 +18,7 @@
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"sortablejs": "1.14.0", "sortablejs": "1.14.0",
"vue": "^3.0.0", "vue": "3.2.26",
"vue3-quill": "^0.2.6" "vue3-quill": "^0.2.6"
}, },
"devDependencies": { "devDependencies": {
@ -32,7 +32,7 @@
"rollup-plugin-external-globals": "^0.6.1", "rollup-plugin-external-globals": "^0.6.1",
"rollup-plugin-visualizer": "^5.5.2", "rollup-plugin-visualizer": "^5.5.2",
"sass": "^1.45.0", "sass": "^1.45.0",
"vite": "^2.7.2", "vite": "2.7.3",
"vite-plugin-svg-icons": "^1.0.5" "vite-plugin-svg-icons": "^1.0.5"
}, },
"browserslist": [ "browserslist": [

View File

@ -123,6 +123,10 @@
return this.aceEditor.getSession().getAnnotations() return this.aceEditor.getSession().getAnnotations()
}, },
setValue(newValue) {
this.aceEditor.getSession().setValue(newValue)
},
} }
} }
</script> </script>

View File

@ -22,7 +22,7 @@ export function createDesigner(vueInstance) {
labelAlign: 'label-left-align', labelAlign: 'label-left-align',
cssCode: '', cssCode: '',
customClass: '', customClass: '',
functions: '', functions: '', //全局函数
layoutType: 'PC', layoutType: 'PC',
jsonVersion: 3, jsonVersion: 3,
@ -638,6 +638,33 @@ export function createDesigner(vueInstance) {
return Object.keys(originalWidget.options).indexOf(configName) > -1 return Object.keys(originalWidget.options).indexOf(configName) > -1
}, },
upgradeWidgetConfig(oldWidget) {
let newWidget = null
if (!!oldWidget.category) {
newWidget = this.getContainerByType(oldWidget.type)
} else {
newWidget = this.getFieldWidgetByType(oldWidget.type)
}
if (!newWidget || !newWidget.options) {
return
}
Object.keys(newWidget.options).forEach(ck => {
if (!oldWidget.hasOwnProperty(ck)) {
oldWidget.options[ck] = deepClone(newWidget.options[ck])
}
})
},
upgradeFormConfig(oldFormConfig) {
Object.keys(this.formConfig).forEach(fc => {
if (!oldFormConfig.hasOwnProperty(fc)) {
oldFormConfig[fc] = deepClone(this.formConfig[fc])
}
})
},
cloneGridCol(widget, parentWidget) { cloneGridCol(widget, parentWidget) {
let newGridCol = deepClone(this.getContainerByType('grid-col')) let newGridCol = deepClone(this.getContainerByType('grid-col'))
newGridCol.options.span = widget.options.span newGridCol.options.span = widget.options.span

View File

@ -543,6 +543,14 @@ export default {
this.enableOptionOfList(this.field.options.optionItems, optionValue) this.enableOptionOfList(this.field.options.optionItems, optionValue)
}, },
/**
* 返回选择项
* @returns {*}
*/
getOptionItems() {
return this.field.options.optionItems
},
setUploadHeader(name, value) { setUploadHeader(name, value) {
this.uploadHeaders[name] = value this.uploadHeaders[name] = value
}, },

View File

@ -69,7 +69,7 @@
import VFormWidget from './form-widget/index' import VFormWidget from './form-widget/index'
import {createDesigner} from "@/components/form-designer/designer" import {createDesigner} from "@/components/form-designer/designer"
import {addWindowResizeHandler, deepClone, getQueryParam, getAllContainerWidgets, import {addWindowResizeHandler, deepClone, getQueryParam, getAllContainerWidgets,
getAllFieldWidgets} from "@/utils/util" getAllFieldWidgets, traverseAllWidgets} from "@/utils/util"
import {MOCK_CASE_URL, VARIANT_FORM_VERSION} from "@/utils/config" import {MOCK_CASE_URL, VARIANT_FORM_VERSION} from "@/utils/config"
import i18n, { changeLocale } from "@/utils/i18n" import i18n, { changeLocale } from "@/utils/i18n"
import axios from 'axios' import axios from 'axios'
@ -170,7 +170,6 @@
}) })
this.loadCase() this.loadCase()
this.loadFieldListFromServer() this.loadFieldListFromServer()
}, },
methods: { methods: {
@ -364,6 +363,24 @@
return !!widgetList ? getAllContainerWidgets(widgetList) : getAllContainerWidgets(this.designer.widgetList) return !!widgetList ? getAllContainerWidgets(widgetList) : getAllContainerWidgets(this.designer.widgetList)
}, },
/**
* 升级表单json以补充最新的组件属性
* @param formJson
*/
upgradeFormJson(formJson) {
if (!formJson.widgetList || !formJson.formConfig) {
this.$message.error('Invalid form json!')
return
}
traverseAllWidgets(formJson.widgetList, (w) => {
this.designer.upgradeWidgetConfig(w)
})
this.designer.upgradeFormConfig(formJson.formConfig)
return formJson
},
getWidgetRef(widgetName, showError = false) { getWidgetRef(widgetName, showError = false) {
return this.$refs['formRef'].getWidgetRef(widgetName, showError) return this.$refs['formRef'].getWidgetRef(widgetName, showError)
}, },
@ -382,7 +399,7 @@
.el-container.main-container { .el-container.main-container {
background: #fff; background: #fff;
::v-deep aside { /* 防止aside样式被外部样式覆盖 */ :deep(aside) { /* 防止aside样式被外部样式覆盖 */
margin: 0; margin: 0;
padding: 0; padding: 0;
background: inherit; background: inherit;

View File

@ -32,10 +32,10 @@
</template> </template>
<script> <script>
import emitter from '@/utils/emitter'
import i18n from "../../../utils/i18n" import i18n from "../../../utils/i18n"
import refMixin from "../../../components/form-render/refMixin" import refMixin from "../../../components/form-render/refMixin"
import FieldComponents from '@/components/form-designer/form-widget/field-widget/index' import FieldComponents from '@/components/form-designer/form-widget/field-widget/index'
import emitter from "@/utils/emitter";
export default { export default {
name: "GridColItem", name: "GridColItem",

View File

@ -26,10 +26,10 @@
</template> </template>
<script> <script>
import emitter from '@/utils/emitter'
import i18n from "../../../utils/i18n" import i18n from "../../../utils/i18n"
import refMixin from "../../../components/form-render/refMixin" import refMixin from "../../../components/form-render/refMixin"
import FieldComponents from '@/components/form-designer/form-widget/field-widget/index' import FieldComponents from '@/components/form-designer/form-widget/field-widget/index'
import emitter from "@/utils/emitter";
export default { export default {
name: "TableCellItem", name: "TableCellItem",

View File

@ -6,7 +6,7 @@
<template #header> <template #header>
<div class="clear-fix"> <div class="clear-fix">
<span>{{widget.options.label}}</span> <span>{{widget.options.label}}</span>
<i v-if="widget.options.showFold" class="float-right" @click="toggleCard"> <i v-if="widget.options.showFold" class="float-right" @click="toggleCard">
<template v-if="!widget.options.folded"> <template v-if="!widget.options.folded">
<el-icon><ArrowDown /></el-icon> <el-icon><ArrowDown /></el-icon>
</template> </template>