Blame view

src/components/inspection/EditInspectionRoutePoint.vue 3.86 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
48ea9c43   wuxw   巡检开发完成
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
    <el-dialog
      :title="$t('inspectionRoute.editPointTitle')"
      :visible.sync="visible"
      width="50%"
      @close="handleClose"
    >
      <el-form
        ref="form"
        :model="editInspectionRoutePointInfo"
        label-width="120px"
      >
        <el-form-item
          :label="$t('inspectionRoute.startTime')"
          prop="pointStartTime"
          :rules="[
            { required: true, message: $t('inspectionRoute.startTimeRequired') }
          ]"
        >
          <el-time-picker
            v-model="editInspectionRoutePointInfo.pointStartTime"
            :placeholder="$t('inspectionRoute.startTimePlaceholder')"
            value-format="HH:mm"
            style="width: 100%"
          />
        </el-form-item>
        <el-form-item
          :label="$t('inspectionRoute.endTime')"
          prop="pointEndTime"
          :rules="[
            { required: true, message: $t('inspectionRoute.endTimeRequired') }
          ]"
        >
          <el-time-picker
            v-model="editInspectionRoutePointInfo.pointEndTime"
            :placeholder="$t('inspectionRoute.endTimePlaceholder')"
            value-format="HH:mm"
            style="width: 100%"
          />
        </el-form-item>
        <el-form-item
          :label="$t('inspectionRoute.sortNumber')"
          prop="sortNumber"
          :rules="[
            { required: true, message: $t('inspectionRoute.sortNumberRequired') },
            { type: 'number', message: $t('inspectionRoute.sortNumberMustBeNumber') }
          ]"
        >
          <el-input
            v-model.number="editInspectionRoutePointInfo.sortNumber"
            :placeholder="$t('inspectionRoute.sortNumberPlaceholder')"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClose">
          {{ $t('common.cancel') }}
        </el-button>
        <el-button
          type="primary"
          @click="editInspectionRoutePoint"
        >
          {{ $t('common.save') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { updateInspectionRoutePointRel } from '@/api/inspection/inspectionRouteApi'
  
  export default {
    name: 'EditInspectionRoutePoint',
    data() {
      return {
        visible: false,
        editInspectionRoutePointInfo: {
          communityId: '',
          inspectionId: '',
          irpRelId: '',
          inspectionName: '',
          inspectionRouteId: '',
          pointEndTime: '',
          pointObjId: '',
          pointObjName: '',
          pointObjType: '',
          pointStartTime: '',
          pointTypeName: '',
          remark: '',
          sortNumber: ''
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
    },
    methods: {
      open(params) {
        this.visible = true
        this.editInspectionRoutePointInfo = { ...params }
        this.editInspectionRoutePointInfo.communityId = this.communityId
        this.$nextTick(() => {
          this.$refs.form.clearValidate()
        })
      },
      async editInspectionRoutePoint() {
        try {
          this.$refs.form.validate(async valid => {
            if (!valid) return
  
            await updateInspectionRoutePointRel(this.editInspectionRoutePointInfo)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
114
            this.$message.success(this.$t('common.operationSuccess'))
48ea9c43   wuxw   巡检开发完成
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
            this.$emit('success')
            this.handleClose()
          })
        } catch (error) {
          console.error('修改巡检点失败:', error)
          this.$message.error(this.$t('inspectionRoute.editFailed'))
        }
      },
      handleClose() {
        this.visible = false
        this.editInspectionRoutePointInfo = {
          communityId: '',
          inspectionId: '',
          irpRelId: '',
          inspectionName: '',
          inspectionRouteId: '',
          pointEndTime: '',
          pointObjId: '',
          pointObjName: '',
          pointObjType: '',
          pointStartTime: '',
          pointTypeName: '',
          remark: '',
          sortNumber: ''
        }
      }
    }
  }
  </script>