centaline-data-driven 1.4.6 → 1.4.8

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
package/src/Form.vue CHANGED
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div id="form-app" class="data-driven" style="width:100%;height:100%;overflow:auto">
3
3
  <!-- <ct-form :source="formdata.content" :apiParam="apiParam"></ct-form> -->
4
- <ct-form :api="'/PropertyContact/getLayoutOfNew'" :apiParam="apiParam" :topHeight="topHeight"></ct-form>
4
+ <ct-form :api="'/commissionmanage/apply'" :apiParam="apiParam" :topHeight="topHeight"></ct-form>
5
5
  <ct-dialog-list></ct-dialog-list>
6
6
  </div>
7
7
  </template>
@@ -12,7 +12,7 @@
12
12
  data() {
13
13
  return {
14
14
  apiParam:{
15
- chanceID: "1580430736434008064", actionType: 2
15
+
16
16
  },
17
17
  topHeight:10,
18
18
  }
@@ -329,7 +329,7 @@
329
329
  return false;
330
330
  }
331
331
  }
332
- if (this.model.min && this.modelPhotoselect.required) {
332
+ if (this.model.min && this.model.required) {
333
333
  if (this.model.getfileListLength() < this.model.min) {
334
334
  //change时需要判断有没有上传图片如果没有图片则不提示
335
335
  if (eventName == "change" && this.model.getfileListLength() > 0) {
@@ -441,7 +441,7 @@
441
441
  "mediaLabelName": "",
442
442
  "fileExtension": "",
443
443
  "progressFlag": true,
444
- "loadProgress": 1,
444
+ "loadProgress": 0,
445
445
  "uid": uid,
446
446
  }
447
447
  this.model.fileList.push(awaitfile);
@@ -460,18 +460,26 @@
460
460
  uploadguid() {
461
461
  return (this.S4() + this.S4() + '-' + this.S4() + '-' + this.S4() + '-' + this.S4() + '-' + this.S4() + this.S4() + this.S4());
462
462
  },
463
- uploadpro(uploadOptions, res) {
463
+ uploadpro(uploadOptions, res, xhr) {
464
464
 
465
- if (res.rtnCode != 200 && res.rtnMsg != "") {
466
- this.$message.error(res.rtnMsg);
467
- return;
465
+ if (xhr.status >= 400) {
466
+ this.$message.error(res);
468
467
  }
469
- const { file, onProgress, onSuccess, onError } = uploadOptions;
470
- const Progress = Math.min(100, Math.floor(1E4 * parseInt(res.content.nextOffSet) / parseInt(file.size)) / 100);
471
- this.model.setByPieces(res, Progress, file);
468
+ else if (xhr.status == 0) {
469
+ this.$message.error(res);
470
+ }
471
+ else if (xhr.status == 200) {
472
+ if (res.rtnCode != 200 && res.rtnMsg != "") {
473
+ this.$message.error(res.rtnMsg);
474
+ return;
475
+ }
476
+ const { file, onProgress, onSuccess, onError } = uploadOptions;
477
+ const Progress = Math.min(100, Math.floor(1E4 * parseInt(res.content.nextOffSet) / parseInt(file.size)) / 100);
478
+ this.model.setByPieces(res, Progress, file);
472
479
 
473
- if (res.content.finished == 1) {
474
- this.handleChange();
480
+ if (res.content.finished == 1) {
481
+ this.handleChange();
482
+ }
475
483
  }
476
484
  },
477
485
 
@@ -104,7 +104,7 @@
104
104
  model: null,
105
105
  foucus: false,
106
106
  itemKey: Math.random(),
107
- tableColumnWith: 0
107
+ tableColumnWith: 0
108
108
  }
109
109
  },
110
110
  created() {
@@ -233,6 +233,7 @@
233
233
  fd.$forceUpdate();
234
234
  }
235
235
  });
236
+ self.itemKey = Math.random();
236
237
  });
237
238
  },
238
239
  fieldsValidExcute() {
@@ -375,23 +376,23 @@
375
376
 
376
377
  return sums;
377
378
  },
