Newer
Older
KaiFengPC / src / views / longoPeration / Patrolmanagement / inspectiontasks.vue
@zhangdeliang zhangdeliang on 20 Jun 8 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 Xmpersonnel" :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="project" />
      <el-table-column label="巡查人员" prop="user" />
      <el-table-column label="巡查类型" prop="type" />
      <el-table-column label="任务开始时间" prop="start" />
      <el-table-column label="任务结束时间" prop="end" />
      <el-table-column label="任务状态" prop="status" />
      <el-table-column label="超时时间" prop="cstime" />
      <el-table-column label="任务下发时间" prop="create" />
      <el-table-column label="操作" width="240">
        <template #default="scope">
          <el-button link icon="View" type="primary" @click="handleDetail(scope.row, 'view')">查看</el-button>
          <!-- <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row, 'view')">修改</el-button>
          <el-button link type="danger" icon="Delete" @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="500px" 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="20">
            <el-form-item label="巡查任务名称:" prop="q">
              <el-input v-model="form.q" placeholder="请输入巡查任务名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="20">
            <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-row>
        <el-row :gutter="20">
          <el-col :span="20">
            <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-row>
        <el-row :gutter="20">
          <el-col :span="20">
            <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">
          <el-col :span="20">
            <el-form-item label="巡查任务描述:" prop="q">
              <el-input v-model="form.q" 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>
  </div>
</template>
<script setup name="Inspectionplan">
const { proxy } = getCurrentInstance();
const open = ref(false);
const multiple = ref(false);
const showSearch = ref(true);
const Xmpersonnel = ref([
  { value: '0', label: '小李' },
  { value: '1', label: '小王' },
  { value: '2', label: '小鲁' },
]);
const Xcfrequency = ref([
  { value: 'tian', label: '天' },
  { value: 'zhou', label: '周' },
]);
const Xcpersonnel = ref([
  { value: '0', label: '激萌飞' },
  { value: '1', label: '杨辉' },
]);

const loading = ref(true);
const total = ref(0);
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',
    cstime: '超时5天12小时',
  },
  {
    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',
    cstime: '超时5天12小时',
  },
]);
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>