Newer
Older
KaiFengPC / src / views / longoPeration / CaseIssues.vue
@鲁yixuan 鲁yixuan on 19 Jul 12 KB update
<template>
  <!-- 日常巡查任务管理 -->
  <div class="publicContainer">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="任务名称:" prop="taskName">
        <el-input v-model="queryParams.taskName" placeholder="请输入任务名称" clearable style="width: 180px" />
      </el-form-item>
      <el-form-item label="项目名称:" prop="projectCodeList">
        <el-select clearable v-model="queryParams.projectCodeList" style="width: 180px" placeholder="请选择项目名称">
          <el-option v-for="proj in projectTList" :key="proj.projectNo" :label="proj.projectName" :value="proj.projectNo" />
        </el-select>
      </el-form-item>
      <el-form-item label="整改状态:" prop="isRectification">
        <el-select clearable v-model="queryParams.isRectification" style="width: 180px" placeholder="请选择整改状态">
          <el-option v-for="item in case_level" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="巡查类型:" prop="patrolType">
        <el-select clearable v-model="queryParams.patrolType" style="width: 180px" placeholder="请选择巡查类型">
          <el-option v-for="item in patrol_type" :key="item.value" :label="item.label" :value="item.value" />
        </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-form-item>
    </el-form>

    <!-- 按钮区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <!-- <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button> -->
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
    </el-row>
    <!-- 表格 -->
    <el-table :data="dataList" v-loading="loading" stripe :max-height="280">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="巡查任务名称" prop="taskName" />
      <el-table-column label="项目名称" prop="projectName" />
      <el-table-column label="项目开始时间" prop="projectStartTime" />
      <el-table-column label="项目结束时间" prop="projectEndTime" />
      <el-table-column label="建设进度(%)" prop="projectProgress" />
      <el-table-column label="巡查人员" prop="useridlist">
        <template #default="scope">
          <p v-for="item in scope.row.useridlist">{{ item.userName }}</p>
        </template>
      </el-table-column>
      <el-table-column label="巡查需整改问题" prop="expiredDays" />
      <el-table-column label="项目整改状态" prop="problemtitle" />
      <el-table-column label="巡查类型" prop="patroltype">
        <template #default="scope">
          <dict-tag :options="patrol_type" :value="String(scope.row.patroltype)" />
        </template>
      </el-table-column>
      <el-table-column label="创建时间" prop="createTime" />
      <el-table-column label="操作" width="350">
        <template #default="scope">
          <el-button link icon="View" type="primary" @click="handleDetail(scope.row, 'view')">查看</el-button>
          <el-button link type="primary" icon="Edit" @click="handlenotice(scope.row)">发布整改通知</el-button>
          <el-button link type="primary" icon="Edit" @click="handleUpdate(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="getList"
    />

    <!-- 新增弹窗 -->
    <el-dialog :title="title" v-model="open" width="1000px" append-to-body :close-on-click-modal="false">
      <el-form ref="roleRef" :model="form" :rules="rules" label-width="120px" :disabled="multiple">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="巡查任务名称:" prop="taskName">
              <el-input v-model="form.taskName" placeholder="请输入巡查任务名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="整改方式:" prop="rectifyType">
              <el-input v-model="form.rectifyType" placeholder="请输入整改方式" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="督办事项:" prop="supervisionWork">
              <el-input v-model="form.supervisionWork" type="textarea" placeholder="请输入督办事项" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="存在问题:" prop="haveProblem">
              <el-input v-model="form.haveProblem" type="textarea" placeholder="请输入存在问题" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="建设单位:" prop="projectCompanyId">
              <el-select v-model="form.projectCompanyId" placeholder="请选择建设单位" clearable style="width: 100%">
                <el-option v-for="proj in ConstructionUnit" :key="proj.id" :label="proj.unitName" :value="proj.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="整改时限:" prop="rectifyTime">
              <el-date-picker
                type="date"
                value-format="YYYY-MM-DD"
                v-model="form.rectifyTime"
                multiple
                placeholder="请选择整改时限"
                clearable
                style="width: 100%"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="责任领导:" prop="leaderName">
              <el-input v-model="form.leaderName" placeholder="请输入责任领导" clearable style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话:" prop="leaderPhone">
              <el-input v-model="form.leaderPhone" placeholder="请输入责任领导电话" clearable style="width: 100%" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="责任人:" prop="peopleName">
              <el-input v-model="form.peopleName" placeholder="请输入责任人" clearable style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话:" prop="peoplePhone">
              <el-input v-model="form.peoplePhone" placeholder="请输入责任人电话" clearable style="width: 100%" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="整改书:" prop="fileListToNotice">
              <ImageFileUpload
                :limit="1"
                v-model:saveFileArr="form.fileListToNotice"
                :listType="'text'"
                :refField="'trfield'"
                :refType="'problem_notice'"
                :fileType="['jpg', 'png', 'jpeg', 'pdf']"
              ></ImageFileUpload>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="备注:" prop="remark">
              <el-input v-model="form.remark" placeholder="请输入备注" type="textarea" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <!--详情弹框 -->
    <el-dialog
      title="查看案件巡查问题详情"
      v-model="opendetails"
      width="1200px"
      append-to-body
      class="dialog-detail-box"
      :close-on-click-modal="false"
    >
      <anjianPopup :DataList="DataList" />
    </el-dialog>
  </div>
