Newer
Older
KaiFengPC / src / views / project / projectJinDu / monthReport.vue
@zhangdeliang zhangdeliang on 23 Jul 11 KB update
<template>
  <!-- 项目综合管理 项目进度管理  月度上报-->
  <div class="publicContainer">
    <!-- 搜索区域 -->
    <el-form :model="queryParams" ref="queryRef" :inline="true">
      <el-form-item label="月份选择:" prop="month">
        <el-date-picker type="month" v-model="queryParams.month" value-format="YYYY-MM" placeholder="请选择日期"> </el-date-picker>
      </el-form-item>
      <el-form-item label="项目名称:" prop="projectId">
        <el-select v-model="queryParams.projectId" filterable clearable placeholder="请选择">
          <el-option v-for="dict in projectList" :key="dict.id" :label="dict.projectName" :value="dict.id" />
        </el-select>
      </el-form-item>
      <el-form-item label="建设状态:" prop="status">
        <el-select v-model="queryParams.status" clearable placeholder="请选择">
          <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </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-button type="warning" icon="Upload" @click="importData">导入</el-button>
      </el-form-item>
    </el-form>

    <!-- 表格 -->
    <el-table v-loading="tableLoading" :data="tableData" max-height="650">
      <el-table-column label="月份" prop="month" />
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="项目类别" prop="title" />
      <el-table-column label="责任单位" prop="linkUrl" />
      <el-table-column label="建设状态" prop="publishTime" />
      <el-table-column label="建设进度(%)" prop="publishTime" />
      <el-table-column label="累计完成项目总投资(含主体工程)(万元)" prop="publishTime" />
      <el-table-column label="累计完成海绵投资(不含主体工程)(万元)" prop="publishTime" />
      <el-table-column label="本月完成投资(万元)" prop="publishTime" />
      <el-table-column label="本月完成海绵投资(万元)" prop="publishTime" />
      <el-table-column label="项目照片" prop="publishTime" />
      <el-table-column label="备注" prop="publishTime" />
      <el-table-column label="操作" width="240" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="warning" icon="Comment" @click="handleNotice(scope.row)">通知提醒</el-button>
          <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row)">修改</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="导入月报进度" v-model="dialogShowDR" width="500px" append-to-body>
      <el-form ref="formRefDR" :model="formExport" :rules="rulesFormDR" label-width="110px" class="publicForm">
        <el-form-item label="月份:" prop="month">
          <el-date-picker type="month" v-model="formExport.month" value-format="YYYY-MM" placeholder="请选择日期"> </el-date-picker>
        </el-form-item>
        <el-form-item label="月度报表:" prop="fileList" style="width: 100%">
          <ImageFileUpload
            :limit="1"
            :listType="'text'"
            :saveFileArr="formExport.fileList"
            :refField="'coverPhotos'"
            :refType="'rtu_site_info'"
            :fileType="['xlsx']"
          ></ImageFileUpload>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShowDR = false">取 消</el-button>
          <el-button type="primary" @click="submitFormExport">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 修改弹窗 -->
    <el-dialog title="修改进度" v-model="dialogShow" width="900px" append-to-body>
      <el-form ref="formRef" :model="formData" :rules="rulesForm" label-width="170px" class="publicForm flex50">
        <el-form-item label="项目名称:" prop="userName">
          <el-input type="text" v-model="formData.userName" placeholder="请输入" clearable disabled />
        </el-form-item>
        <el-form-item label="责任单位:" prop="userName">
          <el-input type="text" v-model="formData.userName" placeholder="请输入" clearable disabled />
        </el-form-item>
        <el-form-item label="累计完成总投资(万元):" prop="linkUrl">
          <el-input type="number" :min="0" v-model="formData.linkUrl" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="累计完成海绵投资(万元):" prop="linkUrl">
          <el-input type="number" :min="0" v-model="formData.linkUrl" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="本月完成投资(万元):" prop="linkUrl">
          <el-input type="number" :min="0" v-model="formData.linkUrl" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="本月完成海绵投资(万元):" prop="linkUrl">
          <el-input type="number" :min="0" v-model="formData.linkUrl" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="建设进度(%):" prop="linkUrl">
          <el-input type="number" :min="0" v-model="formData.linkUrl" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="建设状态:" prop="status">
          <el-select v-model="formData.status" clearable placeholder="请选择">
            <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="项目照片:" prop="fileList" style="width: 100%">
          <ImageFileUpload
            :limit="3"
            :listType="'picture-card'"
            :saveFileArr="formData.fileList"
            :refField="'coverPhotos'"
            :refType="'rtu_site_info'"
          ></ImageFileUpload>
        </el-form-item>
        <el-form-item label="备注:" prop="remark" style="width: 100%">
          <el-input type="textarea" v-model="formData.remark" placeholder="请输入" clearable />
        </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="submitForm">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 通知提醒弹窗 -->
    <el-dialog title="通知提醒" v-model="dialogShowTZ" width="600px" append-to-body>
      <el-form ref="formRefTZ" :model="formDataTZ" :rules="rulesFormTZ" label-width="120px" class="publicForm">
        <el-form-item label="责任人:" prop="userName">
          <el-input type="text" v-model="formDataTZ.userName" placeholder="请输入" clearable />
        </el-form-item>
        <el-form-item label="责任人电话:" prop="userPhone">
          <el-input type="text" v-model="formDataTZ.userPhone" placeholder="请输入" clearable maxlength="11" />
        </el-form-item>
        <el-form-item label="通知单:" prop="fileList">
          <ImageFileUpload
            :limit="1"
            :saveFileArr="formDataTZ.fileList"
            :listType="'text'"
            :fileType="['pdf']"
            :refField="'coverPhotos'"
            :refType="'rtu_site_info'"
          ></ImageFileUpload>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="info" @click="dialogShowTZ = false">取 消</el-button>
          <el-button type="primary" @click="submitFormTZ">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="月度上报">
