jiangping
2025-04-18 8ea0fed403b7750c96b1507e7396aa1a93b994d6
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
<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="typeIdPath">
<!--          <el-cascader  v-model="searchForm.categoryList" :options="categorys" @change="handleChangeCategory" :show-all-levels="false"
                        clearable filterable :props="categoryprops"  >
            <template slot-scope="{ node, data }">
              <span>{{ data.name }}</span> &lt;!&ndash; 自定义显示内容 &ndash;&gt;
            </template>
          </el-cascader>-->
          <treeselect
              style="width: 150px"
              v-model="searchForm.typeIdPath"
              placeholder="伤害类型"
              clearable
              :options="categorys"
              :normalizer="normalizeOptions"
              :default-expand-level="1"
              @input="search"
              noChildrenText="没有子选项"
              noOptionsText="没有可选项"
              noResultsText="没有匹配的结果" />
        </el-form-item>
        <el-form-item label="上报人员" prop="memberName">
          <el-input v-model="searchForm.memberName" clearable placeholder="人员姓名或手机号" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <el-form-item label="工单号" prop="code">
          <el-input v-model="searchForm.code" clearable placeholder="请输入工单号" @keypress.enter.native="search"></el-input>
        </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="150px" fixed>
          <template slot-scope="{row}">
            <span style="color: #2E68EC;cursor: pointer" @click="$refs.operaWorkorderWindow.open('SHE事件工单详情', row)" >{{ row.code || '-'}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="typeNamePath" label="伤害类型" min-width="100px"></el-table-column>
        <el-table-column prop="submitDate" label="上报时间" min-width="150px"></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="memberType" label="涉及人员" min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.memberType == 2">供应商-{{row.memberNames}}</span>
            <span v-else-if="row.memberType == 1">同事-{{row.memberNames}}</span>
            <span v-else>本人</span>
          </template>
        </el-table-column>
        <el-table-column prop="happenTime" label="发现时间" min-width="150px"></el-table-column>
        <el-table-column prop="locationName" label="发生地点" min-width="200px"></el-table-column>
        <el-table-column prop="remark" label="具体位置" min-width="100px"></el-table-column>
          <el-table-column prop="outJiuyi" label="就医情况" min-width="100px">
            <template slot-scope="{row}">
              <span v-if="row.outJiuyi == 0">非外部就医-
                  <span v-if="row.isYiwushi == 0">非医务室-
                     <span v-if="row.isHurted == 0">未受伤</span>
                     <span v-else>受伤</span>
                  </span>
                   <span v-else>医务室</span>
              </span>
              <span v-else>外部就医</span>
            </template>
          </el-table-column>
          <el-table-column prop="workRelated" label="和工作相关" min-width="100px">
            <template slot-scope="{row}">
              <span v-if="row.workRelated == 1">是</span>
              <span v-else>否</span>
            </template>
          </el-table-column>
        <el-table-column prop="eventInfo" label="事件说明" min-width="200px"></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('SHE事件工单详情', 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>
    <!-- 新建/修改 -->
    <OperaWorkorderDetailSheWindow 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 OperaWorkorderDetailSheWindow from '@/components/business/OperaWorkorderDetailSheWindow'
import { treeList } from '@/api/business/category'
export default {
  name: 'Workorder',
  extends: BaseTable,
  components: {TableLayout, Pagination, OperaWorkorderDetailSheWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        type: '0',
        memberName: '',
        memberCompanyId: '',
        localtionId: '',
        typeId: null,
        typeIdPath: null,
        code: '',
        categoryList: []
      },
      categoryprops: {
        label: 'name',
        value: 'id',
        checkStrictly: true,
        lazyLoad: this.lazyLoad
      },
      categorys: []
    }
  },
  created () {
    this.config({
      module: '工单信息表',
      api: '/business/workorder',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.loadCategorys()
    this.search()
  },
  methods: {
    normalizeOptions(node) {
      if (node.childList && !node.childList.length) {
        // 去掉children=[]的children属性
        delete node.childList;
      }
      return {
        id: node.idPath,
        label: node.name,
        children: node.childList,
      };
    },
    handleChangeCategory (value) {
      if (this.searchForm.categoryList && this.searchForm.categoryList.length >= 1) {
        this.searchForm.typeId = this.searchForm.categoryList[this.searchForm.categoryList.length - 1]
      }
    },
    loadCategorys () {
      treeList({ type: 0 })
        .then(res => {
          if (res && res.length > 0) {
            res[0].fsStatus = 1
            this.categorys = this.getCategoryTree(res)
          }
        })
    },
    getCategoryTree (tree) {
      if (tree == null) {
        return []
      }
      return tree.map(item => {
        const newItem = { ...item }
        if (newItem) {
          newItem.children = newItem.childList
        }
        if (item.children && item.children.length === 0) {
          this.$delete(newItem, 'children')
        } else {
          newItem.children = this.getCategoryTree(newItem.children)
        }
        // newItem.disabled = false
        return newItem
      })
    }
  }
}
</script>