378
- // 表头部重新渲染
379
- renderHeader(h, { column, $index }) {
380
- // 新建一个 span
381
- let span = document.createElement('span');
382
- // 设置表头名称
383
- span.innerText = column.label;
384
- span.style.whiteSpace = 'nowrap';
385
- span.style.width = 'auto';
386
- // 临时插入 document
387
- document.body.appendChild(span);
388
- // 重点:获取 span 最小宽度,设置当前列,注意这里加了 10,字段较多时还是有挤压,且渲染后的 div 内左右 padding 都是 5,所以 +10 。(可能还有边距/边框等值,需要根据实际情况加上)
389
- column.minWidth = span.getBoundingClientRect().width + 10;
390
- this.tableColumnWith = column.minWidth
391
- // 移除 document 中临时的 span
392
- document.body.removeChild(span);
393
- return h('span', column.label);
394
- }
379
+ // 表头部重新渲染
380
+ renderHeader(h, { column, $index }) {
381
+ // 新建一个 span
382
+ let span = document.createElement('span');
383
+ // 设置表头名称
384
+ span.innerText = column.label;
385
+ span.style.whiteSpace = 'nowrap';
386
+ span.style.width = 'auto';
387
+ // 临时插入 document
388
+ document.body.appendChild(span);
389
+ // 重点:获取 span 最小宽度,设置当前列,注意这里加了 10,字段较多时还是有挤压,且渲染后的 div 内左右 padding 都是 5,所以 +10 。(可能还有边距/边框等值,需要根据实际情况加上)
390
+ column.minWidth = span.getBoundingClientRect().width + 10;
391
+ this.tableColumnWith = column.minWidth
392
+ // 移除 document 中临时的 span
393
+ document.body.removeChild(span);
394
+ return h('span', column.label);
395
+ }
395
396
  }
396
397
  }
397
398
  </script>
@@ -142,7 +142,7 @@
142
142
  </a>
143
143
  </template>
144
144
  <a v-if="itemFile.rightDownload"
145
- :href="resultObject.replace(/\/preview$/,'/download')" target="_blank"
145
+ :href="downloadUrl(resultObject)" target="_blank"
146
146
  class="magnify-btn el-icon-download"
147
147
  title="下载"
148
148
  :download="(itemFile.mediaLabelName || itemFile.fileName)"></a>
@@ -225,6 +225,17 @@
225
225
  }
226
226
  },
