centaline-data-driven 1.2.37 → 1.2.38

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.
@@ -42,6 +42,7 @@ const paths = {
42
42
  "dynamicPhotoSelect": "./src/centaline/dynamicPhotoSelect/index.js",//图片
43
43
  "dynamicPhotoSelectList": "./src/centaline/dynamicPhotoSelectList/index.js",//图片选择列表
44
44
  "dynamicViewer": "./src/centaline/dynamicViewer/index.js",//图片选择列表
45
+ "dynamicRepeat": "./src/centaline/dynamicRepeat/index.js",//重复控件
45
46
  },
46
47
  "plugs": {
47
48
  "api": "./src/centaline/api/index.js",//调用API插件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
@@ -0,0 +1,14 @@
1
+ import dynamicRepeat from './src/dynamicRepeat'
2
+ import api from '../api/index'
3
+
4
+ dynamicRepeat.install = function (Vue) {
5
+ Vue.component(dynamicRepeat.name, dynamicRepeat);
6
+
7
+ Vue.use(api);
8
+ }
9
+
10
+ if (typeof window !== 'undefined' && window.Vue) {
11
+ window.Vue.use(dynamicRepeat);
12
+ }
13
+
14
+ export default dynamicRepeat;
@@ -0,0 +1,186 @@
1
+ <template>
2
+ <div class="ct-form-list" v-focus="foucus" :class="{'tableDisabled':model.tableDisabled}">
3
+ <div class="list-button">
4
+ <el-button v-if="model.create" type="success" class=" max-btn-add" size="mini" icon="el-icon-circle-plus-outline" @click="addRow">
5
+ 新增
6
+ </el-button>
7
+ </div>
8
+
9
+ <div class="el-col el-col-24" v-for="(v, i) in model.tableData" :key="v.guid" v-if="!v.deleted">
10
+ <div class="list-title">
11
+ <h5>{{model.title}}</h5>
12
+ </div>
13
+ <el-row v-if="v.field.length > 0">
14
+ <el-col v-for="(col, index) in v.field" :key="col.guid" v-if="col.show !== false" :span="col.colspan" style="padding:5px">
15
+ <component ref="Fields" :is="col.is" :vmodel="col" :api="model.OptApi" v-bind="col.bindPara"
16
+ @click="fieldClickHandler(col,index,i)" @change="changeHandler(col,index,i)"
17
+ @input="inputHandler(col,index,i)"></component>
18
+ </el-col>
19
+ </el-row>
20
+ <div class="list-button" v-if="i>0">
21
+ <el-button v-if="v.delete" type="success" class=" max-btn-add" size="mini" icon="el-icon-circle-plus-outline" @click="deleteRow(i)">
22
+ 删除
23
+ </el-button>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ </template>
29
+
30
+ <script>
31
+ //Form内表格
32
+ var ctSpan = {//临时的span组件对象,用于vue双向绑定,强制更新
33
+ props: {
34
+ vmodel: Object,
35
+ rowNum: Number,
36
+ },
37
+ data: function () {
38
+ return {
39
+
40
+ }
41
+ },
42
+ methods: {
43
+ getClass() {
44
+ if (this.vmodel.is === "ct-inputNumber") {
45
+ return 'ct-table-inputnumber';
46
+ }
47
+ }
48
+ },
49
+ template: '<div :class="getClass()">{{vmodel.labelValue}}{{vmodel.unitName}}</div>'
50
+ }
51
+
52
+ export default {
53
+ name: 'ct-repeat',
54
+ components: {
55
+ 'ct-span': ctSpan
56
+ },
57
+ props: {
58
+ vmodel: Object,
59
+ api: String
60
+ },
61
+ data() {
62
+ return {
63
+ model: null,
64
+ foucus: false,
65
+ itemKey: Math.random()
66
+ }
67
+ },
68
+ created() {
69
+ let self = this;
70
+ this.model = this.vmodel;
71
+ this.model.OptApi = this.api;
72
+
73
+ this.$nextTick(function () {
74
+ self.model.refField = this.$refs.Fields;
75
+ self.model.refFieldsLabel = this.$refs.FieldsLabel;
76
+ });
77
+ },
78
+ methods: {
79
+ //添加
80
+ addRow() {
81
+ var app = this;
82
+ if (app.fieldsValidExcute()) {
83
+ let newRow = app.model.getCloneRowData(0)
84
+ app.model.tableData.push(newRow);
85
+ app.model.addSourceRow();
86
+ }
87
+ },
88
+ //删除
89
+ deleteRow(index) {
90
+ var self = this;
91
+ this.model.deleteRow(index + 1, () => {
92
+ self.model.tableData[index].deleted = true;
93
+ self.$forceUpdate();
94
+ self.model.change = self.model.formListChange;
95
+ self.$emit('change');
96
+ });
97
+ },
98
+ fieldsValidExcute() {
99
+ var self = this;
100
+ var rtnBool = true;
101
+ debugger
102
+ if (typeof self.$refs.Fields !== 'undefined') {
103
+ self.$refs.Fields.forEach((f) => {
104
+ if (typeof f.validExcute !== 'undefined') {
105
+ if (!f.validExcute()) {
106
+ rtnBool = false;
107
+ }
108
+ }
109
+ });
110
+ }
111
+ return rtnBool;
112
+ },
113
+ validExcute() {
114
+ var self = this;
115
+ var rtnBool = true;
116
+ if (!self.fieldsValidExcute()) {
117
+ rtnBool = false;
118
+ }
119
+ if (rtnBool && self.model.required && this.model.tableData.length === 0) {
120
+ self.$message.warning(this.model.label + " 表格不能为空");
121
+ rtnBool = false;
122
+ }
123
+ return rtnBool;
124
+ },
125
+ changeHandler(field, rowindex,index) {
126
+ var self = this;
127
+ this.model.change = field.change;
128
+ self.$emit('change');
129
+ },
130
+ inputHandler(field, rowindex, index) {
131
+ var self = this;
132
+ this.model.input = field.input;//当前小组件事件作为大组件事件
133
+ self.$emit('input');
134
+
135
+ },
136
+ }
137
+ }
138
+ </script>
139
+ <style>
140
+ .el-table-add-row {
141
+ margin-top: 10px;
142
+ width: 100%;
143
+ height: 34px;
144
+ border: 1px dashed #c1c1cd;
145
+ border-radius: 3px;
146
+ cursor: pointer;
147
+ justify-content: center;
148
+ display: flex;
149
+ line-height: 34px;
150
+ }
151
+
152
+ .ct-form-list .list-title {
153
+ padding-bottom: 5px;
154
+ text-align: left;
155
+ display: inline-table;
156
+ width: 45%;
157
+ }
158
+
159
+ .ct-form-list .list-button {
160
+ padding-bottom: 5px;
161
+ text-align: right;
162
+ display: inline-table;
163
+ float: right;
164
+ }
165
+
166
+ .ct-table-inputnumber {
167
+ text-align: right;
168
+ }
169
+
170
+ .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter div {
171
+ text-align: right;
172
+ }
173
+
174
+ .ct-form-list .el-table__footer-wrapper .el-table__footer .has-gutter tr td:first-child div {
175
+ text-align: left;
176
+ }
177
+
178
+ .ct-table-required {
179
+ color: red;
180
+ }
181
+
182
+ .tableDisabled {
183
+ pointer-events: none;
184
+ opacity: 0.4;
185
+ }
186
+ </style>
@@ -30,10 +30,9 @@
30
30
  </li>
31
31
  </ul>
32
32
  </div>
33
- <el-popover :append-to-table="option.appendId?option.appendId:''"
33
+ <el-popover :append-to-table="option.appendId?option.appendId:''" class="Stats-popover"
34
34
  :placement="option.placement?option.placement:'left'"
35
- :trigger="option.trigger?option.trigger:''"
36
- >
35
+ :trigger="option.trigger?option.trigger:''">
37
36
  <div v-if="FlagStatistics" class="tab-list" style="border-bottom:none">
38
37
  <div class="tablf" v-for="(item, index) in showData[1]" @click="handleClick($event,item)" style="text-align:left">
39
38
  <ul class="btnTab">
@@ -44,7 +43,7 @@
44
43
  </ul>
45
44
  </div>
46
45
  </div>
47
- <i slot="reference" class="icon-more"></i>
46
+ <sapn slot="reference" class="icon-more">⋮</sapn>
48
47
 
49
48
  </el-popover>
50
49
  </template>
@@ -71,7 +70,7 @@
71
70
  option: {
72
71
  isHidden: true,//是否开启操作栏隐藏设置,默认开启
73
72
  showNum: 3,//如果isHidden为true时,个数大于3就会隐藏,默认是3
74
- appendId: '.s-table',//将浮动栏添加到对应id或者class节点中。或者.xxx。传空字符串是添加到body中。
73
+ appendId: '',//将浮动栏添加到对应id或者class节点中。或者.xxx。传空字符串是添加到body中。
75
74
  trigger: 'hover',//触发方式,传值可查看Popper UI组件trigger属性
76
75
  placement: 'bottom-start'//方向,传值可查看Popper UI组件placement属性
77
76
  },
@@ -177,9 +176,8 @@
177
176
 
178
177
  <style>
179
178
  .tab-list {
180
- border-bottom: 2px solid #E0E0E0;
181
- margin-bottom: 10px;
182
- padding-bottom: 5px;
179
+ position:relative;
180
+ margin-bottom: 10px;
183
181
  height: 30px;
184
182
  }
185
183
 
@@ -220,8 +218,7 @@
220
218
  /* border-bottom-right-radius: 12px !important; */
221
219
  /* border-top-right-radius: 11px; */
222
220
  width: 20px;
223
- background: -webkit-linear-gradient(right, #dfdede,#ff0c00);
224
- height: 4px;
221
+ border-bottom: #ee5d56 solid 3px;
225
222
  }
226
223
 
227
224
  .tab-list .activecolor {
@@ -234,11 +231,17 @@
234
231
  }
235
232
 
236
233
  .tab-list .icon-more {
237
- background: url(../../../assets/ver.png)no-repeat;
238
- background-size: 80% 80%;
239
- height: 20px;
240
- width: 7px;
234
+ color: #ee5d56;
235
+ font-size: 20px;
236
+ font-weight: 900;
241
237
  display: inline-block;
242
- vertical-align: bottom;
238
+ vertical-align: 0.5em;
239
+ margin-top: -3px;
240
+ cursor: pointer;
243
241
  }
242
+
243
+ .Stats-popover {
244
+ position:absolute;
245
+ right:5px;
246
+ }
244
247
  </style>
@@ -0,0 +1,241 @@
1
+ import base from '../../index';
2
+ import LibFunction from './lib/LibFunction';
3
+ import common from '../../../common/index';
4
+ import Router from './Router';
5
+ import Enum from './lib/Enum';
6
+ import Vue from 'vue';
7
+
8
+ const Repeat = function (source, master, isFormList) {
9
+ var rtn = {
10
+ form: null,
11
+ refField: Object,
12
+ refFieldsLabel: Object,
13
+ get id() {
14
+ return source.name;
15
+ },
16
+ get type() {
17
+ return master.controlType;
18
+ },
19
+ get label() {
20
+ return master.dn || '';
21
+ },
22
+ get source() {
23
+ return source;
24
+ },
25
+ get master() {
26
+ return master;
27
+ },
28
+ get title() {
29
+ return master.controlLabel || '';
30
+ },
31
+ get show() {
32
+ if (typeof master.show !== "undefined") {
33
+ return master.show;
34
+ }
35
+ return true;
36
+ },
37
+ get create() {
38
+ return source.rightNew === true;
39
+ },
40
+ get required() {
41
+ return master.required;
42
+ },
43
+ set required(v) {
44
+ master.required = false;
45
+ },
46
+ get primaryKeys() {
47
+ return source.primaryKeys;
48
+ },
49
+ //get rowEdit() {
50
+ // return source.editMode !== true;
51
+ //},
52
+ get dialogEdit() {
53
+ return source.editMode === 1;
54
+ },
55
+ get showSummary() {
56
+ return source.totalCols.length > 0;
57
+ },
58
+ get totalColTitle() {
59
+ return source.totalColTitle;
60
+ },
61
+ get totalCols() {
62
+ return source.totalCols;
63
+ },
64
+ set tableDisabled(v) {
65
+ source.disabled = v;
66
+ },
67
+ get tableDisabled() {
68
+ return source.disabled || false;
69
+ },
70
+ getFormObj() {
71
+ let rtnFormArr = [];
72
+ for (let i = 0; i < rtn.tableData.length; i++) {
73
+ let rtnFormObj = {};
74
+ rtn.tableData[i].field.forEach((s) => {
75
+ Object.assign(rtnFormObj, s.getFormObj());
76
+ });
77
+ rtnFormObj.flagDeleted = rtn.tableData[i].deleted;
78
+ rtnFormObj.flagNew = rtn.tableData[i].isNewFlag;
79
+ rtnFormArr.push(rtnFormObj);
80
+ }
81
+
82
+ let rtnObj = {};
83
+ Object.defineProperty(rtnObj, master.fieldName1, {
84
+ get: function () {
85
+ return rtnFormArr;
86
+ },
87
+ enumerable: true,
88
+ configurable: true
89
+ });
90
+ console.log(rtnObj);
91
+ return rtnObj;
92
+ },
93
+ _buttons: null,
94
+ get buttons() {
95
+ if (rtn._buttons !== null) {
96
+ return rtn._buttons;
97
+ }
98
+ else {
99
+ rtn._buttons = [];
100
+ if (source.actionRouters) {
101
+ source.actionRouters.forEach((v) => {
102
+ var button = Router(v);
103
+ button.is = "ct-btn";
104
+ rtn._buttons.push(button);
105
+ });
106
+ }
107
+ return rtn._buttons;
108
+ }
109
+ },
110
+ _rows: null,
111
+ get rows() {
112
+
113
+ if (this._rows) {
114
+ return this._rows;
115
+ }
116
+ else {
117
+ this._rows = [];
118
+ //遍历每一行
119
+ source.rows.forEach((r) => {
120
+ var row = rtn.initRow(r);
121
+ this._rows.push(row);
122
+ });
123
+ return this._rows;
124
+ }
125
+ },
126
+ initRow(r) {
127
+ var row = {
128
+ field: [],
129
+ get delete() {//删除权限
130
+ return r.rightDelete === true;
131
+ },
132
+ get edit() {
133
+ return r.rightEdit === true;
134
+ },
135
+ get deleted() {//是否已删除
136
+ return r.flagDeleted === true;
137
+ },
138
+ set deleted(v) {
139
+ if (v) {
140
+ r.flagDeleted = true;
141
+ }
142
+ else {
143
+ r.flagDeleted = false;
144
+ }
145
+ },
146
+ get guid() {
147
+ return rtn.guid();
148
+ },
149
+ set guid(v) {
150
+ r.guid = v;
151
+ },
152
+ };
153
+ //遍历每一列
154
+ let rowIndex = 0;
155
+ //for (var key in source.fields) {
156
+ r.columns.forEach((value) => {
157
+ //let value = source.fields[key];
158
+ value.onChanged = value.onChange ? value.onChange : source.rows[0].columns[rowIndex].onChanged;//事件使用第一条的
159
+ value.onBlur = value.onBlur ? value.onBlur : source.rows[0].columns[rowIndex].onBlur;//事件使用第一条的
160
+ rowIndex++;
161
+ let showLabel = true;
162
+ if (isFormList) {
163
+ showLabel = false;
164
+ }
165
+ let item = LibFunction.GetControl(value, source, showLabel, false);
166
+ if (item instanceof Object) {
167
+ item.form = rtn.form;
168
+ row.field.push(item);
169
+ }
170
+ });
171
+ //}
172
+ return row;
173
+ },
174
+ _tableData: undefined,
175
+ get tableData() {
176
+ if (this._tableData) {
177
+ return this._tableData;
178
+ }
179
+ else {
180
+ this._tableData = [];
181
+ let rows = rtn.rows;
182
+ if (rows.length > 1) {
183
+ for (let i = 1; i < rows.length; i++) {//遍历每一行
184
+ this._tableData.push(rows[i]);
185
+ }
186
+ }
187
+ else {
188
+ let newRow = this.getCloneRowData(0)
189
+ this.tableData.push(newRow);
190
+ this.addSourceRow();
191
+ }
192
+ return this._tableData;
193
+ }
194
+ },
195
+ addSourceRow() {
196
+ let sourceRow = JSON.parse(JSON.stringify(source.rows[0]));
197
+ source.rows.push(sourceRow);
198
+ let iRow = this.initRow(sourceRow);
199
+ iRow.isNewFlag = true;
200
+ iRow.guid = this.guid();
201
+ rtn._rows.push(iRow);
202
+ },
203
+ getCloneRowData(index) {
204
+ let sourceRow = source.rows[index];
205
+ let rowData = rtn.initRow(JSON.parse(JSON.stringify(sourceRow)));
206
+ rowData.isNewFlag = true;
207
+ rowData.guid = this.guid();
208
+ return rowData;
209
+ },
210
+
211
+ get formListChange() {
212
+ return master.onChanged;
213
+ },
214
+ deleteRow(index, callback) {
215
+ Vue.prototype.$common.confirm("确定删除?", "提示", {
216
+ confirmButtonText: "确定",
217
+ cancelButtonText: "取消",
218
+ }).then(() => {
219
+ if (rtn.rows[index].isNewFlag) {
220
+ rtn.rows.splice(index, 1);
221
+ source.rows.splice(index, 1);
222
+ }
223
+ else {
224
+ rtn.rows[index].deleted = true;
225
+ }
226
+ callback();
227
+ }).catch(() => {
228
+ });
229
+ },
230
+ guid() {
231
+ return (rtn.S4() + rtn.S4() + '-' + rtn.S4() + '-' + rtn.S4() + '-' + rtn.S4() + '-' + rtn.S4() + rtn.S4() + rtn.S4()
232
+ );
233
+ },
234
+ S4() {
235
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
236
+ }
237
+
238
+ };
239
+ return rtn;
240
+ };
241
+ export default Repeat;
@@ -224,7 +224,11 @@ const Enum = {
224
224
  /// <summary>
225
225
  /// 年份-月份控件
226
226
  /// </summary>
227
- DateYearMonth:46,
227
+ DateYearMonth: 46,
228
+ /// <summary>
229
+ /// 重复控件
230
+ /// </summary>
231
+ Repeat: 47,
228
232
  },
229
233
 
230
234
  //返回状态码
@@ -32,6 +32,7 @@ import PlaceHolder from '../PlaceHolder';
32
32
  import SensitiveEye from '../SensitiveEye';
33
33
  import Cb from '../Cb';
34
34
  import PhotoSelect from '../PhotoSelect';
35
+ import Repeat from '../Repeat';
35
36
 
36
37
  const LibFunction = {
37
38
  install(Vue) {
@@ -206,6 +207,17 @@ const LibFunction = {
206
207
  //item.is = 'ct-form-list';
207
208
  item.is = 'ct-form-list-table';
208
209
  break;
210
+ case Enum.ControlType.Repeat://重复
211
+ var listobj = source.list.find((v1) => {
212
+ return v1.name === field.fieldName1;
213
+ });
214
+ if (!listobj) {
215
+ console.error("找不到对应的list:" + field.fieldName1);
216
+ }
217
+ listobj.scripts = source.scripts;
218
+ item = Repeat(listobj, field);
219
+ item.is = 'ct-repeat';
220
+ break;
209
221
  case Enum.ControlType.Hidden://隐藏控件
210
222
  item = Hd(field);
211
223
  break;
@@ -38,6 +38,7 @@ const loader = {
38
38
  PhotoSelectList: require("./ctl/PhotoSelectList.js").default,
39
39
  QuickInputSos: require("./ctl/QuickInputSos.js").default,
40
40
  ContactList: require("./ctl/ContactList.js").default,
41
+ Repeat: require("./ctl/Repeat.js").default,
41
42
  };
42
43
 
43
44
  export default loader;
package/src/main.js CHANGED
@@ -12,8 +12,8 @@ Vue.use(ElementUI, { size: 'mini'});
12
12
  // 关闭生产模式下给出的提示
13
13
  Vue.config.productionTip = false;
14
14
  Vue.use(centaline, {
15
- // baseUrl: "http://10.88.22.46:7070/v1/form/router",
16
- baseUrl: "http://10.1.245.111:38028/v1/form/router",
15
+ baseUrl: "http://10.88.22.46:7070/v1/form/router",
16
+ // baseUrl: "http://10.1.245.111:38028/v1/form/router",
17
17
  // baseUrl: "http://10.88.22.46:7070/",
18
18
  // flagRouterSelf: true,
19
19
  zindex: 999,