Blame view

src/views/work/repairSettingList.vue 9.84 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
2e0fd29c   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
    <div class="repair-setting-container">
      <!-- 查询条件 -->
      <el-card class="search-card">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('repairSetting.queryCondition') }}</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="5">
            <el-input v-model="searchForm.repairTypeName" :placeholder="$t('repairSetting.repairTypeNamePlaceholder')"
              clearable />
          </el-col>
          <el-col :span="5">
            <el-select v-model="searchForm.repairWay" :placeholder="$t('repairSetting.repairWayPlaceholder')"
              style="width:100%">
              <el-option :label="$t('common.all')" value=""></el-option>
              <el-option v-for="item in repairWays" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
            </el-select>
          </el-col>
          <el-col :span="5">
            <el-select v-model="searchForm.repairSettingType"
              :placeholder="$t('repairSetting.repairSettingTypePlaceholder')" style="width:100%">
              <el-option :label="$t('common.all')" value=""></el-option>
              <el-option v-for="item in repairSettingTypes" :key="item.statusCd" :label="item.name"
                :value="item.statusCd" />
            </el-select>
          </el-col>
          <el-col :span="5">
            <el-select v-model="searchForm.publicArea" :placeholder="$t('repairSetting.publicAreaPlaceholder')"
              style="width:100%">
              <el-option :label="$t('common.all')" value=""></el-option>
              <el-option v-for="item in publicAreas" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
            </el-select>
          </el-col>
          <el-col :span="4">
            <el-button type="primary" @click="handleSearch">{{ $t('repairSetting.search') }}</el-button>
            <el-button @click="handleReset">{{ $t('repairSetting.reset') }}</el-button>
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 报修设置列表 -->
      <el-card class="list-card">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('repairSetting.repairSettingTitle') }}</span>
          <div style="float: right">
0b10c798   wuxw   v1.9 优化报修相关bug
47
            <!-- <el-button type="text" @click="showDocumentation">
2e0fd29c   wuxw   开发报修
48
              {{ $t('repairSetting.documentation') }}
0b10c798   wuxw   v1.9 优化报修相关bug
49
            </el-button> -->
