Newer
Older
HuangJiPC / src / pages / views / reminder / reminderSettings.vue
@zhangdeliang zhangdeliang on 21 Jun 9 KB update
<template>
  <div id="reminderSettings">
    <div id="searchBox">
      <n-space>
        <n-input
          placeholder="泵站名称"
          v-model:value="selectedValue1"
          autosize
          style="width: 250px"
        />
        <n-select
          v-model:value="selectedValue2"
          filterable
          placeholder=""
          :options="options"
          style="width: 250px"
        />
        <n-radio-group v-model:value="selectedValue3" name="radiobuttongroup1">
          <n-radio-button
            v-for="song in songs"
            :key="song.value"
            :value="song.value"
          >
            {{ song.label }}
          </n-radio-button>
        </n-radio-group>
      </n-space>
    </div>
    <div id="cententBox">
      <div
        class="reminderBox"
        v-for="(item, index) in reminderData"
        :key="item.Id"
      >
        <div class="reminderTitle">{{ item.titleName }}</div>
        <div class="reminderTableHeader">
          <div class="rheader1"></div>
          <div class="rheader2">序号</div>
          <div class="rheader3">提醒事项</div>
          <div class="rheader4">提醒频率(天/次/时)</div>
        </div>
        <div class="reminderTableBody">
          <div
            class="reminderTableList"
            v-for="(item2, index2) in item.Data"
            :key="item2.Id"
          >
            <div class="rBody1">
              <n-checkbox v-model:checked="item2.startUp" />
            </div>
            <div class="rBody2">{{ index2 + 1 }}</div>
            <div class="rBody3">
              <n-ellipsis style="max-width: 180px">
                {{ item2.Title }}
              </n-ellipsis>
            </div>
            <div class="rBody4">
              <div v-if="item2.type == 1">
                <!-- 文本 + 时间 + 单位 -->
                <n-space>
                  <span class="ruleFont">{{ item2.ruleData.ruleFont }}</span>
                  <n-input-number
                    v-model:value="item2.ruleData.dateValue"
                    :min="0"
                    :max="30"
                    style="width: 90px"
                    size="small"
                  />
                  <span class="ruleunit">{{ item2.ruleData.unit }}</span>
                </n-space>
              </div>
              <div v-else-if="item2.type == 2">
                <!-- 下拉框 + 时间 + 单位 -->
                <n-space>
                  <n-select
                    v-model:value="item2.ruleData.selectValue"
                    filterable
                    :options="item2.ruleData.selectOptions"
                    style="width: 110px"
                    size="small"
                  />
                  <n-input-number
                    v-model:value="item2.ruleData.dateValue"
                    :min="0"
                    :max="30"
                    style="width: 90px"
                    size="small"
                  />
                  <span class="ruleunit">{{ item2.ruleData.unit }}</span>
                </n-space>
              </div>
              <div v-else-if="item2.type == 3">
                <!-- 多选 -->
                <n-space>
                  <div
                    class="DuoXuanBox"
                    v-for="item4 in item2.ruleData.checkboxOptions"
                    @click="item4.startUp = !item4.startUp"
                    :class="{ isStart: item4.startUp }"
                  >
                    {{ item4.label }}
                  </div>
                </n-space>
              </div>
              <div v-else>
                <!-- 开始-结束 时间框 -->
                <n-space>
                  <n-time-picker
                    size="small"
                    style="width: 110px"
                    placeholder="开始时间"
                    v-model:formatted-value="item2.ruleData.startTimer"
                  />
                  <n-time-picker
                    size="small"
                    style="width: 110px"
                    placeholder="结束时间"
                    v-model:formatted-value="item2.ruleData.endTimer"
                  />
                </n-space>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div id="paginationBox">
      <n-pagination
        v-model:page="page"
        :page-count="AllPage"
        @update:page="paginationChange"
        style="float: right; padding-right: 50px"
      />
    </div>
  </div>