</template>
<script setup name="CaseIssues">
import { rectifypage, patrolProblemRectifyedit, projectCompanyList } from '@/api/longoPeration/CaseIssues';
import { getProjectInfoList } from '@/api/preassess/targetManage';

import anjianPopup from '../longoPeration/Patrolmanagement/anjianPopup.vue'; //详情弹框
import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
import { validPhone } from '@/utils/validate';
const { proxy } = getCurrentInstance();
const { patrol_type } = proxy.useDict('patrol_type'); //  巡查类型的字典
const open = ref(false);
const opendetails = ref(false);
const showSearch = ref(true);
const case_level = ref([
  {
    value: '1',
    label: '无需整改',
  },
  {
    value: '2',
    label: '待整改',
  },
  { value: '3', label: '整改已完成' },
]);
const projectTList = ref([]);
const ConstructionUnit = ref([]);
const loading = ref(true);
const total = ref(0);
const title = ref('');
const dataList = ref([]);
const DataList = ref([]);
const AllData = reactive({
  publishTime: [],
  publishTime1: [],
  form: { fileListToNotice: [] },
  NumId: '',
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    handleStatus: '',
    taskName: '',
    taskUserIdList: '',
  },
  queryParamstwo: {
    pageNum: 1,
    pageSize: 10,
  },
  rules: {
    taskName: [{ required: true, message: '请输入巡查任务名称', trigger: 'blur' }],
    rectifyType: [{ required: true, message: '请输入整改方式', trigger: 'blur' }],
    supervisionWork: [{ required: true, message: '请输入督办事项', trigger: 'blur' }],
    haveProblem: [{ required: true, message: '请输入存在问题', trigger: 'blur' }],
    // fileListToNotice: [{ required: true, message: '请上传整改书', trigger: 'blur' }],
    rectifyTime: [{ required: true, message: '请选择整改时限', trigger: 'blur' }],
    projectCompanyId: [{ required: true, message: '请选择建设单位', trigger: 'blur' }],
    leaderName: [{ required: true, message: '请输入责任领导', trigger: 'blur' }],
    leaderPhone: [
      { required: true, message: '请输入责任领导电话', trigger: 'blur' },
      {
        validator: (rule, value) => {
          return new Promise((resolve, reject) => {
            if (!validPhone(value)) {
              reject(Error('手机号格式错误'));
            } else {
              resolve();
            }
          });
        },
        trigger: 'blur',
      },
    ],
    peopleName: [{ required: true, message: '请输入责任人', trigger: 'blur' }],
    peoplePhone: [
      { required: true, message: '请输入责任人电话', trigger: 'blur' },
      {
        validator: (rule, value) => {
          return new Promise((resolve, reject) => {
            if (!validPhone(value)) {
              reject(Error('手机号格式错误'));
            } else {
              resolve();
            }
          });
        },
        trigger: 'blur',
      },
    ],
  },
});
const { queryParams, form, rules } = toRefs(AllData);

//搜索
function handleQuery() {
  getList();
}
//重置
function resetQuery() {
  AllData.publishTime = [];
  proxy.resetForm('queryRef');
  handleQuery();
}

// 发布整改通知
function handlenotice(Val) {
  title.value = '发布整改通知';
  open.value = true;
  // form.value = { ...Val };
  AllData.NumId = Val.id;
  // form.value = {};
}
// 发布整改取消事件
function cancel() {
  open.value = false;
  proxy.resetForm('roleRef');
}

/** 查询列表 */
const getList = async () => {
  loading.value = true;
  let res = await rectifypage(queryParams.value);
  dataList.value = res.data;
  total.value = res.total;
  loading.value = false;
};
//查看详情操作
function handleDetail(row) {
  opendetails.value = true;
  DataList.value = { ...row };
  // console.log(DataList.value, 'DataList.value');
}
/** 提交按钮 */

function submitForm() {
  proxy.$refs['roleRef'].validate(valid => {
    if (valid) {
      form.value.id = AllData.NumId;
      console.log(form.value, 'form.value');
      patrolProblemRectifyedit(form.value).then(response => {
        proxy.$modal.msgSuccess('发布整改通知单成功');
        open.value = false;
        getList();
      });
    }
  });
}

// 下拉框
async function DropDown() {
  let { data } = await projectCompanyList();
  ConstructionUnit.value = data;
}
// 项目接口
async function projectTypeListM() {
  let { data } = await getProjectInfoList();
  projectTList.value = data;
}
onMounted(() => {
  getList();
  DropDown();
  projectTypeListM();
});
</script>
<style scoped lang="scss"></style>