Blame view

src/views/inspection/inspectionPlanList.vue 8.08 KB
1d73dc48   wuxw   继续晚上巡检功能
1
2
3
4
5
6
7
8
9
  <template>
    <div class="animated fadeInRight padding">
      <el-card class="box-card">
        <div slot="header" class="flex justify-between">
          <div>{{ $t('inspectionPlan.queryCondition') }}</div>
        </div>
        <div class="card-content">
          <el-row :gutter="20">
            <el-col :span="5">
d367e130   wuxw   巡检功能测试
10
11
              <el-input :placeholder="$t('inspectionPlan.inspectionPlanIdPlaceholder')"
                v-model="searchConditions.inspectionPlanId" clearable />
1d73dc48   wuxw   继续晚上巡检功能
12
13
            </el-col>
            <el-col :span="5">
d367e130   wuxw   巡检功能测试
14
15
              <el-input :placeholder="$t('inspectionPlan.inspectionPlanNamePlaceholder')"
                v-model="searchConditions.inspectionPlanName" clearable />
1d73dc48   wuxw   继续晚上巡检功能
16
17
            </el-col>
            <el-col :span="5">
d367e130   wuxw   巡检功能测试
18
19
              <el-input :placeholder="$t('inspectionPlan.staffNamePlaceholder')" v-model="searchConditions.staffNameLike"
                clearable />
1d73dc48   wuxw   继续晚上巡检功能
20
21
            </el-col>
            <el-col :span="5">
d367e130   wuxw   巡检功能测试
22
23
24
              <el-select v-model="searchConditions.state" :placeholder="$t('inspectionPlan.statePlaceholder')"
                style="width:100%">
                <el-option v-for="(item, index) in stateOptions" :key="index" :label="item.name" :value="item.statusCd" />
1d73dc48   wuxw   继续晚上巡检功能
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
              </el-select>
            </el-col>
            <el-col :span="4">
              <el-button type="primary" @click="fetchInspectionPlans">
                {{ $t('inspectionPlan.query') }}
              </el-button>
              <el-button @click="resetSearch">
                {{ $t('inspectionPlan.reset') }}
              </el-button>
            </el-col>
          </el-row>
        </div>
      </el-card>
  
      <el-card class="box-card margin-top">
        <div slot="header" class="flex justify-between">
          <div>{{ $t('inspectionPlan.inspectionPlanTitle') }}</div>
          <div style="">
            <el-button type="primary" size="small" @click="openAddModal">
              {{ $t('inspectionPlan.add') }}
            </el-button>
          </div>
        </div>
        <el-table :data="planList" border style="width: 100%">
          <el-table-column prop="inspectionPlanName" :label="$t('inspectionPlan.planName')" align="center" />
          <el-table-column prop="inspectionRouteName" :label="$t('inspectionPlan.planRoute')" align="center" />
          <el-table-column prop="inspectionPlanPeriodName" :label="$t('inspectionPlan.planCycle')" align="center" />
          <el-table-column prop="signTypeName" :label="$t('inspectionPlan.signMethod')" align="center" />
          <el-table-column :label="$t('inspectionPlan.dateRange')" align="center">
            <template slot-scope="scope">
              {{ scope.row.startDate }}~{{ scope.row.endDate }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionPlan.timeRange')" align="center">
            <template slot-scope="scope">
              {{ scope.row.startTime }}~{{ scope.row.endTime }}
            </template>
          </el-table-column>
          <el-table-column prop="beforeTime" :label="$t('inspectionPlan.taskAdvance')" align="center" />
          <el-table-column prop="createUserName" :label="$t('inspectionPlan.maker')" align="center" />
          <el-table-column prop="createTime" :label="$t('inspectionPlan.createTime')" align="center" />
          <el-table-column prop="stateName" :label="$t('inspectionPlan.status')" align="center" />
          <el-table-column :label="$t('inspectionPlan.inspectionStaff')" align="center">
            <template slot-scope="scope">
              <div v-for="(staff, i) in scope.row.staffs" :key="i">
                {{ staff.staffName }}
              </div>
            </template>
          </el-table-column>
          <el-table-column :label="$t('inspectionPlan.operation')" align="center" width="280">
            <template slot-scope="scope">
              <el-button-group>
                <el-button size="mini" @click="openEditModal(scope.row)">
                  {{ $t('inspectionPlan.modify') }}
                </el-button>
                <el-button size="mini" @click="openDeleteModal(scope.row)">
                  {{ $t('inspectionPlan.delete') }}
                </el-button>
d367e130   wuxw   巡检功能测试
83
84
                <el-button v-if="scope.row.state === '2020025'" size="mini"
                  @click="openStateModal(scope.row, '2020026', $t('inspectionPlan.disable'))">
1d73dc48   wuxw   继续晚上巡检功能
85
86
                  {{ $t('inspectionPlan.disable') }}
                </el-button>
d367e130   wuxw   巡检功能测试
87
                <el-button v-else size="mini" @click="openStateModal(scope.row, '2020025', $t('inspectionPlan.enable'))">
1d73dc48   wuxw   继续晚上巡检功能
88
89
90
91
92
93
94
95
96
                  {{ $t('inspectionPlan.enable') }}
                </el-button>
                <el-button size="mini" @click="viewDetail(scope.row)">
                  {{ $t('inspectionPlan.detail') }}
                </el-button>
              </el-button-group>
            </template>
          </el-table-column>
        </el-table>
d367e130   wuxw   巡检功能测试
97
  
1d73dc48   wuxw   继续晚上巡检功能
98
        <el-row class="margin-top">
d367e130   wuxw   巡检功能测试
99
          <el-col :span="18" class="text-left table-desc">
1d73dc48   wuxw   继续晚上巡检功能
100
101
102
            <div>{{ $t('inspectionPlan.note') }}</div>
          </el-col>
          <el-col :span="6">
d367e130   wuxw   巡检功能测试
103
104
105
            <el-pagination :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]"
              :page-size="pagination.size" layout="total, sizes, prev, pager, next" :total="pagination.total"
              @size-change="handleSizeChange" @current-change="handlePageChange" />
