Newer
Older
KaiFengPC / src / views / project / projectManage / projectDesign.vue
@鲁yixuan 鲁yixuan on 24 Aug 9 KB updata
<template>
  <!-- 项目设计管理 -->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true">
      <el-form-item label="项目名称:" prop="projectNo">
        <el-select v-model="queryParams.projectNo" placeholder="请选择项目" clearable filterable>
          <el-option v-for="dict in projectList" :key="dict.projectNo" :label="dict.projectName" :value="dict.projectNo" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
        <el-button type="warning" icon="Edit" @click="totalQuery">汇总统计</el-button>
      </el-form-item>
    </el-form>

    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="650">
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="审核状态" prop="reviewStatus">
        <template #default="scope">
          <span :class="[scope.row.reviewStatus == '1' || scope.row.reviewStatus == '2' ? 'green' : 'red']">
            {{
              scope.row.reviewStatus == '1'
                ? '审核通过'
                : scope.row.reviewStatus == '3'
                ? '审核拒绝'
                : scope.row.reviewStatus == '2'
                ? '已提交市规划局'
                : '未审核'
            }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="海绵专篇文件" prop="sysFileList">
        <template #default="scope">
          <span class="filePreview" @click="previewPdf(scope.row.sysFileList)">
            {{ scope.row.sysFileList.length > 0 ? scope.row.sysFileList[0].name : '--' }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="备注" prop="remark" />
      <el-table-column label="发布时间" prop="updateTime" />
      <el-table-column label="操作" width="160" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button
            link
            type="warning"
            @click="handleAudit(scope.row)"
            v-if="scope.row.reviewStatus == '' || scope.row.reviewStatus == '0'"
          >
            审核
          </el-button>
          <el-button link type="primary" @click="handleSubmit(scope.row)" v-if="scope.row.reviewStatus == '1'"> 提交市规划局 </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="getTableList"
    />

    <!-- 审核弹窗 -->
    <el-dialog title="审核" 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="reviewStatus">
          <el-select v-model="formData.reviewStatus" filterable clearable placeholder="请选择">
            <el-option label="通过" value="1" />
            <el-option label="拒绝" value="3" />
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input type="textarea" v-model="formData.remark" placeholder="请输入" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShow = false">取 消</el-button>
          <el-button type="primary" @click="submitAudit">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 提交市规划局弹窗 -->
    <el-dialog title="提交市规划局" v-model="dialogShowGH" width="500px" append-to-body>
      <el-form ref="formRefGH" :model="formDataGH" :rules="rulesFormGH" label-width="100px" class="publicForm">
        <el-form-item label="被通知人" prop="userIdArray">
          <el-select v-model="formDataGH.userIdArray" multiple clearable placeholder="请选择被通知人">
            <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
          </el-select>
        </el-form-item>

        <el-form-item label="通知人电话:" prop="phone">
          <el-input type="text" v-model="formDataGH.phone" placeholder="请输入通知人电话" clearable maxlength="11" />
        </el-form-item>
        <!-- <el-form-item label="通知状态" prop="msgState">
          <el-select v-model="formDataGH.msgState" placeholder="请选择通知状态">
            <el-option v-for="item in infoStaticList" :key="item.id" :label="item.staticLabel" :value="item.id" />
          </el-select>
        </el-form-item> -->
        <el-form-item label="通知消息" prop="noticeMsg">
          <el-input type="textarea" v-model="formDataGH.noticeMsg" placeholder="请输入通知消息" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShowGH = false">取 消</el-button>
          <el-button type="primary" @click="submitGH">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 汇总统计弹窗 -->
    <el-dialog title="汇总统计" v-model="dialogShowTJ" width="600px" append-to-body>
      <el-table :data="tableDataTJ">
        <el-table-column label="日期" prop="reviewMonth" />
        <el-table-column label="未审核" prop="unReviewCount" />
        <el-table-column label="已审核" prop="reviewCount" />
      </el-table>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShowTJ = false">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import {
  projectFileReviewPage,
  projectFileReviewEdit,
  projectFileReviewGH,
  projectFileReviewTJ,
  getProjectInfoNewList,
} from '@/api/document/projectTransfer';
import { listUser } from '@/api/system/user';
import bus from '@/utils/mitt';
import { projectNoticeAdd } from '@/api/publicService/index';
const { proxy } = getCurrentInstance();
const projectList = ref([]);
const dialogShow = ref(false);
const tableData = ref([]);
const tableLoading = ref(false);
const total = ref(0);
const dialogShowTJ = ref(false);
const dialogShowGH = ref(false);
const tableDataTJ = ref([]);
const userList = ref([]);
const allData = reactive({
  formData: {
    remark: '',
    reviewStatus: '1',
    projectNo: '',
  },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    fileType: 'hmchzp', //海绵城市专篇
    projectNo: '',
  },
  rulesForm: {
    reviewStatus: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
  formDataGH: {
    msgState: '1',
  },
  rulesFormGH: {
    userIdArray: [{ required: true, message: '请选择被通知人', trigger: 'blur' }],
    msgState: [{ required: true, message: '请选择通知状态', trigger: 'blur' }],
    noticeMsg: [{ required: true, message: '请输入通知消息', trigger: 'blur' }],
    phone: [
      {
        pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
        message: '请输入正确的手机号码',
        trigger: 'blur',
        required: true,
      },
    ],
  },
});
const { queryParams, formData, rulesForm, formDataGH, rulesFormGH } = toRefs(allData);

//搜索
function handleQuery() {
  queryParams.value.pageNum = 1;
  getTableList();
}
//重置
function resetQuery() {
  proxy.resetForm('queryRef');
  handleQuery();
}

/** 搜索 */
function getTableList() {
  tableLoading.value = true;
  projectFileReviewPage(queryParams.value).then(res => {
    tableData.value = res.data || [];
    total.value = res.total;
    tableLoading.value = false;
  });
}

// 审核
const handleAudit = row => {
  proxy.resetForm('formRef'); //清空表单
  formData.value = { ...row };
  dialogShow.value = true;
};
// 审核提交
function submitAudit() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      formData.value.fileType = 'hmchzp';
      projectFileReviewEdit(formData.value).then(response => {
        proxy.$modal.msgSuccess('审核成功');
        dialogShow.value = false;
        getTableList();
      });
    }
  });
}

