Newer
Older
Nanping_sponge_GCYPG / src / views / preassess / noopReview / index.vue
@liyingjing liyingjing on 25 Oct 2023 4 KB 工程预评估
<template>
  <div class="noopReview">
    <div class="top">
      <el-form ref="ruleForm" :model="form">
        <el-row :gutter="20">
          <el-col :span="5">
            <el-form-item label="建设工程:" prop="projectName">
              <el-input v-model="form.projectName" placeholder="建设工程" style="width: 100%" />
            </el-form-item></el-col>
          <el-col :span="3">
            <el-form-item label="建设分区:" prop="drainagePartition">
              <el-select v-model="form.drainagePartition" placeholder="建设分区" style="width: 100%">
                <el-option label="全部" value="" />
                <el-option
                  v-for="dict in drainage_partition"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="工程类型:" prop="engineeringType">
              <el-select v-model="form.engineeringType" placeholder="工程类型" style="width: 100%">
                <el-option label="全部" value="" />
                <el-option
                  v-for="dict in sponge_engineering_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="修改时间:" prop="time">
              <el-date-picker
                v-model="form.time"
                type="daterange"
                range-separator="~"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item>
              <el-button type="primary" icon="Search" @click="search">
                查询</el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-row class="mb8">
        <el-button class="mr10" type="primary" plain icon="Plus" @click="openDialog({}, 'add')">新增</el-button>
      </el-row>
    </div>
    <new-table class="table" :data="tableData" :columns="columns" :loading="loading" />
    <pagination :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />
    <el-dialog
      v-model="visible"
      :title="`${opts.text}智能审查`"
      :close-on-click-modal="false"
      width="85%"
      :before-close="() => close(opts.type)"
      class="dialog"
    >
      <operate
        v-if="visible"
        ref="operateRef"
        :id="row.id || ''"
        :opts="opts"
        :status="row.status"
        @close="close"
      ></operate>
    </el-dialog>
  </div>
</template>

<script setup>
import { reactive, onMounted } from 'vue'
import { usePagination } from '@/hooks'
import useColumns from './useColumns'
import operate from './operate.vue'
import {
  getIntelligentApprovePage
} from '@/api/preassess/noopReview'
const { proxy } = getCurrentInstance();
const form = reactive({
  projectName: '',
  drainagePartition: '',
  engineeringType: '',
  time: []
})

const params = computed(() => {
  const args = JSON.parse(JSON.stringify(form))
  const { time } = args
  delete args.time
  return {
    ...args,
    updateStartTime: time[0] || '',
    updateEndTime: time[1] || ''
  }
})

const {
  pageNum,
  pageSize,
  tableData,
  total,
  loading,
  getTableList
} = usePagination(getIntelligentApprovePage, params)

const {
  columns,
  openDialog,
  visible,
  row,
  opts,
  drainage_partition,
  sponge_engineering_type
} = useColumns(proxy, getTableList)

const search = () => {
  pageNum.value = 1
  getTableList()
}

const resetQuery = () => {
  proxy.$refs.ruleForm.resetFields()
  search()
}

const close = (type) => {
  visible.value = false
  opts.type = ''
  opts.text = ''
  row.value = {}
  if(type === 'view') return
  if(type ==='add') search()
  else getTableList()
}

onMounted(() => {
  getTableList()
})
</script>

<style lang="scss" scoped>
.noopReview {
  padding: 20px;
  height: 90vh;
  overflow-y: hidden;
  .top {
    margin-bottom: 15px;
  }
}
::v-deep(.dialog) {
  .el-dialog__body {
    padding-bottom: 20px !important;
  }
  .el-dialog__footer {
    padding-top: 0 !important;
  }
}
::v-deep(.el-table) {
  .el-table__header {
    .cell {
      .el-tooltip__trigger.el-icon {
        margin-top: 0 !important;
        transform: translateY(2px);
      }
    }
  }
}
</style>