@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,263 +1,263 @@
1
- <template>
2
- <div>
3
- <Select v-model="auditOpinionText" style="width:190px" clearable transfer>
4
- <Option v-for="item in auditOpinionForSelect" :value="item.value" :key="item.value">
5
- <span>{{ item.label }}</span>
6
- <span style="float:right;color:#ccc">{{ item.type }}</span>
7
- </Option>
8
- </Select>
9
- <Button style="margin-left: 10px" @click="customCommentListModal = true">自定义我的意见</Button>
10
- <Input v-model="auditOpinion" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }" show-word-limit
11
- :maxlength="200" placeholder="处理意见" style="margin-top: 15px"
12
- ></Input>
13
-
14
- <Modal v-model="customCommentListModal" title="常用意见" width="800px" footer-hide>
15
- <LamboPagingTable :requestSuccessCodes="requestSuccessCodes" ref="customCommentTable" :dataUrl="dataUrl"
16
- :columns="tableColumn">
17
- <div slot="buttons">
18
- <Button type="primary" ghost icon="md-add" @click="openDetailModal('create')">新增</Button>
19
- </div>
20
- </LamboPagingTable>
21
- </Modal>
22
- <Modal v-model="customCommentDetailModal" :title="customCommentDetailTitle" width="700px"
23
- @on-cancel="customCommentDetailCancel"
24
- @on-ok="customCommentDetailOk">
25
- <Card v-model="customCommentDetailModal" width="600px" dis-hover>
26
- <Form ref="customCommentForm" :model="customCommentDetailForm" :rules="customCommentRuleValidate"
27
- :label-width="100" label-position="right">
28
- <FormItem label="常用意见:" prop="commentContent">
29
- <Input type="textarea" v-model="customCommentDetailForm.commentContent" show-word-limit :maxlength="1000"
30
- style="width: 500px"/>
31
- </FormItem>
32
- <FormItem label="排序码:">
33
- <Input style="width: 100px" v-model="customCommentDetailForm.orders"/>
34
- </FormItem>
35
- </Form>
36
- </Card>
37
- </Modal>
38
- </div>
39
- </template>
40
-
41
- <script>
42
- import ajax from "@lambo-design/shared/utils/ajax";
43
- import LamboPagingTable from "@lambo-design/paging-table/index";
44
- import { operateHref } from '@lambo-design/shared/utils/assist'
45
-
46
- // 引入docx-preview插件
47
- let docx = require('docx-preview');
48
- export default {
49
- components: {
50
- LamboPagingTable
51
- },
52
- props: {
53
- smartFlowServerContext: {
54
- type: String,
55
- default: '/api/smart-flow-server',
56
- },
57
- },
58
- data() {
59
- return {
60
- requestSuccessCodes: [200, "200"],
61
- auditOpinionText: '',
62
- auditOpinionForSelect: [{
63
- label: '',
64
- value: ''
65
- }],
66
- customCommentListModal: false,
67
- auditOpinion: '',
68
- customCommentDetailModal: false,
69
- customCommentDetailTitle: '',
70
- dataUrl: this.smartFlowServerContext + '/manage/smartflowCustomComment/list?commentType=10',
71
- customCommentDetailForm: {
72
- id: '',
73
- commentContent: '',
74
- orders: 10
75
- },
76
- customCommentRuleValidate: {
77
- commentContent: [
78
- {required: true, trigger: "blur", message: "意见不能为空"},
79
- {max: 1000, message: "意见不能大于1000位", trigger: "blur"}
80
- ]
81
- },
82
- }
83
- },
84
- computed: {
85
- tableColumn() {
86
- let column = [];
87
- let self = this;
88
- column.push({
89
- title: '常用意见',
90
- key: "commentContent",
91
- minWidth: 150,
92
- align: 'center',
93
- });
94
- column.push({
95
- title: "排序码",
96
- key: "orders",
97
- width: 170,
98
- align: "center",
99
- });
100
-
101
- column.push({
102
- title: "修改时间",
103
- key: "updateTime",
104
- width: 170,
105
- align: "center",
106
- render: (v, param) => {
107
- if (param.row.updateTime) {
108
- let date = new Date(param.row.updateTime)
109
- let y = date.getFullYear() // 年
110
- let MM = date.getMonth() + 1 // 月
111
- MM = MM < 10 ? ('0' + MM) : MM
112
- let d = date.getDate() // 日
113
- d = d < 10 ? ('0' + d) : d
114
- let h = date.getHours() // 时
115
- h = h < 10 ? ('0' + h) : h
116
- let m = date.getMinutes()// 分
117
- m = m < 10 ? ('0' + m) : m
118
- let s = date.getSeconds()// 秒
119
- s = s < 10 ? ('0' + s) : s
120
- let state = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
121
- return v("span", state);
122
- }
123
- return v("span", '')
124
- }
125
- });
126
-
127
- column.push({
128
- title: "操作", width: 160, align: 'center', tooltip: true,
129
- render: (h, {row}) => {
130
- return h("div", [
131
- operateHref(this, h, row, "修改", () => {
132
- this.openDetailModal('update', row);
133
- }, "primary"),
134
- operateHref(this, h, row, "删除", () => {
135
- this.deleteCustomComment(row);
136
- }, "error")
137
- ]);
138
-
139
- }
140
-
141
- });
142
-
143
- return column;
144
- },
145
- },
146
- methods: {
147
- openDetailModal(type, row) {
148
- this.customCommentDetailModal = true
149
- if (type === 'create') {
150
- this.customCommentDetailTitle = '新增常用意见'
151
- } else {
152
- this.customCommentDetailTitle = '修改常用意见'
153
- this.customCommentDetailForm.id = row.id
154
- this.customCommentDetailForm.commentContent = row.commentContent
155
- this.customCommentDetailForm.orders = row.orders
156
- }
157
- },
158
- customCommentDetailCancel() {
159
- this.getAuditOpinionForSelect()
160
- this.customCommentDetailForm = {
161
- id: '',
162
- commentContent: '',
163
- orders: 10
164
- }
165
- this.customCommentDetailModal = false
166
- },
167
- customCommentDetailOk() {
168
- const self = this
169
- self.$refs.customCommentForm.validate((valid) => {
170
- if (valid) {
171
- if (self.customCommentDetailForm.id) {
172
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/update", self.customCommentDetailForm).then((resp) => {
173
- if (resp.data.code === "200") {
174
- self.customCommentDetailForm = {
175
- id: '',
176
- commentContent: '',
177
- orders: 10
178
- }
179
- self.refreshTable()
180
- }
181
- }).catch(err => {
182
- console.log(err);
183
- })
184
- } else {
185
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/insert", self.customCommentDetailForm).then((resp) => {
186
- if (resp.data.code === "200") {
187
- self.customCommentDetailForm = {
188
- id: '',
189
- commentContent: '',
190
- orders: 10
191
- }
192
- self.refreshTable()
193
- }
194
- }).catch(err => {
195
- console.log(err);
196
- })
197
- }
198
- this.getAuditOpinionForSelect()
199
- this.customCommentDetailModal = false
200
- }
201
- })
202
- },
203
- getAuditOpinionForSelect() {
204
- const self = this
205
- let auditOpinionForSelect = []
206
- ajax.get(this.smartFlowServerContext + "/manage/smartflowCustomComment/list", {params: {limit: 100}}).then((resp) => {
207
- if (resp.data.code == "200" && resp.data.data) {
208
- resp.data.data.rows.forEach(item =>
209
- auditOpinionForSelect.push({
210
- value: item.commentContent,
211
- label: item.commentContent,
212
- type: item.commentType === '10' ? '自定义' : '系统预置'
213
- })
214
- )
215
- self.auditOpinionForSelect = auditOpinionForSelect
216
- }
217
- }).catch(err => {
218
- console.log(err);
219
- })
220
- },
221
- deleteCustomComment(row) {
222
- const self = this
223
- this.$Modal.confirm({
224
- title: '提示',
225
- content: `<p>确定要删除${row.commentContent}吗?</p>`,
226
- onOk: () => {
227
- ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/delete/" + row.id).then(function (resp) {
228
- if (resp.data.code === "200") {
229
- self.refreshTable()
230
- } else {
231
- self.$Message.error(resp.data.data);
232
- }
233
- }).catch(function (err) {
234
- self.$Message.error('删除失败,请联系应用管理员');
235
- });
236
- }
237
- });
238
- },
239
- refreshTable() {
240
- this.$refs.customCommentTable.tableRefresh()
241
- },
242
- updateValue() {
243
- this.$emit('input', this.auditOpinion);
244
- }
245
- },
246
- mounted() {
247
- this.getAuditOpinionForSelect()
248
- },
249
- watch: {
250
- auditOpinionText(label) {
251
- this.auditOpinion = label;
252
- },
253
- auditOpinion(val) {
254
- this.$emit('input', val)
255
- }
256
- }
257
-
258
- }
259
- </script>
260
-
261
- <style scoped>
262
-
263
- </style>
1
+ <template>
2
+ <div>
3
+ <Select v-model="auditOpinionText" style="width:190px" clearable transfer>
4
+ <Option v-for="item in auditOpinionForSelect" :value="item.value" :key="item.value">
5
+ <span>{{ item.label }}</span>
6
+ <span style="float:right;color:#ccc">{{ item.type }}</span>
7
+ </Option>
8
+ </Select>
9
+ <Button style="margin-left: 10px" @click="customCommentListModal = true">自定义我的意见</Button>
10
+ <Input v-model="auditOpinion" type="textarea" :autosize="{ minRows: 3, maxRows: 5 }" show-word-limit
11
+ :maxlength="200" placeholder="处理意见" style="margin-top: 15px"
12
+ ></Input>
13
+
14
+ <Modal v-model="customCommentListModal" title="常用意见" width="800px" footer-hide>
15
+ <LamboPagingTable :requestSuccessCodes="requestSuccessCodes" ref="customCommentTable" :dataUrl="dataUrl"
16
+ :columns="tableColumn">
17
+ <div slot="buttons">
18
+ <Button type="primary" ghost icon="md-add" @click="openDetailModal('create')">新增</Button>
19
+ </div>
20
+ </LamboPagingTable>
21
+ </Modal>
22
+ <Modal v-model="customCommentDetailModal" :title="customCommentDetailTitle" width="700px"
23
+ @on-cancel="customCommentDetailCancel"
24
+ @on-ok="customCommentDetailOk">
25
+ <Card v-model="customCommentDetailModal" width="600px" dis-hover>
26
+ <Form ref="customCommentForm" :model="customCommentDetailForm" :rules="customCommentRuleValidate"
27
+ :label-width="100" label-position="right">
28
+ <FormItem label="常用意见:" prop="commentContent">
29
+ <Input type="textarea" v-model="customCommentDetailForm.commentContent" show-word-limit :maxlength="1000"
30
+ style="width: 500px"/>
31
+ </FormItem>
32
+ <FormItem label="排序码:">
33
+ <Input style="width: 100px" v-model="customCommentDetailForm.orders"/>
34
+ </FormItem>
35
+ </Form>
36
+ </Card>
37
+ </Modal>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ import ajax from "@lambo-design/shared/utils/ajax";
43
+ import LamboPagingTable from "@lambo-design/paging-table/index";
44
+ import { operateHref } from '@lambo-design/shared/utils/assist'
45
+
46
+ // 引入docx-preview插件
47
+ let docx = require('docx-preview');
48
+ export default {
49
+ components: {
50
+ LamboPagingTable
51
+ },
52
+ props: {
53
+ smartFlowServerContext: {
54
+ type: String,
55
+ default: '/api/smart-flow-server',
56
+ },
57
+ },
58
+ data() {
59
+ return {
60
+ requestSuccessCodes: [200, "200"],
61
+ auditOpinionText: '',
62
+ auditOpinionForSelect: [{
63
+ label: '',
64
+ value: ''
65
+ }],
66
+ customCommentListModal: false,
67
+ auditOpinion: '',
68
+ customCommentDetailModal: false,
69
+ customCommentDetailTitle: '',
70
+ dataUrl: this.smartFlowServerContext + '/manage/smartflowCustomComment/list?commentType=10',
71
+ customCommentDetailForm: {
72
+ id: '',
73
+ commentContent: '',
74
+ orders: 10
75
+ },
76
+ customCommentRuleValidate: {
77
+ commentContent: [
78
+ {required: true, trigger: "blur", message: "意见不能为空"},
79
+ {max: 1000, message: "意见不能大于1000位", trigger: "blur"}
80
+ ]
81
+ },
82
+ }
83
+ },
84
+ computed: {
85
+ tableColumn() {
86
+ let column = [];
87
+ let self = this;
88
+ column.push({
89
+ title: '常用意见',
90
+ key: "commentContent",
91
+ minWidth: 150,
92
+ align: 'center',
93
+ });
94
+ column.push({
95
+ title: "排序码",
96
+ key: "orders",
97
+ width: 170,
98
+ align: "center",
99
+ });
100
+
101
+ column.push({
102
+ title: "修改时间",
103
+ key: "updateTime",
104
+ width: 170,
105
+ align: "center",
106
+ render: (v, param) => {
107
+ if (param.row.updateTime) {
108
+ let date = new Date(param.row.updateTime)
109
+ let y = date.getFullYear() // 年
110
+ let MM = date.getMonth() + 1 // 月
111
+ MM = MM < 10 ? ('0' + MM) : MM
112
+ let d = date.getDate() // 日
113
+ d = d < 10 ? ('0' + d) : d
114
+ let h = date.getHours() // 时
115
+ h = h < 10 ? ('0' + h) : h
116
+ let m = date.getMinutes()// 分
117
+ m = m < 10 ? ('0' + m) : m
118
+ let s = date.getSeconds()// 秒
119
+ s = s < 10 ? ('0' + s) : s
120
+ let state = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
121
+ return v("span", state);
122
+ }
123
+ return v("span", '')
124
+ }
125
+ });
126
+
127
+ column.push({
128
+ title: "操作", width: 160, align: 'center', tooltip: true,
129
+ render: (h, {row}) => {
130
+ return h("div", [
131
+ operateHref(this, h, row, "修改", () => {
132
+ this.openDetailModal('update', row);
133
+ }, "primary"),
134
+ operateHref(this, h, row, "删除", () => {
135
+ this.deleteCustomComment(row);
136
+ }, "error")
137
+ ]);
138
+
139
+ }
140
+
141
+ });
142
+
143
+ return column;
144
+ },
145
+ },
146
+ methods: {
147
+ openDetailModal(type, row) {
148
+ this.customCommentDetailModal = true
149
+ if (type === 'create') {
150
+ this.customCommentDetailTitle = '新增常用意见'
151
+ } else {
152
+ this.customCommentDetailTitle = '修改常用意见'
153
+ this.customCommentDetailForm.id = row.id
154
+ this.customCommentDetailForm.commentContent = row.commentContent
155
+ this.customCommentDetailForm.orders = row.orders
156
+ }
157
+ },
158
+ customCommentDetailCancel() {
159
+ this.getAuditOpinionForSelect()
160
+ this.customCommentDetailForm = {
161
+ id: '',
162
+ commentContent: '',
163
+ orders: 10
164
+ }
165
+ this.customCommentDetailModal = false
166
+ },
167
+ customCommentDetailOk() {
168
+ const self = this
169
+ self.$refs.customCommentForm.validate((valid) => {
170
+ if (valid) {
171
+ if (self.customCommentDetailForm.id) {
172
+ ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/update", self.customCommentDetailForm).then((resp) => {
173
+ if (resp.data.code === "200") {
174
+ self.customCommentDetailForm = {
175
+ id: '',
176
+ commentContent: '',
177
+ orders: 10
178
+ }
179
+ self.refreshTable()
180
+ }
181
+ }).catch(err => {
182
+ console.log(err);
183
+ })
184
+ } else {
185
+ ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/insert", self.customCommentDetailForm).then((resp) => {
186
+ if (resp.data.code === "200") {
187
+ self.customCommentDetailForm = {
188
+ id: '',
189
+ commentContent: '',
190
+ orders: 10
191
+ }
192
+ self.refreshTable()
193
+ }
194
+ }).catch(err => {
195
+ console.log(err);
196
+ })
197
+ }
198
+ this.getAuditOpinionForSelect()
199
+ this.customCommentDetailModal = false
200
+ }
201
+ })
202
+ },
203
+ getAuditOpinionForSelect() {
204
+ const self = this
205
+ let auditOpinionForSelect = []
206
+ ajax.get(this.smartFlowServerContext + "/manage/smartflowCustomComment/list", {params: {limit: 100}}).then((resp) => {
207
+ if (resp.data.code == "200" && resp.data.data) {
208
+ resp.data.data.rows.forEach(item =>
209
+ auditOpinionForSelect.push({
210
+ value: item.commentContent,
211
+ label: item.commentContent,
212
+ type: item.commentType === '10' ? '自定义' : '系统预置'
213
+ })
214
+ )
215
+ self.auditOpinionForSelect = auditOpinionForSelect
216
+ }
217
+ }).catch(err => {
218
+ console.log(err);
219
+ })
220
+ },
221
+ deleteCustomComment(row) {
222
+ const self = this
223
+ this.$Modal.confirm({
224
+ title: '提示',
225
+ content: `<p>确定要删除${row.commentContent}吗?</p>`,
226
+ onOk: () => {
227
+ ajax.post(this.smartFlowServerContext + "/manage/smartflowCustomComment/delete/" + row.id).then(function (resp) {
228
+ if (resp.data.code === "200") {
229
+ self.refreshTable()
230
+ } else {
231
+ self.$Message.error(resp.data.data);
232
+ }
233
+ }).catch(function (err) {
234
+ self.$Message.error('删除失败,请联系应用管理员');
235
+ });
236
+ }
237
+ });
238
+ },
239
+ refreshTable() {
240
+ this.$refs.customCommentTable.tableRefresh()
241
+ },
242
+ updateValue() {
243
+ this.$emit('input', this.auditOpinion);
244
+ }
245
+ },
246
+ mounted() {
247
+ this.getAuditOpinionForSelect()
248
+ },
249
+ watch: {
250
+ auditOpinionText(label) {
251
+ this.auditOpinion = label;
252
+ },
253
+ auditOpinion(val) {
254
+ this.$emit('input', val)
255
+ }
256
+ }
257
+
258
+ }
259
+ </script>
260
+
261
+ <style scoped>
262
+
263
+ </style>