@zhijiancloud/bpm 0.0.4 → 0.0.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 20231220
4
+
5
+ - [add] 新增 支持组件库按需引用
6
+
3
7
  ## 202311 首次支持表单字段组件
4
8
 
5
9
  表单字段:
@@ -52,3 +52,7 @@ img{
52
52
  height: 100%;
53
53
  width: auto;
54
54
  }
55
+
56
+ .viewer-container{
57
+ z-index: 10000!important;
58
+ }
@@ -0,0 +1,7 @@
1
+ import BpmAudit from './src/main.vue'
2
+
3
+ BpmAudit.install = function(Vue) {
4
+ Vue.component(BpmAudit.name , BpmAudit);
5
+ }
6
+
7
+ export default BpmAudit
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <component
3
+ class="bpm-audit"
4
+ v-model="curVal"
5
+ :is="curComponent"
6
+ :fieldConf="fieldConf"
7
+ :row="row"
8
+ :mode="mode"
9
+ :uiType="uiType"
10
+ v-bind="$attrs"
11
+ v-on="$listeners"
12
+ @change="onChange"
13
+ >
14
+ </component>
15
+
16
+ </template>
17
+ <script>
18
+ import editorComponent from "./part/editor.vue";
19
+ import readerComponent from "./part/reader.vue";
20
+
21
+ export default {
22
+ name: "BpmAudit",
23
+ components: {
24
+ editorComponent,
25
+ readerComponent
26
+ },
27
+ props: {
28
+ value: {
29
+ type: [Object]
30
+ },
31
+ fieldConf: {
32
+ type: Object,
33
+ default() {
34
+ return {};
35
+ },
36
+ },
37
+ row: {
38
+ type: Object,
39
+ default() {
40
+ return {};
41
+ },
42
+ },
43
+ mode: {
44
+ type: String,
45
+ default() {
46
+ return "view";
47
+ },
48
+ },
49
+ uiType: {
50
+ type: String,
51
+ default() {
52
+ return "default";
53
+ },
54
+ }
55
+ },
56
+ computed: {
57
+ curComponent() {
58
+ if (this.mode == "view") {
59
+ return readerComponent;
60
+ } else {
61
+ return editorComponent;
62
+ }
63
+ },
64
+ },
65
+ data() {
66
+ return {
67
+ curVal: {},
68
+ };
69
+ },
70
+ watch: {
71
+ value() {
72
+ this.curVal = this.value;
73
+ },
74
+ },
75
+ mounted() {
76
+ this.curVal = this.value;
77
+ },
78
+ methods: {
79
+ onChange(val){
80
+ console.log("onChange", _.cloneDeep(val))
81
+ this.$emit("input", val);
82
+ this.$emit("change", val);
83
+ }
84
+ }
85
+ };
86
+ </script>
@@ -0,0 +1,316 @@
1
+ <template>
2
+ <div class="audit">
3
+ <div class="row no-wrap relative-position q-chips-input">
4
+ <div class="col row items-center q-input-chips" @click="opened = true">
5
+ <span
6
+ class="aduit-result"
7
+ :style="{
8
+ background: resultColor,
9
+ color: resultColor ? '#fff' : '#333',
10
+ }"
11
+ >{{ getViewFont }}</span
12
+ >
13
+ </div>
14
+ </div>
15
+
16
+ <el-dialog
17
+ :visible.sync="opened"
18
+ class="audit-modal"
19
+ @close="onHide"
20
+ :modal="false"
21
+ :title="fieldConf.name"
22
+ @open="onOpen"
23
+ >
24
+ <div>
25
+ <el-form
26
+ ref="form"
27
+ class="audit-modal-content"
28
+ :model="curVal"
29
+ label-width="120px"
30
+ >
31
+ <el-form-item label="审批结果:">
32
+ <span
33
+ class="aduit-result"
34
+ :style="{
35
+ background: resultColor,
36
+ color: resultColor ? '#fff' : '#333',
37
+ }"
38
+ >{{ getViewFont }}</span
39
+ >
40
+ </el-form-item>
41
+ <el-form-item
42
+ label="回退节点:"
43
+ v-if="curVal && curVal.reject_target"
44
+ >
45
+ {{ curVal.reject_target.name || "上一个节点" }}
46
+ </el-form-item>
47
+ <el-form-item label="签名:" :required="isSignatureMust" v-if="showSignature">
48
+ <bpm-mul-image
49
+ v-model="curVal.signature"
50
+ :fieldConf="{
51
+ 'type': 'Signature',
52
+ }"
53
+ mode="edit"
54
+ ></bpm-mul-image>
55
+ </el-form-item>
56
+ <el-form-item label="评审意见:" :required="isJudgmentMust" v-if="showJudgment">
57
+ <el-input
58
+ v-model="curVal.judgment"
59
+ type="textarea"
60
+ placeholder="请输入评审意见"
61
+ />
62
+ </el-form-item>
63
+ <el-form-item label="拍照:" :required="isPhotoMust" v-if="showPhoto">
64
+ <bpm-mul-image
65
+ v-model="curVal.photos"
66
+ :fieldConf="{
67
+ 'type': 'MulImage',
68
+ }"
69
+ mode="edit"
70
+ ></bpm-mul-image>
71
+ </el-form-item>
72
+ <el-form-item label="审批日期:">
73
+ <el-date-picker
74
+ ref="dateSelect"
75
+ v-model="curVal.audit_at"
76
+ type="datetime"
77
+ :format="auditFormat"
78
+ />
79
+ </el-form-item>
80
+ <el-form-item label="审批人:">
81
+ {{curVal.auditor_name}}
82
+ <!-- <el-select v-model="curVal.auditor" placeholder="请选择">
83
+ <el-option
84
+ v-for="item in userList"
85
+ :key="item.user_id"
86
+ :label="`${item.label}(${item.user_id})`"
87
+ :value="item.user_id"
88
+ >
89
+ </el-option>
90
+ </el-select> -->
91
+ </el-form-item>
92
+ </el-form>
93
+ </div>
94
+ <span slot="footer" class="dialog-footer">
95
+ <el-button @click="opened = false">取 消</el-button>
96
+ <el-button type="primary" @click="onSubmit">确 定</el-button>
97
+ </span>
98
+ </el-dialog>
99
+ </div>
100
+ </template>
101
+
102
+
103
+ <script>
104
+ import _ from "lodash";
105
+ import Vue from "vue";
106
+ import { Dialog, DatePicker } from "element-ui";
107
+ Vue.use(Dialog);
108
+ Vue.use(DatePicker);
109
+ import MulImage from "../../../bpmMulImage/index";
110
+ Vue.use(MulImage);
111
+
112
+ export default {
113
+ data() {
114
+ return {
115
+ curVal: {
116
+ result: 1,
117
+ judgment: "",
118
+ photos: [],
119
+ reject_target: "",
120
+ signature: "",
121
+ auditor_name: "",
122
+ audit_at: "",
123
+ auditor: "",
124
+ },
125
+ opened: false,
126
+ dispMode: "nolink",
127
+ auditFormat: "yyyy-MM-dd HH:mm:ss",
128
+ userList: []
129
+ };
130
+ },
131
+ props: ["value", "fieldConf", "row"],
132
+ computed: {
133
+ useDetail() {
134
+ return (
135
+ !!_.get(this.fieldConf, "detail_allow", null) &&
136
+ !!_.get(this.fieldConf, "detail_deny", null)
137
+ );
138
+ },
139
+ resultColor() {
140
+ let result = _.get(this.curVal, "result", -1);
141
+ let color =
142
+ result == 1 ? this.allowColor : result == -1 ? null : this.denyColor;
143
+ return this.useDetail ? color : null;
144
+ },
145
+ allowColor() {
146
+ let color = _.get(this.fieldConf, "detail_allow.color", "#fff");
147
+ return color == "#fff" || color == "#ffffff" ? null : color;
148
+ },
149
+ getViewFont() {
150
+ let result = this.curVal.result;
151
+ let font = result == 1 ? "通过" : result == -1 ? "" : "不通过";
152
+ if (this.useDetail) {
153
+ font =
154
+ result == 1
155
+ ? _.get(this.fieldConf, "detail_allow.text", "通过")
156
+ : result == -1
157
+ ? ""
158
+ : _.get(this.fieldConf, "detail_deny.text", "不通过");
159
+ }
160
+ return font;
161
+ },
162
+ jucdgment() {
163
+ let result = this.curVal.result;
164
+ let jucdgment = _.get(this.fieldConf, "judgment");
165
+ if (this.useDetail) {
166
+ jucdgment =
167
+ result == 1
168
+ ? _.get(this.fieldConf, "detail_allow.judgment")
169
+ : _.get(this.fieldConf, "detail_deny.judgment");
170
+ }
171
+ return jucdgment;
172
+ },
173
+ showJudgment() {
174
+ return this.jucdgment == "yes" || this.jucdgment == "must";
175
+ },
176
+ denyColor() {
177
+ let color = _.get(this.fieldConf, "detail_deny.color", "#fff");
178
+ return color == "#fff" || color == "#ffffff" ? null : color;
179
+ },
180
+ signature() {
181
+ let result = this.curVal.result;
182
+ let signature = _.get(this.fieldConf, "signature");
183
+ if (this.useDetail) {
184
+ signature =
185
+ result == 1
186
+ ? _.get(this.fieldConf, "detail_allow.signature")
187
+ : _.get(this.fieldConf, "detail_deny.signature");
188
+ }
189
+ return signature;
190
+ },
191
+ showSignature() {
192
+ return this.signature == "yes" || this.signature == "must";
193
+ },
194
+ photo() {
195
+ let result = this.curVal.result;
196
+ let photo = _.get(this.fieldConf, "photo");
197
+ if (this.useDetail) {
198
+ photo =
199
+ result == 1
200
+ ? _.get(this.fieldConf, "detail_allow.photo")
201
+ : _.get(this.fieldConf, "detail_deny.photo");
202
+ }
203
+ return photo;
204
+ },
205
+ showPhoto() {
206
+ return this.photo == "yes" || this.photo == "must";
207
+ },
208
+ isJudgmentMust() {
209
+ return this.judgment == "must";
210
+ },
211
+ isSignatureMust() {
212
+ return this.signature == "must";
213
+ },
214
+ isPhotoMust() {
215
+ return this.photo == "must";
216
+ },
217
+ isRequired() {
218
+ return _.get(this.fieldConf, "check.required");
219
+ },
220
+ getCanvasBoxStyle() {
221
+ return {
222
+ height: "150px",
223
+ width: "100%",
224
+ };
225
+ },
226
+ },
227
+ created() {
228
+ },
229
+ mounted() {
230
+ if(this.value){
231
+ let value = _.cloneDeep(this.value);
232
+ value.audit_at = value.audit_at * 1000
233
+ this.curVal = _.merge(this.curVal, value)
234
+ }
235
+
236
+ if (this.useDetail) {
237
+ this.selectOptions = [
238
+ {
239
+ label: _.get(this.fieldConf, "detail_allow.text", "通过"),
240
+ value: 1,
241
+ },
242
+ {
243
+ label: _.get(this.fieldConf, "detail_deny.text", "不通过"),
244
+ value: 2,
245
+ },
246
+ ];
247
+ }
248
+ },
249
+ methods: {
250
+ onHide() {
251
+ this.opened = false;
252
+ this.showForm = false
253
+ },
254
+ onOpen() {
255
+ if (this.value) {
256
+ let value = _.cloneDeep(this.value);
257
+ value.audit_at = value.audit_at * 1000
258
+ this.curVal = _.merge(this.curVal, value)
259
+
260
+ }
261
+ },
262
+ async onSubmit() {
263
+ let curVal = this.curVal;
264
+ if (this.isRequired && !curVal.result) {
265
+ this.$q.notify({
266
+ message: "请选择审批结果",
267
+ position: "top",
268
+ type: "warning",
269
+ });
270
+ return;
271
+ }
272
+ if (this.isSignatureMust && !curVal.signature) {
273
+ this.$q.notify({
274
+ message: "请完成签名",
275
+ position: "top",
276
+ type: "warning",
277
+ });
278
+ return;
279
+ }
280
+ if (this.isJudgmentMust && !curVal.judgment) {
281
+ this.$q.notify({
282
+ message: "请填写意见",
283
+ position: "top",
284
+ type: "warning",
285
+ });
286
+ return;
287
+ }
288
+ if (this.isPhotoMust && _.isEmpty(curVal.photos)) {
289
+ this.$q.notify({
290
+ message: "请至少上传一张图片",
291
+ position: "top",
292
+ type: "warning",
293
+ });
294
+ return;
295
+ }
296
+ let value = {
297
+ result: curVal.result,
298
+ signature: curVal.signature,
299
+ judgment: curVal.judgment,
300
+ photos: curVal.photos,
301
+ audit_at: curVal.audit_at / 1000,
302
+ auditor: curVal.auditor,
303
+ auditor_name: curVal.auditor_name,
304
+ };
305
+ this.$emit("change", value);
306
+ this.$emit("input", value);
307
+ this.opened = false;
308
+ },
309
+ getRejectTarget(id) {
310
+ // let rejectTargetMap = this.rejectTargetMap;
311
+ return id == "last_id" ? { type: "RejectToLastUserNode" } : id;
312
+ },
313
+ },
314
+ };
315
+ </script>
316
+
@@ -0,0 +1,217 @@
1
+ <template>
2
+ <div class="el-form-item-no-input audit">
3
+ <div class="row no-wrap relative-position q-chips-input">
4
+ <div class="col row no-wrap relative-position">
5
+ <div
6
+ class="col row items-center q-input-chips text-primary"
7
+ v-if="modalShow"
8
+ @click="opened = true"
9
+ >
10
+ <span
11
+ class="aduit-result"
12
+ :style="{
13
+ background: resultColor,
14
+ color: resultColor ? '#fff' : '#333',
15
+ }"
16
+ >{{ getViewFont }}</span
17
+ >
18
+ </div>
19
+ <div
20
+ class="col row items-center text-primary"
21
+ v-else
22
+ @click="opened = true"
23
+ >
24
+ <span
25
+ class="aduit-result"
26
+ :style="{
27
+ background: resultColor,
28
+ color: resultColor ? '#fff' : '#333',
29
+ }"
30
+ >{{ getViewFont }}</span
31
+ >
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <div
36
+ v-if="value && value.reject_target"
37
+ label="回退节点:"
38
+ class="el-form-item-required"
39
+ >
40
+ {{ value.reject_target.name || "上一个节点" }}
41
+ </div>
42
+ <el-dialog
43
+ class="audit-modal read-audit"
44
+ :visible.sync="opened"
45
+ @close="onHide"
46
+ :modal="false"
47
+ :ok="false"
48
+ v-if="showSignature || showJudgment || showPhoto"
49
+ :title="fieldConf.name"
50
+ >
51
+ <div>
52
+ <el-form
53
+ v-if="value"
54
+ ref="form"
55
+ class="audit-modal-content"
56
+ :model="curVal"
57
+ label-width="120px"
58
+ >
59
+ <el-form-item label="审批结果:" class="el-form-item-required">
60
+ <span
61
+ class="aduit-result"
62
+ :style="{
63
+ background: resultColor,
64
+ color: resultColor ? '#fff' : '#333',
65
+ }"
66
+ >{{ getViewFont }}</span
67
+ >
68
+ </el-form-item>
69
+
70
+ <el-form-item
71
+ v-if="value && value.reject_target"
72
+ label="回退节点:"
73
+ class="el-form-item-required"
74
+ >
75
+ {{ value.reject_target.name || "上一个节点" }}
76
+ </el-form-item>
77
+
78
+ <el-form-item
79
+ label="签名:"
80
+ :required="isSignatureMust"
81
+ v-if="showSignature"
82
+ >
83
+ <bpm-mul-image
84
+ :value="value.signature"
85
+ :fieldConf="{type: 'Signature'}"
86
+ ></bpm-mul-image>
87
+ </el-form-item>
88
+ <el-form-item
89
+ label="填写意见:"
90
+ :required="isJudgmentMust"
91
+ v-if="showJudgment"
92
+ ><span :title="value && value.judgment">{{
93
+ value && value.judgment ? value.judgment : "--"
94
+ }}</span></el-form-item
95
+ >
96
+ <el-form-item
97
+ label="拍照:"
98
+ v-if="showPhoto"
99
+ :class="isPhotoMust ? 'el-form-item-required' : ''"
100
+ >
101
+ <bpm-mul-image
102
+ :value="value.photos"
103
+ :fieldConf="{type: 'MulImage'}"
104
+ ></bpm-mul-image>
105
+ </el-form-item>
106
+ <el-form-item label="审批人">{{ auditorName }}</el-form-item>
107
+ <el-form-item label="审批时间">{{ auditAt }}</el-form-item>
108
+ </el-form>
109
+ </div>
110
+ </el-dialog>
111
+ </div>
112
+ </template>
113
+
114
+ <script>
115
+ import _ from "lodash";
116
+ import Vue from "vue";
117
+ import fecha from "fecha"
118
+ import { Dialog } from "element-ui";
119
+ Vue.use(Dialog);
120
+ import MulImage from "../../../bpmMulImage/index";
121
+ Vue.use(MulImage);
122
+ export default {
123
+ props: ["value", "fieldConf", "row"],
124
+ data() {
125
+ return {
126
+ opened: false,
127
+ auditFormat: "YYYY-MM-DD HH:mm:ss",
128
+ };
129
+ },
130
+ computed: {
131
+ useDetail() {
132
+ return (
133
+ !!_.get(this.fieldConf, "detail_allow", null) &&
134
+ !!_.get(this.fieldConf, "detail_deny", null)
135
+ );
136
+ },
137
+ resultColor() {
138
+ let result = _.get(this.value, "result", -1);
139
+ let color =
140
+ result == 1 ? this.allowColor : result == -1 ? null : this.denyColor;
141
+ return this.useDetail ? color : null;
142
+ },
143
+ allowColor() {
144
+ let color = _.get(this.fieldConf, "detail_allow.color", "#fff");
145
+ return color == "#fff" || color == "#ffffff" ? null : color;
146
+ },
147
+ denyColor() {
148
+ let color = _.get(this.fieldConf, "detail_deny.color", "#fff");
149
+ return color == "#fff" || color == "#ffffff" ? null : color;
150
+ },
151
+ getViewFont() {
152
+ let result = _.get(this.value, "result", -1);
153
+ let font = result == 1 ? "通过" : result == -1 ? "未审批" : "不通过";
154
+ if (this.useDetail) {
155
+ font =
156
+ result == 1
157
+ ? _.get(this.fieldConf, "detail_allow.text", "通过")
158
+ : result == -1
159
+ ? "未审批"
160
+ : _.get(this.fieldConf, "detail_deny.text", "不通过");
161
+ }
162
+ return font;
163
+ },
164
+ hasAudited() {
165
+ let result = _.get(this.value, "result", -1);
166
+ return result != -1;
167
+ },
168
+ showJudgment() {
169
+ let judgment = _.get(this.fieldConf, "judgment");
170
+ return judgment == "yes" || judgment == "must";
171
+ },
172
+ showSignature() {
173
+ let signature = _.get(this.fieldConf, "signature");
174
+ return signature == "yes" || signature == "must";
175
+ },
176
+ showPhoto() {
177
+ let photo = _.get(this.fieldConf, "photo");
178
+ return photo == "yes" || photo == "must";
179
+ },
180
+ isJudgmentMust() {
181
+ return _.get(this.fieldConf, "judgment") == "must";
182
+ },
183
+ isSignatureMust() {
184
+ return _.get(this.fieldConf, "signature") == "must";
185
+ },
186
+ isPhotoMust() {
187
+ return _.get(this.fieldConf, "photo") == "must";
188
+ },
189
+ isRequired() {
190
+ return _.get(this.fieldConf, "check.required");
191
+ },
192
+ modalShow() {
193
+ return (
194
+ (this.showSignature || this.showJudgment || this.showPhoto) &&
195
+ this.hasAudited
196
+ );
197
+ },
198
+ auditAt() {
199
+ let time = _.get(this.value, "audit_at");
200
+ if(!time) return
201
+ time = time * 1000
202
+ // let timeStamp = new Date(time).getTime();
203
+ return fecha.format(time, this.auditFormat);
204
+ },
205
+ auditorName() {
206
+ return _.get(this.value, "auditor_name");
207
+ },
208
+ },
209
+ mounted() {
210
+ },
211
+ methods: {
212
+ onHide() {
213
+ this.opened = false;
214
+ }
215
+ },
216
+ };
217
+ </script>
@@ -33,6 +33,7 @@ import BpmMulImage from "../../bpmMulImage";
33
33
  import BpmSelectFromForm from "../../bpmSelectFromForm";
