MrShi
2025-08-19 30e858fa504b268b9b436afca0a1259cf6e8c488
admin/src/views/business/workorderShe.vue
@@ -3,19 +3,40 @@
    <!-- 搜索表单 -->
    <div slot="search-form">
      <el-form ref="searchForm" :model="searchForm" label-width="100px" inline>
        <el-form-item label="伤害类型" prop="typeId">
          <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> <!-- 自定义显示内容 -->
            </template>
          </el-cascader>
        <el-form-item label="伤害类型" prop="typeIdPath">
          <treeselect
              style="width: 200px"
              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-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" clearable placeholder="请输入工单号" @keypress.enter.native="search"></el-input>
          <el-input v-model="searchForm.code" clearable style="width: 150px" placeholder="工单号" @keypress.enter.native="search"></el-input>
        </el-form-item>
        <el-form-item label="提交时间" prop="queryStartTime">
          <el-date-picker type="datetime" v-model="searchForm.queryStartTime" style="width: 190px" 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"  style="width: 190px"  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>
@@ -44,8 +65,8 @@
        <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-else-if="row.status ==3 ||row.status ==4||row.status ==5">已处理</span>
            <!--                <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>
@@ -56,7 +77,8 @@
            <span v-else>本人</span>
          </template>
        </el-table-column>
        <el-table-column prop="locationName" label="发生地点" min-width="100px"></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}">
@@ -76,14 +98,14 @@
              <span v-else>否</span>
            </template>
          </el-table-column>
        <el-table-column prop="eventInfo" label="事件说明" min-width="100px"></el-table-column>
        <el-table-column prop="memberName" label="上报人员" min-width="100px">
        <el-table-column prop="eventInfo" label="事件说明" min-width="200px"  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="100px"></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'])"
@@ -115,6 +137,7 @@
import Pagination from '@/components/common/Pagination'
import OperaWorkorderDetailSheWindow from '@/components/business/OperaWorkorderDetailSheWindow'
import { treeList } from '@/api/business/category'
import {timeForMat} from "@/utils/util";
export default {
  name: 'Workorder',
  extends: BaseTable,
@@ -123,11 +146,15 @@
    return {
      // 搜索
      searchForm: {
        queryStartTime: null,
        queryEndTime: null,
        radio: null,
        type: '0',
        memberName: '',
        memberCompanyId: '',
        localtionId: '',
        typeId: '',
        typeId: null,
        typeIdPath: null,
        code: '',
        categoryList: []
      },
@@ -151,6 +178,38 @@
    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()
    },
    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]