1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
| <template>
| <avue-crud ref="crud" :table-loading="loading" :data="data" v-model="form" :option="option" :page.sync="page"
| :search.sync="search" @on-load="getDataList" @row-save="handleSave" @row-del="handleDelete"
| @row-update="handleEdit" @refresh-change="handleRefresh" @size-change="handleSizePage"
| @current-change="handleCurrentPage">
| </avue-crud>
| </template>
|
| <script>
| import { getFlowpathList, getStartList, flowpathSave, flowpathDelete } from '@/api/template/flowpath.js'
| export default {
| name: 'FlowPath',
| props: {
| checkStatus: {
| type: Boolean,
| default: false
| },
| crudLCStatus: {
| type: String,
| default: 'Editing'
| },
| code: {
| typeof: String,
| required: true,
| default: ""
| }
| },
| data() {
| return {
| loading: false,
| page: {
| currentPage: 1,
| pageSize: 10,
| total: 0
| },
| search: {},
| delIds: [],
| data: [],
| startData: [],
| form: {},
| option: {
| height: 340,
| border: true,
| align: 'center',
| menu:!this.checkStatus || this.crudLCStatus == 'Editing',
| menuAlign: 'center',
| index: true,
| searchMenuSpan: 8,
| searchBtn: false,
| refreshBtn:false,
| emptyBtn: false,
| columnBtn: false,
| editBtn:!this.checkStatus || this.crudLCStatus == 'Editing',
| delBtn:!this.checkStatus || this.crudLCStatus == 'Editing',
| addBtn: !this.checkStatus || this.crudLCStatus == 'Editing',
| defaultSort: {
| prop: 'id,name,description,version',
| order: 'descending'
| },
| column: [
| {
| label: '模板key',
| prop: 'modelKey',
| width: 120,
| sortable: true,
| type: 'tree',
| dicData: [],
| props: {
| label: "key",
| value: "key"
| },
| rules: [{
| required: true,
| message: '模板key不能为空',
| trigger: 'blur'
| }],
| nodeClick: (data) => {
| console.log(data)
| // 节点点击的时候会获取到数据
| this.form.modelName = data.name
| }
| }, {
| label: '模板名称',
| prop: 'modelName',
| sortable: true,
| width: 220,
| addDisabled: true,
| editDisabled: true,
| },
| {
| label: '模板用途',
| prop: 'buttonTypeKey',
| type: 'tree',
| width: 120,
| dicUrl: '/api/ubcs-flow/processTS/tt',
| dicMethod: 'post',
| props: {
| value: "codee",
| label: "namee",
| },
| },
| {
| label: '模板描述',
| prop: 'description',
| type: 'textarea'
| },
| ]
| }
| }
| },
| created() {
| this.getStart()
| },
| watch: {
| code: {
| handler(newval, oldval) {
| this.getDataList()
| }
| },
| checkStatus: {
| handler(newval, oldval) {
| this.option.delBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| this.option.editBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| this.option.addBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| }
| },
| crudLCStatus: {
| handler(newval, oldval) {
| this.option.delBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| this.option.editBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| this.option.addBtn=!this.checkStatus || this.crudLCStatus == 'Editing';
| }
| }
| },
| methods: {
| async getStart() {
| const response = await getStartList()
| if (response.status === 200) {
| console.log(response.data.data.records)
| const data = response.data.data.records
| let newData = data.map(item => {
| const { key, name, version } = item
| return { key, name, version }
| })
| this.option.column[0].dicData = newData
|
| }
| },
| // 获取列表
| async getDataList() {
| this.loading = false
| if(this.code){
| const { pageSize, currentPage } = this.page
| let param = { size: pageSize, current: currentPage }
| const response = await getFlowpathList({ ...param, ...{ templateId: this.code } })
| if (response.status === 200) {
| this.loading = false
| const data = response.data.data
| this.data = data.records
| this.page.total = data.total
| } else this.loading = false
| }
|
| },
| // 新增
| async handleSave(row, done, loading) {
| console.log(row)
| const response = await flowpathSave({ ...row, ...{ templateId: this.code } })
| if (response.status === 200) {
| loading()
| console.log(response)
| this.$message({
| type: 'success',
| message: '新增数据成功!'
| })
| done()
| this.getDataList()
| }
|
| },
| // 编辑
| async handleEdit(row, index, done, loading) {
| console.log(row)
| const { modelName, modelKey, buttonTypeKey, id ,description} = row
| let param = { modelName, modelKey, buttonTypeKey, id,description }
| const response = await flowpathSave({ ...param, ...{ templateId: this.code } })
| if (response.status === 200) {
| loading()
| this.$message({
| type: 'success',
| message: '修改数据成功!'
| })
| done()
| this.getDataList()
| }
|
| },
| // 删除单条
| handleDelete(row) {
| console.log(row)
| const { id } = row
| this.deleteSysInfo({ id: id })
| },
| // 删除接口
| deleteSysInfo(param) {
| this.$confirm('是否确定删除选择的模板流程?', '提示', {
| confirmButtonText: '确定',
| cancelButtonText: '取消',
| type: 'warning'
| }).then(async () => {
| // 接口
| const response = await flowpathDelete(param)
| if (response.status === 200) {
| console.log(response)
| this.$message({
| type: 'success',
| message: '删除成功!'
| });
| this.getDataList()
| }
| })
| },
| // enter搜索
| handleEnter() {
| if (this.search[this.selectValue] === '') return
| else this.getDataList()
| },
| // 输入框清空
| handleClear() {
|
| },
| // 刷新按钮
| handleRefresh() {
| this.getDataList()
| },
| handleSizePage(event) {
| this.page.pageSize = event
| },
| handleCurrentPage(event) {
| this.page.currentPage = event
| },
| }
| }
| </script>
|
|