jiangping
2025-04-22 d06afcaf821b178b8b6169779842a56b423bd6e6
admin/src/views/business/workorderShe.vue
@@ -4,14 +4,8 @@
    <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"
              style="width: 200px"
              v-model="searchForm.typeIdPath"
              placeholder="伤害类型"
              clearable
@@ -24,10 +18,25 @@
              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>
@@ -128,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,
@@ -136,6 +146,9 @@
    return {
      // 搜索
      searchForm: {
        queryStartTime: null,
        queryEndTime: null,
        radio: null,
        type: '0',
        memberName: '',
        memberCompanyId: '',
@@ -165,6 +178,27 @@
    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属性