@zhijiancloud/bpm 0.0.3 → 0.0.5

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.
@@ -7,7 +7,7 @@
7
7
  <viewer :images="photo" rebuild @inited="inited" ref="viewer">
8
8
  <span v-for="item in value" :key="item.md5">
9
9
  <div class="file-box" v-if="isImageFile(item)">
10
- <div class="file-icon">
10
+ <div class="file-icon" style="height: 20px;border: 1px dashed #ececec;">
11
11
  <img :src="fileLink(item, 600)" alt />
12
12
  </div>
13
13
  <div
@@ -12,10 +12,12 @@
12
12
  :on-success="onUploaded"
13
13
  :on-error="onFail"
14
14
  :file-list="fileList"
15
- v-bind="$attrs"
15
+ v-bind="$attrs"
16
16
  v-on="$listeners"
17
17
  >
18
- <el-button size="small" type="primary" slot="trigger" :disabled="disabled">点击上传</el-button>
18
+ <el-button size="small" type="primary" slot="trigger" :disabled="disabled"
19
+ >点击上传</el-button
20
+ >
19
21
  </el-upload>
20
22
  <div class="row gutter-sm q-my-sm file-list">
21
23
  <template v-if="curVal && curVal.length">
@@ -27,7 +29,11 @@
27
29
  @inited="inited"
28
30
  >
29
31
  <div class="col-12 file-box" v-for="item in curVal" :key="item.md5">
30
- <span class="file-content" @click="previewImg(item)" v-if="isImageFile(item)">
32
+ <span
33
+ class="file-content"
34
+ @click="previewImg(item)"
35
+ v-if="isImageFile(item)"
36
+ >
31
37
  <img class="preview-img" :src="fileLink(item)" />
32
38
  </span>
33
39
  <span @click="preview(item)" v-else class="file-content q-mb-xs">
@@ -45,9 +51,7 @@
45
51
  >
46
52
  {{ item.name }}
47
53
  </div>
48
- <div class="file-remove" @click="remove(item.md5, item)">
49
- 删除
50
- </div>
54
+ <div class="file-remove" @click="remove(item.md5, item)">删除</div>
51
55
  </div>
52
56
  </viewer>
53
57
  </template>
@@ -78,7 +82,7 @@ Vue.use(Dialog);
78
82
  import Vue from "vue";
79
83
  import Viewer from "v-viewer";
80
84
  import "viewerjs/dist/viewer.css";
81
- import "font-awesome/css/font-awesome.min.css"
85
+ import "font-awesome/css/font-awesome.min.css";
82
86
  const piexif = require("piexifjs");
83
87
  import { comparessImg, ImageTool } from "./lib/compressImageUtils";
84
88
  import { showGPSInfo, getFileType, gethashcode } from "./lib/utils";
@@ -120,32 +124,33 @@ export default {
120
124
  fileList: [],
121
125
  opened: false,
122
126
  officeUrl: "",
123
- windowH: 0
127
+ windowH: 0,
124
128
  };
125
129
  },