2e0fd29c   wuxw   开发报修
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
            <el-button type="primary" size="small" @click="openAddDialog">
              {{ $t('repairSetting.add') }}
            </el-button>
          </div>
        </div>
  
        <el-table v-loading="loading" :data="tableData" border style="width: 100%">
          <el-table-column prop="repairTypeName" :label="$t('repairSetting.typeName')" align="center" />
          <el-table-column prop="repairSettingTypeName" :label="$t('repairSetting.repairSettingType')" align="center" />
          <el-table-column prop="repairWayName" :label="$t('repairSetting.dispatchMethod')" align="center" />
          <el-table-column prop="publicArea" :label="$t('repairSetting.area')" align="center">
            <template slot-scope="scope">
              {{ scope.row.publicArea === 'T' ? $t('repairSetting.nonHouse') : $t('repairSetting.house') }}
            </template>
          </el-table-column>
          <el-table-column prop="isShow" :label="$t('repairSetting.ownerDisplay')" align="center">
            <template slot-scope="scope">
              {{ scope.row.isShow === 'Y' ? $t('repairSetting.yes') : $t('repairSetting.no') }}
            </template>
          </el-table-column>
          <el-table-column prop="notifyWay" :label="$t('repairSetting.notificationMethod')" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.notifyWay === 'SMS'">{{ $t('repairSetting.sms') }}</span>
              <span v-else-if="scope.row.notifyWay === 'WORK_LICENSE'">{{ $t('repairSetting.wechatWorkLicense') }}</span>
              <span v-else>{{ $t('repairSetting.wechat') }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="returnVisitFlagName" :label="$t('repairSetting.returnVisit')" align="center" />
          <el-table-column prop="doTime" :label="$t('repairSetting.processingTime')" align="center">
            <template slot-scope="scope">
              {{ scope.row.doTime }}{{ $t('repairSetting.processingTimeUnit') }}
            </template>
          </el-table-column>
          <el-table-column prop="warningTime" :label="$t('repairSetting.timeoutWarning')" align="center">
            <template slot-scope="scope">
              {{ scope.row.warningTime }}{{ $t('repairSetting.timeoutWarningUnit') }}
            </template>
          </el-table-column>
          <el-table-column prop="createTime" :label="$t('repairSetting.createTime')" align="center" />
          <el-table-column :label="$t('repairSetting.operation')" align="center" width="300">
            <template slot-scope="scope">
              <el-button size="mini" @click="openEditDialog(scope.row)">
                {{ $t('repairSetting.edit') }}
              </el-button>
              <el-button size="mini" @click="bindRepairMaster(scope.row)">
                {{ $t('repairSetting.bindRepairMaster') }}
              </el-button>
              <el-button size="mini" type="danger" @click="openDeleteDialog(scope.row)">
                {{ $t('repairSetting.delete') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
  
        <!-- 分页和说明 -->
4927ce37   wuxw   开发完成报修功能
105
        <el-row :gutter="20" class="margin-top-xs text-left">
2e0fd29c   wuxw   开发报修
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
          <el-col :span="18">
            <div class="explanation-section">
              <p><strong>{{ $t('repairSetting.dispatchExplanation') }}</strong></p>
              <p>{{ $t('repairSetting.dispatchPoint1') }}</p>
              <p>{{ $t('repairSetting.dispatchPoint2') }}</p>
              <p>{{ $t('repairSetting.dispatchPoint3') }}</p>
              <p><strong>{{ $t('repairSetting.areaExplanation') }}</strong></p>
              <p>{{ $t('repairSetting.areaPoint1') }}</p>
              <p>{{ $t('repairSetting.areaPoint2') }}</p>
            </div>
          </el-col>
          <el-col :span="6">
            <el-pagination background :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]"
              :page-size="pagination.size" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange" @current-change="handleCurrentChange" />
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 子组件 -->
      <add-repair-setting ref="addDialog" @success="fetchData" />
      <edit-repair-setting ref="editDialog" @success="fetchData" />
      <delete-repair-setting ref="deleteDialog" @success="fetchData" />
    </div>
  </template>
  
  <script>
  import { listRepairSettings } from '@/api/work/repairSettingApi'
  import AddRepairSetting from '@/components/work/AddRepairSetting'
  import EditRepairSetting from '@/components/work/EditRepairSetting'
  import DeleteRepairSetting from '@/components/work/DeleteRepairSetting'
47b8eddb   wuxw   优化完成 平凉客户反馈bug
137
  import { getDict } from '@/api/community/communityApi'
2e0fd29c   wuxw   开发报修
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
215
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
  
  export default {
    name: 'RepairSettingList',
    components: {
      AddRepairSetting,
      EditRepairSetting,
      DeleteRepairSetting
    },
    data() {
      return {
        loading: false,
        searchForm: {
          repairTypeName: '',
          repairWay: '',
          repairSettingType: '',
          publicArea: '',
          returnVisitFlag: ''
        },
        tableData: [],
        repairWays: [],
        repairSettingTypes: [],
        publicAreas: [],
        returnVisitFlags: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.fetchData()
      this.loadDictData()
    },
    methods: {
      async fetchData() {
        this.loading = true
        try {
          const params = {
            page: this.pagination.current,
            row: this.pagination.size,
            ...this.searchForm
          }
  
          const { data, records } = await listRepairSettings(params)
          this.tableData = data
          this.pagination.total = records
        } catch (error) {
          console.error('获取报修设置列表失败:', error)
          this.$message.error(this.$t('common.fetchError'))
        } finally {
          this.loading = false
        }
      },
  
      async loadDictData() {
        try {
          this.repairWays = await getDict('r_repair_setting', 'repair_way')
          this.repairSettingTypes = await getDict('r_repair_setting', 'repair_setting_type')
          this.publicAreas = await getDict('r_repair_setting', 'public_area')
          this.returnVisitFlags = await getDict('r_repair_setting', 'return_visit_flag')
        } catch (error) {
          console.error('加载字典数据失败:', error)
        }
      },
  
      handleSearch() {
        this.pagination.current = 1
        this.fetchData()
      },
  
      handleReset() {
        this.searchForm = {
          repairTypeName: '',
          repairWay: '',
          repairSettingType: '',
          publicArea: '',
          returnVisitFlag: ''
        }
        this.handleSearch()
      },
  
      handleSizeChange(size) {
        this.pagination.size = size
        this.fetchData()
      },
  
      handleCurrentChange(current) {
        this.pagination.current = current
        this.fetchData()
      },
  
      openAddDialog() {
        this.$refs.addDialog.open()
      },
  
      openEditDialog(row) {
        this.$refs.editDialog.open(row)
      },
  
      openDeleteDialog(row) {
        this.$refs.deleteDialog.open(row)
      },
  
      bindRepairMaster(row) {
        // 跳转到绑定维修师傅页面
        this.$router.push({
          path: '/views/work/repairTypeUser',
          query: {
            settingId: row.settingId,
            repairType: row.repairType,
            repairTypeName: row.repairTypeName
          }
        })
      },
  
      showDocumentation() {
        // 显示文档逻辑
        console.log('Show documentation')
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .repair-setting-container {
    padding: 20px;
  
    .search-card {
      margin-bottom: 20px;
    }
  
    .list-card {
      margin-bottom: 20px;
    }
  
    .margin-top-xs {
      margin-top: 20px;
    }
  
    .explanation-section {
2e0fd29c   wuxw   开发报修
279
      font-size: 14px;
47b8eddb   wuxw   优化完成 平凉客户反馈bug
280
  
2e0fd29c   wuxw   开发报修
281
      p {
4927ce37   wuxw   开发完成报修功能
282
        margin-bottom: 2px;
2e0fd29c   wuxw   开发报修
283
284
285
286
      }
    }
  }
  </style>