Newer
Older
KaiFengPC / src / views / dataAnalysis / manualAssay / blackWater.vue
@鲁yixuan 鲁yixuan on 19 Aug 8 KB updata
<template>
  <!-- 数据采集子系统 人工化验  士壤本底检测-->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="采样地点" prop="title">
        <el-input v-model="queryParams.title" placeholder="请输入采样地点" clearable />
      </el-form-item>

      <el-form-item label="年份">
        <el-date-picker
          type="year"
          v-model="queryParams.trainTime"
          value-format="YYYY"
          placeholder="请选择年"
          style="width: 100%"
        ></el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button type="success" icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 按钮区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['floodSys:jing:add']">新增</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
    </el-row>
    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="650">
      <el-table-column label="序号" type="index" width="55" />
      <el-table-column label="采样日期" prop="trainTime" />
      <el-table-column label="采样地点" prop="address" />
      <el-table-column label="土壤渗透系数(m/d)" prop="title" />
      <el-table-column label="孔系度(%)" prop="people" />
      <el-table-column label="土壤容重(g/cm³)" prop="content" />
      <el-table-column label="检测报告" prop="report">
        <template #default="scope">
          <span
            class="filePreview"
            @click="
              previewPdf(
                'https://server1.wh-nf.cn:9000/newfiber-standard-kaifeng/2024/07/15/4-2-6 2022年示范区老旧小区改造项目(二)竣工验收报告_20240715154024A438.pdf'
              )
            "
          >
            检测报告.pdf
          </span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="160" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['floodSys:jing:edit']">修改</el-button>
          <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['floodSys:jing:remove']">
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getDataList"
    />

    <!-- 添加或修改弹窗 -->
    <el-dialog :title="dialogTitle" v-model="dialogShow" width="500px" append-to-body>
      <el-form ref="formRef" :model="formData" :rules="rulesForm" label-width="120px" class="publicForm">
        <el-form-item label="采样日期:" prop="trainTime">
          <el-date-picker type="date" v-model="formData.trainTime" value-format="YYYY-MM-DD" placeholder="请选择采样日期" />
        </el-form-item>
        <el-form-item label="采样地点:" prop="address">
          <el-input type="text" v-model="formData.address" placeholder="请输入采样地点" clearable style="width: 100%" />
        </el-form-item>
        <el-form-item label="土壤渗透系数:" prop="title">
          <el-input type="text" v-model="formData.title" placeholder="请输入土壤渗透系数" clearable style="width: 100%" />
        </el-form-item>
        <el-form-item label="孔系度:" prop="people">
          <el-input type="text" v-model="formData.people" placeholder="请输入孔系度" clearable style="width: 100%" />
        </el-form-item>
        <el-form-item label="土壤容重:" prop="content">
          <el-input type="text" v-model="formData.content" placeholder="请输入土壤容重" clearable style="width: 100%" />
        </el-form-item>
        <el-form-item label="检测报告:" prop="reportList">
          <ImageFileUpload
            :limit="1"
            :saveFileArr="formData.reportList"
            :listType="'text'"
            :refField="'trfield'"
            :refType="'tr_site_info'"
            :fileType="['pdf']"
          ></ImageFileUpload>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="cancelForm">取 消</el-button>
          <el-button type="primary" @click="submitForm">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { specialNavPage, specialNavAdd, specialNavDel, specialNavDetail, specialNavEdit } from '@/api/publicService/index';
import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传

const { proxy } = getCurrentInstance();

const tableData = ref([]);
// const tableLoading = ref(true);
const total = ref(0);
const dialogShow = ref(false);
const dialogTitle = ref('');
const showSearch = ref(true);

const allData = reactive({
  formData: {
    reportList: [],
    linkType: '',
    linkUrl: '',
    platePosition: '',
  },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    trainTime: '',
    title: '',
  },
  rulesForm: {
    trainTime: [{ required: true, message: '请选择培训日期', trigger: 'change' }],
    linkUrl: [{ required: true, message: '请输入跳转链接', trigger: 'blur' }],
    address: [{ required: true, message: '请输入培训地点', trigger: 'blur' }],
    title: [{ required: true, message: '请输入培训宣传名称', trigger: 'blur' }],
    people: [{ required: true, message: '请输入参加人员', trigger: 'blur' }],
    content: [{ required: true, message: '请输入培训内容', trigger: 'blur' }],
    reportList: [{ required: true, message: '请选择检测报告', trigger: 'change', type: 'array' }],
  },
});
const { queryParams, formData, rulesForm } = toRefs(allData);
/** 获取搜索数据列表 */
function getDataList() {
  // tableLoading.value = true;
  tableData.value = [
    {
      trainTime: '2024-03-21',
    },
  ];
  // tableLoading.value = true;
  // specialNavPage(queryParams.value).then(response => {
  //   tableData.value = response.data;
  //   total.value = response.total;
  //   tableLoading.value = false;
  // });
}
/** 取消按钮 */
function cancelForm() {
  dialogShow.value = false;
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getDataList();
}
/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm('queryRef');
  handleQuery();
}
/** 新增按钮操作 */
function handleAdd() {
  proxy.resetForm('formRef'); //清空表单
  dialogShow.value = true;
  dialogTitle.value = '新增土壤本底检测';
}
/** 修改按钮操作 */
function handleUpdate(row) {
  dialogShow.value = true;
  dialogTitle.value = '修改土壤本底检测';

  // specialNavDetail(row.id).then(response => {
  //   dialogShow.value = true;
  //   dialogTitle.value = '修改培训宣传';
  //   setTimeout(() => {
  //     formData.value = response.data;
  //   });
  // });
}
/** 提交按钮 */
function submitForm() {
  // proxy.$refs['formRef'].validate(valid => {
  //   if (valid) {
  //     if (dialogTitle.value == '修改培训宣传') {
  //       specialNavEdit(formData.value).then(response => {
  //         proxy.$modal.msgSuccess('修改成功');
  //         dialogShow.value = false;
  //         getDataList();
  //       });
  //     } else {
  //       if (formData.value.id) delete formData.value.id;
  //       specialNavAdd(formData.value).then(response => {
  //         proxy.$modal.msgSuccess('新增成功');
  //         dialogShow.value = false;
  //         getDataList();
  //       });
  //     }
  //   }
  // });
}
/** 删除按钮操作 */
function handleDelete(row) {
  // const postIds = row.id;
  // proxy.$modal
  //   .confirm('是否确认删除该数据项?')
  //   .then(function () {
  //     return specialNavDel(postIds);
  //   })
  //   .then(() => {
  //     getDataList();
  //     proxy.$modal.msgSuccess('删除成功');
  //   })
  //   .catch(() => {});
}

function previewPdf(url) {
  window.open(url);
}

onMounted(() => {
  getDataList();
});
</script>
<style lang="scss"></style>