Newer
Older
KaiFengPC / src / views / longoPeration / Patrolmanagement / Inspectionplan.vue
@zhangdeliang zhangdeliang on 20 Jun 9 KB update
<template>
  <!-- 巡查计划管理 -->
  <div class="publicContainer">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="计划名称:" prop="searchContent">
        <el-input v-model="queryParams.searchContent" placeholder="请输入计划名称" clearable style="width: 180px" />
      </el-form-item>

      <el-form-item label="项目名称:" prop="eventType">
        <el-select clearable v-model="queryParams.eventType" style="width: 180px" placeholder="请选择项目名称">
          <el-option v-for="item in Xmtype" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>

      <el-form-item label="计划状态:" prop="handleStatus">
        <el-select clearable v-model="queryParams.handleStatus" style="width: 180px" placeholder="请选择计划状态">
          <el-option v-for="item in WaterDate" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </el-form-item>

      <el-form-item label="计划日期" prop="reportTime">
        <el-date-picker
          style="width: 380px"
          format="YYYY-MM-DD"
          v-model="AllData.publishTime"
          type="daterange"
          range-separator="至"
          start-placeholder="开始时间"
          end-placeholder="结束时间"
        />
      </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="580">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="巡查计划名称" prop="name" />
      <el-table-column label="巡查计划状态" prop="status" />
      <el-table-column label="项目名称" prop="project" />
      <el-table-column label="巡查人员" prop="user" />
      <el-table-column label="巡查类型" prop="type" />
      <el-table-column label="巡查公里数(km)" prop="num" />
      <el-table-column label="计划开始时间" prop="start" />
      <el-table-column label="计划结束时间" prop="end" />
      <el-table-column label="任务频率" prop="pl" />
      <el-table-column label="创建时间" prop="create" />
      <el-table-column label="巡查要求" prop="remark" />
      <el-table-column label="操作" width="280">
        <template #default="scope">
          <el-button link icon="View" type="success" v-if="scope.row.status == '未激活'" @click="activation(scope.row, 'view')">
            激活
          </el-button>
          <el-button link icon="View" type="primary" @click="handleDetail(scope.row, 'view')">查看</el-button>
          <el-button link type="warning" icon="Edit" v-if="scope.row.status == '未激活'" @click="handleUpdate(scope.row, 'view')">
            修改
          </el-button>
          <el-button link type="danger" icon="Delete" v-if="scope.row.status == '未激活'" @click="handleDelete(scope.row, 'view')">
            删除
          </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="800px" append-to-body :close-on-click-modal="false">
      <el-form ref="roleRef" :model="form" :rules="rules" label-width="100px" :disabled="multiple">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="项目名称:" prop="q">
              <el-select clearable v-model="form.q" style="width: 100%" placeholder="请选择项目名称">
                <el-option v-for="item in Xmtype" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计划名称:" prop="w">
              <el-input v-model="form.w" 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="fileTag">
              <el-select v-model="form.fileTag" placeholder="请选择巡查频率" clearable style="width: 100%" @change="changeStation">
                <el-option v-for="dict in Xcfrequency" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="巡查频率(周):" prop="fileTag1" v-if="form.fileTag == 'zhou'">
              <el-select v-model="form.fileTag1" placeholder="请选择巡查频率(周)" clearable style="width: 100%">
                <el-option v-for="dict in document_tag" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="巡查人员:" prop="fileTag1">
              <el-select v-model="form.fileTag1" placeholder="请选择巡查人员" clearable style="width: 100%">
                <el-option v-for="dict in Xcpersonnel" :key="dict.value" :label="dict.label" :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计划日期" prop="reportTime1">
              <el-date-picker
                style="width: 380px"
                format="YYYY-MM-DD"
                v-model="form.reportTime1"
                type="daterange"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <div class="dituclass">地图</div>
        </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>
  </div>
</template>
<script setup name="Inspectionplan">
const { proxy } = getCurrentInstance();
const open = ref(false);
const multiple = ref(false);
const showSearch = ref(true);
const Xmtype = ref([
  { value: '0', label: '海绵项目0' },
  { value: '1', label: '海绵项目1' },
  { value: '2', label: '海绵项目2' },
]);
const Xcfrequency = ref([
  { value: 'tian', label: '天' },
  { value: 'zhou', label: '周' },
]);
const Xcpersonnel = ref([
  { value: '0', label: '激萌飞' },
  { value: '1', label: '杨辉' },
]);
const WaterDate = ref([
  { value: '0', label: '已完成' },
  { value: '1', label: '已激活' },
  { value: '2', label: '未激活' },
]);
const loading = ref(true);
const total = ref(1);
const title = ref('');
const dataList = ref([
  {
    name: '0612汴京路巡查',
    status: '未激活',
    project: '汴京路东郊沟雨水泵站新建项目、市政公建雨水资源化利用项目',
    user: '杨辉,张磊',
    type: '海绵项目巡查',
    num: '1.2',
    pl: '天',
    start: '2024-06-12 09:00:00',
    end: '2024-06-12 13:00:00',
    create: '2024-06-11 09:00:00',
    remark: '仔细巡查',
  },
]);
const AllData = reactive({
  id: '',
  caseid: '',
  caseidone: '',
  publishTime: [proxy.moment(new Date()).subtract(3, 'days').format('YYYY-MM-DD '), proxy.moment().format('YYYY-MM-DD 23:59:59')],
  form: {},
  formDate: {},
  caseFormDate: { id: '' },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    caseType: 1,
    handleStatus: '',
    searchContent: '',
  },
  rules: {
    id: [{ required: true, message: '请输入', trigger: 'blur' }],
    eventDescription: [{ required: true, message: '请输入', trigger: 'blur' }],
  },
  rulesFormRef: {
    dispositionDepartment: [{ required: true, message: '请选择', trigger: 'blur' }],
  },
});
const { queryParams, form, formDate, rules, rulesFormRef, caseFormDate } = toRefs(AllData);

//搜索
function handleQuery() {
  getList();
}
//重置
function resetQuery() {
  AllData.publishTime = [proxy.moment(new Date()).subtract(3, 'days').format('YYYY-MM-DD '), proxy.moment().format('YYYY-MM-DD 23:59:59')];
  proxy.resetForm('queryRef');
  handleQuery();
}
// 新增
function handleAdd() {
  title.value = '新增巡查计划';
  open.value = true;
  form.value = {};
  multiple.value = false;
  form.value.fileTag = Xcfrequency.value[0].value;
}
// 新增中取消事件
function cancel() {
  open.value = false;
  proxy.resetForm('roleRef');
}

// 巡查频率下拉框点击事件
function changeStation(value) {
  // console.log(value, 'value');
}

//查看详情操作
function handleDetail(row) {
  open.value = true;
  title.value = '查看巡查计划';
  multiple.value = true;
  form.value = row;
}
// 修改按钮操作
function handleUpdate(row) {
  open.value = true;
  title.value = '修改巡查计划';
  multiple.value = false;
  form.value = { ...row };
}

/** 查询列表 */
const getList = async () => {
  // loading.value = true;
  loading.value = false;
};

onMounted(() => {
  getList();
});
</script>
<style scoped lang="scss">
.dituclass {
  width: 100%;
  height: 300px;
  // background: red;
  margin-bottom: 10px;
  border: 1px solid #004565;
}
</style>