Blame view

src/views/car/auditParkingSpaceApply.vue 7.93 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
    <div class="audit-container">
      <el-card class="box-card">
        <div slot="header" class=" flex justify-between">
          <span>{{ $t('auditParkingSpaceApply.applyInfo') }}</span>
          <el-button style="float: right; padding: 3px 0" type="text" @click="goBack">
            {{ $t('auditParkingSpaceApply.back') }}
          </el-button>
        </div>
        <el-form ref="viewForm" :model="formData" label-width="120px" class="text-left">
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.licensePlate') + ':'">
                <span>{{ formData.carNum }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.carBrand') + ':'">
                <span>{{ formData.carBrand }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.carType') + ':'">
                <span>{{ formData.carType }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.color') + ':'">
                <span>{{ formData.carColor }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.startRentTime') + ':'">
                <span>{{ formData.startTime }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.endRentTime') + ':'">
                <span>{{ formData.endTime }}</span>
              </el-form-item>
            </el-col>
  
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.applicant') + ':'">
                <span>{{ formData.applyPersonName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.applicantPhone') + ':'">
                <span>{{ formData.applyPersonLink }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="$t('auditParkingSpaceApply.applicantId') + ':'">
                <span>{{ formData.applyPersonId }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item :label="$t('auditParkingSpaceApply.remark') + ':'">
                <span>{{ formData.remark }}</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
  
      <el-card class="box-card" style="margin-top: 20px;">
        <div slot="header" class="clearfix">
          <span>{{ $t('auditParkingSpaceApply.auditInfo') }}</span>
        </div>
  
        <el-form ref="form" :model="formData" label-width="120px">
          <el-form-item :label="$t('auditParkingSpaceApply.startRentTime')" required>
b25b036d   wuxw   v1.9 优化日期
74
            <el-date-picker v-model="formData.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"            :placeholder="$t('auditParkingSpaceApply.requiredField')" 
2c760b97   wuxw   完成停车功能
75
76
77
78
              style="width: 100%;" />
          </el-form-item>
  
          <el-form-item :label="$t('auditParkingSpaceApply.endRentTime')" required>
b25b036d   wuxw   v1.9 优化日期
79
            <el-date-picker v-model="formData.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"            :placeholder="$t('auditParkingSpaceApply.requiredField')" 
2c760b97   wuxw   完成停车功能
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
              style="width: 100%;" />
          </el-form-item>
  
          <el-form-item :label="$t('auditParkingSpaceApply.auditResult')" required>
            <el-select v-model="formData.state" :placeholder="$t('auditParkingSpaceApply.selectResult')" style="width:100%">
              <el-option :label="$t('auditParkingSpaceApply.pass')" value="3003" />
              <el-option :label="$t('auditParkingSpaceApply.reject')" value="4004" />
            </el-select>
          </el-form-item>
  
          <el-form-item v-if="formData.state === '3003'" :label="$t('auditParkingSpaceApply.selectParkingSpace')">
            <el-input v-model="formData.psName" :placeholder="$t('auditParkingSpaceApply.selectParkingSpace')" readonly
              style="width: 80%;" />
            <el-button type="primary" @click="openChooseParkingSpace" style="margin-left: 10px;">
              <i class="el-icon-search"></i>
              {{ $t('auditParkingSpaceApply.select') }}
            </el-button>
          </el-form-item>
  
          <el-form-item :label="$t('auditParkingSpaceApply.auditOpinion')">
            <el-input v-model="formData.remark2" type="textarea" :placeholder="$t('auditParkingSpaceApply.optional')"
              :rows="3" />
          </el-form-item>
  
          <el-form-item>
            <el-button @click="goBack">
              {{ $t('auditParkingSpaceApply.back') }}
            </el-button>
            <el-button type="primary" @click="doAudit">
              {{ $t('auditParkingSpaceApply.submit') }}
            </el-button>
          </el-form-item>
        </el-form>
      </el-card>
  
  
      <!-- 搜索车位组件 -->
      <search-parking-space 
        ref="searchParkingSpace"
        :ps-flag="formData.parkingSpaceFlag"
        @choose-parking-space="handleChooseParkingSpace"
      />
    </div>
  </template>
  
  <script>
  import { getParkingSpaceApplyDetail, auditParkingSpaceApply } from '@/api/car/auditParkingSpaceApplyApi'
  import SearchParkingSpace from '@/components/car/SearchParkingSpace'
  
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'AuditParkingSpaceApply',
    components: {
      SearchParkingSpace
    },
    data() {
      return {
        formData: {
          applyId: '',
          communityId: getCommunityId(),
          psId: '',
          psName: '',
          carNum: '',
          carBrand: '',
          carType: '',
          carColor: '',
          startTime: '',
          endTime: '',
          applyPersonName: '',
          applyPersonLink: '',
          applyPersonId: '',
          state: '',
          remark: '',
          remark2: '',
          parkingSpaceFlag: 'F'
        }
      }
    },
    created() {
      this.formData.applyId = this.$route.query.applyId
      this.getApplyDetail()
    },
    methods: {
      async getApplyDetail() {
        try {
          const params = {
            page: 1,
            row: 1,
            applyId: this.formData.applyId
          }
  
          const res = await getParkingSpaceApplyDetail(params)
          if (res.data && res.data.length > 0) {
            Object.assign(this.formData, res.data[0])
          }
        } catch (error) {
          this.$message.error(this.$t('common.queryFailed'))
        }
      },
      openChooseParkingSpace() {
        this.$refs.searchParkingSpace.open()
      },
      handleChooseParkingSpace(parkingSpace) {
        console.log('选择车位', parkingSpace)
        this.formData.psId = parkingSpace.psId
        this.formData.psName = parkingSpace.num
      },
      async doAudit() {
        // 验证逻辑
        if (!this.formData.state) {
          this.$message.warning(this.$t('auditParkingSpaceApply.selectResult'))
          return
        }
  
        if (this.formData.state === '3003' && !this.formData.psId) {
          this.$message.warning(this.$t('auditParkingSpaceApply.selectParkingSpace'))
          return
        }
  
        if (this.formData.state === '4004' && !this.formData.remark2) {
          this.$message.warning(this.$t('auditParkingSpaceApply.auditOpinionRequired'))
          return
        }
  
        try {
          // 合并备注信息
          const remark = `${this.formData.remark}\n审核意见:${this.formData.remark2}`
  
          const data = {
            ...this.formData,
            remark
          }
  
          await auditParkingSpaceApply(data)
6ec243d6   wuxw   v1.9 点击提交后,成功提示没有...
215
          this.$message.success(this.$t('common.operationSuccess'))
2c760b97   wuxw   完成停车功能
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
245
246
          this.goBack()
        } catch (error) {
          this.$message.error(this.$t('common.submitFailed'))
        }
      },
      goBack() {
        this.$router.go(-1)
      }
    }
  }
  </script>
  
  <style scoped>
  .audit-container {
    padding: 20px;
  }
  
  .box-card {
    margin-bottom: 20px;
  }
  
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  
  .clearfix:after {
    clear: both;
  }
  </style>