// 提交市规划局
function handleSubmit(row) {
  proxy.resetForm('formRefGH'); //清空表单
  dialogShowGH.value = true;
  formData.value = { ...row };
}
function submitGH() {
  proxy.$refs['formRefGH'].validate(valid => {
    if (valid) {
      formDataGH.value.fileType = 'hmchzp';
      projectNoticeAdd(formDataGH.value).then(response => {
        proxy.$modal.msgSuccess('提交市规划局成功');
        dialogShowGH.value = false;
        getTableList();
        bus.emit('Refresh');
      });
      // 修改状态
      // formData.value.reviewStatus = '2';
      // formData.value.fileType = 'hmchzp';
      // projectFileReviewEdit(formData.value).then(response => {
      //   proxy.$modal.msgSuccess('审核成功');
      //   dialogShow.value = false;
      //   getTableList();
      // });
    }
  });
}

// 汇总统计
function totalQuery() {
  dialogShowTJ.value = true;
  searchCount();
}
// 汇总统计搜索
function searchCount() {
  projectFileReviewTJ({ fileType: 'hmchzp' }).then(res => {
    tableDataTJ.value = res.data;
  });
}

// 获取项目列表
const getProjectList = async () => {
  const res = await getProjectInfoNewList();
  if (res?.code !== 200) return;
  projectList.value = res.data || [];
};

// 文件预览
function previewPdf(item) {
  if (item.length > 0) {
    window.open(item[0].url);
  }
}

//搜索人员列表
function getUserList() {
  listUser().then(res => {
    userList.value = res.data || [];
    userList.value.map(item => {
      item.userId = String(item.userId);
    });
  });
}

onMounted(() => {
  getProjectList(); // 获取项目列表
  getUserList();
  handleQuery();
});
</script>

<style lang="scss" scoped></style>