ocpview-plus 0.0.1
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/efviewplus.min.esm.js +99954 -0
- package/dist/efviewplus.min.js +142 -0
- package/dist/locale/lang.js +1 -0
- package/dist/locale/zh-CN.js +1 -0
- package/dist/locale/zh-TW.js +1 -0
- package/dist/locale/zh-UG.js +1 -0
- package/dist/style.css +9 -0
- package/dist/styles/efviewplus.css +1 -0
- package/package.json +144 -0
- package/src/components/base/controlbase.vue +191 -0
- package/src/components/base/controlbox.vue +102 -0
- package/src/components/base/index.js +3 -0
- package/src/components/base/load.js +20 -0
- package/src/components/base/probase.js +220 -0
- package/src/components/base/size.js +78 -0
- package/src/components/billbox/billbox.vue +68 -0
- package/src/components/billbox/index.js +2 -0
- package/src/components/cascaderbox/cascaderbox.vue +184 -0
- package/src/components/cascaderbox/index.js +2 -0
- package/src/components/checkbox/checkbox.vue +76 -0
- package/src/components/checkbox/checkgroupbox.vue +104 -0
- package/src/components/checkbox/index.js +3 -0
- package/src/components/colorbox/colorbox.vue +44 -0
- package/src/components/colorbox/index.js +2 -0
- package/src/components/combobox/combobox.vue +220 -0
- package/src/components/combobox/index.js +2 -0
- package/src/components/conditionbox/conditionbase.vue +195 -0
- package/src/components/conditionbox/conditionbox.vue +63 -0
- package/src/components/conditionbox/conditionfilterbox.vue +477 -0
- package/src/components/conditionbox/conditionselectorbox.vue +237 -0
- package/src/components/conditionbox/index.js +5 -0
- package/src/components/conditionbox/queryconditionbox.vue +26 -0
- package/src/components/conditionbox/queryconditionboxbase.vue +124 -0
- package/src/components/conditionbox/searchconditionbox.vue +114 -0
- package/src/components/conditionbox/searchgrid.vue +391 -0
- package/src/components/datebox/datebox.vue +129 -0
- package/src/components/datebox/daterangebox.vue +155 -0
- package/src/components/datebox/index.js +3 -0
- package/src/components/form/baseform.vue +677 -0
- package/src/components/form/detailsbox.vue +487 -0
- package/src/components/form/formbox.vue +29 -0
- package/src/components/form/formcardbox.vue +268 -0
- package/src/components/form/formcardgroupbox.vue +252 -0
- package/src/components/form/formcompro.js +19 -0
- package/src/components/form/formdetail.vue +129 -0
- package/src/components/form/formdetailtwo.vue +302 -0
- package/src/components/form/index.js +8 -0
- package/src/components/form/toolanchor.js +46 -0
- package/src/components/form/workform.vue +168 -0
- package/src/components/grid/basegrid.vue +1061 -0
- package/src/components/grid/editgrid.vue +51 -0
- package/src/components/grid/editgridbase.vue +947 -0
- package/src/components/grid/editgridcard.vue +193 -0
- package/src/components/grid/expandrow.vue +137 -0
- package/src/components/grid/index.js +6 -0
- package/src/components/grid/viewgrid.vue +122 -0
- package/src/components/grid/viewgridbase.vue +1284 -0
- package/src/components/icon/common-icon.vue +53 -0
- package/src/components/icon/eicon.vue +29 -0
- package/src/components/icon/icons.vue +42 -0
- package/src/components/icon/index.js +2 -0
- package/src/components/label/index.js +3 -0
- package/src/components/label/showtext.vue +95 -0
- package/src/components/load/loadcartoon.vue +228 -0
- package/src/components/map/index.js +2 -0
- package/src/components/map/mapbox.vue +348 -0
- package/src/components/masterplate/appendix.vue +586 -0
- package/src/components/masterplate/approval.vue +803 -0
- package/src/components/masterplate/base.vue +985 -0
- package/src/components/masterplate/billasyncimport.vue +614 -0
- package/src/components/masterplate/billconditionbox.vue +224 -0
- package/src/components/masterplate/billconditionsbox.vue +427 -0
- package/src/components/masterplate/billdetailform.vue +990 -0
- package/src/components/masterplate/billimport.vue +263 -0
- package/src/components/masterplate/billquerygrid.vue +316 -0
- package/src/components/masterplate/billsinglegrid.vue +234 -0
- package/src/components/masterplate/birtreport.vue +185 -0
- package/src/components/masterplate/detailbtntoolbar.vue +311 -0
- package/src/components/masterplate/detailsbox.vue +386 -0
- package/src/components/masterplate/editgridcard.vue +222 -0
- package/src/components/masterplate/editgridcard2.vue +109 -0
- package/src/components/masterplate/formcard.vue +106 -0
- package/src/components/masterplate/formcardgroupbox.vue +168 -0
- package/src/components/masterplate/formdetailtwo.vue +356 -0
- package/src/components/masterplate/gridcolset.vue +227 -0
- package/src/components/masterplate/index.js +23 -0
- package/src/components/masterplate/layouttemplate.vue +33 -0
- package/src/components/masterplate/leftlistrightdetails.vue +474 -0
- package/src/components/masterplate/leftlistrightlist.vue +465 -0
- package/src/components/masterplate/lefttreerightdetails.vue +619 -0
- package/src/components/masterplate/levelreport.vue +510 -0
- package/src/components/masterplate/listbtntoolbar.vue +257 -0
- package/src/components/masterplate/listdetails.vue +769 -0
- package/src/components/masterplate/operlog.vue +272 -0
- package/src/components/masterplate/options.vue +110 -0
- package/src/components/masterplate/page.vue +102 -0
- package/src/components/masterplate/promptmessage.vue +74 -0
- package/src/components/masterplate/querybar.vue +490 -0
- package/src/components/masterplate/report.vue +357 -0
- package/src/components/masterplate/rowbtntoolbar.vue +126 -0
- package/src/components/masterplate/simpletree.vue +129 -0
- package/src/components/masterplate/simpleviewgrid.vue +144 -0
- package/src/components/mychart/bar/bar.vue +202 -0
- package/src/components/mychart/basechart.vue +190 -0
- package/src/components/mychart/complexmychart/barline.vue +154 -0
- package/src/components/mychart/gauge/gauge.vue +83 -0
- package/src/components/mychart/index.js +9 -0
- package/src/components/mychart/line/line.vue +202 -0
- package/src/components/mychart/liquidfill/liquidfill.vue +109 -0
- package/src/components/mychart/pie/pie.vue +96 -0
- package/src/components/mychart/radar/radar.vue +122 -0
- package/src/components/mychart/scatter/scatter.vue +76 -0
- package/src/components/numberbox/append.js +11 -0
- package/src/components/numberbox/index.js +3 -0
- package/src/components/numberbox/numberbox.vue +303 -0
- package/src/components/numberbox/numberrangebox.vue +423 -0
- package/src/components/picturebox/filebox.vue +365 -0
- package/src/components/picturebox/index.js +3 -0
- package/src/components/picturebox/picturebox.vue +541 -0
- package/src/components/picturebox/uploadbox.vue +164 -0
- package/src/components/poptagbox/index.js +2 -0
- package/src/components/poptagbox/poptagbox.vue +389 -0
- package/src/components/poptextbox/index.js +2 -0
- package/src/components/poptextbox/poptextbox.vue +601 -0
- package/src/components/radiobox/index.js +2 -0
- package/src/components/radiobox/radiogroupbox.vue +76 -0
- package/src/components/richtextbox/editor.vue +150 -0
- package/src/components/richtextbox/index.js +2 -0
- package/src/components/richtextbox/richtextbox.vue +448 -0
- package/src/components/textbox/index.js +2 -0
- package/src/components/textbox/textbox.vue +98 -0
- package/src/components/timebox/index.js +2 -0
- package/src/components/timebox/timebox.vue +76 -0
- package/src/components/toolbar/ebutton.vue +169 -0
- package/src/components/toolbar/index.js +3 -0
- package/src/components/toolbar/toolbar.vue +446 -0
- package/src/components/tree/basetree.vue +725 -0
- package/src/components/tree/index.js +3 -0
- package/src/components/tree/treedata.vue +51 -0
- package/src/components/tree/treedatabase.vue +189 -0
- package/src/components/upload/billimport.vue +233 -0
- package/src/components/upload/index.js +2 -0
- package/src/components/videobox/index.js +2 -0
- package/src/components/videobox/uploadbox.vue +148 -0
- package/src/components/videobox/videobox.vue +503 -0
- package/src/components/wrichtextbox/editor.vue +219 -0
- package/src/components/wrichtextbox/index.js +2 -0
- package/src/components/wrichtextbox/wrichtextbox.vue +63 -0
- package/src/index.js +215 -0
- package/src/locale/format.js +51 -0
- package/src/locale/index.js +63 -0
- package/src/locale/lang/zh-CN.js +123 -0
- package/src/locale/lang/zh-TW.js +114 -0
- package/src/locale/lang/zh-UG.js +115 -0
- package/src/locale/lang.js +15 -0
- package/src/method/case/case.js +1180 -0
- package/src/method/config/queryconfig.js +24 -0
- package/src/method/const/const.js +815 -0
- package/src/method/index.js +8 -0
- package/src/static/excel/exportexcel.js +627 -0
- package/src/static/iview/coustom.js +463 -0
- package/src/store/index.js +19 -0
- package/src/store/modules/app.js +53 -0
- package/src/styles/README.md +3 -0
- package/src/styles/common.less +75 -0
- package/src/styles/components/anchor.less +74 -0
- package/src/styles/components/approval.less +136 -0
- package/src/styles/components/button.less +208 -0
- package/src/styles/components/card.less +51 -0
- package/src/styles/components/content.less +38 -0
- package/src/styles/components/font.less +314 -0
- package/src/styles/components/form.less +72 -0
- package/src/styles/components/iconfont/fonts/iconfont.less +1376 -0
- package/src/styles/components/iconfont/fonts/iconfont.svg +699 -0
- package/src/styles/components/iconfont/fonts/iconfont.ttf +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff +0 -0
- package/src/styles/components/iconfont/fonts/iconfont.woff2 +0 -0
- package/src/styles/components/index.less +16 -0
- package/src/styles/components/input.less +290 -0
- package/src/styles/components/modal.less +203 -0
- package/src/styles/components/page.less +340 -0
- package/src/styles/components/select.less +361 -0
- package/src/styles/components/steps.less +367 -0
- package/src/styles/components/table.less +544 -0
- package/src/styles/components/tabs.less +249 -0
- package/src/styles/components/upload.less +83 -0
- package/src/styles/custom.less +67 -0
- package/src/styles/index.less +6 -0
- package/src/styles/pack.less +6 -0
- package/src/utils/EfuMessenger.js +155 -0
- package/src/utils/assist.js +353 -0
- package/src/utils/index.js +1 -0
- package/src/utils/random_str.js +10 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
<style lang="less">
|
|
2
|
+
.vertical-center-modal{
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
.ivu-modal{
|
|
8
|
+
top: 0;
|
|
9
|
+
.ivu-modal-content {
|
|
10
|
+
.ivu-modal-body {
|
|
11
|
+
padding:0px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
</style>
|
|
18
|
+
<template>
|
|
19
|
+
<div>
|
|
20
|
+
<Modal v-model="modalSearch" :width="900" title="高级查询" class-name="vertical-center-modal" :footer-hide="true">
|
|
21
|
+
<div style="padding:10px">
|
|
22
|
+
<Row type="flex" :gutter="10" justify="start" align="middle">
|
|
23
|
+
<Col>
|
|
24
|
+
<Button icon="ios-add" type="primary" @click="addCondition">新建</Button>
|
|
25
|
+
</Col>
|
|
26
|
+
<Col>
|
|
27
|
+
<Button icon="ios-remove" type="primary" @click="delCondition">删除</Button>
|
|
28
|
+
</Col>
|
|
29
|
+
<Col>
|
|
30
|
+
<Button icon="ios-close" type="primary" @click="clearCondition">清空</Button>
|
|
31
|
+
</Col>
|
|
32
|
+
<Col>
|
|
33
|
+
<Button icon="ios-redo-outline" style="float:right;" @click="backCondition">取消</Button>
|
|
34
|
+
</Col>
|
|
35
|
+
<Col>
|
|
36
|
+
<Button icon="ios-search" style="float:right;margin-right:5px;" type="primary" @click="searchCondition">确定查询</Button>
|
|
37
|
+
</Col>
|
|
38
|
+
</Row>
|
|
39
|
+
<EditGrid ref="grid" :config="gridConfig" :dictData="dictData">
|
|
40
|
+
</EditGrid>
|
|
41
|
+
</div>
|
|
42
|
+
</Modal>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</template>
|
|
47
|
+
<script>
|
|
48
|
+
export default {
|
|
49
|
+
name:'searchgrid',
|
|
50
|
+
data () {
|
|
51
|
+
return {
|
|
52
|
+
myConfig:{},
|
|
53
|
+
searchDictData:{},
|
|
54
|
+
modalSearch:false,
|
|
55
|
+
gridConfig:{
|
|
56
|
+
showAddBtn:false,
|
|
57
|
+
showDelBatchBtn:false,
|
|
58
|
+
showDelRow:true,
|
|
59
|
+
showCheckBox:true,
|
|
60
|
+
showIndex:false,
|
|
61
|
+
height:0.5,
|
|
62
|
+
cellbeginedit:this.cellbeginedit,
|
|
63
|
+
items:[ {
|
|
64
|
+
label:'左括号',
|
|
65
|
+
name:'bracket_left',
|
|
66
|
+
type:'ComboBox',
|
|
67
|
+
width:80,
|
|
68
|
+
align:'center',
|
|
69
|
+
codeWithName:false,
|
|
70
|
+
data:[{code:'1',name:'('},{code:'2',name:'(('}]
|
|
71
|
+
},{
|
|
72
|
+
label:'条件字段',
|
|
73
|
+
name:'field',
|
|
74
|
+
type:'ComboBox',
|
|
75
|
+
codeWithName:false,
|
|
76
|
+
align:'center',
|
|
77
|
+
contentAlign:'left',
|
|
78
|
+
dictkey:'FIELD'
|
|
79
|
+
}, {
|
|
80
|
+
label:'运算',
|
|
81
|
+
name:'calculator',
|
|
82
|
+
type:'ComboBox',
|
|
83
|
+
width:100,
|
|
84
|
+
align:'center',
|
|
85
|
+
codeWithName:false,
|
|
86
|
+
clearable:false,
|
|
87
|
+
data:[{
|
|
88
|
+
name: '等于',
|
|
89
|
+
code: '=='
|
|
90
|
+
}, {
|
|
91
|
+
name: '大于',
|
|
92
|
+
code: '>'
|
|
93
|
+
}, {
|
|
94
|
+
name: '大于等于',
|
|
95
|
+
code: '>='
|
|
96
|
+
}, {
|
|
97
|
+
name: '小于',
|
|
98
|
+
code: '<'
|
|
99
|
+
}, {
|
|
100
|
+
name: '小于等于',
|
|
101
|
+
code: '<='
|
|
102
|
+
}, {
|
|
103
|
+
name: '不等于',
|
|
104
|
+
code: '<>'
|
|
105
|
+
}, {
|
|
106
|
+
name: '包含',
|
|
107
|
+
code: 'LIKE'
|
|
108
|
+
}],
|
|
109
|
+
defaultValue:'=='
|
|
110
|
+
}, {
|
|
111
|
+
label:'条件值',
|
|
112
|
+
name:'editors',
|
|
113
|
+
type:'TextBox',
|
|
114
|
+
align:'center',
|
|
115
|
+
contentAlign:'left',
|
|
116
|
+
updateCellConfig:this.updateCellConfig
|
|
117
|
+
},{
|
|
118
|
+
label:'右括号',
|
|
119
|
+
name:'bracket_right',
|
|
120
|
+
type:'ComboBox',
|
|
121
|
+
width:80,
|
|
122
|
+
align:'center',
|
|
123
|
+
codeWithName:false,
|
|
124
|
+
data:[{code:'1',name:')'},{code:'2',name:'))'}]
|
|
125
|
+
},{
|
|
126
|
+
label:'关系',
|
|
127
|
+
name:'relationship',
|
|
128
|
+
type:'ComboBox',
|
|
129
|
+
width:80,
|
|
130
|
+
align:'center',
|
|
131
|
+
codeWithName:false,
|
|
132
|
+
clearable:false,
|
|
133
|
+
data:[{code:'1',name:'且'},{code:'2',name:'或'}]
|
|
134
|
+
}]
|
|
135
|
+
},
|
|
136
|
+
initData:[],
|
|
137
|
+
condition:[],
|
|
138
|
+
bracket:[],
|
|
139
|
+
bracketLeft:0,
|
|
140
|
+
bracketRight:0
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
props: {
|
|
144
|
+
config: {
|
|
145
|
+
type: Object,
|
|
146
|
+
default: () => {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
dictData: {
|
|
151
|
+
type: Object,
|
|
152
|
+
default:null
|
|
153
|
+
},
|
|
154
|
+
dataType: {
|
|
155
|
+
type: Object,
|
|
156
|
+
default:null
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
created() {
|
|
160
|
+
this.init();
|
|
161
|
+
},
|
|
162
|
+
methods: {
|
|
163
|
+
init() {
|
|
164
|
+
this.myConfig = this.$Method.copy(this.config);
|
|
165
|
+
for (let i=0;i<6;i++) {
|
|
166
|
+
let obj = {};
|
|
167
|
+
obj.relationship = '1';
|
|
168
|
+
obj.field = '';
|
|
169
|
+
obj.calculator = '==';
|
|
170
|
+
obj.editors = '';
|
|
171
|
+
obj.bracket_left = '';
|
|
172
|
+
obj.bracket_right = '';
|
|
173
|
+
this.initData.push(obj);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
updateCellConfig(obj) {
|
|
177
|
+
let field = obj.row.field;
|
|
178
|
+
let itemConfig = Object.assign({},obj.column,this.dataType[field]);
|
|
179
|
+
itemConfig.name = 'editors';
|
|
180
|
+
if (itemConfig.readOnly) {
|
|
181
|
+
delete itemConfig.readOnly;
|
|
182
|
+
}
|
|
183
|
+
if (!itemConfig.visible) {
|
|
184
|
+
delete itemConfig.visible;
|
|
185
|
+
}
|
|
186
|
+
return itemConfig;
|
|
187
|
+
|
|
188
|
+
},
|
|
189
|
+
cellbeginedit (obj) {
|
|
190
|
+
let field = obj.column.key;
|
|
191
|
+
let record = obj.row;
|
|
192
|
+
if (field === 'editors') {
|
|
193
|
+
if (!record.field) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
},
|
|
199
|
+
addCondition() {
|
|
200
|
+
this.$refs.grid.addRow();
|
|
201
|
+
},
|
|
202
|
+
delCondition() {
|
|
203
|
+
this.$refs.grid.delBatchRow();
|
|
204
|
+
},
|
|
205
|
+
clearCondition() {
|
|
206
|
+
this.condition = [];
|
|
207
|
+
let data = this.$Method.copy(this.initData);
|
|
208
|
+
this.$refs.grid.setData(data);
|
|
209
|
+
},
|
|
210
|
+
getResultCondition() {
|
|
211
|
+
let obj = {};
|
|
212
|
+
if (this.condition.length > 0) {
|
|
213
|
+
if (this.condition.length === 1) {
|
|
214
|
+
obj = Object.assign({}, obj, this.condition[0].condition);
|
|
215
|
+
} else {
|
|
216
|
+
if (this.bracket.length > 0) {
|
|
217
|
+
let last = this.bracket.length -1;
|
|
218
|
+
obj['$and'] = [];
|
|
219
|
+
this.createCondition(last, obj['$and']);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return obj;
|
|
224
|
+
},
|
|
225
|
+
searchCondition() {
|
|
226
|
+
this.condition = [];
|
|
227
|
+
if (!this.checkCondition()){
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.modalSearch = false;
|
|
231
|
+
this.$emit('search', this.getResultCondition());
|
|
232
|
+
},
|
|
233
|
+
createCondition(index, obj) {
|
|
234
|
+
if (index >= 0) {
|
|
235
|
+
let tempObj = {};
|
|
236
|
+
let list = [];
|
|
237
|
+
let str = this.bracket[index];
|
|
238
|
+
let oper = '$or';
|
|
239
|
+
if (str.indexOf('$and') !== -1) {
|
|
240
|
+
oper = '$and';
|
|
241
|
+
}
|
|
242
|
+
list = str.split(oper);
|
|
243
|
+
if (list.length > 0) {
|
|
244
|
+
tempObj[oper] = [];
|
|
245
|
+
list.forEach(el => {
|
|
246
|
+
if (el) {
|
|
247
|
+
let temp = el.split('_');
|
|
248
|
+
tempObj[oper].push(this.condition[Number(temp[1])].condition);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (index -1 >= 0) {
|
|
253
|
+
this.createCondition(index-1,tempObj[oper]);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
obj.push(tempObj);
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
checkCondition() {
|
|
261
|
+
this.bracketLeft = 0;
|
|
262
|
+
this.bracketRight = 0;
|
|
263
|
+
let data = this.$refs.grid.getData();
|
|
264
|
+
let result = [];
|
|
265
|
+
|
|
266
|
+
if (data && data.length > 0) {
|
|
267
|
+
for (let i=0;i<data.length;i++) {
|
|
268
|
+
if (data[i].bracket_left || data[i].bracket_right) {
|
|
269
|
+
if (!data[i].field) {
|
|
270
|
+
this.alert('第'+(i+1)+'行的条件字段为空,请检查');
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
if (!data[i].editors) {
|
|
274
|
+
this.alert('第'+(i+1)+'行的值为空,请检查');
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
if (data[i].bracket_left) {
|
|
278
|
+
this.bracketLeft = this.bracketLeft + Number(data[i].bracket_left);
|
|
279
|
+
}
|
|
280
|
+
if (data[i].bracket_right) {
|
|
281
|
+
this.bracketRight = this.bracketRight + Number(data[i].bracket_right);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (data[i].field && data[i].editors) {
|
|
286
|
+
if (!data[i].relationship) {
|
|
287
|
+
this.alert('第'+(i+1)+'行的关系为空,请检查');
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
result.push(this.$Method.copy(data[i]));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (this.bracketLeft !== this.bracketRight) {
|
|
295
|
+
this.alert('有效条件的左括号('+this.bracketLeft+')与右括号('+this.bracketRight+')的数量不一致,请检查');
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
if (result.length > 0) {
|
|
299
|
+
let str = '';
|
|
300
|
+
result.forEach((el,j) => {
|
|
301
|
+
el.condition = this.getConditionValue(el.field,el.editors,el.calculator,this.dataType[el.field]);
|
|
302
|
+
if (el.bracket_left === '1') {
|
|
303
|
+
str = str + '(';
|
|
304
|
+
}
|
|
305
|
+
if (el.bracket_left === '2') {
|
|
306
|
+
str = str + '((';
|
|
307
|
+
}
|
|
308
|
+
str = str + el.field + '_' + j;
|
|
309
|
+
if (el.bracket_right === '1') {
|
|
310
|
+
str = str + ')';
|
|
311
|
+
}
|
|
312
|
+
if (el.bracket_right === '2') {
|
|
313
|
+
str = str + '))';
|
|
314
|
+
}
|
|
315
|
+
if (j + 1 < result.length) {
|
|
316
|
+
if (el.relationship === '1') {
|
|
317
|
+
str = str + '$and';
|
|
318
|
+
}
|
|
319
|
+
if (el.relationship === '2') {
|
|
320
|
+
str = str + '$or';
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
this.condition = result;
|
|
325
|
+
this.bracket = [];
|
|
326
|
+
if (str) {
|
|
327
|
+
this.separateBracket(str, this.bracket);
|
|
328
|
+
}
|
|
329
|
+
this.bracket.some(el => {
|
|
330
|
+
let andIndex = el.indexOf('$and');
|
|
331
|
+
let orIndex = el.indexOf('$or');
|
|
332
|
+
if (andIndex !== -1 && orIndex !== -1) {
|
|
333
|
+
let oper = '$or';
|
|
334
|
+
let opername = '或';
|
|
335
|
+
if (orIndex < andIndex) {
|
|
336
|
+
oper = '$and';
|
|
337
|
+
opername = '且';
|
|
338
|
+
}
|
|
339
|
+
let list = el.split('_');
|
|
340
|
+
let index = -1;
|
|
341
|
+
if (list.length > 0) {
|
|
342
|
+
list.some(el2 => {
|
|
343
|
+
if (el2.indexOf(oper) !== -1) {
|
|
344
|
+
let tempList= el2.split(oper);
|
|
345
|
+
if (tempList.length > 0) {
|
|
346
|
+
index = Number(tempList[0]);
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
if (index > -1) {
|
|
353
|
+
this.alert('第'+(index+1)+'行的关系不能为['+opername+']或请添加括号' );
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
separateBracket (str,obj) {
|
|
363
|
+
let newStr = this.$Method.copy(str);
|
|
364
|
+
let bracket_leftIndex = newStr.lastIndexOf('(');
|
|
365
|
+
let bracket_rightIndex = newStr.indexOf(')');
|
|
366
|
+
if (bracket_leftIndex !== -1 && bracket_rightIndex !== -1) {
|
|
367
|
+
let tempstr = newStr.substring(bracket_leftIndex+1,bracket_rightIndex);
|
|
368
|
+
obj.push(tempstr);
|
|
369
|
+
str = str.replace('('+tempstr+')','');
|
|
370
|
+
if (str) {
|
|
371
|
+
this.separateBracket(str,obj);
|
|
372
|
+
}
|
|
373
|
+
} else {
|
|
374
|
+
if (newStr) {
|
|
375
|
+
obj.push(newStr);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
show() {
|
|
381
|
+
this.modalSearch = true;
|
|
382
|
+
},
|
|
383
|
+
backCondition() {
|
|
384
|
+
this.modalSearch = false;
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
mounted () {
|
|
388
|
+
this.clearCondition();
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
</script>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="myConfig.visible">
|
|
3
|
+
<DatePicker ref="myControl" v-model="culValue" :options="options" :transfer="myConfig.transfer" :size="myConfig.size" :format="myConfig.format" :placeholder="myConfig.placeholder" :type="myConfig.vtype" clearable :disabled="myConfig.readOnly" @on-change="onChange" @on-open-change="onOpenChange" @keydown.enter.stop="_enterSetFatherValue" style="width:100%" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import Base from '@/components/base/controlbase.vue';
|
|
8
|
+
export default {
|
|
9
|
+
name: 'datebox',
|
|
10
|
+
extends: Base,
|
|
11
|
+
data () {
|
|
12
|
+
return {
|
|
13
|
+
myConfig: {
|
|
14
|
+
vtype:'date',
|
|
15
|
+
format:'yyyy-MM-dd',
|
|
16
|
+
defaultValue:null,
|
|
17
|
+
transfer:false
|
|
18
|
+
},
|
|
19
|
+
options:{
|
|
20
|
+
disabledDate:this.disabledDate
|
|
21
|
+
},
|
|
22
|
+
culValue:null,
|
|
23
|
+
value:null,
|
|
24
|
+
oldValue:null
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
props:{
|
|
28
|
+
fatherValue: {
|
|
29
|
+
type: [String, Date],
|
|
30
|
+
default: null
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
fatherValueToValue (value) {
|
|
35
|
+
if (value) {
|
|
36
|
+
return value;
|
|
37
|
+
} else {
|
|
38
|
+
return this.myConfig.defaultValue;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setFatherValueFail() {
|
|
42
|
+
this.value = this.oldValue;
|
|
43
|
+
this.$nextTick(() => {
|
|
44
|
+
if (!this.value) {
|
|
45
|
+
this.culValue = null;
|
|
46
|
+
} else {
|
|
47
|
+
this.culValue = new Date(this.value);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
watchCustomFatherValue() {
|
|
53
|
+
if (this.value) {
|
|
54
|
+
this.culValue = new Date(this.value);
|
|
55
|
+
} else{
|
|
56
|
+
this.culValue = null;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onChange(e) {
|
|
60
|
+
this.value = e;
|
|
61
|
+
if (!this.value) {
|
|
62
|
+
this.culValue = null;
|
|
63
|
+
} else {
|
|
64
|
+
this.culValue = new Date(this.value);
|
|
65
|
+
}
|
|
66
|
+
this.setFatherValue();
|
|
67
|
+
},
|
|
68
|
+
valueToFatherValue() {
|
|
69
|
+
let para= {};
|
|
70
|
+
if (!this.culValue) {
|
|
71
|
+
para.value = '';
|
|
72
|
+
} else {
|
|
73
|
+
if (this.myConfig.vtype ==='month') {
|
|
74
|
+
para.value = this.$Method.formatDate(this.culValue,'yyyy-MM-dd');
|
|
75
|
+
} else {
|
|
76
|
+
if (this.myConfig.format === 'MM-dd') {
|
|
77
|
+
para.value = this.$Method.formatDate(this.culValue,'yyyy-MM-dd');
|
|
78
|
+
} else {
|
|
79
|
+
para.value = this.$Method.formatDate(this.culValue,this.myConfig.format);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return para;
|
|
84
|
+
},
|
|
85
|
+
disabledDate(date) {
|
|
86
|
+
if (this.myConfig.disabledDate) {
|
|
87
|
+
return this.myConfig.disabledDate(date);
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
},
|
|
91
|
+
customInit() {
|
|
92
|
+
if (this.config && this.config.format === undefined) {
|
|
93
|
+
if (this.myConfig.vtype === 'date') {
|
|
94
|
+
this.myConfig.format = 'yyyy-MM-dd';
|
|
95
|
+
} else if (this.myConfig.vtype === 'datetime') {
|
|
96
|
+
this.myConfig.format = 'yyyy-MM-dd HH:mm:ss';
|
|
97
|
+
} else if (this.myConfig.vtype ==='month') {
|
|
98
|
+
this.myConfig.format = 'yyyy-MM';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
onOpenChange(value) {
|
|
103
|
+
if (this.config.onOpenChange) {
|
|
104
|
+
this.config.onOpenChange(value);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
setFocus(value) {
|
|
108
|
+
if (value) {
|
|
109
|
+
this.$refs.myControl.$refs.input.focus();
|
|
110
|
+
this.$refs.myControl.isFocused = true;
|
|
111
|
+
} else {
|
|
112
|
+
this.$refs.myControl.$refs.input.blur();
|
|
113
|
+
this.$refs.myControl.isFocused = false;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
_enterSetFatherValue() {
|
|
117
|
+
if (this.value === this.oldValue) {
|
|
118
|
+
if (this.$parent.enterKeyDown) {
|
|
119
|
+
this.$parent.enterKeyDown();
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
this.isEnter = true;
|
|
123
|
+
this.setFatherValue();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="myConfig.visible">
|
|
3
|
+
<DatePicker ref="myControl" v-model="culValue" :size="myConfig.size" :transfer="myConfig.transfer" :format="myConfig.format" :placeholder="myConfig.placeholder" type="datetimerange" clearable :disabled="myConfig.readOnly" @on-change="onEnterValue" @keydown.enter.stop="_enterSetFatherValue" @on-open-change="onOpenChange" style="width:100%" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import Base from '@/components/base/controlbase.vue';
|
|
8
|
+
export default {
|
|
9
|
+
name: 'daterangebox',
|
|
10
|
+
extends: Base,
|
|
11
|
+
data () {
|
|
12
|
+
return {
|
|
13
|
+
myConfig: {
|
|
14
|
+
vtype:'datetimerange',
|
|
15
|
+
format:'yyyy-MM-dd',
|
|
16
|
+
defaultValue:'',
|
|
17
|
+
transfer:false
|
|
18
|
+
},
|
|
19
|
+
oldValue:['',''],
|
|
20
|
+
svalue: '',
|
|
21
|
+
evalue: '',
|
|
22
|
+
oldSvalue: '',
|
|
23
|
+
oldEvalue: '',
|
|
24
|
+
culValue:['','']
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
props:{
|
|
28
|
+
fatherSvalue: {
|
|
29
|
+
type: [String, Date],
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
fatherEvalue: {
|
|
33
|
+
type: [String, Date],
|
|
34
|
+
default: ''
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
valueToFatherValue() {
|
|
39
|
+
let para= {};
|
|
40
|
+
para.sname = this.myConfig.sname;
|
|
41
|
+
para.ename = this.myConfig.ename;
|
|
42
|
+
if (this.culValue[0]) {
|
|
43
|
+
para.svalue = this.$Method.formatDate(this.culValue[0], this.myConfig.format);
|
|
44
|
+
} else {
|
|
45
|
+
para.svalue = '';
|
|
46
|
+
}
|
|
47
|
+
if (this.culValue[1]) {
|
|
48
|
+
para.evalue = this.$Method.formatDate(this.culValue[1], this.myConfig.format);
|
|
49
|
+
} else {
|
|
50
|
+
para.evalue = '';
|
|
51
|
+
}
|
|
52
|
+
return para;
|
|
53
|
+
},
|
|
54
|
+
onOpenChange(value) {
|
|
55
|
+
if (this.config.onOpenChange) {
|
|
56
|
+
this.config.onOpenChange(value);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onEnterValue(value) {
|
|
60
|
+
if (value[0] && value[1]) {
|
|
61
|
+
this.svalue = value[0];
|
|
62
|
+
this.evalue = value[1]
|
|
63
|
+
}
|
|
64
|
+
this.setFatherValue();
|
|
65
|
+
},
|
|
66
|
+
_enterSetFatherValue(e) {
|
|
67
|
+
let value = e.target.value;
|
|
68
|
+
if (value) {
|
|
69
|
+
let values = value.split(' - ');
|
|
70
|
+
let chekflag = this.isValidDate(values[0]);
|
|
71
|
+
chekflag = this.isValidDate(values[1]);
|
|
72
|
+
if (chekflag) {
|
|
73
|
+
this.svalue = values[0];
|
|
74
|
+
this.evalue = values[1];
|
|
75
|
+
this.culValue = [new Date(this.svalue),new Date(this.evalue)];
|
|
76
|
+
} else {
|
|
77
|
+
this.$parent.reset();
|
|
78
|
+
//this.setFatherValueFail();
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
this.svalue = '';
|
|
83
|
+
this.evalue = '';
|
|
84
|
+
this.culValue = ['', ''];
|
|
85
|
+
}
|
|
86
|
+
this.isEnter = true;
|
|
87
|
+
this.setFatherValue();
|
|
88
|
+
},
|
|
89
|
+
//时间合法性验证
|
|
90
|
+
isValidDate(dateString) {
|
|
91
|
+
// 正则表达式匹配YYYY-MM-DD格式
|
|
92
|
+
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
93
|
+
// 尝试将日期字符串转换为日期对象,并比较原日期
|
|
94
|
+
const date = new Date(dateString);
|
|
95
|
+
return date instanceof Date && date.toString() !== 'Invalid Date' && regex.test(dateString);
|
|
96
|
+
},
|
|
97
|
+
setFocus(value) {
|
|
98
|
+
if (value) {
|
|
99
|
+
this.$refs.myControl.$refs.input.focus();
|
|
100
|
+
this.$refs.myControl.isFocused = true;
|
|
101
|
+
} else {
|
|
102
|
+
this.$refs.myControl.$refs.input.blur();
|
|
103
|
+
this.$refs.myControl.isFocused = false;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
setFatherValueSuccess(para) {
|
|
107
|
+
this.oldValue = this.$Method.copy(this.culValue);
|
|
108
|
+
this.oldSvalue = para.svalue;
|
|
109
|
+
this.oldEvalue = para.evalue;
|
|
110
|
+
this.$emit('inputValue', para);
|
|
111
|
+
},
|
|
112
|
+
setFatherValueFail() {
|
|
113
|
+
this.$nextTick(() => {
|
|
114
|
+
if (this.oldSvalue && this.oldEvalue) {
|
|
115
|
+
this.culValue = [new Date(this.oldSvalue),new Date(this.oldEvalue)];
|
|
116
|
+
} else {
|
|
117
|
+
this.oldSvalue = '';
|
|
118
|
+
this.oldEvalue = '';
|
|
119
|
+
this.culValue = ['','']
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
setCulValue(sdate,edate){
|
|
124
|
+
this.$nextTick(() => {
|
|
125
|
+
if (sdate && edate) {
|
|
126
|
+
this.culValue = [new Date(sdate),new Date(edate)];
|
|
127
|
+
this.oldEvalue = edate;
|
|
128
|
+
this.oldSvalue = sdate;
|
|
129
|
+
} else {
|
|
130
|
+
this.oldSvalue = '';
|
|
131
|
+
this.oldEvalue = '';
|
|
132
|
+
this.culValue = ['','']
|
|
133
|
+
}
|
|
134
|
+
this.oldValue = this.$Method.copy(this.culValue);
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
watch: {
|
|
139
|
+
fatherSvalue: {
|
|
140
|
+
handler(newValue) {
|
|
141
|
+
this.setCulValue(newValue,this.fatherEvalue);
|
|
142
|
+
},
|
|
143
|
+
deep: true,
|
|
144
|
+
immediate: true
|
|
145
|
+
},
|
|
146
|
+
fatherEvalue: {
|
|
147
|
+
handler(newValue) {
|
|
148
|
+
this.setCulValue(this.fatherSvalue,newValue);
|
|
149
|
+
},
|
|
150
|
+
deep: true,
|
|
151
|
+
immediate: true
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
</script>
|