</template>
<script>
import { defineComponent, ref, reactive, onMounted } from "vue";
export default defineComponent({
  name: "reminderSettings",
  setup() {
    let reminderData = reactive([]);
    //获取所有数据
    async function getData() {
      let res = await getReminderSettingsData();
      if (res.code == 200) {
        reminderData.push(...res.data.data);
      }
    }
    let page = ref(1);
    function paginationChange() {
      console.log(`分页发生了改变,当前值为    ${page.value}`);
    }
    onMounted(() => {
      getData();
    });
    return {
      selectedValue1: ref(null),
      selectedValue2: ref("0"),
      selectedValue3: ref("0"),
      options: [
        {
          label: "全部",
          value: "0",
        },
        {
          label: "工单维修提醒配置",
          value: "1",
        },
        {
          label: "运维巡查提醒提置",
          value: "2",
        },
        {
          label: "应急指挥提醒",
          value: "3",
        },
        {
          label: "设备故障提醒",
          value: "4",
        },
        {
          label: "事件报警提醒",
          value: "5",
        },
        {
          label: "事件报警提醒",
          value: "6",
        },
      ],
      songs: [
        {
          value: "0",
          label: "今天",
        },
        {
          value: "1",
          label: "近30天",
        },
        {
          value: "2",
          label: "近6个月",
        },
        {
          value: "3",
          label: "近一年",
        },
        {
          value: "4",
          label: "近三年",
        },
      ],
      reminderData,
      page,
      AllPage: ref(10),
      paginationChange,
      getData,
    };
  },
  computed: {},
  methods: {},
});
</script>
<style lang="less" scoped>
#reminderSettings {
  width: 100%;
  height: 100%;
}
#searchBox {
  width: 100%;
  height: 40px;
  //   background: yellowgreen;
}
#cententBox {
  width: 100%;
  height: calc(100% - 100px);
  margin-top: 20px;
  //   background: #dbdee4;
}
#paginationBox {
  width: 100%;
  height: 30px;
  list-style: 30px;
  margin-top: 10px;
}
.reminderBox {
  width: calc(33.33% - 20px);
  height: calc(50% - 20px);
  float: left;
  margin: 10px;
  //   background: #dbdee4;
  box-shadow: 0px 0px 20px #6a9590;
  border-radius: 5px;

  .reminderTitle {
    height: 50px;
    width: 100%;
    line-height: 50px;
    box-sizing: border-box;
    padding-left: 50px;
    font-size: 18px;
    font-family: Alibaba PuHuiTi;
    font-weight: bold;
  }
  .reminderTableHeader {
    height: 50px;
    width: 100%;
    line-height: 50px;
    .rheader1 {
      float: left;
      width: 30px;
      height: 50px;
      line-height: 50px;
      text-align: center;
    }
    .rheader2 {
      float: left;
      height: 50px;
      line-height: 50px;
      width: 50px;
      text-align: center;
    }
    .rheader3 {
      float: left;
      height: 50px;
      line-height: 50px;
      width: 180px;
      text-align: left;
      box-sizing: border-box;
      padding-left: 40px;
    }
    .rheader4 {
      float: left;
      height: 50px;
      line-height: 50px;
      width: calc(100% - 260px);
      text-align: center;
    }
  }
  .reminderTableBody {
    width: 100%;
    height: calc(100% - 110px);
    overflow: auto;
  }
  .reminderTableList {
    width: 100%;
    height: 16.66%;
    // background: rgb(238, 230, 225);
    .rBody1 {
      float: left;
      width: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      text-align: center;
    }
    .rBody2 {
      float: left;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      width: 50px;
      text-align: center;
    }
    .rBody3 {
      float: left;
      display: flex;
      align-items: center;
      height: 100%;
      width: 180px;
      text-align: left;
      box-sizing: border-box;
      padding-left: 10px;
    }
    .rBody4 {
      float: left;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      width: calc(100% - 260px);
      text-align: center;

      .ruleFont {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        width: 110px;
      }
      .ruleunit {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
      }
      ::v-deep(.n-radio-group .n-radio-button) {
        padding-left: 8px;
        padding-right: 8px;
      }
      .DuoXuanBox {
        box-sizing: border-box;
        width: auto;
        height: auto;
        border: 1px solid;
        padding: 0px 6px;
        font-size: 12px;
        height: 28px;
        line-height: 28px;
        cursor: pointer;
      }
      .isStart {
        color: rgb(1, 204, 35);
      }
    }
  }
}
</style>