227
227
  methods: {
228
+ downloadUrl(url) {
229
+ if (/\/viewer\//.test(url)) {
230
+ return url.replace(/\/viewer\//, '/download/');
231
+ }
232
+ else if (/\/preview$/.test(url)) {
233
+ return url.replace(/\/preview$/, '/download');
234
+ }
235
+ else {
236
+ return url;
237
+ }
238
+ },
228
239
  handleMouse(e) {
229
240
  e.preventDefault();
230
241
  },
@@ -270,8 +270,7 @@ const box = function (source, fileSourceList, router, optionApi) {
270
270
  setByPieces(res, Progress, file) {
271
271
  if (res.rtnCode === Enum.ReturnCode.Successful) {
272
272
  //下面的方式绑定,会有一些问题 todo 不强与页面关联
273
-
274
-
273
+ var data = {};
275
274
  if (res.content.finished == 1) {
276
275
  //下面的方式绑定,会有一些问题 todo 不强与页面关联
277
276
  fileSourceList.push(res.content.media);
@@ -279,6 +278,24 @@ const box = function (source, fileSourceList, router, optionApi) {
279
278
  data = rtn.getFileData(res.content.media);
280
279
  data.progressFlag = false;
281
280
  data.loadProgress = 100;
281
+
282
+ Vue.set(file, "url", data.url);
283
+ Vue.set(file, "source", data.source);
284
+ Vue.set(file, "mediaUrl", data.mediaUrl);
285
+ Vue.set(file, "fileName", data.fileName);
286
+ Vue.set(file, "flagDefault", data.flagDefault);
287
+ Vue.set(file, "mediaTypeID", data.mediaTypeID);
288
+ Vue.set(file, "flagDeleted", data.flagDeleted);
289
+ Vue.set(file, "actionType", data.actionType);
290
+ Vue.set(file, "rightDel", data.rightDel);
291
+ Vue.set(file, "rightEdit", data.rightEdit);
292
+ Vue.set(file, "rightDownload", data.rightDownload);
293
+ Vue.set(file, "mediaLabelID", data.mediaLabelID);
294
+ Vue.set(file, "mediaLabelName", data.mediaLabelName);
295
+ Vue.set(file, "fileExtension", data.fileExtension);
296
+
297
+ Vue.set(file, "progressFlag", data.progressFlag);
298
+ Vue.set(file, "loadProgress", data.loadProgress);
282
299
  }
283
300
  else {
284
301
  data.progressFlag = true;
@@ -287,25 +304,6 @@ const box = function (source, fileSourceList, router, optionApi) {
287
304
  let i = this.fileList.findIndex(v => v.uid === file.uid);
288
305
  if (i === -1) return;
289
306
 
290
- Vue.set(file, "url", data.url);
291
- Vue.set(file, "source", data.source);
292
- Vue.set(file, "mediaUrl", data.mediaUrl);
293
- Vue.set(file, "fileName", data.fileName);
294
- Vue.set(file, "flagDefault", data.flagDefault);
295
- Vue.set(file, "mediaTypeID", data.mediaTypeID);
296
- Vue.set(file, "flagDeleted", data.flagDeleted);
297
- Vue.set(file, "actionType", data.actionType);
298
- Vue.set(file, "rightDel", data.rightDel);
299
- Vue.set(file, "rightEdit", data.rightEdit);
300
- Vue.set(file, "rightDownload", data.rightDownload);
301
- Vue.set(file, "mediaLabelID", data.mediaLabelID);
302
- Vue.set(file, "mediaLabelName", data.mediaLabelName);
303
- Vue.set(file, "fileExtension", data.fileExtension);
304
-
305
- Vue.set(file, "progressFlag", false);
306
- Vue.set(file, "loadProgress", 100);
307
-
308
-
309
307
  Vue.set(rtn.fileList, i, {
310
308
  url: data.url,
311
309
  source: data.source,
@@ -5,7 +5,18 @@ async function postFile(api, data, callback) {
5
5
  xhr.onreadystatechange = function () {
6
6
  if (xhr.readyState === 4 && xhr.status === 200) {
7
7
  var rtn = JSON.parse(xhr.responseText);
8
- callback(rtn);
8
+ callback(xhr, rtn);
9
+ }
10
+ else if (xhr.readyState === 4 && (xhr.status === 0 || xhr.status >= 400)) {
11
+ var rtn = xhr.responseText || xhr.statusText;
12
+ if (rtn == "") {
13
+ if (xhr.status === 0) {
14
+ rtn = "网络请求失败:" + api;
15
+ } else {
16
+ rtn = "status:" + xhr.status;
17
+ }
18
+ }
19
+ callback(xhr, rtn);
9
20
  }
10
21
  }
11
22
  xhr.send(data)
@@ -21,16 +32,19 @@ const uploadByPieces = async (url, { file }, callback, uploadOptions) => {
21
32
  let chunk = file.slice(start, end);
22
33
  return { start, end, chunk };
23
34
  };
35
+
24
36
  // 分片上传接口
25
- const uploadChunk = async (data) => {
37
+ const uploadChunk = async (xhr, data) => {
26
38
  return new Promise((resolve, reject) => {
27
39
 
28
- callback(uploadOptions, data);
29
- if (data.rtnCode == 200) {
30
- if (data.content.finished != 1) {
31
- uploadData.nextOffSet = data.content.nextOffSet;
32
- uploadData.blockSize = data.content.blockSize;
33
- readChunk(uploadData);
40
+ callback(uploadOptions, data, xhr);
41
+ if (xhr.status === 200) {
42
+ if (data.rtnCode == 200) {
43
+ if (data.content.finished != 1) {
44
+ uploadData.nextOffSet = data.content.nextOffSet;
45
+ uploadData.blockSize = data.content.blockSize;
46
+ readChunk(uploadData);
47
+ }
34
48
  }
35
49
  }
36
50
 
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.25.10.67:9999/v1/form/router",
15
+ // baseUrl: "http://10.88.22.46:7070/v1/form/router",
16
+ baseUrl: "http://10.25.10.63:9999/v1/form/router",
17
17
  // baseUrl: "http://10.88.22.42:9999/v1/form/router",
18
18
  // baseUrl: "http://10.88.22.39:8080/api/",
19
19
  // baseUrl: "http://tjcptest.centaline.com.cn/",
@@ -43,14 +43,14 @@ Vue.use(centaline, {
43
43
  getRequestHeaders: function () {
44
44
  return {
45
45
  oldToken: '854e91e2-3a5e-42af-a522-c51a0f5c09bc',
46
- token:'aplus eyJhbGciOiJIUzI1NiIsInppcCI6IkRFRiJ9.eNrEjjEOgkAQRe8yNZMwMDszSycLNh6CuGFJsDICicZ4dzVCR-8rXvGa_58wLREq0BXc0UbnV3BHGx0ReyVp8eA1IAuXaBQMA0vgY9OWoW4gg3S_QkUi6p0WuWYwnudfMM3tG5Yp3U7p8Y9zl3n8zBIPYs4bRjcocuEMPYkh5cZ9ZNeXHOH1BgAA__8.J4WTk1z7IsB5k_3a-fvnnjm6AUgGBRi7Y631pFLVCPo',
46
+ token:'aplus eyJhbGciOiJIUzI1NiIsInppcCI6IkRFRiJ9.eNrEjrEOgkAQRP9lazZhub29PTo9sPEjyJ2eCVZGINEY_1000NH7ildMJpl5wTAlqMEt4IZWOr-AG1rpiNg7khZ33gVkYYNKQTGwBD40rQn7BgrIjxvUJKIlq1dbQB_HX-C8VPYbTEO-H_PzH-euYz_PluyrFO0FrZt7fFJFlTOjIRtjijmbiuD9AQAA__8.ps7UJfVktTvSQGwtbwB3WniD6KYKapmBPH_moOJScMQ',
47
47
 
48
48
  originalRequestURL: 'http://10.88.22.67:8080',
49
49
  EstateInfo: '{"estateId":"FAF029E8-EC28-4297-83CF-B8FFD826DB91","estateName":"AABBCC"}',
50
50
  estateId: '20210729104021C49F04B55C50F6AF58',
51
51
 
52
- authObject: '{"currentEstate":{},"platform":1,"OSVersion":"","clientVersion":"","machineCode":""}',
53
- Authorization:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjcyYzkxMzRlLTc5ODItNDFiYi04NDZjLWRhNmE0YTAwNGUzZSJ9.Dqw228vC10bapkK7Rnz_REvV_1x3igpsmFVHfeSIMFPHkMSpeh6py61NJ7HtkYnTTrSeRr2IjXvH9EoHLH3T3Q',
52
+ authObject: '{"currentEstate":{"estateId":"2209201708108B8F50AB530A49EAA858","estateName":"U%E7%89%88%E6%B5%8B%E8%AF%95%E6%A5%BC%E7%9B%98%E7%82%B9%E4%BD%8D"},"platform":1,"OSVersion":"","clientVersion":"","machineCode":""}',
53
+ Authorization:'Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImViNGU3NDFlLTYwZjEtNGVlMC04YTZlLWU5NjMwYjcyODU0YyJ9.8MyYlz55w4tL8iRmqQyMrq8DbvYSYkf2h8O5ei8UPghAqX3eQzfH233_D9yzU_qFeesjrw_hh8iq3e8J43CEXg',
54
54
  };
55
55
  },
56
56
  // 请求完成事件,可判断是否登录过期执行响应操作