@lambo-design/workflow-approve 1.0.0-beta.3 → 1.0.0-beta.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.
@@ -1,389 +1,302 @@
1
- <template>
2
- <div>
3
- <div style="font-size: small; background-color: #f0f0f0">
4
- &nbsp;
5
- <a style="color: black" @click="customCommentListModal = true"><Icon type="ios-browsers-outline" /> 常用意见</a> &nbsp;
6
- <Tooltip placement="bottom" v-if="attachmentFile">
7
- <div style="font-size: smaller" slot="content">支持扩展名:.rar .zip .doc .docx .pdf .jpg...</div>
8
- <Upload :action="actionUrl" :on-error="handleError" :before-upload="handleUpload" :show-upload-list="false"
9
- multiple
10
- :on-success="handleSuccess" :on-progress="handleProgress"
11
- :on-format-error="handleFormatError"
12
- :format="['xlsx', 'xls','txt','rar','zip','doc','docx','jpg','pdf','gif','png']">
13
- <a style="color: black"><Icon type="md-attach" /> 附件</a>
14
- </Upload>
15
- </Tooltip>
16
- </div>
17
- <Input v-model="auditOpinion" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }" show-word-limit
18
- :maxlength="200" placeholder="处理意见" style="width: 100%"
19
- ></Input>
20
- <div>
21
- <span v-for="(item, index) in attachmentdata" :key="index" style="font-size: 14px">
22
- <span v-if="index>0">、</span>
23
- <span style="color:#2D8cF0 "> {{ item.fileName }}</span>
24
- <a @click="forRemoveAttachment(index)" style="font-size: 13px;">.删除</a>
25
- </span>
26
- </div>
27
- <Modal v-model="customCommentListModal" title="常用意见" width="800px" footer-hide>
28
- <LamboPagingTable :requestSuccessCodes="requestSuccessCodes" ref="customCommentTable" :dataUrl="dataUrl"
29
- :columns="tableColumn">
30
- <div slot="buttons">
31
- <Button type="primary" ghost icon="md-add" @click="openDetailModal('create')">新增</Button>
32
- </div>
33
- </LamboPagingTable>
34
- </Modal>
35
- <Modal v-model="customCommentDetailModal" :title="customCommentDetailTitle" width="700px"
36
- @on-cancel="customCommentDetailCancel"
37
- @on-ok="customCommentDetailOk">
38
- <Card v-model="customCommentDetailModal" width="600px" dis-hover>
39
- <Form ref="customCommentForm" :model="customCommentDetailForm" :rules="customCommentRuleValidate"
40
- :label-width="100" label-position="right">
41
- <FormItem label="常用意见:" prop="commentContent">
42
- <Input type="textarea" v-model="customCommentDetailForm.commentContent" show-word-limit :maxlength="1000"
43
- style="width: 500px"/>
44
- </FormItem>
45
- <FormItem label="排序码:">
46
- <Input style="width: 100px" v-model="customCommentDetailForm.orders"/>
47
- </FormItem>
48
- </Form>
49
- </Card>
50
- </Modal>
51
- </div>
52
- </template>
53
-
54
- <script>
55
- import ajax from "@lambo-design/shared/utils/ajax";
56
- import { operateHref } from '@lambo-design/shared/utils/assist';
57
- import LamboPagingTable from "@lambo-design/paging-table";
58
-
59
- import axios from 'axios';
60
- // 引入docx-preview插件
61
- let docx = require('docx-preview');
62
- export default {
63
- components: {
64
- LamboPagingTable
65
- },
66
- props: {
67
- attachmentFile:{
68
- type: Boolean,
69
- default: false,
70
- },
71
- actionUrl: {
72
- default: "/api/oss-server/file/put",
73
- },
74
- attachmentdata: {
75
- type: Array,
76
- default: function () {
77
- return []
78
- }
79
- },
80
- smartFlowServerContext: {
81
- type: String,
82
- default: '/api/smart-flow-server',
83
- },
84
- ossServerContext: {
85
- type: String,
86
- default: '/api/oss-server',
87
- },
88
- },
89
- data() {
90
- return {
91
- requestSuccessCodes: [200, "200"],
92
- tempFileArr: [],
93
- fileList: [],
94
- auditOpinionText: '',
95
- auditOpinionForSelect: [{
96
- label: '',
97
- value: ''
98
- }],
99
- customCommentListModal: false,
100
- auditOpinion: '',
101
- customCommentDetailModal: false,
102
- customCommentDetailTitle: '',
103
- dataUrl: this.smartFlowServerContext + '/manage/smartflowCustomComment/list',
104
- customCommentDetailForm: {
105
- id: '',
106
- commentContent: '',
107
- orders: 10
108
- },
109
- customCommentRuleValidate: {
110
- commentContent: [
111
- {required: true, trigger: "blur", message: "意见不能为空"},
112
- {max: 1000, message: "意见不能大于1000位", trigger: "blur"}
113
- ]
114
- },
115
- }
116
- },
117
- computed: {
118
- tableColumn() {
119
- let column = [];
120
- let self = this;
121
- column.push({
122
- title: '常用意见',
123
- key: "commentContent",
124
- minWidth: 150,
125
- align: 'center',
126
- });
127
- column.push({
128
- title: "意见类型",
129
- key: "commentType",
130
- width: 170,
131
- align: "center",
132
- render: (v, param) => {
133
- if (param.row.commentType === '10') {
134
- return v("span", '自定义');
135
- }
136
- return v("span", '系统预置')
137
- }
138
- });
139
- column.push({
140
- title: "排序码",
141
- key: "orders",
142
- width: 100,
143
- align: "center",
144
- });
145
-
146
- column.push({
147
- title: "修改时间",
148
- key: "updateTime",
149
- width: 170,
150
- align: "center",
151
- render: (v, param) => {
152
- if (param.row.updateTime) {
153
- let date = new Date(param.row.updateTime)
154
- let y = date.getFullYear() // 年
155
- let MM = date.getMonth() + 1 // 月
156
- MM = MM < 10 ? ('0' + MM) : MM
157
- let d = date.getDate() // 日
158
- d = d < 10 ? ('0' + d) : d
159
- let h = date.getHours() // 时
160
- h = h < 10 ? ('0' + h) : h
161
- let m = date.getMinutes()//
162
- m = m < 10 ? ('0' + m) : m
163
- let s = date.getSeconds()// 秒
164
- s = s < 10 ? ('0' + s) : s
165
- let state = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
166
- return v("span", state);
167
- }
168
- return v("span", '')
169
- }
170
- });
171
-
172
- column.push({
173
- title: "操作", width: 160, align: 'center', tooltip: true,
174
- render: (h, {row}) => {
175
- return h("div", [
176
- operateHref(this, h, row, "修改", () => {
177
- this.openDetailModal('update', row);
178
- }, "primary"),
179
- operateHref(this, h, row, "删除", () => {
180
- this.deleteCustomComment(row);
181
- }, "error"),
182
- operateHref(this, h, row, "选择", () => {
183
- this.choose(row);
184
- }, "primary")
185
- ]);
186
-
187
- }
188
-
189
- });
190
-
191
- return column;
192
- },
193
- },
194
- methods: {
195
- openDetailModal(type, row) {
196
- this.customCommentDetailModal = true
197
- if (type === 'create') {
198
- this.customCommentDetailTitle = '新增常用意见'
199
- } else {
200
- this.customCommentDetailTitle = '修改常用意见'
201
- this.customCommentDetailForm.id = row.id
202
- this.customCommentDetailForm.commentContent = row.commentContent
203
- this.customCommentDetailForm.orders = row.orders
204
- }
205
- },
206
- customCommentDetailCancel() {
207
- this.getAuditOpinionForSelect()
208
- this.customCommentDetailForm = {
209
- id: '',
210
- commentContent: '',
211
- orders: 10
212
- }
213
- this.customCommentDetailModal = false
214
- },
215
- customCommentDetailOk() {
216
- const self = this
217
- self.$refs.customCommentForm.validate((valid) => {
218
- if (valid) {
219
- if (self.customCommentDetailForm.id) {
220
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/update", self.customCommentDetailForm).then((resp) => {
221
- if (resp.data.code === "200") {
222
- self.customCommentDetailForm = {
223
- id: '',
224
- commentContent: '',
225
- orders: 10
226
- }
227
- self.refreshTable()
228
- }
229
- }).catch(err => {
230
- console.log(err);
231
- })
232
- } else {
233
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/insert", self.customCommentDetailForm).then((resp) => {
234
- if (resp.data.code === "200") {
235
- self.customCommentDetailForm = {
236
- id: '',
237
- commentContent: '',
238
- orders: 10
239
- }
240
- self.refreshTable()
241
- }
242
- }).catch(err => {
243
- console.log(err);
244
- })
245
- }
246
- this.getAuditOpinionForSelect()
247
- this.customCommentDetailModal = false
248
- }
249
- })
250
- },
251
- getAuditOpinionForSelect() {
252
- const self = this
253
- let auditOpinionForSelect = []
254
- ajax.get(this.smartFlowServerContext + "/manage/smartflowCustomComment/list", {params: {limit: 100}}).then((resp) => {
255
- if (resp.data.code == "200" && resp.data.data) {
256
- resp.data.data.rows.forEach(item =>
257
- auditOpinionForSelect.push({
258
- value: item.commentContent,
259
- label: item.commentContent,
260
- type: item.commentType === '10' ? '自定义' : '系统预置'
261
- })
262
- )
263
- self.auditOpinionForSelect = auditOpinionForSelect
264
- }
265
- }).catch(err => {
266
- console.log(err);
267
- })
268
- },
269
- deleteCustomComment(row) {
270
- const self = this
271
- this.$Modal.confirm({
272
- title: '提示',
273
- content: `<p>确定要删除${row.commentContent}吗?</p>`,
274
- onOk: () => {
275
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/delete/" + row.id).then(function (resp) {
276
- if (resp.data.code === "200") {
277
- self.refreshTable()
278
- } else {
279
- self.$Message.error(resp.data.data);
280
- }
281
- }).catch(function (err) {
282
- self.$Message.error('删除失败,请联系应用管理员');
283
- });
284
- }
285
- });
286
- },
287
- refreshTable() {
288
- this.$refs.customCommentTable.tableRefresh()
289
- },
290
- updateValue() {
291
- this.$emit('input', this.auditOpinion);
292
- },
293
- choose(row) {
294
- this.auditOpinion = row.commentContent
295
- this.customCommentListModal = false
296
- },
297
- // 上传附件
298
- handleError: function (error, file, fileList) {
299
- this.loading = false
300
- this.$Message.error({
301
- content: fileList.name + ' 上传失败!',
302
- });
303
- },
304
- handleUpload: function (file) {
305
- if (!file.canceled) {
306
- this.tempFileArr.push(file.name)
307
- }
308
- },
309
- handleSuccess: function (response, file, fileList) {
310
- let self = this;
311
- let tempArr = JSON.parse(JSON.stringify(this.tempFileArr))
312
-
313
- tempArr.forEach(function (value, index, array) {
314
- if (value == file.name) {
315
- self.tempFileArr.splice(index, 1)
316
- }
317
- });
318
-
319
- if (response.code == 1 && self.tempFileArr && self.tempFileArr.length < 1) {
320
- self.loading = false;
321
- self.$Message.success("上传成功");
322
- }
323
-
324
- if (response.code == 1) {
325
- if (response.data != undefined && response.data != null && response.data.length > 0) {
326
- let tempData = [].concat(response.data);
327
- this.attachmentdata.push({
328
- fileName: tempData[0].originalName,
329
- fileId: tempData[0].fileName,
330
- });
331
- }
332
-
333
- this.fileList = fileList
334
-
335
- } else {
336
- self.loading = false;
337
- this.$Message.error({
338
- content: file.name + '上传失败!',
339
- });
340
- //this.$Message.error("上传失败!");
341
-
342
- let j = 0;
343
- for (let i = 0; i < fileList.length; i++) {
344
- if (fileList[i].canceled) {
345
- continue;
346
- }
347
- if (fileList[i].name === file.name && fileList[i].timestamp === file.timestamp) {
348
- j = i;
349
- }
350
- }
351
-
352
- //console.log(fileList)
353
- fileList.splice(j, 1);
354
-
355
- }
356
-
357
- },
358
- handleProgress(event, file, fileList) {
359
- this.loading = true
360
- },
361
- handleFormatError(file) {
362
- this.loading = false
363
- this.$Notice.warning({
364
- title: "文件格式不正确",
365
- desc: "文件 " + file.name + " 格式不支持,请上传其他格式的文件。",
366
- });
367
- },
368
- forRemoveAttachment: function (index) {
369
- this.attachmentdata.splice(index, 1);
370
- },
371
- },
372
- mounted() {
373
- this.getAuditOpinionForSelect()
374
- },
375
- watch: {
376
- auditOpinionText(label) {
377
- this.auditOpinion = label;
378
- },
379
- auditOpinion(val) {
380
- this.$emit('input', val)
381
- }
382
- }
383
-
384
- }
385
- </script>
386
-
387
- <style scoped>
388
-
389
- </style>
1
+ <template>
2
+ <div>
3
+ <div style="font-size: small; background-color: #f0f0f0">
4
+ &nbsp;
5
+ <a style="color: black" @click="customCommentListModal = true"><Icon type="ios-browsers-outline" /> 常用意见</a> &nbsp;
6
+ <Tooltip placement="bottom" v-if="attachmentFile" max-width="200">
7
+ <div style="font-size: smaller" slot="content">支持扩展名:.pdf .doc .docx .txt .xls .xlsx .jpg .jpeg .png .gif</div>
8
+ <UploadFile @upload-result="uploadFile" :upload-btn="false" :show-file-list="false" :multiple="true"
9
+ :oss-server-context="smartFlowServerContext" :oss-file-put-url="ossFilePutUrl"></UploadFile>
10
+ </Tooltip>
11
+ </div>
12
+ <Input v-model="auditOpinion" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }" show-word-limit
13
+ :maxlength="200" placeholder="处理意见" style="width: 100%"
14
+ ></Input>
15
+ <div>
16
+ <div v-for="(item, index) in attachmentdata" :key="index" style="font-size: 14px">
17
+ <span style="color:#2D8cF0 "> {{ item.fileName }}</span>
18
+ <a @click="forRemoveAttachment(index)" style="font-size: 13px;"> &nbsp;.删除</a>
19
+ </div>
20
+ </div>
21
+ <Modal v-model="customCommentListModal" title="常用意见" width="800px" footer-hide>
22
+ <LamboPagingTable :requestSuccessCodes="requestSuccessCodes" ref="customCommentTable" :dataUrl="dataUrl"
23
+ :columns="tableColumn">
24
+ <div slot="buttons">
25
+ <Button type="primary" ghost icon="md-add" @click="openDetailModal('create')">新增</Button>
26
+ </div>
27
+ </LamboPagingTable>
28
+ </Modal>
29
+ <Modal v-model="customCommentDetailModal" :title="customCommentDetailTitle" width="700px"
30
+ @on-cancel="customCommentDetailCancel"
31
+ @on-ok="customCommentDetailOk">
32
+ <Card v-model="customCommentDetailModal" width="600px" dis-hover>
33
+ <Form ref="customCommentForm" :model="customCommentDetailForm" :rules="customCommentRuleValidate"
34
+ :label-width="100" label-position="right">
35
+ <FormItem label="常用意见:" prop="commentContent">
36
+ <Input type="textarea" v-model="customCommentDetailForm.commentContent" show-word-limit :maxlength="1000"
37
+ style="width: 500px"/>
38
+ </FormItem>
39
+ <FormItem label="排序码:">
40
+ <Input style="width: 100px" v-model="customCommentDetailForm.orders"/>
41
+ </FormItem>
42
+ </Form>
43
+ </Card>
44
+ </Modal>
45
+ </div>
46
+ </template>
47
+
48
+ <script>
49
+ import ajax from "@lambo-design/shared/utils/ajax";
50
+ import { operateHref } from '@lambo-design/shared/utils/assist';
51
+ import LamboPagingTable from "@lambo-design/paging-table";
52
+ import UploadFile from "@lambo-design/upload-file";
53
+
54
+ // 引入docx-preview插件
55
+ let docx = require('docx-preview');
56
+ export default {
57
+ components: {
58
+ LamboPagingTable,
59
+ UploadFile
60
+ },
61
+ props: {
62
+ attachmentFile:{
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ actionUrl: {
67
+ default: "/api/oss-server/file/put",
68
+ },
69
+ attachmentdata: {
70
+ type: Array,
71
+ default: function () {
72
+ return []
73
+ }
74
+ },
75
+ smartFlowServerContext: {
76
+ type: String,
77
+ default: '/api/smart-flow-server',
78
+ },
79
+ },
80
+ data() {
81
+ return {
82
+ requestSuccessCodes: [200, "200"],
83
+ tempFileArr: [],
84
+ fileList: [],
85
+ ossFilePutUrl: '/manage/oss/file/put',
86
+ auditOpinionText: '',
87
+ customCommentListModal: false,
88
+ auditOpinion: '',
89
+ customCommentDetailModal: false,
90
+ customCommentDetailTitle: '',
91
+ dataUrl: this.smartFlowServerContext + '/manage/smartflowCustomComment/list',
92
+ customCommentDetailForm: {
93
+ id: '',
94
+ commentContent: '',
95
+ orders: 10
96
+ },
97
+ customCommentRuleValidate: {
98
+ commentContent: [
99
+ {required: true, trigger: "blur", message: "意见不能为空"},
100
+ {max: 1000, message: "意见不能大于1000位", trigger: "blur"}
101
+ ]
102
+ },
103
+ }
104
+ },
105
+ computed: {
106
+ tableColumn() {
107
+ let column = [];
108
+ let self = this;
109
+ column.push({
110
+ title: '常用意见',
111
+ key: "commentContent",
112
+ minWidth: 150,
113
+ align: 'center',
114
+ });
115
+ column.push({
116
+ title: "意见类型",
117
+ key: "commentType",
118
+ width: 170,
119
+ align: "center",
120
+ render: (v, param) => {
121
+ if (param.row.commentType === '10') {
122
+ return v("span", '自定义');
123
+ }
124
+ return v("span", '系统预置')
125
+ }
126
+ });
127
+ column.push({
128
+ title: "排序码",
129
+ key: "orders",
130
+ width: 100,
131
+ align: "center",
132
+ });
133
+
134
+ column.push({
135
+ title: "修改时间",
136
+ key: "updateTime",
137
+ width: 170,
138
+ align: "center",
139
+ render: (v, param) => {
140
+ if (param.row.updateTime) {
141
+ let date = new Date(param.row.updateTime)
142
+ let y = date.getFullYear() // 年
143
+ let MM = date.getMonth() + 1 // 月
144
+ MM = MM < 10 ? ('0' + MM) : MM
145
+ let d = date.getDate() // 日
146
+ d = d < 10 ? ('0' + d) : d
147
+ let h = date.getHours() // 时
148
+ h = h < 10 ? ('0' + h) : h
149
+ let m = date.getMinutes()// 分
150
+ m = m < 10 ? ('0' + m) : m
151
+ let s = date.getSeconds()//
152
+ s = s < 10 ? ('0' + s) : s
153
+ let state = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
154
+ return v("span", state);
155
+ }
156
+ return v("span", '')
157
+ }
158
+ });
159
+
160
+ column.push({
161
+ title: "操作", width: 160, align: 'center', tooltip: true,
162
+ render: (h, {row}) => {
163
+ if (row.commentType === '10'){
164
+ return h("div", [
165
+ operateHref(this, h, row, "修改", () => {
166
+ this.openDetailModal('update', row);
167
+ }, "primary"),
168
+ operateHref(this, h, row, "删除", () => {
169
+ this.deleteCustomComment(row);
170
+ }, "error"),
171
+ operateHref(this, h, row, "选择", () => {
172
+ this.choose(row);
173
+ }, "primary")
174
+ ]);
175
+ }else {
176
+ return h("div", [
177
+ operateHref(this, h, row, "选择", () => {
178
+ this.choose(row);
179
+ }, "primary")
180
+ ]);
181
+ }
182
+
183
+ }
184
+
185
+ });
186
+
187
+ return column;
188
+ },
189
+ },
190
+ methods: {
191
+ openDetailModal(type, row) {
192
+ this.customCommentDetailModal = true
193
+ if (type === 'create') {
194
+ this.customCommentDetailTitle = '新增常用意见'
195
+ } else {
196
+ this.customCommentDetailTitle = '修改常用意见'
197
+ this.customCommentDetailForm.id = row.id
198
+ this.customCommentDetailForm.commentContent = row.commentContent
199
+ this.customCommentDetailForm.orders = row.orders
200
+ }
201
+ },
202
+ customCommentDetailCancel() {
203
+ this.getAuditOpinionForSelect()
204
+ this.customCommentDetailForm = {
205
+ id: '',
206
+ commentContent: '',
207
+ orders: 10
208
+ }
209
+ this.customCommentDetailModal = false
210
+ },
211
+ customCommentDetailOk() {
212
+ const self = this
213
+ self.$refs.customCommentForm.validate((valid) => {
214
+ if (valid) {
215
+ if (self.customCommentDetailForm.id) {
216
+ ajax.post(self.smartFlowServerContext + "/manage/smartflowCustomComment/update", self.customCommentDetailForm).then((resp) => {
217
+ if (resp.data.code === "200") {
218
+ self.customCommentDetailForm = {
219
+ id: '',
220
+ commentContent: '',
221
+ orders: 10
222
+ }
223
+ self.refreshTable()
224
+ }
225
+ }).catch(err => {
226
+ console.log(err);
227
+ })
228
+ } else {
229
+ ajax.post(self.smartFlowServerContext + "/manage/smartflowCustomComment/insert", self.customCommentDetailForm).then((resp) => {
230
+ if (resp.data.code === "200") {
231
+ self.customCommentDetailForm = {
232
+ id: '',
233
+ commentContent: '',
234
+ orders: 10
235
+ }
236
+ self.refreshTable()
237
+ }
238
+ }).catch(err => {
239
+ console.log(err);
240
+ })
241
+ }
242
+ self.customCommentDetailModal = false
243
+ }
244
+ })
245
+ },
246
+ deleteCustomComment(row) {
247
+ const self = this
248
+ self.$Modal.confirm({
249
+ title: '提示',
250
+ content: `<p>确定要删除${row.commentContent}吗?</p>`,
251
+ onOk: () => {
252
+ ajax.post(self.smartFlowServerContext + "/manage/smartflowCustomComment/delete/" + row.id).then(function (resp) {
253
+ if (resp.data.code === "200") {
254
+ self.refreshTable()
255
+ } else {
256
+ self.$Message.error(resp.data.message);
257
+ }
258
+ }).catch(function (err) {
259
+ self.$Message.error('删除失败,请联系应用管理员');
260
+ });
261
+ }
262
+ });
263
+ },
264
+ refreshTable() {
265
+ this.$refs.customCommentTable.tableRefresh()
266
+ },
267
+ choose(row) {
268
+ this.auditOpinion = row.commentContent
269
+ this.customCommentListModal = false
270
+ },
271
+ uploadFile(file){
272
+ const self = this;
273
+ file.forEach(item => {
274
+ self.attachmentdata.push({
275
+ fileName: item.fileName,
276
+ fileId: item.fileCode,
277
+ });
278
+ })
279
+ },
280
+ forRemoveAttachment: function (index) {
281
+ this.attachmentdata.splice(index, 1);
282
+ },
283
+ },
284
+ mounted() {
285
+ },
286
+ watch: {
287
+ auditOpinionText(label) {
288
+ this.auditOpinion = label;
289
+ },
290
+ auditOpinion(val) {
291
+ this.$emit('input', val)
292
+ }
293
+ }
294
+
295
+ }
296
+ </script>
297
+
298
+ <style scoped>
299
+ /deep/ .upload-btn-box{
300
+ padding-bottom: 0;
301
+ }
302
+ </style>