forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
3e1f92d212
@ -23,6 +23,7 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@ -147,6 +148,10 @@
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -215,6 +220,12 @@
|
||||
<groupId>io.dataease</groupId>
|
||||
<artifactId>dataease-plugin-interface</artifactId>
|
||||
<version>1.13.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dataease</groupId>
|
||||
@ -236,6 +247,14 @@
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -251,12 +270,30 @@
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pentaho</groupId>
|
||||
<artifactId>metastore</artifactId>
|
||||
<version>8.3.0.18-1112</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.pentaho.di.plugins</groupId>
|
||||
@ -302,10 +339,19 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ru.yandex.qatools.ashot</groupId>
|
||||
<artifactId>ashot</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -112,6 +112,8 @@ public interface ParamConstants {
|
||||
MSG_TIME_OUT("basic.msgTimeOut"),
|
||||
DEFAULT_LOGIN_TYPE("basic.loginType"),
|
||||
OPEN_HOME_PAGE("ui.openHomePage"),
|
||||
|
||||
OPEN_MARKET_PAGE("ui.openMarketPage"),
|
||||
TEMPLATE_MARKET_ULR("basic.templateMarketUlr"),
|
||||
TEMPLATE_ACCESS_KEY("basic.templateAccessKey");
|
||||
|
||||
|
@ -20,5 +20,7 @@ public class BasicInfo implements Serializable {
|
||||
private String templateMarketUlr;
|
||||
@ApiModelProperty("模板市场AccessKey")
|
||||
private String templateAccessKey;
|
||||
@ApiModelProperty("显示模板市场")
|
||||
private String openMarketPage;
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,18 @@
|
||||
AND param_value = 'true'
|
||||
)
|
||||
)
|
||||
AND (
|
||||
sys_menu.menu_id != 202
|
||||
OR EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
system_parameter
|
||||
WHERE
|
||||
param_key = 'ui.openMarketPage'
|
||||
AND param_value = 'true'
|
||||
)
|
||||
)
|
||||
ORDER BY
|
||||
menu_sort
|
||||
</select>
|
||||
|
@ -517,6 +517,7 @@ public class ChartViewService {
|
||||
// 仪表板有参数不使用缓存
|
||||
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getOuterParamsFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill()) || CollectionUtils.isNotEmpty(rowPermissionsTree) || fields.size() != columnPermissionFields.size()) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else {
|
||||
@ -911,6 +912,7 @@ public class ChartViewService {
|
||||
// 仪表板有参数不使用缓存
|
||||
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getOuterParamsFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill()) || CollectionUtils.isNotEmpty(rowPermissionsTree) || fields.size() != columnPermissionFields.size()) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else {
|
||||
|
@ -51,7 +51,9 @@ public class SystemParameterService {
|
||||
public BasicInfo basicInfo() {
|
||||
List<SystemParameter> paramList = this.getParamList("basic");
|
||||
List<SystemParameter> homePageList = this.getParamList("ui.openHomePage");
|
||||
List<SystemParameter> marketPageList = this.getParamList("ui.openMarketPage");
|
||||
paramList.addAll(homePageList);
|
||||
paramList.addAll(marketPageList);
|
||||
BasicInfo result = new BasicInfo();
|
||||
result.setOpenHomePage("true");
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
@ -70,6 +72,10 @@ public class SystemParameterService {
|
||||
boolean open = StringUtils.equals("true", param.getParamValue());
|
||||
result.setOpenHomePage(open ? "true" : "false");
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.OPEN_MARKET_PAGE.getValue())) {
|
||||
boolean open = StringUtils.equals("true", param.getParamValue());
|
||||
result.setOpenMarketPage(open ? "true" : "false");
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.TEMPLATE_MARKET_ULR.getValue())) {
|
||||
result.setTemplateMarketUlr(param.getParamValue());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ update area_mapping_global set
|
||||
county_code = concat('156', county_code);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (202, 0, 0, 1, '模板市场', 'template-market', 'panel/templateMarket/index', 5, 'dashboard', '/templateMarket', 0, 0, 0, null, NULL, NULL, NULL, 1620444227389);
|
||||
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (202, 0, 0, 1, '模板市场', 'template-market', 'panel/templateMarket/index', 5, 'dashboard', '/templateMarket', 1, 0, 0, null, NULL, NULL, NULL, 1620444227389);
|
||||
|
||||
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateAccessKey', 'dataease', 'text', NULL);
|
||||
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateMarketUlr', 'https://dataease.io/templates', 'text', 4);
|
||||
@ -92,8 +92,6 @@ SET
|
||||
`permission` = 'datasource:read'
|
||||
WHERE
|
||||
`menu_id` = 39;
|
||||
UPDATE `sys_menu`
|
||||
SET
|
||||
`permission` = 'user:editPwd'
|
||||
WHERE
|
||||
`menu_id` = 51;
|
||||
|
||||
|
||||
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.openMarketPage', 'true', 'boolean', 14);
|
||||
|
@ -51,9 +51,7 @@
|
||||
"svgo": "1.2.2",
|
||||
"tinymce": "^5.8.2",
|
||||
"umy-ui": "^1.1.6",
|
||||
"vcolorpicker": "^1.1.0",
|
||||
"vue": "2.6.10",
|
||||
"vue-axios": "3.2.4",
|
||||
"vue-clipboard2": "0.3.1",
|
||||
"vue-codemirror": "^4.0.6",
|
||||
"vue-friendly-iframe": "^0.20.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import {validateDs} from "@/api/system/datasource";
|
||||
import { validateDs } from '@/api/system/datasource'
|
||||
|
||||
export function engineMode() {
|
||||
return request({
|
||||
|
@ -1,7 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import {validateDs} from "@/api/system/datasource";
|
||||
|
||||
|
||||
import { validateDs } from '@/api/system/datasource'
|
||||
|
||||
export function validate(data) {
|
||||
return request({
|
||||
@ -37,8 +35,6 @@ export function deleteKettle(id) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function pageList(url, data) {
|
||||
return request({
|
||||
url: url,
|
||||
|
@ -48,7 +48,7 @@ export default {
|
||||
padding-left: 3px;
|
||||
padding-right: 0px;
|
||||
cursor:pointer!important;
|
||||
background-color: #0a7be0;
|
||||
background-color: #3370ff;
|
||||
}
|
||||
.bar-main i{
|
||||
color: white;
|
||||
|
@ -5,7 +5,7 @@
|
||||
@click="handleClick"
|
||||
@mousedown="elementMouseDown"
|
||||
>
|
||||
<edit-bar v-if="componentActiveFlag" :element="config" :show-position="showPosition" @showViewDetails="showViewDetails" />
|
||||
<edit-bar v-if="componentActiveFlag" :source-element="sourceConfig" :element="config" :show-position="showPosition" @showViewDetails="showViewDetails" />
|
||||
<div :id="componentCanvasId" :style="commonStyle" class="main_view">
|
||||
<close-bar v-if="previewVisible" @closePreview="closePreview" />
|
||||
<de-out-widget
|
||||
@ -62,6 +62,11 @@ export default {
|
||||
components: { CloseBar, MobileCheckBar, DeOutWidget, EditBar },
|
||||
mixins: [mixins],
|
||||
props: {
|
||||
sourceConfig: {
|
||||
type: Object,
|
||||
require: true,
|
||||
default: null
|
||||
},
|
||||
config: {
|
||||
type: Object,
|
||||
require: true,
|
||||
|
@ -12,11 +12,6 @@
|
||||
<el-checkbox size="medium" @change="batchOptChange" />
|
||||
</div>
|
||||
<div v-if="normalAreaShow">
|
||||
<setting-menu v-if="activeModel==='edit'" style="float: right;height: 24px!important;" @amRemoveItem="amRemoveItem" @linkJumpSet="linkJumpSet" @boardSet="boardSet">
|
||||
<span slot="icon" :title="$t('panel.setting')">
|
||||
<i class="icon iconfont icon-shezhi" style="margin-top:2px" />
|
||||
</span>
|
||||
</setting-menu>
|
||||
<span :title="$t('panel.edit')">
|
||||
<i v-if="activeModel==='edit'&&curComponent&&editFilter.includes(curComponent.type)" class="icon iconfont icon-edit" @click.stop="edit" />
|
||||
</span>
|
||||
@ -26,12 +21,17 @@
|
||||
<span :title="$t('panel.suspension')">
|
||||
<i v-if="activeModel==='edit'&&!curComponent.auxiliaryMatrix" class="icon iconfont icon-xuanfuanniu" @click.stop="auxiliaryMatrixChange" />
|
||||
</span>
|
||||
<span :title="$t('panel.details')">
|
||||
<i v-if="curComponent.type==='view'" class="icon iconfont icon-chakan" @click.stop="showViewDetails('details')" />
|
||||
</span>
|
||||
<span :title="$t('panel.enlarge')">
|
||||
<i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails('enlarge')" />
|
||||
</span>
|
||||
<span :title="$t('panel.details')">
|
||||
<i v-if="curComponent.type==='view'" class="icon iconfont icon-chakan" @click.stop="showViewDetails('details')" />
|
||||
</span>
|
||||
<setting-menu v-if="activeModel==='edit'" style="float: right;height: 24px!important;" @amRemoveItem="amRemoveItem" @linkJumpSet="linkJumpSet" @boardSet="boardSet">
|
||||
<span slot="icon" :title="$t('panel.setting')">
|
||||
<i class="icon iconfont icon-shezhi" style="margin-top:2px" />
|
||||
</span>
|
||||
</setting-menu>
|
||||
<span :title="$t('panel.cancel_linkage')">
|
||||
<i v-if="curComponent.type==='view'&&existLinkage" class="icon iconfont icon-quxiaoliandong" @click.stop="clearLinkage" />
|
||||
</span>
|
||||
@ -58,6 +58,10 @@ export default {
|
||||
components: { SettingMenu, LinkageField },
|
||||
|
||||
props: {
|
||||
sourceElement: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
element: {
|
||||
type: Object,
|
||||
required: true
|
||||
@ -180,7 +184,7 @@ export default {
|
||||
multiplexingCheck(val) {
|
||||
if (val) {
|
||||
// push
|
||||
this.$store.commit('addCurMultiplexingComponent', { 'component': this.element, 'componentId': this.element.id })
|
||||
this.$store.commit('addCurMultiplexingComponent', { 'component': this.sourceElement, 'componentId': this.element.id })
|
||||
} else {
|
||||
// remove
|
||||
this.$store.commit('removeCurMultiplexingComponentWithId', this.element.id)
|
||||
@ -311,7 +315,7 @@ export default {
|
||||
padding-left: 3px;
|
||||
padding-right: 0px;
|
||||
cursor:pointer!important;
|
||||
background-color: rgba(10,123,224, 1);
|
||||
background-color: #3370ff;
|
||||
}
|
||||
.bar-main i{
|
||||
color: white;
|
||||
|
@ -149,7 +149,7 @@ export default {
|
||||
padding-left: 3px!important;
|
||||
padding-right: 0px!important;
|
||||
cursor:pointer!important;
|
||||
background-color: #0a7be0;
|
||||
background-color: #3370ff;
|
||||
}
|
||||
.bar-main i{
|
||||
color: white;
|
||||
|
@ -76,7 +76,7 @@ export default {
|
||||
padding-right: 1px;
|
||||
cursor:pointer!important;
|
||||
text-align: center;
|
||||
background-color: #0a7be0;
|
||||
background-color: #3370ff;
|
||||
}
|
||||
.bar-main i{
|
||||
color: white;
|
||||
|
@ -26,6 +26,7 @@
|
||||
:key="index"
|
||||
ref="viewWrapperChild"
|
||||
:config="item"
|
||||
:source-config="componentData[index]"
|
||||
:search-count="searchCount"
|
||||
:in-screen="inScreen"
|
||||
:terminal="terminal"
|
||||
@ -37,7 +38,6 @@
|
||||
/>
|
||||
<!--视图详情-->
|
||||
<el-dialog
|
||||
:title="$t('chart.chart_details')"
|
||||
:visible.sync="chartDetailsVisible"
|
||||
width="80%"
|
||||
class="dialog-css"
|
||||
|
@ -22,7 +22,6 @@
|
||||
/>
|
||||
<!--视图详情-->
|
||||
<el-dialog
|
||||
:title="$t('chart.chart_details')"
|
||||
:visible.sync="chartDetailsVisible"
|
||||
width="70%"
|
||||
class="dialog-css"
|
||||
|
@ -166,7 +166,7 @@ export default {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
> > > .el-popover {
|
||||
>>> .el-popover {
|
||||
height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
@ -136,7 +136,6 @@
|
||||
|
||||
<!--视图详情-->
|
||||
<el-dialog
|
||||
:title="$t('chart.chart_details')"
|
||||
:visible.sync="chartDetailsVisible"
|
||||
width="80%"
|
||||
class="dialog-css"
|
||||
|
@ -208,7 +208,8 @@ export default {
|
||||
methods: {
|
||||
close() {
|
||||
// 关闭页面清理缓存
|
||||
this.clearCanvas()
|
||||
this.$store.commit('initCanvasBase')
|
||||
this.$store.commit('setInEditorStatus', false)
|
||||
this.$emit('close-left-panel')
|
||||
this.$nextTick(() => {
|
||||
bus.$emit('PanelSwitchComponent', { name: 'PanelMain' })
|
||||
@ -373,7 +374,6 @@ export default {
|
||||
clearCanvas() {
|
||||
this.$store.commit('setComponentData', [])
|
||||
this.$store.commit('recordSnapshot', 'clearCanvas')
|
||||
this.$store.commit('setInEditorStatus', false)
|
||||
},
|
||||
|
||||
handlePreviewChange() {
|
||||
|
@ -9,13 +9,13 @@ export default {
|
||||
state: {
|
||||
copyData: null, // 复制粘贴剪切
|
||||
isCut: false,
|
||||
baseStyle: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
top: 0,
|
||||
left: 0
|
||||
},
|
||||
viewBase: {
|
||||
style: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
top: 0,
|
||||
left: 0
|
||||
},
|
||||
x: 1,
|
||||
y: 216,
|
||||
sizex: 48,
|
||||
@ -39,10 +39,15 @@ export default {
|
||||
const component =
|
||||
{
|
||||
...deepCopy(state.curMultiplexingComponents[componentId]),
|
||||
...deepCopy(deepCopy(state.viewBase)),
|
||||
...deepCopy(state.viewBase),
|
||||
'auxiliaryMatrix': canvasStyleData.auxiliaryMatrix
|
||||
}
|
||||
|
||||
component.style = {
|
||||
...component.style,
|
||||
...deepCopy(state.baseStyle)
|
||||
}
|
||||
|
||||
const tilePosition = index % 3
|
||||
const divisiblePosition = parseInt(index / 3)
|
||||
if (canvasStyleData.auxiliaryMatrix) {
|
||||
|
@ -2,57 +2,57 @@
|
||||
import { attrsMap, styleAttrs } from '@/components/widget/DeWidget/serviceNameFn.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
// 过滤组件名css变量映射
|
||||
refComNameMap: {
|
||||
'de-date': ['--BgDateColor', '--DateColor', '--BrDateColor'],
|
||||
'de-select': ['--BgSelectColor', '--SelectColor', '--BrSelectColor'],
|
||||
'de-select-tree': ['--BgSelectTreeColor', '--SelectTreeColor', '--BrSelectTreeColor'],
|
||||
"de-input-search": ['--BgSearchColor', '--SearchColor', '--BrSearchColor'],
|
||||
"de-number-range": ['--BgRangeColor', '--RangeColor', '--BrRangeColor']
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cssArr: {
|
||||
handler() {
|
||||
if (['de-select', 'de-select-tree'].includes(this.element.component)) {
|
||||
if (!this.element.options.attrs.multiple) {
|
||||
return
|
||||
}
|
||||
this.handleElTagStyle()
|
||||
};
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
cssArr() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style;
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.handleCoustomStyle()
|
||||
},
|
||||
methods: {
|
||||
typeTransform() {
|
||||
let refNode = this.refComNameMap[this.element.component];
|
||||
if (!refNode) return [];
|
||||
return refNode
|
||||
},
|
||||
handleCoustomStyle() {
|
||||
// 判断组件是否是在仪表板内部 否则css样式取默认值
|
||||
const isPanelDe = this.$parent.handlerInputStyle;
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style;
|
||||
const newValue = { brColor, wordColor, innerBgColor };
|
||||
const cssVar = this.typeTransform();
|
||||
this.styleAttrs.forEach((ele, index) => {
|
||||
document.documentElement.style.setProperty(cssVar[index], !isPanelDe ? '' : newValue[ele])
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
// 过滤组件名css变量映射
|
||||
refComNameMap: {
|
||||
'de-date': ['--BgDateColor', '--DateColor', '--BrDateColor'],
|
||||
'de-select': ['--BgSelectColor', '--SelectColor', '--BrSelectColor'],
|
||||
'de-select-tree': ['--BgSelectTreeColor', '--SelectTreeColor', '--BrSelectTreeColor'],
|
||||
'de-input-search': ['--BgSearchColor', '--SearchColor', '--BrSearchColor'],
|
||||
'de-number-range': ['--BgRangeColor', '--RangeColor', '--BrRangeColor']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cssArr: {
|
||||
handler() {
|
||||
if (['de-select', 'de-select-tree'].includes(this.element.component)) {
|
||||
if (!this.element.options.attrs.multiple) {
|
||||
return
|
||||
}
|
||||
this.handleElTagStyle()
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
cssArr() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.handleCoustomStyle()
|
||||
},
|
||||
methods: {
|
||||
typeTransform() {
|
||||
const refNode = this.refComNameMap[this.element.component]
|
||||
if (!refNode) return []
|
||||
return refNode
|
||||
},
|
||||
handleCoustomStyle() {
|
||||
// 判断组件是否是在仪表板内部 否则css样式取默认值
|
||||
const isPanelDe = this.$parent.handlerInputStyle
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style
|
||||
const newValue = { brColor, wordColor, innerBgColor }
|
||||
const cssVar = this.typeTransform()
|
||||
this.styleAttrs.forEach((ele, index) => {
|
||||
document.documentElement.style.setProperty(cssVar[index], !isPanelDe ? '' : newValue[ele])
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1,90 +1,90 @@
|
||||
// 通过控制 js 控制过滤组件输入框样式 如需额外处理 声明组件serviceName同名函数处理
|
||||
import { timeDateRangeWidget, textInputWidget, attrsMap, styleAttrs } from '@/components/widget/DeWidget/serviceNameFn.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
// 过滤组件名ref映射
|
||||
refComNameMap: {
|
||||
'de-date': 'dateRef',
|
||||
'de-select-grid': 'de-select-grid',
|
||||
'de-select': 'deSelect',
|
||||
'de-select-tree': 'deSelectTree',
|
||||
"de-input-search": "de-input-search",
|
||||
"de-number-range": ['de-number-range-min', 'de-number-range-max']
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cssArr: {
|
||||
handler(newValue) {
|
||||
if (!this.isFilterComponent) return;
|
||||
this.typeTransform().forEach(ele => {
|
||||
this.handlerInputStyle(ele, newValue)
|
||||
})
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
multiple: {
|
||||
handler() {
|
||||
if (!['de-select-tree', 'de-select'].includes(this.element.component)) return;
|
||||
const time = setTimeout(() => {
|
||||
clearTimeout(time)
|
||||
this.typeTransform().forEach(ele => {
|
||||
this.handlerInputStyle(ele, this.cssArr)
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cssArr() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style;
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
},
|
||||
multiple() {
|
||||
const { multiple = false } = this.element.options.attrs
|
||||
return multiple;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isFilterComponent) return;
|
||||
this.typeTransform().forEach(item => {
|
||||
const nodeCache = this.$refs.deOutWidget.$refs[item].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[item].$el
|
||||
this.styleAttrs.forEach(ele => {
|
||||
nodeCache.style[this.attrsMap[ele]] = this.element.style[ele];
|
||||
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(item), ele, this.element.style[ele])
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handlerInputStyle(type, newValue) {
|
||||
let nodeCache = '';
|
||||
this.styleAttrs.forEach(ele => {
|
||||
if (!nodeCache) {
|
||||
nodeCache = this.$refs.deOutWidget.$refs[type].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[type].$el
|
||||
}
|
||||
nodeCache.style[this.attrsMap[ele]] = newValue[ele];
|
||||
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(type), ele, newValue[ele])
|
||||
})
|
||||
},
|
||||
selectRange(item) {
|
||||
if (this.element.component === 'de-select-grid') {
|
||||
return this.$refs.deOutWidget.$el;
|
||||
}
|
||||
return this.$refs.deOutWidget.$refs[item].$el;
|
||||
},
|
||||
timeDateRangeWidget: timeDateRangeWidget,
|
||||
textInputWidget: textInputWidget,
|
||||
typeTransform() {
|
||||
let refNode = this.refComNameMap[this.element.component];
|
||||
if (!refNode) return [];
|
||||
if (!Array.isArray(refNode)) {
|
||||
refNode = [refNode]
|
||||
}
|
||||
return refNode
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
// 过滤组件名ref映射
|
||||
refComNameMap: {
|
||||
'de-date': 'dateRef',
|
||||
'de-select-grid': 'de-select-grid',
|
||||
'de-select': 'deSelect',
|
||||
'de-select-tree': 'deSelectTree',
|
||||
'de-input-search': 'de-input-search',
|
||||
'de-number-range': ['de-number-range-min', 'de-number-range-max']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
cssArr: {
|
||||
handler(newValue) {
|
||||
if (!this.isFilterComponent) return
|
||||
this.typeTransform().forEach(ele => {
|
||||
this.handlerInputStyle(ele, newValue)
|
||||
})
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
multiple: {
|
||||
handler() {
|
||||
if (!['de-select-tree', 'de-select'].includes(this.element.component)) return
|
||||
const time = setTimeout(() => {
|
||||
clearTimeout(time)
|
||||
this.typeTransform().forEach(ele => {
|
||||
this.handlerInputStyle(ele, this.cssArr)
|
||||
})
|
||||
}, 100)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cssArr() {
|
||||
const { brColor, wordColor, innerBgColor } = this.element.style
|
||||
return { brColor, wordColor, innerBgColor }
|
||||
},
|
||||
multiple() {
|
||||
const { multiple = false } = this.element.options.attrs
|
||||
return multiple
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isFilterComponent) return
|
||||
this.typeTransform().forEach(item => {
|
||||
const nodeCache = this.$refs.deOutWidget.$refs[item].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[item].$el
|
||||
this.styleAttrs.forEach(ele => {
|
||||
nodeCache.style[this.attrsMap[ele]] = this.element.style[ele]
|
||||
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(item), ele, this.element.style[ele])
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handlerInputStyle(type, newValue) {
|
||||
let nodeCache = ''
|
||||
this.styleAttrs.forEach(ele => {
|
||||
if (!nodeCache) {
|
||||
nodeCache = this.$refs.deOutWidget.$refs[type].$el.querySelector('.el-input__inner') || this.$refs.deOutWidget.$refs[type].$el
|
||||
}
|
||||
nodeCache.style[this.attrsMap[ele]] = newValue[ele]
|
||||
this[this.element.serviceName] && this[this.element.serviceName](this.selectRange(type), ele, newValue[ele])
|
||||
})
|
||||
},
|
||||
selectRange(item) {
|
||||
if (this.element.component === 'de-select-grid') {
|
||||
return this.$refs.deOutWidget.$el
|
||||
}
|
||||
return this.$refs.deOutWidget.$refs[item].$el
|
||||
},
|
||||
timeDateRangeWidget: timeDateRangeWidget,
|
||||
textInputWidget: textInputWidget,
|
||||
typeTransform() {
|
||||
let refNode = this.refComNameMap[this.element.component]
|
||||
if (!refNode) return []
|
||||
if (!Array.isArray(refNode)) {
|
||||
refNode = [refNode]
|
||||
}
|
||||
return refNode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,92 +1,91 @@
|
||||
const attrsMap = { brColor: 'borderColor', wordColor: 'color', innerBgColor: 'backgroundColor' }
|
||||
const styleAttrs = ['innerBgColor', 'wordColor', 'brColor']
|
||||
function timeDateRangeWidget (nodeCache, name, value) {
|
||||
const classList = ['.el-range-input', '.el-range-separator']
|
||||
classList.forEach(ele => {
|
||||
let nodeList = nodeCache.querySelectorAll(ele);
|
||||
if (!nodeList.length) return;
|
||||
nodeList.forEach(ele => {
|
||||
ele.style[attrsMap[name]] = value;
|
||||
})
|
||||
function timeDateRangeWidget(nodeCache, name, value) {
|
||||
const classList = ['.el-range-input', '.el-range-separator']
|
||||
classList.forEach(ele => {
|
||||
const nodeList = nodeCache.querySelectorAll(ele)
|
||||
if (!nodeList.length) return
|
||||
nodeList.forEach(ele => {
|
||||
ele.style[attrsMap[name]] = value
|
||||
})
|
||||
})
|
||||
}
|
||||
function textInputWidget (nodeCache, name, value) {
|
||||
let groupAppend = nodeCache.querySelector('.el-input-group__append');
|
||||
groupAppend.style[attrsMap[name]] = value;
|
||||
if (name === 'brColor') {
|
||||
groupAppend.style.borderLeft = 'none'
|
||||
}
|
||||
function textInputWidget(nodeCache, name, value) {
|
||||
const groupAppend = nodeCache.querySelector('.el-input-group__append')
|
||||
groupAppend.style[attrsMap[name]] = value
|
||||
if (name === 'brColor') {
|
||||
groupAppend.style.borderLeft = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
function textSelectGridWidget (nodeCache, name, value) {
|
||||
if (name === 'innerBgColor') {
|
||||
nodeCache.querySelector('.list').style.backgroundColor = value;
|
||||
function textSelectGridWidget(nodeCache, name, value) {
|
||||
if (name === 'innerBgColor') {
|
||||
nodeCache.querySelector('.list').style.backgroundColor = value
|
||||
}
|
||||
if (name === 'wordColor') {
|
||||
const elRadio = nodeCache.querySelectorAll('.el-radio')
|
||||
const elCheckbox = nodeCache.querySelectorAll('.el-checkbox')
|
||||
if (elRadio.length) {
|
||||
elRadio.forEach(ele => {
|
||||
ele.style.color = value
|
||||
})
|
||||
}
|
||||
if (name === 'wordColor') {
|
||||
let elRadio = nodeCache.querySelectorAll('.el-radio')
|
||||
let elCheckbox = nodeCache.querySelectorAll('.el-checkbox')
|
||||
if (elRadio.length) {
|
||||
elRadio.forEach(ele => {
|
||||
ele.style.color = value;
|
||||
});
|
||||
}
|
||||
if (elCheckbox.length) {
|
||||
elCheckbox.forEach(ele => {
|
||||
ele.style.color = value;
|
||||
});
|
||||
}
|
||||
if (elCheckbox.length) {
|
||||
elCheckbox.forEach(ele => {
|
||||
ele.style.color = value
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function textSelectTreeWidget(nodeCache, style) {
|
||||
textSelectWidget(nodeCache, style)
|
||||
textSelectWidget(nodeCache, style)
|
||||
}
|
||||
|
||||
function textSelectWidget(nodeCache, style) {
|
||||
let elTag = nodeCache.querySelectorAll('.el-tag.el-tag--info')
|
||||
if (elTag.length) {
|
||||
elTag.forEach(item => {
|
||||
item.style.flexWrap = 'wrap'
|
||||
item.style.padding = '0'
|
||||
const textNode = item.querySelector('.el-select__tags-text');
|
||||
const closeNode = item.querySelector('.el-tag__close');
|
||||
textNode.style.width = '100%';
|
||||
item.style.position = 'relative';
|
||||
textNode.style.padding = '0 20px 0 8px';
|
||||
textNode.style.borderRadius = '3px';
|
||||
if (closeNode) {
|
||||
closeNode.style.position = 'absolute';
|
||||
closeNode.style.top = '60%';
|
||||
closeNode.style.transform = 'translateY(-50%)';
|
||||
closeNode.style.right = '2px';
|
||||
}
|
||||
styleAttrs.forEach((ele) => {
|
||||
if (ele !== 'brColor' && closeNode) {
|
||||
closeNode.style[attrsMap[ele]] = style[ele];
|
||||
} else {
|
||||
item.style[attrsMap[ele]] = style[ele];
|
||||
}
|
||||
textNode.style[attrsMap[ele]] = style[ele];
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
const elTag = nodeCache.querySelectorAll('.el-tag.el-tag--info')
|
||||
if (elTag.length) {
|
||||
elTag.forEach(item => {
|
||||
item.style.flexWrap = 'wrap'
|
||||
item.style.padding = '0'
|
||||
const textNode = item.querySelector('.el-select__tags-text')
|
||||
const closeNode = item.querySelector('.el-tag__close')
|
||||
textNode.style.width = '100%'
|
||||
item.style.position = 'relative'
|
||||
textNode.style.padding = '0 20px 0 8px'
|
||||
textNode.style.borderRadius = '3px'
|
||||
if (closeNode) {
|
||||
closeNode.style.position = 'absolute'
|
||||
closeNode.style.top = '60%'
|
||||
closeNode.style.transform = 'translateY(-50%)'
|
||||
closeNode.style.right = '2px'
|
||||
}
|
||||
styleAttrs.forEach((ele) => {
|
||||
if (ele !== 'brColor' && closeNode) {
|
||||
closeNode.style[attrsMap[ele]] = style[ele]
|
||||
} else {
|
||||
item.style[attrsMap[ele]] = style[ele]
|
||||
}
|
||||
textNode.style[attrsMap[ele]] = style[ele]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function handlerInputStyle (node, style) {
|
||||
if (!node) return;
|
||||
styleAttrs.forEach(ele => {
|
||||
node.style[attrsMap[ele]] = style[ele];
|
||||
})
|
||||
function handlerInputStyle(node, style) {
|
||||
if (!node) return
|
||||
styleAttrs.forEach(ele => {
|
||||
node.style[attrsMap[ele]] = style[ele]
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
timeDateRangeWidget,
|
||||
textInputWidget,
|
||||
textSelectGridWidget,
|
||||
textSelectTreeWidget,
|
||||
textSelectWidget,
|
||||
handlerInputStyle,
|
||||
}
|
||||
attrsMap,
|
||||
styleAttrs,
|
||||
timeDateRangeWidget,
|
||||
textInputWidget,
|
||||
textSelectGridWidget,
|
||||
textSelectTreeWidget,
|
||||
textSelectWidget,
|
||||
handlerInputStyle,
|
||||
}
|
||||
|
@ -67,39 +67,38 @@ export const bottom2TopDrag = {
|
||||
const closePress = {
|
||||
inserted: function (el) {
|
||||
el.querySelector('.el-drawer__close-btn').onmousedown = function (e) {
|
||||
e.currentTarget.style.background = '#d2d3d4';
|
||||
e.currentTarget.style.setProperty('background', '#d2d3d4', 'important');
|
||||
}
|
||||
el.querySelector('.el-drawer__close-btn').onmouseup = function (e) {
|
||||
e.currentTarget.style.background = 'none';
|
||||
el.querySelector('.el-drawer__close-btn').onmouseup = function(e) {
|
||||
e.currentTarget.style.background = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const btnPress = {
|
||||
update: function (el, binding) {
|
||||
el.onmousedown = function (e) {
|
||||
e.currentTarget.style.setProperty('background', binding.value || '#EFF0F1', 'important');
|
||||
const btnPress = {
|
||||
update: function(el, binding) {
|
||||
el.onmousedown = function(e) {
|
||||
e.currentTarget.style.setProperty('background', binding.value || '#EFF0F1', 'important')
|
||||
}
|
||||
el.onmouseup = function (e) {
|
||||
e.currentTarget.style.background = 'none';
|
||||
el.onmouseup = function(e) {
|
||||
e.currentTarget.style.background = 'none'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
const customStyle = {
|
||||
inserted: function (el, binding) {
|
||||
const label = el.querySelector('.el-checkbox__label');
|
||||
inserted: function(el, binding) {
|
||||
const label = el.querySelector('.el-checkbox__label')
|
||||
if (label) {
|
||||
if (label.getAttribute("data-color") === binding.value.wordColor) {
|
||||
if (label.getAttribute('data-color') === binding.value.wordColor) {
|
||||
return
|
||||
};
|
||||
label.style.setProperty('color', binding.value.wordColor, 'important');
|
||||
label.setAttribute("data-color", binding.value.wordColor);
|
||||
}
|
||||
label.style.setProperty('color', binding.value.wordColor, 'important')
|
||||
label.setAttribute('data-color', binding.value.wordColor)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
install(Vue) {
|
||||
// Vue.directive('data-permission', dataPermission)
|
||||
|
@ -1896,6 +1896,7 @@ export default {
|
||||
themeDark: 'Dark',
|
||||
themeCustom: 'Custom',
|
||||
openHomePage: 'Show Home Page',
|
||||
openMarketPage: 'Show Market Page',
|
||||
mobileBG: 'Mobile Login page BG',
|
||||
helpLink: 'Help Document Link',
|
||||
homeLink: 'Home Link',
|
||||
|
@ -1904,7 +1904,7 @@ export default {
|
||||
themeDark: '深色',
|
||||
themeCustom: '自定義',
|
||||
openHomePage: '顯示首頁',
|
||||
|
||||
openMarketPage: '显示模板市场',
|
||||
mobileBG: '移動端登錄頁背景',
|
||||
helpLink: '幫助文檔鏈接',
|
||||
homeLink: '首頁鏈接',
|
||||
|
@ -568,7 +568,7 @@ export default {
|
||||
filter: '筛选',
|
||||
list: '列表项',
|
||||
list_info: '请选择列表中要展示的信息',
|
||||
sure_delete: '确定删除该用户吗?',
|
||||
sure_delete: '确定删除该用户吗?'
|
||||
},
|
||||
ldap: {
|
||||
url: 'LDAP地址',
|
||||
@ -1914,6 +1914,7 @@ export default {
|
||||
themeDark: '深色',
|
||||
themeCustom: '自定义',
|
||||
openHomePage: '显示首页',
|
||||
openMarketPage: '显示模板市场',
|
||||
mobileBG: '移动端登录页背景',
|
||||
helpLink: '帮助文档链接',
|
||||
homeLink: '首页链接',
|
||||
|
@ -45,8 +45,6 @@ Vue.prototype.$gaodeMap = GaodeMap
|
||||
import UmyUi from 'umy-ui'
|
||||
Vue.use(UmyUi)
|
||||
|
||||
import vcolorpicker from 'vcolorpicker'
|
||||
Vue.use(vcolorpicker)
|
||||
|
||||
// 全屏插件
|
||||
import fullscreen from 'vue-fullscreen'
|
||||
|
@ -659,7 +659,7 @@ const data = {
|
||||
setChangeProperties(state, propertyInfo) {
|
||||
state.changeProperties[propertyInfo.custom][propertyInfo.property] = propertyInfo.value
|
||||
},
|
||||
initCanvas(state) {
|
||||
initCanvasBase(state) {
|
||||
this.commit('setCurComponent', { component: null, index: null })
|
||||
this.commit('clearLinkageSettingInfo', false)
|
||||
this.commit('resetViewEditInfo')
|
||||
@ -676,6 +676,9 @@ const data = {
|
||||
customStyle: {},
|
||||
customAttr: {}
|
||||
}
|
||||
},
|
||||
initCanvas(state) {
|
||||
this.commit('initCanvasBase')
|
||||
state.isInEditor = true
|
||||
},
|
||||
initViewRender(state, pluginViews) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
import { componentStyle, seniorCfg } from '../common/common'
|
||||
import {BASE_ECHARTS_SELECT, DEFAULT_TOOLTIP} from '@/views/chart/chart/chart'
|
||||
import { BASE_ECHARTS_SELECT, DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
|
||||
|
||||
let bubbleArray = []
|
||||
let terminalType = 'pc'
|
||||
|
@ -400,7 +400,7 @@ span{
|
||||
.field-style{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.field-text{
|
||||
|
@ -49,6 +49,14 @@
|
||||
<el-button class="pwd-tips" type="text">{{ $t('system_parameter_setting.cas_reset') + '[/cas/reset/{adminAcount}/{adminPwd}]' }}</el-button>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item :label="$t('display.openMarketPage')">
|
||||
<el-checkbox v-model="formInline.openMarketPage" true-label="true" false-label="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item :label="$t('display.openHomePage')">
|
||||
@ -163,8 +171,8 @@ export default {
|
||||
{ paramKey: 'basic.frontTimeOut', paramValue: this.formInline.frontTimeOut, type: 'text', sort: 1 },
|
||||
{ paramKey: 'basic.msgTimeOut', paramValue: this.formInline.msgTimeOut, type: 'text', sort: 2 },
|
||||
{ paramKey: 'basic.loginType', paramValue: this.formInline.loginType, type: 'text', sort: 3 },
|
||||
{ paramKey: 'ui.openHomePage', paramValue: this.formInline.openHomePage, type: 'text', sort: 13 }
|
||||
|
||||
{ paramKey: 'ui.openHomePage', paramValue: this.formInline.openHomePage, type: 'text', sort: 13 },
|
||||
{ paramKey: 'ui.openMarketPage', paramValue: this.formInline.openMarketPage, type: 'text', sort: 14 }
|
||||
]
|
||||
|
||||
this.$refs[formInline].validate(valid => {
|
||||
|
@ -149,8 +149,13 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
removeMap(param).then(res => {
|
||||
this.$emit('refresh-tree')
|
||||
this.$success(this.$t('commons.delete_success'))
|
||||
this.$store.dispatch('map/setGeo', {
|
||||
key: param.code,
|
||||
value: null
|
||||
}).then(() => {
|
||||
this.$emit('refresh-tree')
|
||||
this.$success(this.$t('commons.delete_success'))
|
||||
})
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$info(this.$t('commons.delete_cancel'))
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formInline: { pCode: '' },
|
||||
formInline: { pCode: '', fileName: '' },
|
||||
loading: false,
|
||||
rules: {
|
||||
pCode: [
|
||||
@ -227,7 +227,7 @@ export default {
|
||||
return true
|
||||
},
|
||||
uploadMapFile(file) {
|
||||
this.formInline.fileName = file.file.name
|
||||
this.$set(this.formInline, 'fileName', file.file.name)
|
||||
this.formInline.file = file.file
|
||||
},
|
||||
removeFile() {
|
||||
|
@ -1,14 +1,13 @@
|
||||
export class BaseConfig {
|
||||
|
||||
set(options, notUndefined) {
|
||||
options = this.initOptions(options)
|
||||
for (let name in options) {
|
||||
for (const name in options) {
|
||||
if (options.hasOwnProperty(name)) {
|
||||
if (!(this[name] instanceof Array)) {
|
||||
if (notUndefined === true) {
|
||||
this[name] = options[name] === undefined ? this[name] : options[name];
|
||||
this[name] = options[name] === undefined ? this[name] : options[name]
|
||||
} else {
|
||||
this[name] = options[name];
|
||||
this[name] = options[name]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,10 +17,10 @@ export class BaseConfig {
|
||||
sets(types, options) {
|
||||
options = this.initOptions(options)
|
||||
if (types) {
|
||||
for (let name in types) {
|
||||
for (const name in types) {
|
||||
if (types.hasOwnProperty(name) && options.hasOwnProperty(name)) {
|
||||
options[name].forEach(o => {
|
||||
this[name].push(new types[name](o));
|
||||
this[name].push(new types[name](o))
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -29,137 +28,137 @@ export class BaseConfig {
|
||||
}
|
||||
|
||||
initOptions(options) {
|
||||
return options || {};
|
||||
return options || {}
|
||||
}
|
||||
|
||||
isValid() {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
export class KeyValue extends BaseConfig {
|
||||
constructor(options) {
|
||||
options = options || {};
|
||||
options.enable = options.enable === undefined ? true : options.enable;
|
||||
options = options || {}
|
||||
options.enable = options.enable === undefined ? true : options.enable
|
||||
|
||||
super();
|
||||
this.name = undefined;
|
||||
this.value = undefined;
|
||||
this.type = undefined;
|
||||
this.files = undefined;
|
||||
this.enable = undefined;
|
||||
this.uuid = undefined;
|
||||
this.time = undefined;
|
||||
this.contentType = undefined;
|
||||
this.set(options);
|
||||
super()
|
||||
this.name = undefined
|
||||
this.value = undefined
|
||||
this.type = undefined
|
||||
this.files = undefined
|
||||
this.enable = undefined
|
||||
this.uuid = undefined
|
||||
this.time = undefined
|
||||
this.contentType = undefined
|
||||
this.set(options)
|
||||
}
|
||||
|
||||
isValid() {
|
||||
return (!!this.name || !!this.value) && this.type !== 'file';
|
||||
return (!!this.name || !!this.value) && this.type !== 'file'
|
||||
}
|
||||
|
||||
isFile() {
|
||||
return (!!this.name || !!this.value) && this.type === 'file';
|
||||
return (!!this.name || !!this.value) && this.type === 'file'
|
||||
}
|
||||
}
|
||||
|
||||
export class Body extends BaseConfig {
|
||||
constructor(options) {
|
||||
super();
|
||||
this.type = "KeyValue";
|
||||
this.raw = undefined;
|
||||
this.kvs = [];
|
||||
this.binary = [];
|
||||
this.set(options);
|
||||
this.sets({kvs: KeyValue}, {binary: KeyValue}, options);
|
||||
super()
|
||||
this.type = 'KeyValue'
|
||||
this.raw = undefined
|
||||
this.kvs = []
|
||||
this.binary = []
|
||||
this.set(options)
|
||||
this.sets({ kvs: KeyValue }, { binary: KeyValue }, options)
|
||||
}
|
||||
|
||||
isValid() {
|
||||
if (this.isKV()) {
|
||||
return this.kvs.some(kv => {
|
||||
return kv.isValid();
|
||||
return kv.isValid()
|
||||
})
|
||||
} else {
|
||||
return !!this.raw;
|
||||
return !!this.raw
|
||||
}
|
||||
}
|
||||
|
||||
isKV() {
|
||||
return [BODY_TYPE.FORM_DATA, BODY_TYPE.WWW_FORM, BODY_TYPE.BINARY].indexOf(this.type) > 0;
|
||||
return [BODY_TYPE.FORM_DATA, BODY_TYPE.WWW_FORM, BODY_TYPE.BINARY].indexOf(this.type) > 0
|
||||
}
|
||||
}
|
||||
|
||||
export const createComponent = function (name) {
|
||||
let component = MODELS[name];
|
||||
export const createComponent = function(name) {
|
||||
const component = MODELS[name]
|
||||
if (component) {
|
||||
return new component();
|
||||
return new component()
|
||||
} else {
|
||||
return new UnsupportedComponent()
|
||||
}
|
||||
}
|
||||
|
||||
export const BODY_TYPE = {
|
||||
KV: "KeyValue",
|
||||
FORM_DATA: "Form_Data",
|
||||
RAW: "Raw",
|
||||
WWW_FORM: "WWW_FORM",
|
||||
XML: "XML",
|
||||
JSON: "JSON"
|
||||
KV: 'KeyValue',
|
||||
FORM_DATA: 'Form_Data',
|
||||
RAW: 'Raw',
|
||||
WWW_FORM: 'WWW_FORM',
|
||||
XML: 'XML',
|
||||
JSON: 'JSON'
|
||||
}
|
||||
|
||||
export class Scenario extends BaseConfig {
|
||||
constructor(options = {}) {
|
||||
super();
|
||||
this.id = undefined;
|
||||
this.name = undefined;
|
||||
this.url = undefined;
|
||||
this.variables = [];
|
||||
this.headers = [];
|
||||
this.requests = [];
|
||||
this.environmentId = undefined;
|
||||
this.dubboConfig = undefined;
|
||||
this.environment = undefined;
|
||||
this.enableCookieShare = false;
|
||||
this.enable = true;
|
||||
this.databaseConfigs = [];
|
||||
this.tcpConfig = undefined;
|
||||
this.set(options);
|
||||
super()
|
||||
this.id = undefined
|
||||
this.name = undefined
|
||||
this.url = undefined
|
||||
this.variables = []
|
||||
this.headers = []
|
||||
this.requests = []
|
||||
this.environmentId = undefined
|
||||
this.dubboConfig = undefined
|
||||
this.environment = undefined
|
||||
this.enableCookieShare = false
|
||||
this.enable = true
|
||||
this.databaseConfigs = []
|
||||
this.tcpConfig = undefined
|
||||
this.set(options)
|
||||
this.sets({
|
||||
variables: KeyValue,
|
||||
headers: KeyValue,
|
||||
requests: RequestFactory,
|
||||
databaseConfigs: DatabaseConfig
|
||||
}, options);
|
||||
}, options)
|
||||
}
|
||||
|
||||
initOptions(options = {}) {
|
||||
options.id = options.id || uuid();
|
||||
options.requests = options.requests || [new RequestFactory()];
|
||||
options.databaseConfigs = options.databaseConfigs || [];
|
||||
options.dubboConfig = new DubboConfig(options.dubboConfig);
|
||||
options.tcpConfig = new TCPConfig(options.tcpConfig);
|
||||
return options;
|
||||
options.id = options.id || uuid()
|
||||
options.requests = options.requests || [new RequestFactory()]
|
||||
options.databaseConfigs = options.databaseConfigs || []
|
||||
options.dubboConfig = new DubboConfig(options.dubboConfig)
|
||||
options.tcpConfig = new TCPConfig(options.tcpConfig)
|
||||
return options
|
||||
}
|
||||
|
||||
clone() {
|
||||
let clone = new Scenario(this);
|
||||
clone.id = uuid();
|
||||
return clone;
|
||||
const clone = new Scenario(this)
|
||||
clone.id = uuid()
|
||||
return clone
|
||||
}
|
||||
|
||||
isValid() {
|
||||
if (this.enable) {
|
||||
for (let i = 0; i < this.requests.length; i++) {
|
||||
let validator = this.requests[i].isValid(this.environmentId, this.environment);
|
||||
const validator = this.requests[i].isValid(this.environmentId, this.environment)
|
||||
if (!validator.isValid) {
|
||||
return validator;
|
||||
return validator
|
||||
}
|
||||
}
|
||||
}
|
||||
return {isValid: true};
|
||||
return { isValid: true }
|
||||
}
|
||||
|
||||
isReference() {
|
||||
return this.id.indexOf("#") !== -1
|
||||
return this.id.indexOf('#') !== -1
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,19 @@
|
||||
const isBoolean = require("lodash.isboolean");
|
||||
const isEmpty = require("lodash.isempty");
|
||||
const isInteger = require("lodash.isinteger");
|
||||
const isNull = require("lodash.isnull");
|
||||
const isNumber = require("lodash.isnumber");
|
||||
const isObject = require("lodash.isobject");
|
||||
const isString = require("lodash.isstring");
|
||||
const isArray = Array.isArray;
|
||||
|
||||
const isBoolean = require('lodash.isboolean')
|
||||
const isEmpty = require('lodash.isempty')
|
||||
const isInteger = require('lodash.isinteger')
|
||||
const isNull = require('lodash.isnull')
|
||||
const isNumber = require('lodash.isnumber')
|
||||
const isObject = require('lodash.isobject')
|
||||
const isString = require('lodash.isstring')
|
||||
const isArray = Array.isArray
|
||||
|
||||
class Convert {
|
||||
constructor() {
|
||||
this._option = {
|
||||
$id: "http://example.com/root.json",
|
||||
$schema: "http://json-schema.org/draft-07/schema#",
|
||||
$id: 'http://example.com/root.json',
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
}
|
||||
this._object = null;
|
||||
this._object = null
|
||||
}
|
||||
|
||||
/**
|
||||
@ -25,22 +24,22 @@ class Convert {
|
||||
format(object, option = {}) {
|
||||
// 数据校验,确保传入的的object只能是对象或数组
|
||||
if (!isObject(object)) {
|
||||
throw new TypeError("传入参数只能是对象或数组");
|
||||
throw new TypeError('传入参数只能是对象或数组')
|
||||
}
|
||||
// 合并属性
|
||||
this._option = Object.assign(this._option, option);
|
||||
this._option = Object.assign(this._option, option)
|
||||
// 需要转换的对象
|
||||
this._object = object;
|
||||
let convertRes;
|
||||
this._object = object
|
||||
let convertRes
|
||||
// 数组类型和对象类型结构不一样
|
||||
if (isArray(object)) {
|
||||
convertRes = this._arrayToSchema();
|
||||
convertRes = this._arrayToSchema()
|
||||
} else {
|
||||
convertRes = this._objectToSchema();
|
||||
convertRes = this._objectToSchema()
|
||||
}
|
||||
// 释放
|
||||
this._object = null;
|
||||
return convertRes;
|
||||
this._object = null
|
||||
return convertRes
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,22 +47,22 @@ class Convert {
|
||||
*/
|
||||
_arrayToSchema() {
|
||||
// root节点基本信息
|
||||
let result = this._value2object(this._object, this._option.$id, "", true);
|
||||
const result = this._value2object(this._object, this._option.$id, '', true)
|
||||
if (this._object.length > 0) {
|
||||
let itemArr = [];
|
||||
const itemArr = []
|
||||
for (let index = 0; index < this._object.length; index++) {
|
||||
// 创建items对象的基本信息
|
||||
let objectItem = this._object[index]
|
||||
let item = this._value2object(objectItem, `#/items`, 'items');
|
||||
const objectItem = this._object[index]
|
||||
let item = this._value2object(objectItem, `#/items`, 'items')
|
||||
if (isObject(objectItem) && !isEmpty(objectItem)) {
|
||||
// 递归遍历
|
||||
let objectItemSchema = this._json2schema(objectItem, `#/items`);
|
||||
const objectItemSchema = this._json2schema(objectItem, `#/items`)
|
||||
// 合并对象
|
||||
item = Object.assign(item, objectItemSchema);
|
||||
item = Object.assign(item, objectItemSchema)
|
||||
}
|
||||
itemArr.push(item);
|
||||
itemArr.push(item)
|
||||
}
|
||||
result["items"] = itemArr;
|
||||
result['items'] = itemArr
|
||||
}
|
||||
return result
|
||||
}
|
||||
@ -72,8 +71,8 @@ class Convert {
|
||||
* 对象类型转换成JSONSCHEMA
|
||||
*/
|
||||
_objectToSchema() {
|
||||
let baseResult = this._value2object(this._object, this._option.$id, "", true)
|
||||
let objectSchema = this._json2schema(this._object)
|
||||
let baseResult = this._value2object(this._object, this._option.$id, '', true)
|
||||
const objectSchema = this._json2schema(this._object)
|
||||
baseResult = Object.assign(baseResult, objectSchema)
|
||||
return baseResult
|
||||
}
|
||||
@ -83,69 +82,69 @@ class Convert {
|
||||
* @param {*} object 需要转换对象
|
||||
* @param {*} name $id值
|
||||
*/
|
||||
_json2schema(object, name = "") {
|
||||
_json2schema(object, name = '') {
|
||||
// 如果递归值不是对象,那么return掉
|
||||
if (!isObject(object)) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
// 处理当前路径$id
|
||||
if (name === "" || name == undefined) {
|
||||
name = "#"
|
||||
if (name === '' || name == undefined) {
|
||||
name = '#'
|
||||
}
|
||||
let result = {};
|
||||
const result = {}
|
||||
// 判断传入object是对象还是数组。
|
||||
if (isArray(object)) {
|
||||
result.items = {};
|
||||
result.items = {}
|
||||
} else {
|
||||
result.properties = {};
|
||||
result.properties = {}
|
||||
}
|
||||
// 遍历传入的对象
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
const element = object[key];
|
||||
const element = object[key]
|
||||
// 如果只是undefined。跳过
|
||||
if (element === undefined) {
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
let $id = `${name}/properties/${key}`
|
||||
const $id = `${name}/properties/${key}`
|
||||
// 判断当前 element 的值 是否也是对象,如果是就继续递归,不是就赋值给result
|
||||
if(!result["properties"]){
|
||||
continue;
|
||||
if (!result['properties']) {
|
||||
continue
|
||||
}
|
||||
if (isObject(element)) {
|
||||
// 创建当前属性的基本信息
|
||||
result["properties"][key] = this._value2object(element, $id, key)
|
||||
result['properties'][key] = this._value2object(element, $id, key)
|
||||
if (isArray(element)) {
|
||||
// 针对空数组和有值的数组做不同处理
|
||||
if (element.length > 0) {
|
||||
// 是数组
|
||||
let itemArr = [];
|
||||
const itemArr = []
|
||||
for (let index = 0; index < element.length; index++) {
|
||||
let elementItem = element[index];
|
||||
const elementItem = element[index]
|
||||
// 创建items对象的基本信息
|
||||
let item = this._value2object(elementItem, `${$id}/items`, key + 'items');
|
||||
let item = this._value2object(elementItem, `${$id}/items`, key + 'items')
|
||||
// 判断第一项是否是对象,且对象属性不为空
|
||||
if (isObject(elementItem) && !isEmpty(elementItem)) {
|
||||
// 新增的properties才合并进来
|
||||
item = Object.assign(item, this._json2schema(elementItem, `${$id}/items`));
|
||||
item = Object.assign(item, this._json2schema(elementItem, `${$id}/items`))
|
||||
}
|
||||
itemArr.push(item);
|
||||
itemArr.push(item)
|
||||
}
|
||||
result["properties"][key]["items"] = itemArr;
|
||||
result['properties'][key]['items'] = itemArr
|
||||
}
|
||||
} else {
|
||||
// 不是数组,递归遍历获取,然后合并对象属性
|
||||
result["properties"][key] = Object.assign(result["properties"][key], this._json2schema(element, $id));
|
||||
result['properties'][key] = Object.assign(result['properties'][key], this._json2schema(element, $id))
|
||||
}
|
||||
} else {
|
||||
// 一般属性直接获取基本信息
|
||||
if (result["properties"]) {
|
||||
result["properties"][key] = this._value2object(element, $id, key);
|
||||
if (result['properties']) {
|
||||
result['properties'][key] = this._value2object(element, $id, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,39 +154,39 @@ class Convert {
|
||||
* @param {*} key
|
||||
*/
|
||||
_value2object(value, $id, key = '', root = false) {
|
||||
let objectTemplate = {
|
||||
const objectTemplate = {
|
||||
$id: $id,
|
||||
title: `The ${key} Schema`,
|
||||
mock: {
|
||||
"mock": value
|
||||
'mock': value
|
||||
},
|
||||
}
|
||||
|
||||
// 判断是否为初始化root数据
|
||||
if (root) {
|
||||
objectTemplate["$schema"] = this._option.$schema;
|
||||
objectTemplate["title"] = `The Root Schema`;
|
||||
objectTemplate["mock"] = undefined;
|
||||
objectTemplate['$schema'] = this._option.$schema
|
||||
objectTemplate['title'] = `The Root Schema`
|
||||
objectTemplate['mock'] = undefined
|
||||
}
|
||||
if (isBoolean(value)) {
|
||||
objectTemplate.type = "boolean";
|
||||
objectTemplate.type = 'boolean'
|
||||
} else if (isInteger(value)) {
|
||||
objectTemplate.type = "integer";
|
||||
objectTemplate.type = 'integer'
|
||||
} else if (isNumber(value)) {
|
||||
objectTemplate.type = "number";
|
||||
objectTemplate.type = 'number'
|
||||
} else if (isString(value)) {
|
||||
objectTemplate.type = "string";
|
||||
objectTemplate.type = 'string'
|
||||
} else if (isNull(value)) {
|
||||
objectTemplate.type = "null";
|
||||
objectTemplate.type = 'null'
|
||||
} else if (isArray(value)) {
|
||||
objectTemplate.type = "array";
|
||||
objectTemplate["mock"] = undefined;
|
||||
objectTemplate.type = 'array'
|
||||
objectTemplate['mock'] = undefined
|
||||
} else if (isObject(value)) {
|
||||
objectTemplate.type = "object"
|
||||
objectTemplate["mock"] = undefined;
|
||||
objectTemplate.type = 'object'
|
||||
objectTemplate['mock'] = undefined
|
||||
}
|
||||
|
||||
return objectTemplate;
|
||||
return objectTemplate
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,142 +1,134 @@
|
||||
export function formatJson (json) {
|
||||
let i = 0,
|
||||
il = 0,
|
||||
tab = " ",
|
||||
newJson = "",
|
||||
indentLevel = 0,
|
||||
inString = false,
|
||||
currentChar = null;
|
||||
let flag = false;
|
||||
export function formatJson(json) {
|
||||
let i = 0
|
||||
let il = 0
|
||||
const tab = ' '
|
||||
let newJson = ''
|
||||
let indentLevel = 0
|
||||
let inString = false
|
||||
let currentChar = null
|
||||
let flag = false
|
||||
for (i = 0, il = json.length; i < il; i += 1) {
|
||||
currentChar = json.charAt(i);
|
||||
currentChar = json.charAt(i)
|
||||
switch (currentChar) {
|
||||
case '{':
|
||||
if (i != 0 && json.charAt(i - 1) === '$') {
|
||||
newJson += currentChar;
|
||||
flag = true;
|
||||
newJson += currentChar
|
||||
flag = true
|
||||
} else if (!inString) {
|
||||
newJson += currentChar + "\n" + repeat(tab, indentLevel + 1);
|
||||
newJson += currentChar + '\n' + repeat(tab, indentLevel + 1)
|
||||
indentLevel += 1
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case '[':
|
||||
if (!inString) {
|
||||
newJson += currentChar + "\n" + repeat(tab, indentLevel + 1);
|
||||
newJson += currentChar + '\n' + repeat(tab, indentLevel + 1)
|
||||
indentLevel += 1
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case '}':
|
||||
if (flag) {
|
||||
newJson += currentChar;
|
||||
flag = false;
|
||||
newJson += currentChar
|
||||
flag = false
|
||||
} else if (!inString) {
|
||||
indentLevel -= 1;
|
||||
newJson += "\n" + repeat(tab, indentLevel) + currentChar
|
||||
indentLevel -= 1
|
||||
newJson += '\n' + repeat(tab, indentLevel) + currentChar
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case ']':
|
||||
if (!inString) {
|
||||
indentLevel -= 1;
|
||||
newJson += "\n" + repeat(tab, indentLevel) + currentChar
|
||||
indentLevel -= 1
|
||||
newJson += '\n' + repeat(tab, indentLevel) + currentChar
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case ',':
|
||||
if (!inString) {
|
||||
newJson += ",\n" + repeat(tab, indentLevel)
|
||||
newJson += ',\n' + repeat(tab, indentLevel)
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case ':':
|
||||
if (!inString) {
|
||||
newJson += ": "
|
||||
newJson += ': '
|
||||
} else {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case ' ':
|
||||
case "\n":
|
||||
case "\t":
|
||||
case '\n':
|
||||
case '\t':
|
||||
if (inString) {
|
||||
newJson += currentChar
|
||||
}
|
||||
break;
|
||||
break
|
||||
case '"':
|
||||
if (i > 0 && json.charAt(i - 1) !== '\\') {
|
||||
inString = !inString
|
||||
}
|
||||
newJson += currentChar;
|
||||
break;
|
||||
newJson += currentChar
|
||||
break
|
||||
default:
|
||||
newJson += currentChar;
|
||||
newJson += currentChar
|
||||
break
|
||||
}
|
||||
}
|
||||
return newJson;
|
||||
return newJson
|
||||
}
|
||||
|
||||
function repeat(s, count) {
|
||||
return new Array(count + 1).join(s)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function formatXml(text) {
|
||||
//去掉多余的空格
|
||||
text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
|
||||
return name + ' ' + props.replace(/\s+(\w+=)/g, " $1");
|
||||
});
|
||||
//把注释编码
|
||||
text = text.replace(/<!--(.+?)-->/g, function ($0, text) {
|
||||
var ret = '<!--' + escape(text) + '-->';
|
||||
//alert(ret);
|
||||
return ret;
|
||||
});
|
||||
//调整格式
|
||||
var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/mg;
|
||||
var nodeStack = [];
|
||||
var output = text.replace(rgx, function ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
|
||||
var isClosed = (isCloseFull1 == '/') || (isCloseFull2 == '/' ) || (isFull1 == '/') || (isFull2 == '/');
|
||||
//alert([all,isClosed].join('='));
|
||||
var prefix = '';
|
||||
// 去掉多余的空格
|
||||
text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function($0, name, props) {
|
||||
return name + ' ' + props.replace(/\s+(\w+=)/g, ' $1')
|
||||
})
|
||||
// 把注释编码
|
||||
text = text.replace(/<!--(.+?)-->/g, function($0, text) {
|
||||
var ret = '<!--' + escape(text) + '-->'
|
||||
return ret
|
||||
})
|
||||
// 调整格式
|
||||
var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/mg
|
||||
var nodeStack = []
|
||||
var output = text.replace(rgx, function($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
|
||||
var isClosed = (isCloseFull1 == '/') || (isCloseFull2 == '/') || (isFull1 == '/') || (isFull2 == '/')
|
||||
var prefix = ''
|
||||
if (isBegin == '!') {
|
||||
prefix = getPrefix(nodeStack.length);
|
||||
}
|
||||
else {
|
||||
prefix = getPrefix(nodeStack.length)
|
||||
} else {
|
||||
if (isBegin != '/') {
|
||||
prefix = getPrefix(nodeStack.length);
|
||||
prefix = getPrefix(nodeStack.length)
|
||||
if (!isClosed) {
|
||||
nodeStack.push(name);
|
||||
nodeStack.push(name)
|
||||
}
|
||||
}
|
||||
else {
|
||||
nodeStack.pop();
|
||||
prefix = getPrefix(nodeStack.length);
|
||||
} else {
|
||||
nodeStack.pop()
|
||||
prefix = getPrefix(nodeStack.length)
|
||||
}
|
||||
}
|
||||
var ret = '\n' + prefix + all;
|
||||
return ret;
|
||||
});
|
||||
var prefixSpace = -1;
|
||||
var outputText = output.substring(1);
|
||||
//把注释还原并解码,调格式
|
||||
outputText = outputText.replace(/(\s*)<!--(.+?)-->/g, function ($0, prefix, text) {
|
||||
if (prefix.charAt(0) == '\r')
|
||||
prefix = prefix.substring(1);
|
||||
text = unescape(text).replace(/\r/g, '\n');
|
||||
var ret = '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->';
|
||||
//alert(ret);
|
||||
return ret;
|
||||
});
|
||||
return outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n');
|
||||
var ret = '\n' + prefix + all
|
||||
return ret
|
||||
})
|
||||
var prefixSpace = -1
|
||||
var outputText = output.substring(1)
|
||||
// 把注释还原并解码,调格式
|
||||
outputText = outputText.replace(/(\s*)<!--(.+?)-->/g, function($0, prefix, text) {
|
||||
if (prefix.charAt(0) == '\r') { prefix = prefix.substring(1) }
|
||||
text = unescape(text).replace(/\r/g, '\n')
|
||||
var ret = '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->'
|
||||
return ret
|
||||
})
|
||||
return outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,17 +138,17 @@ export function formatXml(text) {
|
||||
* @example formatTime('2018-1-29', '{y}/{m}/{d} {h}:{i}:{s}') // -> 2018/01/29 00:00:00
|
||||
*/
|
||||
export function formatTime(time, cFormat) {
|
||||
if (arguments.length === 0) return null;
|
||||
if (arguments.length === 0) return null
|
||||
if ((time + '').length === 10) {
|
||||
time = +time * 1000;
|
||||
time = +time * 1000
|
||||
}
|
||||
let format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}', date;
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'; let date
|
||||
if (typeof time === 'object') {
|
||||
date = time;
|
||||
date = time
|
||||
} else {
|
||||
date = new Date(time);
|
||||
date = new Date(time)
|
||||
}
|
||||
let formatObj = {
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
@ -164,22 +156,22 @@ export function formatTime(time, cFormat) {
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
};
|
||||
}
|
||||
return format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
let value = formatObj[key];
|
||||
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1];
|
||||
let value = formatObj[key]
|
||||
if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value;
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0;
|
||||
});
|
||||
return value || 0
|
||||
})
|
||||
}
|
||||
|
||||
function getPrefix(prefixIndex) {
|
||||
var span = ' ';
|
||||
var output = [];
|
||||
var span = ' '
|
||||
var output = []
|
||||
for (var i = 0; i < prefixIndex; ++i) {
|
||||
output.push(span);
|
||||
output.push(span)
|
||||
}
|
||||
return output.join('');
|
||||
return output.join('')
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ export default {
|
||||
text-align: right;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
justify-content: flex-end;
|
||||
|
||||
.el-input--medium .el-input__icon {
|
||||
line-height: 32px;
|
||||
|
@ -361,7 +361,7 @@ export default {
|
||||
this.create();
|
||||
return;
|
||||
}
|
||||
const { deptId:id, deptName:label } = row.dept;
|
||||
const { deptId:id, deptName:label } = (row.dept || {});
|
||||
this.selectDepts = [{id, label}]
|
||||
this.formType = "modify";
|
||||
this.dialogVisible = true;
|
||||
|
Loading…
Reference in New Issue
Block a user