import { getProjectInfoNewList } from '@/api/document/projectTransfer';
import { articlePage, articleAdd, articleDetail } from '@/api/publicService/index';
import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
import { useDicts } from '@/hooks';

const { proxy } = getCurrentInstance();
const { build_status } = useDicts(proxy);
const tableData = ref([{ projectName: '市民城市综合体' }]);
const tableLoading = ref(false);
const total = ref(0);
const dialogShow = ref(false);
const dialogShowTZ = ref(false);
const dialogShowDR = ref(false);
const projectList = ref([]);
const allData = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    month: proxy.moment(new Date()).format('YYYY-MM'),
    projectId: null,
    status: '',
    level: '',
  },
  formData: {
    articleType: 'notice',
    coverPhotosFileList: [],
    content: '',
    degist: '',
    title: '',
    remark: '',
  },
  rulesForm: {
    title: [{ required: true, message: '请输入', trigger: 'blur' }],
    // linkUrl: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
  formDataTZ: {
    userName: '',
    fileList: [],
    userPhone: '',
  },
  rulesFormTZ: {
    userName: [{ required: true, message: '请输入', trigger: 'blur' }],
    userPhone: [
      {
        pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
        message: '请输入正确的手机号码',
        trigger: 'blur',
        required: true,
      },
    ],
    fileList: [{ required: true, message: '请输入', trigger: 'blur', type: 'array' }],
  },
  formExport: {
    fileList: [],
    month: proxy.moment(new Date()).format('YYYY-MM'),
  },
  rulesFormDR: {
    fileList: [{ required: true, message: '请输入', trigger: 'blur', type: 'array' }],
  },
});
const { queryParams, formData, rulesForm, formDataTZ, rulesFormTZ, formExport, rulesFormDR } = toRefs(allData);

/** 获取查询数据列表 */
function getDataList() {
  // tableLoading.value = true;
  // articlePage(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 handleEdit() {
  proxy.resetForm('formRef'); //清空表单
  dialogShow.value = true;
}
/** 上报当月进度提交 */
function submitForm() {
  proxy.$refs['formRef'].validate(valid => {
    if (valid) {
      // articleAdd(formData.value).then(response => {
      //   proxy.$modal.msgSuccess('保存成功');
      //   dialogShow.value = false;
      //   getDataList();
      // });
    }
  });
}
/** 通知提醒操作 */
function handleNotice(row) {
  proxy.resetForm('formRefTZ'); //清空表单
  dialogShowTZ.value = true;
}
/** 通知提醒提交 */
function submitFormTZ() {
  proxy.$refs['formRefTZ'].validate(valid => {
    if (valid) {
      // articleAdd(formData.value).then(response => {
      //   proxy.$modal.msgSuccess('保存成功');
      //   dialogShow.value = false;
      //   getDataList();
      // });
    }
  });
}

// 导入
function importData() {
  dialogShowDR.value = true;
  proxy.resetForm('formRefDR'); //清空表单
}

// 导入提交

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