bri-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/lib/.DS_Store +0 -0
- package/lib/0.bri-components.min.js +2 -0
- package/lib/0.bri-components.min.js.map +1 -0
- package/lib/1.bri-components.min.js +2 -0
- package/lib/1.bri-components.min.js.map +1 -0
- package/lib/2.bri-components.min.js +2 -0
- package/lib/2.bri-components.min.js.map +1 -0
- package/lib/3.bri-components.min.js +2 -0
- package/lib/3.bri-components.min.js.gz +0 -0
- package/lib/3.bri-components.min.js.map +1 -0
- package/lib/4.bri-components.min.js +2 -0
- package/lib/4.bri-components.min.js.gz +0 -0
- package/lib/4.bri-components.min.js.map +1 -0
- package/lib/5.bri-components.min.js +2 -0
- package/lib/5.bri-components.min.js.map +1 -0
- package/lib/6.bri-components.min.js +2 -0
- package/lib/6.bri-components.min.js.map +1 -0
- package/lib/bri-components.min.js +21 -0
- package/lib/bri-components.min.js.gz +0 -0
- package/lib/bri-components.min.js.map +1 -0
- package/lib/styles/bri-components.css +1 -0
- package/lib/styles/bundle.css +14 -0
- package/lib/styles/font/fontello.eot +0 -0
- package/lib/styles/font/fontello.svg +32 -0
- package/lib/styles/font/fontello.ttf +0 -0
- package/lib/styles/font/fontello.woff +0 -0
- package/lib/styles/font/fontello.woff2 +0 -0
- package/package.json +121 -0
- package/src/.DS_Store +0 -0
- package/src/components/controls/base/DshBack.vue +36 -0
- package/src/components/controls/base/DshCascader.vue +366 -0
- package/src/components/controls/base/DshCascaderMultiple.vue +158 -0
- package/src/components/controls/base/DshCheckbox.vue +199 -0
- package/src/components/controls/base/DshCoordinates.vue +497 -0
- package/src/components/controls/base/DshDate.vue +148 -0
- package/src/components/controls/base/DshDaterange.vue +335 -0
- package/src/components/controls/base/DshDivider.vue +59 -0
- package/src/components/controls/base/DshEditor.vue +166 -0
- package/src/components/controls/base/DshInput.vue +139 -0
- package/src/components/controls/base/DshLabels.vue +302 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +425 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -0
- package/src/components/controls/base/DshNumber/DshNumber.vue +148 -0
- package/src/components/controls/base/DshNumberange.vue +137 -0
- package/src/components/controls/base/DshPackage.vue +72 -0
- package/src/components/controls/base/DshSelect.vue +231 -0
- package/src/components/controls/base/DshSwitch.vue +112 -0
- package/src/components/controls/base/DshUndeveloped.vue +39 -0
- package/src/components/controls/base/YSerialNumber.vue +37 -0
- package/src/components/controls/base/ZUpload/YUploadImage.vue +228 -0
- package/src/components/controls/base/ZUpload/index.vue +356 -0
- package/src/components/controls/base/ZUpload/upload-list.vue +277 -0
- package/src/components/controls/base/ZUpload/upload-listItem.vue +0 -0
- package/src/components/controls/base/ZUpload/uploadMixin.js +397 -0
- package/src/components/controls/base/selectMixin.js +110 -0
- package/src/components/controls/base/textMultiple/DshTextMultiple.vue +94 -0
- package/src/components/controls/base/textMultiple/MultipleInput.vue +106 -0
- package/src/components/controls/controlMap.js +94 -0
- package/src/components/controls/controlMixin.js +84 -0
- package/src/components/form/DshAdvSearchForm.vue +341 -0
- package/src/components/form/DshDefaultSearch.vue +203 -0
- package/src/components/form/DshForm.vue +364 -0
- package/src/components/form/searchMixin.js +205 -0
- package/src/components/list/DshBox/DshBox.vue +168 -0
- package/src/components/list/DshBox/DshCard.vue +219 -0
- package/src/components/list/DshBox/DshCrossTable.vue +624 -0
- package/src/components/list/DshBox/DshList.vue +442 -0
- package/src/components/list/DshBox/DshPanel.vue +407 -0
- package/src/components/list/DshBox/DshSingleData.vue +82 -0
- package/src/components/list/DshBox/DshTable.vue +273 -0
- package/src/components/list/DshCascaderTable.vue +817 -0
- package/src/components/list/DshFlatTable.vue +622 -0
- package/src/components/list/ZTree.vue +527 -0
- package/src/components/list/easyTable/index.js +23 -0
- package/src/components/list/easyTable/src/directives/clickoutside.js +32 -0
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +62 -0
- package/src/components/list/easyTable/src/settings/settings.js +11 -0
- package/src/components/list/easyTable/src/utils/deepClone.js +256 -0
- package/src/components/list/easyTable/src/utils/dom.js +41 -0
- package/src/components/list/easyTable/src/utils/utils.js +190 -0
- package/src/components/list/easyTable/v-checkbox/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +127 -0
- package/src/components/list/easyTable/v-checkbox-group/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +68 -0
- package/src/components/list/easyTable/v-dropdown/index.js +7 -0
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +337 -0
- package/src/components/list/easyTable/v-table/index.js +7 -0
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +141 -0
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +102 -0
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +189 -0
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +56 -0
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +202 -0
- package/src/components/list/easyTable/v-table/src/export-csv.js +74 -0
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +134 -0
- package/src/components/list/easyTable/v-table/src/loading.vue +49 -0
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +21 -0
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +92 -0
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +108 -0
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +73 -0
- package/src/components/list/easyTable/v-table/src/table-empty.vue +66 -0
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +126 -0
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +122 -0
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +279 -0
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +123 -0
- package/src/components/list/easyTable/v-table/src/table.vue +1565 -0
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +115 -0
- package/src/components/list/evTable/EvTable.vue +323 -0
- package/src/components/list/evTable/EvTableMixin.js +26 -0
- package/src/components/other/DshAvatar.vue +149 -0
- package/src/components/other/DshBtnModal.vue +64 -0
- package/src/components/other/DshColorPanel.vue +128 -0
- package/src/components/other/DshEditPanel.vue +130 -0
- package/src/components/other/InfoCascader.vue +258 -0
- package/src/components/other/YNoPermission.vue +45 -0
- package/src/components/other/ZCode.vue +125 -0
- package/src/components/other/ZCollapseTree.vue +84 -0
- package/src/components/other/ZGantt.vue +669 -0
- package/src/components/other/ZIframe.vue +105 -0
- package/src/components/other/ZLoading.vue +59 -0
- package/src/components/other/menu/DshMenu.vue +133 -0
- package/src/components/other/menu/DshMenuNav.vue +104 -0
- package/src/components/pages/Error/Error403.vue +34 -0
- package/src/components/pages/Error/Error404.vue +34 -0
- package/src/components/pages/Error/Error500.vue +34 -0
- package/src/components/pages/Error/error.less +163 -0
- package/src/components/pages/Error/errorBack.vue +38 -0
- package/src/components/small/Ctooltip.vue +90 -0
- package/src/components/small/DshButtons.vue +195 -0
- package/src/components/small/DshControlDefine.vue +110 -0
- package/src/components/small/DshCrumbs.vue +61 -0
- package/src/components/small/DshCrumbsItem.vue +107 -0
- package/src/components/small/DshDropdown.vue +159 -0
- package/src/components/small/DshFileShow.vue +212 -0
- package/src/components/small/DshIcons.vue +63 -0
- package/src/components/small/DshModal.vue +255 -0
- package/src/components/small/DshPage.vue +98 -0
- package/src/components/small/DshSteps.vue +68 -0
- package/src/components/small/DshTabs.vue +227 -0
- package/src/components/small/DshTags.vue +58 -0
- package/src/components/small/DshTdRender.js +21 -0
- package/src/components/small/DshTitle.vue +36 -0
- package/src/components/small/render.js +20 -0
- package/src/components/unit/DshFormItem.vue +157 -0
- package/src/components/unit/DshUnit.vue +72 -0
- package/src/components/unit/unitMixin.js +43 -0
- package/src/datas/.DS_Store +0 -0
- package/src/datas/common/region.json +1 -0
- package/src/datas/common/resourceData.json +20 -0
- package/src/datas/index.js +11 -0
- package/src/index.js +243 -0
- package/src/styles/animate.less +16 -0
- package/src/styles/bundle.css +14 -0
- package/src/styles/common/box.less +157 -0
- package/src/styles/common/common.less +31 -0
- package/src/styles/common/flex.less +282 -0
- package/src/styles/common/index.less +4 -0
- package/src/styles/common/text.less +43 -0
- package/src/styles/components/controls/DshCascader.less +75 -0
- package/src/styles/components/controls/DshCheckbox.less +156 -0
- package/src/styles/components/controls/DshCoordinates.less +72 -0
- package/src/styles/components/controls/DshDaterange.less +49 -0
- package/src/styles/components/controls/DshDivider.less +115 -0
- package/src/styles/components/controls/DshEditor.less +52 -0
- package/src/styles/components/controls/DshInput.less +40 -0
- package/src/styles/components/controls/DshLabels.less +187 -0
- package/src/styles/components/controls/DshNumberange.less +24 -0
- package/src/styles/components/controls/DshPackage.less +25 -0
- package/src/styles/components/controls/DshSelect.less +172 -0
- package/src/styles/components/controls/MultipleInput.less +55 -0
- package/src/styles/components/controls/ZUpload.less +446 -0
- package/src/styles/components/form/DshAdvSearchForm.less +159 -0
- package/src/styles/components/form/DshDefaultSearch.less +71 -0
- package/src/styles/components/index.less +49 -0
- package/src/styles/components/list/DshCascaderTable.less +113 -0
- package/src/styles/components/list/DshCrossTable.less +175 -0
- package/src/styles/components/list/DshFlatTable.less +98 -0
- package/src/styles/components/list/DshSingleData.less +30 -0
- package/src/styles/components/list/evTable.less +79 -0
- package/src/styles/components/list/evtable/animation.less +141 -0
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +32 -0
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +68 -0
- package/src/styles/components/list/evtable/index.less +5 -0
- package/src/styles/components/list/evtable/v-checkbox.less +167 -0
- package/src/styles/components/list/evtable/v-dropdown.less +235 -0
- package/src/styles/components/list/evtable/v-table.less +334 -0
- package/src/styles/components/list/ivu_reset.less +49 -0
- package/src/styles/components/other/DshEditPanel.less +70 -0
- package/src/styles/components/other/DshMenu.less +37 -0
- package/src/styles/components/other/DshMenuNav.less +82 -0
- package/src/styles/components/other/InfoCascader.less +55 -0
- package/src/styles/components/other/ZCode.less +1 -0
- package/src/styles/components/other/ZCollapseTree.less +62 -0
- package/src/styles/components/other/ZGantt.less +278 -0
- package/src/styles/components/other/ZLoading.less +36 -0
- package/src/styles/components/small/Ctooltip.less +5 -0
- package/src/styles/components/small/DshButtons.less +40 -0
- package/src/styles/components/small/DshControlDefine.less +64 -0
- package/src/styles/components/small/DshDropdown.less +61 -0
- package/src/styles/components/small/DshPage.less +94 -0
- package/src/styles/components/small/DshSteps.less +58 -0
- package/src/styles/components/small/DshTabs.less +82 -0
- package/src/styles/components/small/DshTitle.less +18 -0
- package/src/styles/components/unit/DshFormItem.less +124 -0
- package/src/styles/define.less +374 -0
- package/src/styles/index.less +10 -0
- package/src/styles/reset.less +83 -0
- package/src/styles/variables.less +98 -0
- package/src/styles/view_reset.less +446 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="DshEditor">
|
|
3
|
+
<!-- 有值、无值 可编辑 -->
|
|
4
|
+
<div
|
|
5
|
+
v-if="(value[propsObj._key] && finalCanEdit) || (!value[propsObj._key] && finalCanEdit)"
|
|
6
|
+
class="DshEditor-show"
|
|
7
|
+
:class="commonClass"
|
|
8
|
+
v-show="showType === 'show'"
|
|
9
|
+
v-html="value[propsObj._key]"
|
|
10
|
+
@click="handleEdit"
|
|
11
|
+
></div>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
v-else-if="value[propsObj._key] && !finalCanEdit"
|
|
15
|
+
class="DshEditor-show hb-show-text"
|
|
16
|
+
:class="commonClass"
|
|
17
|
+
v-show="showType === 'show'"
|
|
18
|
+
v-html="value[propsObj._key]"
|
|
19
|
+
@click="handleEdit"
|
|
20
|
+
></div>
|
|
21
|
+
|
|
22
|
+
<div
|
|
23
|
+
v-else
|
|
24
|
+
class="DshEditor-show hb-nodata-text"
|
|
25
|
+
>
|
|
26
|
+
<span>暂无内容</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div
|
|
29
|
+
v-show="showType=='edit'"
|
|
30
|
+
class="DshEditor-wrap"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
ref="toolbar"
|
|
34
|
+
class="toolbar"
|
|
35
|
+
></div>
|
|
36
|
+
<div
|
|
37
|
+
ref="editor"
|
|
38
|
+
class="text"
|
|
39
|
+
></div>
|
|
40
|
+
|
|
41
|
+
<dsh-buttons
|
|
42
|
+
class="DshEditor-wrap-btn"
|
|
43
|
+
:list="$getOperationList(['save'])"
|
|
44
|
+
@click="$dispatchEvent($event)"
|
|
45
|
+
></dsh-buttons>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import controlMixin from "../controlMixin.js";
|
|
52
|
+
import uploadMixin from "./ZUpload/uploadMixin.js";
|
|
53
|
+
import E from "wangeditor";
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: "DshEditor",
|
|
57
|
+
mixins: [controlMixin, uploadMixin],
|
|
58
|
+
props: {},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
editor: null,
|
|
62
|
+
showType: "show",
|
|
63
|
+
operationMap: {
|
|
64
|
+
save: {
|
|
65
|
+
name: "完成",
|
|
66
|
+
type: "save",
|
|
67
|
+
btnType: "primary",
|
|
68
|
+
size: "default",
|
|
69
|
+
event: "save"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
computed: {
|
|
75
|
+
},
|
|
76
|
+
created () {},
|
|
77
|
+
mounted () {
|
|
78
|
+
this.initEditor();
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
initEditor () {
|
|
82
|
+
let that = this;
|
|
83
|
+
let editor = new E(this.$refs.toolbar, this.$refs.editor);
|
|
84
|
+
editor.config.uploadImgShowBase64 = false; // base 64 存储图片
|
|
85
|
+
let url = this.$getRequests(this.computedUrlModule);
|
|
86
|
+
editor.config.uploadImgServer = `${location.origin}${config.apiUrl}${url}`;// 配置服务器端地址(自己更换为自己项目的服务器)
|
|
87
|
+
editor.config.uploadImgHeaders = this.propsObj._headers || { authtoken: sessionStorage.getItem("authtoken") }; // 自定义 header
|
|
88
|
+
editor.config.uploadFileName = "file_stream"; // 后端接受上传文件的参数名
|
|
89
|
+
editor.config.uploadImgMaxSize = 20 * 1024 * 1024; // 将图片大小限制为 20M
|
|
90
|
+
editor.config.uploadImgMaxLength = 1; // 限制一次最多上传 3 张图片
|
|
91
|
+
editor.config.uploadImgTimeout = 3 * 60 * 1000; // 设置超时时间
|
|
92
|
+
// 配置菜单
|
|
93
|
+
editor.config.menus = [
|
|
94
|
+
"head", // 标题
|
|
95
|
+
"bold", // 粗体
|
|
96
|
+
"fontSize", // 字号
|
|
97
|
+
"fontName", // 字体
|
|
98
|
+
"italic", // 斜体
|
|
99
|
+
"underline", // 下划线
|
|
100
|
+
"strikeThrough", // 删除线
|
|
101
|
+
"foreColor", // 文字颜色
|
|
102
|
+
"backColor", // 背景颜色
|
|
103
|
+
"link", // 插入链接
|
|
104
|
+
"list", // 列表
|
|
105
|
+
"justify", // 对齐方式
|
|
106
|
+
"quote", // 引用
|
|
107
|
+
"image", // 插入图片
|
|
108
|
+
"undo", // 撤销
|
|
109
|
+
"redo" // 重复
|
|
110
|
+
];
|
|
111
|
+
editor.config.zIndex = 500;
|
|
112
|
+
editor.config.uploadImgHooks = {
|
|
113
|
+
before: (xhr, editor, files) => {
|
|
114
|
+
editor.config.files = files;
|
|
115
|
+
},
|
|
116
|
+
customInsert: (insertImg, result, editor) => {
|
|
117
|
+
const ossType = result.data && result.data.ossType || "ali-oss";
|
|
118
|
+
editor.config.files.forEach(fileItem => {
|
|
119
|
+
if (ossType === "ali-oss") {
|
|
120
|
+
that.multipartUpload(fileItem, result.data, res => {
|
|
121
|
+
insertImg(res.data.url);
|
|
122
|
+
});
|
|
123
|
+
} else if (ossType === "local") {
|
|
124
|
+
that.localUpload(fileItem, result.data, res => {
|
|
125
|
+
insertImg(res.url);
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
console.log(`请开发这种类型‘${ossType}’的上传模式`);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
editor.config.onchange = (html) => {
|
|
134
|
+
if (this.value[this.propsObj._key] !== html) {
|
|
135
|
+
this.value[this.propsObj._key] = html;
|
|
136
|
+
this.change();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// 创建富文本编辑器
|
|
140
|
+
editor.create();
|
|
141
|
+
if (!this.finalCanEdit)editor.disable();
|
|
142
|
+
this.editor = editor;
|
|
143
|
+
},
|
|
144
|
+
handleEdit () {
|
|
145
|
+
if (this.finalCanEdit) {
|
|
146
|
+
this.editor.txt.html(this.value[this.propsObj._key]);
|
|
147
|
+
this.showType = "edit";
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
save () {
|
|
151
|
+
this.showType = "show";
|
|
152
|
+
},
|
|
153
|
+
// 插入代码
|
|
154
|
+
insertHTML (value) {
|
|
155
|
+
// let tempNode = document.createElement("span");
|
|
156
|
+
// tempNode.innerHTML = value;
|
|
157
|
+
// document.body.appendChild(tempNode);
|
|
158
|
+
// html2canvas(tempNode).then(canvas => {
|
|
159
|
+
// this.editor.cmd.do("insertHTML", canvas);
|
|
160
|
+
// document.body.removeChild(tempNode);
|
|
161
|
+
// });
|
|
162
|
+
this.editor.cmd.do("insertHTML", value);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
</script>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`DshInput ycFormItem control-${mode}`">
|
|
3
|
+
<Input
|
|
4
|
+
v-if="finalCanEdit"
|
|
5
|
+
:class="{
|
|
6
|
+
'DshInput-readonly': $isReadonly(canEdit, selfPropsObj),
|
|
7
|
+
'DshInput-disabled': $isDisabled(canEdit, selfPropsObj)
|
|
8
|
+
}"
|
|
9
|
+
v-model="value[controlKey]"
|
|
10
|
+
:type="inputType"
|
|
11
|
+
:placeholder="selfPropsObj._placeholder"
|
|
12
|
+
:disabled="!finalCanEdit"
|
|
13
|
+
:clearable="selfPropsObj._clearable"
|
|
14
|
+
:size="selfPropsObj._size"
|
|
15
|
+
:rows="selfPropsObj._rows"
|
|
16
|
+
:search="selfPropsObj._search"
|
|
17
|
+
:show-word-limit="selfPropsObj._showWordLimit"
|
|
18
|
+
:maxlength="selfPropsObj._maxlength"
|
|
19
|
+
:autosize="selfPropsObj._autosize"
|
|
20
|
+
@on-enter="onEnter"
|
|
21
|
+
@on-search="onSearch"
|
|
22
|
+
@on-focus="onFocus"
|
|
23
|
+
@on-change="onChange"
|
|
24
|
+
@on-blur="onBlur"
|
|
25
|
+
@on-clear="onClear"
|
|
26
|
+
>
|
|
27
|
+
<span
|
|
28
|
+
v-if="selfPropsObj._prepend"
|
|
29
|
+
slot="prepend"
|
|
30
|
+
>{{ selfPropsObj._prepend }}</span>
|
|
31
|
+
<span
|
|
32
|
+
v-if="selfPropsObj._append"
|
|
33
|
+
slot="append"
|
|
34
|
+
>{{ selfPropsObj._append }}</span>
|
|
35
|
+
</Input>
|
|
36
|
+
|
|
37
|
+
<!-- 查看 和 编辑下无编辑权限 -->
|
|
38
|
+
<p
|
|
39
|
+
v-else-if="subType === 'textarea'"
|
|
40
|
+
:class="[commonClass, showVal ? 'hb-show-text' : 'hb-nodata-text', 'DshInput-textarea-show']"
|
|
41
|
+
>{{ showVal || '暂无内容' }}</p>
|
|
42
|
+
|
|
43
|
+
<Ctooltip
|
|
44
|
+
v-else
|
|
45
|
+
placement="top"
|
|
46
|
+
:transfer="true"
|
|
47
|
+
maxWidth="200"
|
|
48
|
+
:content="showVal"
|
|
49
|
+
:class="{
|
|
50
|
+
'DshInput-notAllowed': mode === 'default',
|
|
51
|
+
'DshInput-ellipsis-readonly': mode === 'default' && $isReadonly(canEdit, selfPropsObj),
|
|
52
|
+
'DshInput-ellipsis-disabled': mode === 'default' && $isDisabled(canEdit, selfPropsObj),
|
|
53
|
+
[commonClass]: true
|
|
54
|
+
}"
|
|
55
|
+
>
|
|
56
|
+
<span
|
|
57
|
+
v-if="showVal"
|
|
58
|
+
class="dsh-ellipsis hb-show-text"
|
|
59
|
+
:class="`control-${mode}-text`"
|
|
60
|
+
>
|
|
61
|
+
{{ showVal }}
|
|
62
|
+
</span>
|
|
63
|
+
<span
|
|
64
|
+
v-else
|
|
65
|
+
class="hb-nodata-text dsh-ellipsis"
|
|
66
|
+
:class="`control-${mode}-text`"
|
|
67
|
+
>
|
|
68
|
+
<span>暂无内容</span>
|
|
69
|
+
</span>
|
|
70
|
+
</Ctooltip>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script>
|
|
75
|
+
import controlMixin from "../controlMixin.js";
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
name: "DshInput",
|
|
79
|
+
mixins: [controlMixin],
|
|
80
|
+
props: {},
|
|
81
|
+
data () {
|
|
82
|
+
return {
|
|
83
|
+
changeStatus: false
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
computed: {
|
|
87
|
+
selfPropsObj () {
|
|
88
|
+
return {
|
|
89
|
+
_showWordLimit: this.propsObj._showWordLimit || (!!this.propsObj._maxlength || this.propsObj._maxlength === 0),
|
|
90
|
+
_autosize: {
|
|
91
|
+
minRows: 2
|
|
92
|
+
},
|
|
93
|
+
...this.propsObj,
|
|
94
|
+
...this.commonDealPropsObj
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
subType () {
|
|
98
|
+
return this.selfPropsObj._type;
|
|
99
|
+
},
|
|
100
|
+
inputType () {
|
|
101
|
+
return ["text", "password", "textarea", "url", "email", "number", "tel"].includes(this.subType)
|
|
102
|
+
? this.subType
|
|
103
|
+
: undefined;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
showVal () {
|
|
107
|
+
return this.value[this.controlKey] || "";
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
created () {},
|
|
111
|
+
methods: {
|
|
112
|
+
onSearch (...params) {
|
|
113
|
+
this.$emit("search", ...params);
|
|
114
|
+
},
|
|
115
|
+
// 无参数
|
|
116
|
+
onFocus () {
|
|
117
|
+
this.changeStatus = false;
|
|
118
|
+
},
|
|
119
|
+
// 无参数
|
|
120
|
+
onBlur () {
|
|
121
|
+
this.$emit("blur");
|
|
122
|
+
if (this.changeStatus === true) {
|
|
123
|
+
this.change();
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
onEnter (event) {
|
|
127
|
+
this.$emit("inputChange");
|
|
128
|
+
},
|
|
129
|
+
// 参数event
|
|
130
|
+
onChange (event) {
|
|
131
|
+
this.$emit("inputChange");
|
|
132
|
+
this.changeStatus = true;
|
|
133
|
+
},
|
|
134
|
+
onClear () {
|
|
135
|
+
this.change();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
</script>
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
<!-- 动态标签 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div
|
|
4
|
+
class="DshLabels"
|
|
5
|
+
ref="dshLabelsRef"
|
|
6
|
+
>
|
|
7
|
+
<!-- 编辑 -->
|
|
8
|
+
<template v-if="canEdit">
|
|
9
|
+
<!-- 编辑区 -->
|
|
10
|
+
<Input
|
|
11
|
+
class="DshLabels-input"
|
|
12
|
+
v-show="status === 'edit'"
|
|
13
|
+
type="text"
|
|
14
|
+
v-model="curVal"
|
|
15
|
+
ref="dshLabelsInput"
|
|
16
|
+
:icon="selfPropsObj._inputIcon"
|
|
17
|
+
:placeholder="selfPropsObj._placeholder"
|
|
18
|
+
:disabled="!finalCanEdit"
|
|
19
|
+
@on-enter="onClick"
|
|
20
|
+
@on-click="onClick"
|
|
21
|
+
@on-change="onChange"
|
|
22
|
+
@on-focus="onChange"
|
|
23
|
+
></Input>
|
|
24
|
+
|
|
25
|
+
<!-- 查看区 -->
|
|
26
|
+
<div
|
|
27
|
+
v-show="status === 'show'"
|
|
28
|
+
:class="{'DshLabels-show':true,'DshLabels-showReadOnly':!finalCanEdit}"
|
|
29
|
+
@click="clickAdd"
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
class="DshLabels-show-content"
|
|
33
|
+
@click="clickAdd"
|
|
34
|
+
>
|
|
35
|
+
<span
|
|
36
|
+
v-for="labelItem in val"
|
|
37
|
+
class="DshLabels-show-content-item"
|
|
38
|
+
:key="labelItem._key"
|
|
39
|
+
>
|
|
40
|
+
<span
|
|
41
|
+
class="DshLabels-show-content-item-content"
|
|
42
|
+
@click.stop="clickEdit(labelItem)"
|
|
43
|
+
:title="labelItem.name"
|
|
44
|
+
>
|
|
45
|
+
{{labelItem.name}}
|
|
46
|
+
</span>
|
|
47
|
+
<Icon
|
|
48
|
+
class="DshLabels-show-content-item-del"
|
|
49
|
+
type="ios-close"
|
|
50
|
+
size="20"
|
|
51
|
+
@click.stop="clickDelete(labelItem)"
|
|
52
|
+
/>
|
|
53
|
+
</span>
|
|
54
|
+
</div>
|
|
55
|
+
<div
|
|
56
|
+
class="DshLabels-show-add"
|
|
57
|
+
v-if="canEdit"
|
|
58
|
+
>
|
|
59
|
+
<Icon
|
|
60
|
+
type="md-create"
|
|
61
|
+
@click="clickAdd"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<!-- 数据选择区:接口依据用户输入返回数据 -->
|
|
68
|
+
<div
|
|
69
|
+
class="DshLabels-searchResult"
|
|
70
|
+
ref="searchResultRef"
|
|
71
|
+
:style="{
|
|
72
|
+
width: getStyle()
|
|
73
|
+
}"
|
|
74
|
+
v-if="ShowTagList"
|
|
75
|
+
>
|
|
76
|
+
<Icon
|
|
77
|
+
type="md-close"
|
|
78
|
+
class="DshLabels-searchResult-close"
|
|
79
|
+
@click="closeTagList"
|
|
80
|
+
/>
|
|
81
|
+
<ul
|
|
82
|
+
class="DshLabels-searchResult-list"
|
|
83
|
+
v-if="list&&list.length>0"
|
|
84
|
+
>
|
|
85
|
+
<li
|
|
86
|
+
v-for="item in list"
|
|
87
|
+
:class="{'selected':item.selected}"
|
|
88
|
+
:key="item._id"
|
|
89
|
+
@click="clickTag(item)"
|
|
90
|
+
>{{ item.name }}
|
|
91
|
+
</li>
|
|
92
|
+
</ul>
|
|
93
|
+
<div
|
|
94
|
+
class="DshLabels-searchResult-nodata"
|
|
95
|
+
v-else
|
|
96
|
+
>
|
|
97
|
+
无匹配数据
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<!-- 查看 -->
|
|
103
|
+
<div
|
|
104
|
+
v-else
|
|
105
|
+
:class="{'DshLabels-view':true,
|
|
106
|
+
'DshLabels-view-readonly': mode === 'default' && $isReadonly(canEdit, selfPropsObj),
|
|
107
|
+
'DshLabels-view-disabled': mode === 'default' && $isDisabled(canEdit, selfPropsObj),
|
|
108
|
+
[commonClass]:true
|
|
109
|
+
}"
|
|
110
|
+
>
|
|
111
|
+
<template v-if="val.length">
|
|
112
|
+
<Tag
|
|
113
|
+
v-for="tagItem in val"
|
|
114
|
+
:key="tagItem._key"
|
|
115
|
+
size="medium"
|
|
116
|
+
class="DshLabels-view-tag"
|
|
117
|
+
>
|
|
118
|
+
{{ tagItem.name }}
|
|
119
|
+
</Tag>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<div
|
|
123
|
+
v-else
|
|
124
|
+
class="DshLabels-view-nodata"
|
|
125
|
+
>
|
|
126
|
+
<span>暂无数据</span>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script>
|
|
133
|
+
import controlMixin from "../controlMixin.js";
|
|
134
|
+
|
|
135
|
+
export default {
|
|
136
|
+
name: "DshLabels",
|
|
137
|
+
mixins: [controlMixin],
|
|
138
|
+
|
|
139
|
+
data () {
|
|
140
|
+
return {
|
|
141
|
+
status: "", // edit/show
|
|
142
|
+
curVal: "",
|
|
143
|
+
curKey: "", // 当前正在修改label的_key
|
|
144
|
+
ShowTagList: false,
|
|
145
|
+
list: []
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
computed: {
|
|
149
|
+
selfPropsObj () {
|
|
150
|
+
return {
|
|
151
|
+
...this.propsObj,
|
|
152
|
+
...this.commonDealPropsObj,
|
|
153
|
+
_inputIcon: !this.propsObj._onlySelect ? "md-add" : ""
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
modKey () {
|
|
157
|
+
return this.propsObj.modKey;
|
|
158
|
+
},
|
|
159
|
+
val: {
|
|
160
|
+
get () {
|
|
161
|
+
return this.value[this.propsObj._key] || [];
|
|
162
|
+
},
|
|
163
|
+
set (val) {
|
|
164
|
+
this.value[this.propsObj._key] = val;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
created () {
|
|
169
|
+
this.init();
|
|
170
|
+
},
|
|
171
|
+
methods: {
|
|
172
|
+
init () {
|
|
173
|
+
this.status = this.canEdit && !this.val.length
|
|
174
|
+
? "edit"
|
|
175
|
+
: "show";
|
|
176
|
+
|
|
177
|
+
},
|
|
178
|
+
// 确认输入
|
|
179
|
+
onClick () {
|
|
180
|
+
if (this.finalCanEdit && !this.selfPropsObj._onlySelect) {
|
|
181
|
+
if (this.curVal.trim().length > 0) {
|
|
182
|
+
this.status = "show";
|
|
183
|
+
let labelItem = {_key: "", name: ""};
|
|
184
|
+
labelItem._key = this.curKey || this.$randomB36("Labels");
|
|
185
|
+
labelItem.name = this.curVal.trim();
|
|
186
|
+
labelItem.labelType = this.selfPropsObj._labelType;
|
|
187
|
+
this.val = this.val.concat([labelItem]);
|
|
188
|
+
this.ShowTagList = false;
|
|
189
|
+
this.change();
|
|
190
|
+
} else {
|
|
191
|
+
this.status = "show";
|
|
192
|
+
this.ShowTagList = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
onChange () {
|
|
197
|
+
this.getListData();
|
|
198
|
+
},
|
|
199
|
+
getListData () {
|
|
200
|
+
this.$https({
|
|
201
|
+
url: {
|
|
202
|
+
module: "sheet",
|
|
203
|
+
name: "memberAll"
|
|
204
|
+
},
|
|
205
|
+
params: {
|
|
206
|
+
search: {
|
|
207
|
+
entityKey: this.entityKey, // 当前工作表关联的数据表Key
|
|
208
|
+
modKey: this.modKey,
|
|
209
|
+
name: this.curVal,
|
|
210
|
+
fieldKey: this.selfPropsObj._key === "_default" ? this.value._key : (this.selfPropsObj.__realKey__ || this.selfPropsObj._key), // 当前字段Key
|
|
211
|
+
labelType: this.selfPropsObj._labelType
|
|
212
|
+
},
|
|
213
|
+
pagination: {
|
|
214
|
+
page: 1,
|
|
215
|
+
pagesize: 999
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
callback: data => {
|
|
219
|
+
// 当前已选择的标签
|
|
220
|
+
let keysArr = this.val.map(item => item._key);
|
|
221
|
+
if (data.list.length > 0) {
|
|
222
|
+
this.list = data.list.map(item => ({
|
|
223
|
+
...item,
|
|
224
|
+
selected: !!keysArr.includes(item._key)
|
|
225
|
+
}));
|
|
226
|
+
} else {
|
|
227
|
+
this.list = [];
|
|
228
|
+
}
|
|
229
|
+
this.ShowTagList = true;
|
|
230
|
+
// this.ShowTagList = !this.ShowTagList;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
clickTag (item) {
|
|
235
|
+
if (this.finalCanEdit) {
|
|
236
|
+
this.status = "show";
|
|
237
|
+
let keysArr = this.val.map(i => i._key);
|
|
238
|
+
if (!keysArr.includes(item._key)) {
|
|
239
|
+
this.val = this.val.concat(this.list.filter(listItem => listItem._key == item._key));
|
|
240
|
+
this.ShowTagList = false;
|
|
241
|
+
this.change();
|
|
242
|
+
} else {
|
|
243
|
+
this.ShowTagList = false;
|
|
244
|
+
this.status = "show";
|
|
245
|
+
this.curVal = "";
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
clickEdit (labelItem) {
|
|
250
|
+
if (this.finalCanEdit) {
|
|
251
|
+
this.status = "edit";
|
|
252
|
+
this.curVal = labelItem.name;
|
|
253
|
+
this.curKey = labelItem._key;
|
|
254
|
+
this.val = this.val.filter(i => i._key != labelItem._key);
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
// 切换为输入框编辑模式
|
|
258
|
+
clickAdd () {
|
|
259
|
+
if (this.finalCanEdit) {
|
|
260
|
+
this.status = "edit";
|
|
261
|
+
this.curVal = "";
|
|
262
|
+
this.$nextTick(() => {
|
|
263
|
+
this.$refs.dshLabelsInput.focus({
|
|
264
|
+
cursor: "start"
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
this.$debounce(this.getListData(), 100);
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
clickDelete (labelItem) {
|
|
272
|
+
if (this.finalCanEdit) {
|
|
273
|
+
this.val = this.val.filter(i => i._key != labelItem._key);
|
|
274
|
+
|
|
275
|
+
if (!this.val.length) {
|
|
276
|
+
this.curVal = "";
|
|
277
|
+
this.status = "edit";
|
|
278
|
+
this.change();
|
|
279
|
+
}
|
|
280
|
+
this.change();
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
closeTagList () {
|
|
284
|
+
this.ShowTagList = false;
|
|
285
|
+
this.status = "show";
|
|
286
|
+
},
|
|
287
|
+
getStyle () {
|
|
288
|
+
this.$nextTick(() => {
|
|
289
|
+
this.$refs.searchResultRef.style.width = `${this.$refs.dshLabelsRef.offsetWidth}px`;
|
|
290
|
+
this.$refs.searchResultRef.style.top = `${this.$refs.dshLabelsRef.getBoundingClientRect().top + 34}px`;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
watch: {
|
|
295
|
+
value (newVal, oldVal) {
|
|
296
|
+
if (newVal !== oldVal) {
|
|
297
|
+
this.init();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
</script>
|