126
130
  watch: {
127
131
  curVal(val) {
128
- let result = this.isSign ? _.get(val, "0.md5", "") : val
132
+ let result = this.isSign ? _.get(val, "0.md5", "") : val;
129
133
  this.$emit("input", result);
130
134
  },
131
- isSign(){
132
- return this.fieldConf.type == 'Signature'
135
+ value() {
136
+ this.curVal =
137
+ this.isSign && _.isString(this.value) && this.value
138
+ ? [
139
+ {
140
+ md5: this.value,
141
+ name: "",
142
+ type: "image/png",
143
+ },
144
+ ]
145
+ : this.value;
133
146
  },
134
- value(){
135
- this.curVal = this.isSign
136
- ? [
137
- {
138
- md5: this.value,
139
- name: "",
140
- type: "image/png",
141
- },
142
- ]
143
- : this.value;
144
- }
145
147
  },
146
148
  computed: {
147
149
  url() {
148
- return "/platform/v1/papi/app_file/upload/"
150
+ return "/platform/v1/papi/app_file/upload/";
151
+ },
152
+ isSign() {
153
+ return this.fieldConf.type == "Signature";
149
154
  },
150
155
  photo() {
151
156
  let list = [];
@@ -173,7 +178,7 @@ export default {
173
178
  return this.maxCountConf - this.curVal && this.curVal.length;
174
179
  },
175
180
  disabled() {
176
- let val = this.curVal ? this.curVal : []
181
+ let val = this.curVal ? this.curVal : [];
177
182
  return val.length >= this.maxCountConf;
178
183
  },
179
184
  },
@@ -181,11 +186,12 @@ export default {
181
186
  // getAgent.register();
182
187
  },
183
188
  mounted() {
184
- this.curVal = this.isSign
189
+ this.curVal =
190
+ this.isSign && _.isString(this.value) && this.value
185
191
  ? [
186
192
  {
187
193
  md5: this.value,
188
- name: "",
194
+ name: "签名",
189
195
  type: "image/png",
190
196
  },
191
197
  ]
@@ -231,10 +237,10 @@ export default {
231
237
  let attrMap = {
232
238
  type: "text/javascript",
233
239
  async: /^http/.test(url) ? "async" : "",
234
- src: url
235
- }
240
+ src: url,
241
+ };
236
242
  for (var key in attrMap) {
237
- link[key] = attrMap[key]
243
+ link[key] = attrMap[key];
238
244
  }
239
245
  document.head.appendChild(link);
240
246
  },
@@ -408,10 +414,10 @@ export default {
408
414
  },
409
415
  onFail(err, file) {
410
416
  let message = `${file.name}上传失败`;
411
- console.log("err:", message)
417
+ console.log("err:", message);
412
418
  },
413
419
  onUploaded(response, file) {
414
- console.log("file", file)
420
+ console.log("file", file);
415
421
 
416
422
  let items = _.isArray(this.curVal) ? this.curVal : [];
417
423
 
@@ -421,7 +427,7 @@ export default {
421
427
  md5: _.get(response, "data.file_md5"),
422
428
  });
423
429
  this.curVal = _.cloneDeep(items);
424
- console.log("this.curVal", this.curVal)
430
+ console.log("this.curVal", this.curVal);
425
431
  },
426
432
  remove(md5) {
427
433
  this.curVal = _.filter(this.curVal, (item) => item.md5 != md5);
@@ -78,8 +78,9 @@ export default {
78
78
  resolve(list);
79
79
  },
80
80
  transformResultToTree(items) {
81
+ console.log("fieldConf", this.fieldConf)
81
82
  let type = _.get(this.fieldConf, "type");
82
- if (type == "Sort" || type == "MulSort") {
83
+ if (type == "SelectCheckItem" || type == "MulSelectCheckItem") {
83
84
  return _.map(items, (item) => {
84
85
  return {
85
86
  value: item[0],
@@ -88,7 +89,7 @@ export default {
88
89
  };
89
90
  });
90
91
  }
91
- if (type == "CheckItem" || type == "MulCheckItem") {
92
+ if (type == "SelectSort" || type == "MulSelectSort") {
92
93
  return _.map(items, (item) => {
93
94
  return {
94
95
  value: item.value,
@@ -76,7 +76,8 @@ export default {
76
76
  async handleAddWord(str) {
77
77
  this.selectWord = str;
78
78
  if (this.curVal) {
79
- let elem = this.$refs.component.$refs.input;
79
+ let elem = this.$refs.component.$refs.textarea;
80
+ if(!elem) elem = this.$refs.component.$refs.text
80
81
  let startPos = elem.selectionStart;
81
82
  let endPos = elem.selectionEnd;
82
83
  let value = this.curVal;
@@ -84,7 +85,6 @@ export default {
84
85
  let endStr = value.substring(endPos, value.length);
85
86
  let result = preStr + str + endStr;
86
87
  this.curVal = result;
87
-
88
88
  await this.$nextTick();
89
89
  elem.focus();
90
90
 
@@ -24,7 +24,13 @@ export default {
24
24
  let value = this.value;
25
25
  if (_.isNil(value) || !value) return (this.label = "未选择");
26
26
  try {
27
- if(_.isObject(value)) value = JSON.parse(value)
27
+ if(_.isObject(value)){
28
+ try {
29
+ value = JSON.parse(value)
30
+ } catch (error) {
31
+ console.log("error", error)
32
+ }
33
+ }
28
34
  let values = _.isArray(value) ? value : [value];
29
35
  let fieldId = _.get(this.fieldConf, "id");
30
36