inl-ui 0.0.74 → 0.0.76

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.
@@ -23,10 +23,52 @@ import { CheckOutlined } from "@ant-design/icons-vue";
23
23
 
24
24
  import dayjs, { Dayjs } from "dayjs";
25
25
 
26
+ import { getStatus } from "../utils";
27
+
26
28
  import pssApi from "@/api/pss";
27
29
 
28
30
  const Format = "YYYY-MM-DD HH:mm";
29
31
 
32
+ const relevanceColumns = [
33
+ {
34
+ dataIndex: "supplyTypeName",
35
+ title: "申请类型",
36
+ width: 150,
37
+ },
38
+ {
39
+ dataIndex: "applyUserName",
40
+ title: "发起人",
41
+ width: 100,
42
+ },
43
+ {
44
+ key: "equipName",
45
+ title: "名称",
46
+ width: 200,
47
+ },
48
+ {
49
+ key: "runStatus",
50
+ title: "运行信号",
51
+ width: 100,
52
+ },
53
+ {
54
+ title: "回路数量",
55
+ key: "loopsNum",
56
+ width: 100,
57
+ },
58
+ {
59
+ title: "控制回路",
60
+ key: "loops",
61
+ width: 300,
62
+ ellipsis: true,
63
+ },
64
+ // {
65
+ // title: "操作",
66
+ // key: "operation",
67
+ // fixed: "right",
68
+ // width: 100,
69
+ // },
70
+ ];
71
+
30
72
  export default defineComponent({
31
73
  props: {
32
74
  detail: {
@@ -167,6 +209,23 @@ export default defineComponent({
167
209
  }
168
210
 
169
211
  getLockLoop();
212
+
213
+ getRelevanceList();
214
+ };
215
+
216
+ const relevanceList = ref<any>([]);
217
+ const getRelevanceList = () => {
218
+ const upList = dataObj.value.upstreamProcess.map((up) => {
219
+ up.relevanceType = "上游";
220
+ return up;
221
+ });
222
+
223
+ const downList = dataObj.value.downstreamProcess.map((down) => {
224
+ down.relevanceType = "下游";
225
+ return down;
226
+ });
227
+
228
+ relevanceList.value = [...upList, ...downList];
170
229
  };
171
230
 
172
231
  watch(
@@ -227,6 +286,8 @@ export default defineComponent({
227
286
  context.emit("update:showInfo", false);
228
287
  };
229
288
 
289
+ const activeKey = ref("1");
290
+
230
291
  return () => (
231
292
  <div class="pssInfo">
232
293
  <a-modal
@@ -321,8 +382,16 @@ export default defineComponent({
321
382
  {dataObj.value?.attempt === "1" ? "有" : "无"}
322
383
  </div>
323
384
  </Col>
385
+
386
+ <Col span={8}>
387
+ <div class="label">运行信号:</div>
388
+ <div class="value">
389
+ {getStatus(dataObj.value?.runStatus)}
390
+ </div>
391
+ </Col>
324
392
  </Row>
325
393
  </div>
394
+
326
395
  <div class="content_title" style="margin-top: 24px">
327
396
  控制回路 ({dataObj.value?.loopVOs?.length})
328
397
  </div>
@@ -400,44 +469,109 @@ export default defineComponent({
400
469
  </div>
401
470
  ))}
402
471
 
403
- <div class="content_title">工单流程</div>
404
- <div class="timeLine">
405
- <Timeline>
406
- {dataObj.value?.process?.map((pro: any, index: number) => (
407
- <TimelineItem
408
- dot={
409
- dataObj.value?.process?.length - 1 === index ? (
410
- <div class="complate">
411
- <CheckOutlined />
412
- </div>
413
- ) : (
414
- <div class="active">
415
- <span></span>
416
- </div>
472
+ <a-tabs v-model={[activeKey.value, "activeKey"]} class="infoTabs">
473
+ <a-tab-pane key="1" tab="工单流程">
474
+ <div class="timeLine">
475
+ <Timeline>
476
+ {dataObj.value?.process?.map(
477
+ (pro: any, index: number) => (
478
+ <TimelineItem
479
+ dot={
480
+ dataObj.value?.process?.length - 1 === index ? (
481
+ <div class="complate">
482
+ <CheckOutlined />
483
+ </div>
484
+ ) : (
485
+ <div class="active">
486
+ <span></span>
487
+ </div>
488
+ )
489
+ }
490
+ >
491
+ <div class="content flex">
492
+ <div
493
+ class={[
494
+ "label",
495
+ dataObj.value?.process?.length - 1 === index
496
+ ? "timeLineActive"
497
+ : "",
498
+ ]}
499
+ >
500
+ <div>{pro.activityName}</div>
501
+ <div>{pro.assigneeName || "-"}</div>
502
+ <div>{pro.comments}</div>
503
+ </div>
504
+ <div class="time">
505
+ {pro.endTime &&
506
+ dayjs(pro.endTime).format(Format)}
507
+ </div>
508
+ </div>
509
+ </TimelineItem>
417
510
  )
418
- }
419
- >
420
- <div class="content flex">
421
- <div
422
- class={[
423
- "label",
424
- dataObj.value?.process?.length - 1 === index
425
- ? "timeLineActive"
426
- : "",
427
- ]}
428
- >
429
- <div>{pro.activityName}</div>
430
- <div>{pro.assigneeName || "-"}</div>
431
- <div>{pro.comments}</div>
432
- </div>
433
- <div class="time">
434
- {pro.endTime && dayjs(pro.endTime).format(Format)}
435
- </div>
436
- </div>
437
- </TimelineItem>
438
- ))}
439
- </Timeline>
440
- </div>
511
+ )}
512
+ </Timeline>
513
+ </div>
514
+ </a-tab-pane>
515
+
516
+ <a-tab-pane key="2" tab="关联工单">
517
+ <a-table
518
+ dataSource={relevanceList.value}
519
+ columns={relevanceColumns}
520
+ pagination={false}
521
+ rowKey="processInstanceId"
522
+ v-slots={{
523
+ bodyCell: ({ column, record, index }: any) => {
524
+ // console.log(text, column, record, index);
525
+
526
+ // 设备名称
527
+ if (column.key === "equipName") {
528
+ return `${record.equipName}(${record.relevanceType})`;
529
+ }
530
+ // 运行信号
531
+ if (column.key === "runStatus") {
532
+ return getStatus(record.runStatus);
533
+ }
534
+
535
+ // 回路数量
536
+ if (column.key === "loopsNum") {
537
+ return <span>{record.loops.length}个</span>;
538
+ }
539
+
540
+ // 控制回路
541
+ if (column.key === "loops") {
542
+ const result = record.loops
543
+ .map((loop: any) => {
544
+ // return `${loop.id}-${loop.name}`;
545
+ return loop.name;
546
+ })
547
+ .join(";");
548
+
549
+ return <span>{result}</span>;
550
+ }
551
+
552
+ // 操作
553
+ if (column.key === "operation") {
554
+ return (
555
+ <div class="operation">
556
+ <a-button
557
+ type="link"
558
+ disabled
559
+ onClick={() => {
560
+ // currentObj.value = record;
561
+ // operationState.showFooter = true;
562
+ // operationState.showInfo = true;
563
+ }}
564
+ >
565
+ 详情
566
+ </a-button>
567
+ </div>
568
+ );
569
+ }
570
+ },
571
+ }}
572
+ ></a-table>
573
+ </a-tab-pane>
574
+ </a-tabs>
441
575
  </div>
442
576
  </div>
443
577
  </a-modal>
@@ -0,0 +1,408 @@
1
+ import { defineComponent, reactive, ref, watch, nextTick } from "vue";
2
+ import {
3
+ Button,
4
+ Table,
5
+ Modal,
6
+ Form,
7
+ FormItem,
8
+ Select,
9
+ Input,
10
+ Row,
11
+ Col,
12
+ message,
13
+ } from "ant-design-vue";
14
+ import { cloneDeep } from "lodash";
15
+
16
+ import SelectRelevance from "./SelectRelevance";
17
+
18
+ import { getStatus } from "../../utils";
19
+
20
+ import pssApi from "@/api/pss";
21
+
22
+ export default defineComponent({
23
+ props: {
24
+ showDevice: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ selectedDeviceList: {
29
+ type: Array,
30
+ default: () => [],
31
+ },
32
+ currentRow: {
33
+ type: Object,
34
+ default: () => ({}),
35
+ },
36
+ // 已选设备
37
+ oldDeviceList: {
38
+ type: Array,
39
+ default: () => [],
40
+ },
41
+ // 已选关联设备
42
+ oldRelevanceList: {
43
+ type: Array,
44
+ default: () => [],
45
+ },
46
+ },
47
+
48
+ emits: ["update:showDevice", "toUpdate"],
49
+
50
+ setup(props, context) {
51
+ watch(
52
+ () => props.showDevice,
53
+ (val) => {
54
+ if (val) {
55
+ searchDeviceList();
56
+ getCatalog();
57
+
58
+ selectedRow.selectedRows = props.oldDeviceList;
59
+ selectedRow.selectedRowKeys = props.oldDeviceList.map(
60
+ (device: any) => device.id
61
+ );
62
+
63
+ selectedRelevanceList.value = cloneDeep(props.oldRelevanceList);
64
+ }
65
+ }
66
+ );
67
+
68
+ const selectedRow: any = reactive({
69
+ selectedRowKeys: [],
70
+ selectedRows: [],
71
+ });
72
+
73
+ const onSelect = (selectedRowKeys: any[], selectedRows: any) => {
74
+ // console.log(selectedRowKeys, selectedRows);
75
+ selectedRow.selectedRowKeys = selectedRowKeys;
76
+ selectedRow.selectedRows = selectedRows;
77
+ };
78
+
79
+ const showRelevance = ref(false);
80
+ const currentRow = ref<any>();
81
+
82
+ const eqModal: any = reactive({
83
+ dataSource: [],
84
+ columns: [
85
+ {
86
+ dataIndex: "code",
87
+ title: "设备编码",
88
+ width: 100,
89
+ },
90
+ {
91
+ dataIndex: "name",
92
+ title: "设备名称",
93
+ ellipsis: true,
94
+ },
95
+ // {
96
+ // dataIndex: "location",
97
+ // title: "设备位置",
98
+ // ellipsis: true,
99
+ // },
100
+ {
101
+ key: "runStatus",
102
+ title: "运行信号",
103
+ width: 100,
104
+ },
105
+ {
106
+ dataIndex: "loop",
107
+ title: "控制回路",
108
+ ellipsis: true,
109
+ },
110
+ {
111
+ key: "relevance",
112
+ title: "关联设备",
113
+ width: 80,
114
+ },
115
+ ],
116
+ });
117
+
118
+ const searchFormRef = ref();
119
+ const searchForm = reactive({
120
+ deviceName: "", // 设备名称
121
+ deviceCode: "", // 设备编码
122
+ deviceCatalogId: null, // 设备类型
123
+ });
124
+ const devicesLoading = ref(false);
125
+
126
+ // 查询设备
127
+ const searchDeviceList = async () => {
128
+ devicesLoading.value = true;
129
+ const res: any = await pssApi.getDeviceList(searchForm);
130
+ eqModal.dataSource = res.data.map((item: any) => {
131
+ item.loop = item.loops.join(",");
132
+ return item;
133
+ });
134
+ devicesLoading.value = false;
135
+ };
136
+
137
+ const catalogList: any = ref([]);
138
+
139
+ const getCatalog = async () => {
140
+ const { data } = await pssApi.getTree();
141
+ catalogList.value = data;
142
+ };
143
+
144
+ const ok = async () => {
145
+ if (selectedRow.selectedRows.length > 0) {
146
+ context.emit(
147
+ "toUpdate",
148
+ selectedRow.selectedRows,
149
+ selectedRelevanceList.value
150
+ );
151
+ cancelModal();
152
+ } else {
153
+ message.info("请选择设备");
154
+ }
155
+ };
156
+
157
+ const cancelModal = () => {
158
+ context.emit("update:showDevice", false);
159
+
160
+ searchFormRef.value.resetFields();
161
+ eqModal.dataSource = [];
162
+
163
+ selectedRow.selectedRowKeys = [];
164
+ selectedRow.selectedRows = [];
165
+
166
+ selectedRelevanceList.value = [];
167
+ };
168
+
169
+ const selectedRelevanceList: any = ref([]);
170
+ const toUpdateRelevance = (relevanceList) => {
171
+ selectedRelevanceList.value = relevanceList;
172
+ };
173
+
174
+ return () => (
175
+ <div class="SelectDevice">
176
+ <Modal
177
+ v-model={[props.showDevice, "visible"]}
178
+ title="添加设备"
179
+ width="1200px"
180
+ wrapClassName="newOrder_device_modal"
181
+ onCancel={cancelModal}
182
+ v-slots={{
183
+ footer: () => (
184
+ <div class="modal_footer">
185
+ <Button onClick={cancelModal}>取消</Button>
186
+ <Button type="primary" onClick={ok}>
187
+ 确定
188
+ </Button>
189
+ </div>
190
+ ),
191
+ }}
192
+ >
193
+ <div class="deviceModal_content flex" style="">
194
+ <div class="left flex flex1">
195
+ <Form
196
+ ref={searchFormRef}
197
+ model={searchForm}
198
+ labelCol={{ span: 8 }}
199
+ wrapperCol={{ span: 16 }}
200
+ labelAlign="right"
201
+ onSubmit={searchDeviceList}
202
+ >
203
+ <Row gutter={24}>
204
+ <Col span={8}>
205
+ <FormItem label="设备名称" name="deviceName">
206
+ <a-input
207
+ v-model={[searchForm.deviceName, "value"]}
208
+ placeholder="请输入"
209
+ allow-clear
210
+ ></a-input>
211
+ </FormItem>
212
+ </Col>
213
+ <Col span={8}>
214
+ <FormItem label="设备编码" name="deviceCode">
215
+ <a-input
216
+ v-model={[searchForm.deviceCode, "value"]}
217
+ placeholder="请输入"
218
+ allow-clear
219
+ ></a-input>
220
+ </FormItem>
221
+ </Col>
222
+ <Col span={8} class="align-r">
223
+ <a-space>
224
+ <a-button type="primary" html-type="submit">
225
+ 查询
226
+ </a-button>
227
+
228
+ <a-button
229
+ onClick={() => {
230
+ searchFormRef.value.resetFields();
231
+ searchDeviceList();
232
+ }}
233
+ >
234
+ 重置
235
+ </a-button>
236
+ </a-space>
237
+ </Col>
238
+
239
+ <a-col span={8}>
240
+ <a-form-item label="设备类型" name="deviceCatalogId">
241
+ <a-select
242
+ v-model={[searchForm.deviceCatalogId, "value"]}
243
+ allowClear
244
+ placeholder="请选择"
245
+ style="width: 100%"
246
+ >
247
+ {catalogList.value.map((item: any) => (
248
+ <a-select-option value={item.code} key={item.code}>
249
+ {item.name}
250
+ </a-select-option>
251
+ ))}
252
+ </a-select>
253
+ </a-form-item>
254
+ </a-col>
255
+ </Row>
256
+ </Form>
257
+
258
+ <div class="tableBox">
259
+ <Table
260
+ pagination={false}
261
+ columns={eqModal.columns}
262
+ dataSource={eqModal.dataSource}
263
+ // class="cus-table"
264
+ rowKey="id"
265
+ loading={devicesLoading.value}
266
+ rowSelection={{
267
+ onChange: onSelect,
268
+ selectedRowKeys: selectedRow.selectedRowKeys,
269
+ type: "radio",
270
+ // getCheckboxProps: (record: any) => {
271
+ // const oldDeviceIdList = formState.value.deviceList.map(
272
+ // (device: any) => device.id
273
+ // );
274
+
275
+ // return {
276
+ // disabled: oldDeviceIdList.includes(record.id),
277
+ // name: record.name,
278
+ // };
279
+ // },
280
+ }}
281
+ v-slots={{
282
+ bodyCell: ({ column, record, index }: any) => {
283
+ // console.log(text, column, record, index);
284
+
285
+ // 运行信号
286
+ if (column.key === "runStatus") {
287
+ return getStatus(record.runStatus);
288
+ }
289
+
290
+ // 关联设备
291
+ if (column.key === "relevance") {
292
+ return (
293
+ <a-button
294
+ type="link"
295
+ disabled={
296
+ !selectedRow.selectedRowKeys.includes(record.id)
297
+ }
298
+ onClick={() => {
299
+ currentRow.value = null;
300
+
301
+ nextTick(() => {
302
+ currentRow.value = record;
303
+ showRelevance.value = true;
304
+ });
305
+ }}
306
+ >
307
+ 选择
308
+ </a-button>
309
+ );
310
+ }
311
+ },
312
+ }}
313
+ ></Table>
314
+ </div>
315
+ </div>
316
+
317
+ <div class="right flex">
318
+ <div class="top flex-center">
319
+ <div>
320
+ 已选
321
+ {selectedRow.selectedRows.length +
322
+ selectedRelevanceList.value.length}
323
+ 台设备
324
+ </div>
325
+ <a-button
326
+ type="link"
327
+ onClick={() => {
328
+ selectedRow.selectedRowKeys = [];
329
+ selectedRow.selectedRows = [];
330
+
331
+ selectedRelevanceList.value = [];
332
+ }}
333
+ >
334
+ 清空
335
+ </a-button>
336
+ </div>
337
+
338
+ <div class="activedBox">
339
+ {selectedRow.selectedRows.map((selected: any, idx: number) => {
340
+ // const name = `${selected.code}${selected.name}`;
341
+ const name = selected.name;
342
+ const textLength = 10;
343
+ const title = name.length > textLength ? name : "";
344
+ return (
345
+ <a-tag
346
+ class="tag"
347
+ title={title}
348
+ key={selected.id}
349
+ closable
350
+ onClose={() => {
351
+ const index = selectedRow.selectedRows.findIndex(
352
+ (item: any) => item.id === selected.id
353
+ );
354
+ selectedRow.selectedRowKeys.splice(index, 1);
355
+ selectedRow.selectedRows.splice(idx, 1);
356
+
357
+ selectedRelevanceList.value = [];
358
+ }}
359
+ >
360
+ {name.length > textLength
361
+ ? `${name.slice(0, textLength)}...`
362
+ : name}
363
+ </a-tag>
364
+ );
365
+ })}
366
+ </div>
367
+
368
+ <div class="top flex-center">关联设备</div>
369
+ <div class="activedBox">
370
+ {selectedRelevanceList.value.map(
371
+ (relevance: any, idx: number) => {
372
+ const name = `${relevance.name}(${relevance.relevanceType})`;
373
+ const textLength = 10;
374
+ const title = name.length > textLength ? name : "";
375
+ return (
376
+ <a-tag
377
+ class="tag"
378
+ title={title}
379
+ key={relevance.id}
380
+ closable
381
+ onClose={() => {
382
+ selectedRelevanceList.value.splice(idx, 1);
383
+ }}
384
+ >
385
+ {name.length > textLength
386
+ ? `${name.slice(0, textLength)}...`
387
+ : name}
388
+ </a-tag>
389
+ );
390
+ }
391
+ )}
392
+ </div>
393
+ </div>
394
+ </div>
395
+ </Modal>
396
+
397
+ <SelectRelevance
398
+ v-model={[showRelevance.value, "showRelevance"]}
399
+ currentRow={currentRow.value}
400
+ selectedRelevanceList={selectedRelevanceList.value}
401
+ onToUpdate={(relevanceList) => {
402
+ toUpdateRelevance(relevanceList);
403
+ }}
404
+ />
405
+ </div>
406
+ );
407
+ },
408
+ });