Newer
Older
KaiFengPC / src / views / longoPeration / LSCaseIssues.vue
@鲁yixuan 鲁yixuan on 30 Aug 14 KB updada
<template>
  <!-- 日常巡查任务管理 -->
  <div class="publicContainer">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="项目名称:" prop="projectNo">
        <el-select clearable v-model="queryParams.projectNo" 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="status">
        <el-select clearable v-model="queryParams.status" 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>
        <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" :max-height="580">
      <el-table-column type="index" width="55" label="序号" />
      <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="userName">
        <!-- <template #default="scope">
          <p v-for="item in scope.row.useridlist">{{ item.userName }}</p>
        </template> -->
      </el-table-column>

      <el-table-column label="问题类型" prop="problemType">
        <!-- <template #default="scope">
          <dict-tag :options="problem_type" :value="String(scope.row.problemType)" />
        </template> -->
      </el-table-column>

      <el-table-column label="检查项" prop="checkItem"> </el-table-column>

      <el-table-column label="问题描述" prop="problemContent"> </el-table-column>

      <el-table-column label="项目整改状态" prop="status">
        <template #default="scope">
          <span>
            {{ scope.row.status == '0' ? '待整改' : scope.row.status == '1' ? '已整改' : '' }}
          </span>
        </template>
      </el-table-column>

      <el-table-column label="创建时间" prop="createTime" width="160" />
      <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 v-if="scope.row.ishaveNotice == 1" link type="warning" icon="Edit" @click="handlenotice(scope.row)"
            >发布整改通知</el-button
          >
          <el-button link type="warning" icon="Edit" v-if="scope.row.ishaveNotice == 2" @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="projectName">
              <el-input v-model="form.projectName" placeholder="请输入项目名称" :disabled="true" />
            </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="openOne" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="roleRefOne" :model="formOne" :rules="rulesOne" label-width="120px">
        <el-form-item label="整改回复单:" prop="fileListToReply">
          <ImageFileUpload
            :limit="1"
            v-model:saveFileArr="formOne.fileListToReply"
            :listType="'text'"
            :refField="'trfield'"
            :refType="'problem_reply'"
            :fileType="['jpg', 'png', 'jpeg', 'pdf']"
          ></ImageFileUpload>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFormOne">确 定</el-button>
          <el-button @click="cancelOne">取 消</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 { patrolProblemRectifypage, patrolProblemRectifyedit, projectCompanyList, upreplyfile } from '@/api/longoPeration/CaseIssues';
import { getProjectInfoList } from '@/api/preassess/targetManage';

import anjianPopup from '../longoPeration/Patrolmanagement/LsanjianPopup.vue'; //详情弹框
import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
import { validPhone } from '@/utils/validate';
const { proxy } = getCurrentInstance();
const { problem_type } = proxy.useDict('problem_type'); //  巡查类型的字典
const open = ref(false);
const openOne = ref(false);
const opendetails = ref(false);
const showSearch = ref(true);
const multipleA = ref(true);
const case_level = ref([
  {
    value: '0',
    label: '待整改',
  },
  {
    value: '1',
    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: [] },
  formOne: { fileListToReply: [] },
  NumId: '',
  NumIdOne: '',
  queryParams: { pageNum: 1, pageSize: 10, uploadType: '2' },
  queryParamstwo: {
    pageNum: 1,
    pageSize: 10,
  },
  rules: {
    projectName: [{ 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',
      },
    ],
  },
  rulesOne: {
    fileListToReply: [{ required: true, message: '请上传整改回复单', trigger: 'blur' }],
  },
});
const { queryParams, form, rules, formOne, rulesOne } = toRefs(AllData);

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

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

//
function handleUpdate(Val) {
  openOne.value = true;
  console.log(Val, 'Val');
  // console.log('multipleA.value', multipleA.value);

  proxy.resetForm('roleRefOne');
  AllData.NumIdOne = Val.id;
}

/** 搜索列表 */
const getList = async () => {
  loading.value = true;
  let res = await patrolProblemRectifypage(queryParams.value);
  dataList.value = res.data;
  // res.data.forEach(item => {
  //   if (item.fileListToNotice.length != 0) {
  //     multipleA.value = false;
  //     console.log(multipleA.value, 'multipleA.value');
  //   }
  // });

  total.value = res.total;
  loading.value = false;
};
//查看详情操作
function handleDetail(row) {
  opendetails.value = true;
  DataList.value = { ...row };
}
/** 提交按钮 */
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();
      });
    }
  });
}

function submitFormOne() {
  proxy.$refs['roleRefOne'].validate(valid => {
    if (valid) {
      formOne.value.id = AllData.NumIdOne;
      upreplyfile(formOne.value).then(response => {
        proxy.$modal.msgSuccess('提交整改回复单成功');
        openOne.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>