jiangping
2025-06-17 64fa2c33cd645e86d4e2a8c34c7881ea4aa678cf
1
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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<template>
  <TableLayout :permissions="['business:workorder:query']">
    <!-- 搜索表单 -->
    <div slot="search-form">
      <el-form ref="searchForm" :model="searchForm" label-width="100px" inline>
        <el-form-item label="观察主题" prop="typeId">
          <el-select v-model="searchForm.typeId" placeholder="一级主题" clearable @change="changeType" style="width: 120px">
          <el-option  clearable filterable
              v-for="item in categorys"
              :key="item.id"
              :label="item.name"
              :value="item.id">
          </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="" prop="categoryId">
          <el-select v-model="searchForm.categoryId" clearable  placeholder="二级主题"  style="width: 120px"  @change="search" >
          <el-option   filterable
              v-for="item in categorys1"
              :key="item.id"
              :label="item.name"
              :value="item.id">
          </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="上报人员" prop="memberName">
          <el-input v-model="searchForm.memberName" style="width: 150px"  clearable placeholder="姓名或手机号" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <el-form-item label="工单号" prop="code">
          <el-input v-model="searchForm.code" style="width: 120px"  clearable placeholder="工单号" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <el-form-item label="状态描述" prop="status">
          <el-select v-model="searchForm.status" placeholder="请选择" clearable  @change="search" >
            <el-option label="待分配WTS" value="0"></el-option>
            <el-option label="待分配工程师" value="1"></el-option>
            <el-option label="SHE关闭" value="2"></el-option>
            <el-option label="WTS关闭" value="3"></el-option>
            <el-option label="工程师关闭" value="4"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="提交时间" prop="queryStartTime">
          <el-date-picker type="datetime" v-model="searchForm.queryStartTime" value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="开始时间" @change="changeRadio" />
        </el-form-item>
        <el-form-item label="" prop="queryEndTime">
          <el-date-picker type="datetime" v-model="searchForm.queryEndTime" value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="结束时间" @change="changeRadio" />
        </el-form-item>
        <el-form-item label="" prop="radio">
          <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio">
            <el-radio-button label="0">当天</el-radio-button>
            <el-radio-button label="1">近7天</el-radio-button>
            <el-radio-button label="2">近30天</el-radio-button>
          </el-radio-group>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
    </div>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:workorder:exportExcel']">
        <li> <el-button type="primary" :loading="isWorking.export" @click="exportExcel">导出</el-button></li>
      </ul>
      <el-table
        :height="tableHeightNew"
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        @selection-change="handleSelectionChange"
      >
        <el-table-column prop="code"  label="工单号" min-width="160px" fixed>
          <template slot-scope="{row}">
            <span style="color: #2E68EC;cursor: pointer" @click="$refs.operaWorkorderWindow.open('DCA事件工单详情', row)" >{{ row.code || '-'}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="typeName" label="观察主题" min-width="100px">
          <template slot-scope="{row}"> {{row.typeName}}/{{row.categoryName}}
          </template>
        </el-table-column>
        <el-table-column prop="problemTitle" label="不符合项" min-width="250px"></el-table-column>
        <el-table-column prop="status" label="状态" min-width="100px">
          <template slot-scope="{row}">
            <!--                <span :class="'statusInfo'+row.status" v-if="row.status ==0">待处理</span>-->
            <span :class="'statusInfo'+row.status" v-if="row.status ==3 ||row.status ==4||row.status ==5">已处理</span>
            <span :class="'statusInfo'+row.status" v-else>处理中</span>
          </template>
        </el-table-column>
        <el-table-column prop="statusInfo" label="状态描述" min-width="100px">
          <template slot-scope="{row}">
            <span :class="'statusInfo'+row.status" >{{ row.statusName}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="locationName" label="位置" min-width="150px"></el-table-column>
        <el-table-column prop="submitDate" label="上报时间" min-width="150px"></el-table-column>
        <el-table-column prop="happenTime" label="发现时间" min-width="150px"></el-table-column>
        <el-table-column prop="eventInfo" label="不符合原因" min-width="250px"  show-overflow-tooltip ></el-table-column>
        <el-table-column prop="memberName" label="上报人员" min-width="150px">
          <template slot-scope="{row}">
            <span v-if="row.memberPhone" >{{row.memberName}}/{{row.memberPhone }}</span>
            <span v-else >{{row.memberName}} </span>
          </template>
        </el-table-column>
        <el-table-column prop="companyName" label="所属部门" min-width="150px"></el-table-column>
        <el-table-column prop="createDate" label="创建时间" min-width="150px"></el-table-column>
        <el-table-column
          v-if="containPermissions(['business:workorder:update', 'business:workorder:delete'])"
          label="操作"
          min-width="120"
          fixed="right"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaWorkorderWindow.open('DCA事件工单详情', row)" icon="el-icon-zoom-out" >查看详情</el-button>
          <!--<el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:workorder:delete']">删除</el-button>-->
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaWorkorderDetailDcaInfoWindow ref="operaWorkorderWindow" @success="handlePageChange"/>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaWorkorderDetailDcaInfoWindow from '@/components/business/OperaWorkorderDetailDcaInfoWindow'
import { allList } from '@/api/business/category'
import {timeForMat} from "@/utils/util";
export default {
  name: 'Workorder',
  extends: BaseTable,
  components: {TableLayout, Pagination, OperaWorkorderDetailDcaInfoWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        queryStartTime: null,
        queryEndTime: null,
        radio: null,
        type: '2',
        memberName: '',
        memberCompanyId: '',
        localtionId: '',
        categoryId: '',
        typeId: '',
        code: '',
        status: null,
        categoryList: []
      },
      categoryprops: {
        label: 'name',
        value: 'id',
        checkStrictly: true,
        lazyLoad: this.lazyLoad
      },
      categorys: [],
      categorys1: []
    }
  },
  created () {
    this.config({
      module: '工单信息表',
      api: '/business/workorder',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.loadCategorys()
    this.search()
  },
  methods: {
    changeRadio(e) {
      if (e === '0') {
        this.searchForm.queryStartTime = timeForMat(0)[0]
        this.searchForm.queryEndTime = timeForMat(0)[1]
      } else if (e === '1') {
        this.searchForm.queryStartTime = timeForMat(6)[0]
        this.searchForm.queryEndTime = timeForMat(6)[1]
      } else if (e === '2') {
        this.searchForm.queryStartTime = timeForMat(29)[0]
        this.searchForm.queryEndTime = timeForMat(29)[1]
      } else {
        this.searchForm.radio = ''
      }
      if (this.searchForm.queryStartTime && this.searchForm.endTime && new Date(this.searchForm.startTime).getTime() > new Date(this.searchForm.endTime).getTime()) {
        this.$message.error('开始时间不能大于结束时间')
        this.searchForm.queryStartTime = ''
        return
      }
      this.search()
    },
    changeType(){
      this.search()
      this.categorys1 = []
      this.searchForm.categoryId = null
      this.loadCategorys1()
    },
    handleChangeCategory (value) {
      if (this.searchForm.categoryList && this.searchForm.categoryList.length >= 1) {
        this.searchForm.typeId = this.searchForm.categoryList[this.searchForm.categoryList.length - 1]
      }
    },
    loadCategorys () {
      allList({ type: 4, isRoot:1})
        .then(res => {
          if (res && res.length > 0) {
            this.categorys = res
          }
        })
    },
    loadCategorys1 ( ) {
      if (!this.searchForm.typeId) {
        return
      }
      allList({ type: 4, parentId: this.searchForm.typeId })
        .then(res => {
          if (res && res.length > 0) {
            this.categorys1 = res
          }
        })
    },
  }
}
</script>