riku
2024-08-14 b4033c002e21c1376d68be61622da56182a962e9
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
import dayjs from 'dayjs';
 
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true,
  },
  properties: {
    index: {
      type: Number,
      value: 0,
    },
    readOnly: {
      type: Boolean,
      value: false,
    },
    // 设备位置信息
    location: {
      type: Object,
      value: {},
      observer(value) {
        this.setData({ ...value });
      },
    },
  },
 
  data: {},
 
  methods: {
    onStandardChange(e) {
      if (!e) {
        this.setData({ dlUnstandardReason: '' });
      }
    },
    changeEdit() {
      this.setData({ readOnly: false, isUpdate: true });
    },
    cancel() {
      this.setData({ readOnly: true });
      this.triggerEvent('cancel');
    },
    confirm() {
      const date = this.data.dlUpdateTime ? dayjs(this.data.dlUpdateTime) : dayjs();
      const time = date.format('YYYY年MM月DD日');
      this.setData({ time, readOnly: true });
      const { readOnly, location, ...rest } = this.data;
      this.triggerEvent('confirm', rest);
    },
    update() {},
  },
});