34
34
  import BpmSelectFromId from "../../bpmSelectFromId";
35
35
  import BpmSubForm from '../../bpmSubForm';
36
+ import BpmAudit from '../../bpmAudit';
36
37
 
37
38
  const bpmComponents = {
38
39
  BpmText,
@@ -72,7 +73,8 @@ const bpmComponents = {
72
73
  'BpmMulSelectSort': BpmSelectCheckItem,
73
74
  'BpmSelectSort': BpmSelectCheckItem,
74
75
  'BpmXSubForm': BpmSubForm,
75
- 'BpmOrderSubform': BpmSubForm
76
+ 'BpmOrderSubform': BpmSubForm,
77
+ BpmAudit
76
78
  };
77
79
 
78
80
  export default {
@@ -166,6 +168,7 @@ export default {
166
168
  },
167
169
  },
168
170
  mounted () {
171
+ this.$bpm.env.form_name = this.formDefId
169
172
  this.curVal = this.value
170
173
  this.$bpm.orgInfo = this.orgInfo
171
174
  }
@@ -128,10 +128,6 @@ export default {
128
128
  };
129
129
  },
130
130
  watch: {
131
- curVal(val) {
132
- let result = this.isSign ? _.get(val, "0.md5", "") : val;
133
- this.$emit("input", result);
134
- },
135
131
  value() {
136
132
  this.curVal =
137
133
  this.isSign && _.isString(this.value) && this.value
@@ -427,11 +423,15 @@ export default {
427
423
  md5: _.get(response, "data.file_md5"),
428
424
  });
429
425
  this.curVal = _.cloneDeep(items);
430
- console.log("this.curVal", this.curVal);
426
+ let result = this.isSign ? _.get( this.curVal, "0.md5", "") : this.curVal;
427
+ this.$emit("input", result);
428
+
431
429
  },
432
430
  remove(md5) {
433
431
  this.curVal = _.filter(this.curVal, (item) => item.md5 != md5);
434
432
  this.$refs.uploader.queue = [];
433
+ let result = this.isSign ? _.get( this.curVal, "0.md5", "") : this.curVal;
434
+ this.$emit("input", result);
435
435
  },
436
436
  onHide() {
437
437
  this.opened = false;