1d73dc48   wuxw   继续晚上巡检功能
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
          </el-col>
        </el-row>
      </el-card>
  
      <edit-inspection-plan ref="editModal" @success="handleSuccess" />
      <delete-inspection-plan ref="deleteModal" @success="handleSuccess" />
      <inspection-plan-state ref="stateModal" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import { listInspectionPlans } from '@/api/inspection/inspectionPlanApi'
  import EditInspectionPlan from '@/components/inspection/editInspectionPlan'
  import DeleteInspectionPlan from '@/components/inspection/deleteInspectionPlan'
  import InspectionPlanState from '@/components/inspection/inspectionPlanState'
d367e130   wuxw   巡检功能测试
121
  import { getDict } from '@/api/community/communityApi'
1d73dc48   wuxw   继续晚上巡检功能
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
  export default {
    name: 'InspectionPlanList',
    components: {
      EditInspectionPlan,
      DeleteInspectionPlan,
      InspectionPlanState
    },
    data() {
      return {
        searchConditions: {
          inspectionPlanId: '',
          inspectionPlanName: '',
          staffNameLike: '',
          state: ''
        },
        planList: [],
        stateOptions: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    async created() {
      await this.loadDictData()
      this.fetchInspectionPlans()
    },
    methods: {
      async loadDictData() {
        try {
          this.stateOptions = await getDict('inspection_plan', 'state')
        } catch (error) {
          console.error('Failed to load dictionary data:', error)
        }
      },
d367e130   wuxw   巡检功能测试
158
  
1d73dc48   wuxw   继续晚上巡检功能
159
160
161
162
163
164
165
      async fetchInspectionPlans() {
        try {
          const params = {
            ...this.searchConditions,
            page: this.pagination.current,
            row: this.pagination.size
          }
d367e130   wuxw   巡检功能测试
166
  
1d73dc48   wuxw   继续晚上巡检功能
167
168
169
170
171
172
173
          const { data, total } = await listInspectionPlans(params)
          this.planList = data
          this.pagination.total = total
        } catch (error) {
          this.$message.error(this.$t('inspectionPlan.fetchError'))
        }
      },
d367e130   wuxw   巡检功能测试
174
  
1d73dc48   wuxw   继续晚上巡检功能
175
176
177
178
179
180
181
182
183
184
      resetSearch() {
        this.searchConditions = {
          inspectionPlanId: '',
          inspectionPlanName: '',
          staffNameLike: '',
          state: ''
        }
        this.pagination.current = 1
        this.fetchInspectionPlans()
      },
d367e130   wuxw   巡检功能测试
185
  
1d73dc48   wuxw   继续晚上巡检功能
186
187
188
189
      handleSizeChange(size) {
        this.pagination.size = size
        this.fetchInspectionPlans()
      },
d367e130   wuxw   巡检功能测试
190
  
1d73dc48   wuxw   继续晚上巡检功能
191
192
193
194
      handlePageChange(page) {
        this.pagination.current = page
        this.fetchInspectionPlans()
      },
d367e130   wuxw   巡检功能测试
195
  
1d73dc48   wuxw   继续晚上巡检功能
196
197
198
      openAddModal() {
        this.$router.push({ path: '/views/inspection/addInspectionPlan' })
      },
d367e130   wuxw   巡检功能测试
199
  
1d73dc48   wuxw   继续晚上巡检功能
200
201
202
      openEditModal(plan) {
        this.$refs.editModal.open(plan)
      },
d367e130   wuxw   巡检功能测试
203
  
1d73dc48   wuxw   继续晚上巡检功能
204
205
206
      openDeleteModal(plan) {
        this.$refs.deleteModal.open(plan)
      },
d367e130   wuxw   巡检功能测试
207
  
1d73dc48   wuxw   继续晚上巡检功能
208
209
210
211
212
213
214
      openStateModal(plan, state, stateName) {
        this.$refs.stateModal.open({
          inspectionPlanId: plan.inspectionPlanId,
          state,
          stateName
        })
      },
d367e130   wuxw   巡检功能测试
215
  
1d73dc48   wuxw   继续晚上巡检功能
216
217
218
      viewDetail(plan) {
        window.open(`/#/pages/inspection/inspectionPlanDetail?inspectionPlanId=${plan.inspectionPlanId}`)
      },
d367e130   wuxw   巡检功能测试
219
  
1d73dc48   wuxw   继续晚上巡检功能
220
221
222
223
224
225
226
227
228
229
230
      handleSuccess() {
        this.fetchInspectionPlans()
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top {
    margin-top: 20px;
  }
d367e130   wuxw   巡检功能测试
231
  
1d73dc48   wuxw   继续晚上巡检功能
232
233
234
235
  .card-content {
    padding: 20px;
  }
  </style>