Blame view

src/components/car/editParkingSpaceApply.vue 5.72 KB
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
1
  <template>
2c760b97   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
    <el-dialog 
      :title="$t('editParkingSpaceApply.editApplication')" 
      :visible.sync="visible" 
      width="800px"
      @close="closeDialog"
    >
      <el-form 
        ref="form" 
        :model="formData" 
        :rules="rules" 
        label-width="150px"
      >
        <el-form-item 
          :label="$t('editParkingSpaceApply.licensePlate')" 
          prop="carNum"
        >
          <el-input 
            v-model="formData.carNum" 
            :placeholder="$t('editParkingSpaceApply.fillLicensePlate')"
          />
        </el-form-item>
        
        <el-form-item 
          :label="$t('editParkingSpaceApply.carBrand')" 
          prop="carBrand"
        >
          <el-input 
            v-model="formData.carBrand" 
            :placeholder="$t('editParkingSpaceApply.fillCarBrand')"
          />
        </el-form-item>
        
        <el-form-item 
          :label="$t('editParkingSpaceApply.vehicleType')" 
          prop="carType"
        >
          <el-select 
            v-model="formData.carType" 
            :placeholder="$t('editParkingSpaceApply.selectVehicleType')"
            style="width: 100%"
          >
            <el-option 
              :label="$t('parkingSpaceApplyManage.homeCar')" 
              value="9901" 
            />
            <el-option 
              :label="$t('parkingSpaceApplyManage.bus')" 
              value="9902" 
            />
            <el-option 
              :label="$t('parkingSpaceApplyManage.truck')" 
              value="9903" 
            />
          </el-select>
        </el-form-item>
        
        <el-form-item 
          :label="$t('editParkingSpaceApply.color')" 
          prop="carColor"
        >
          <el-input 
            v-model="formData.carColor" 
            :placeholder="$t('editParkingSpaceApply.fillColor')"
          />
        </el-form-item>
        
        <el-form-item 
          :label="$t('editParkingSpaceApply.startTime')" 
          prop="startTime"
        >
          <el-date-picker
            v-model="formData.startTime"
b25b036d   wuxw   v1.9 优化日期
74
75
            type="datetime" value-format="yyyy-MM-dd HH:mm:ss"          :placeholder="$t('editParkingSpaceApply.fillStartTime')"
            
2c760b97   wuxw   完成停车功能
76
77
78
79
80
81
82
83
84
85
            style="width: 100%"
          />
        </el-form-item>
        
        <el-form-item 
          :label="$t('editParkingSpaceApply.endTime')" 
          prop="endTime"
        >
          <el-date-picker
            v-model="formData.endTime"
b25b036d   wuxw   v1.9 优化日期
86
87
            type="datetime" value-format="yyyy-MM-dd HH:mm:ss"          :placeholder="$t('editParkingSpaceApply.fillEndTime')"
            
2c760b97   wuxw   完成停车功能
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
            style="width: 100%"
          />
        </el-form-item>
        
        <el-form-item :label="$t('editParkingSpaceApply.applicant')">
          <el-input 
            v-model="formData.applyPersonName" 
            disabled 
            :placeholder="$t('editParkingSpaceApply.fillApplicant')"
          />
        </el-form-item>
        
        <el-form-item :label="$t('editParkingSpaceApply.applicantPhone')">
          <el-input 
            v-model="formData.applyPersonLink" 
            disabled 
            :placeholder="$t('editParkingSpaceApply.fillApplicantPhone')"
          />
        </el-form-item>
        
        <el-form-item :label="$t('editParkingSpaceApply.remarks')">
          <el-input 
            v-model="formData.remark" 
            type="textarea" 
            :rows="3"
            :placeholder="$t('editParkingSpaceApply.optional')"
          />
        </el-form-item>
      </el-form>
      
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">
          {{ $t('editParkingSpaceApply.cancel') }}
        </el-button>
        <el-button type="primary" @click="submitForm">
          {{ $t('editParkingSpaceApply.save') }}
        </el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { updateParkingSpaceApply } from '@/api/car/parkingSpaceApplyManageApi'
  
  export default {
    name: 'EditParkingSpaceApply',
    data() {
      return {
        visible: false,
        formData: {
          applyId: '',
          carNum: '',
          carBrand: '',
          carType: '',
          carColor: '',
          startTime: '',
          endTime: '',
          applyPersonName: '',
          applyPersonLink: '',
          applyPersonId: '',
          state: '1001',
          remark: ''
        },
        rules: {
          carNum: [
            { required: true, message: this.$t('editParkingSpaceApply.fillLicensePlate'), trigger: 'blur' }
          ],
          carBrand: [
            { required: true, message: this.$t('editParkingSpaceApply.fillCarBrand'), trigger: 'blur' }
          ],
          carType: [
            { required: true, message: this.$t('editParkingSpaceApply.selectVehicleType'), trigger: 'change' }
          ],
          carColor: [
            { required: true, message: this.$t('editParkingSpaceApply.fillColor'), trigger: 'blur' }
          ],
          startTime: [
            { required: true, message: this.$t('editParkingSpaceApply.fillStartTime'), trigger: 'change' }
          ],
          endTime: [
            { required: true, message: this.$t('editParkingSpaceApply.fillEndTime'), trigger: 'change' }
          ]
        }
      }
    },
    methods: {
      open(data) {
        this.formData = { ...data }
        this.visible = true
      },
      
      closeDialog() {
        this.$refs.form.resetFields()
      },
      
      submitForm() {
        this.$refs.form.validate(async valid => {
          if (valid) {
            try {
              const response = await updateParkingSpaceApply(this.formData)
              if (response.code === 0) {
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
189
                this.$message.success(this.$t('common.operationSuccess'))
2c760b97   wuxw   完成停车功能
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
                this.visible = false
                this.$emit('success')
              } else {
                this.$message.error(response.msg || this.$t('common.updateFailed'))
              }
            } catch (error) {
              console.error('Error updating parking space application:', error)
              this.$message.error(this.$t('common.requestError'))
            }
          }
        })
      }
    }
  }
  </script>