heyang 1 vuosi sitten
vanhempi
commit
5e08eb33f2

+ 19 - 0
components/dengrq-datetime-picker/customPickerView/index.css

@@ -0,0 +1,19 @@
+.picker-view {
+  height: 356rpx;
+}
+
+.picker-view-column {
+  font-size: 14px;
+  line-height: 34px;
+  text-align: center;
+  color: #333;
+}
+
+/* 覆盖默认样式,样式可以按需自己改 */
+.uni-picker-view-indicator {
+  background-color: rgba(106, 123, 255, 0.1);
+}
+.uni-picker-view-indicator::before,
+.uni-picker-view-indicator::after {
+  content: none;
+}

+ 53 - 0
components/dengrq-datetime-picker/customPickerView/index.js

@@ -0,0 +1,53 @@
+export default {
+  data() {
+    return {};
+  },
+  props: {
+    // 所有列选项数据
+    columns: {
+      type: Array,
+      default: () => []
+    },
+    // 每一列默认选中值数组,不传默认选中第一项
+    selectVals: {
+      type: Array,
+      default: () => []
+    }
+  },
+  computed: {
+    // 每一列选中项的索引,当默认选中值变化的时候这个值也要变化
+    indexArr: {
+      // 多维数组,深度监听
+      cache: false,
+      get() {
+        if (this.selectVals.length > 0) {
+          return this.columns.map((col, cIdx) => {
+            return col.findIndex((i) => i == this.selectVals[cIdx]);
+          });
+        } else {
+          return [].fill(0, 0, this.columns.length);
+        }
+      }
+    }
+  },
+  methods: {
+    onChange(e) {
+      const { value } = e.detail;
+
+      let ret = this.columns.map((item, index) => {
+        let idx = value[index];
+        if (idx < 0) {
+          idx = 0;
+        }
+        if (idx > item.length - 1) {
+          idx = item.length - 1;
+        }
+        return item[idx];
+      });
+
+      this.$emit('onChange', {
+        value: ret
+      });
+    }
+  }
+};

+ 11 - 0
components/dengrq-datetime-picker/customPickerView/index.vue

@@ -0,0 +1,11 @@
+<template>
+  <picker-view class="picker-view" :value="indexArr" @change="onChange">
+    <picker-view-column class="picker-view-column" v-for="(col, colIdx) in columns" :key="colIdx">
+      <view v-for="(item, idx) in col" :key="idx">{{ item }}</view>
+    </picker-view-column>
+  </picker-view>
+</template>
+
+<script src="./index.js"></script>
+
+<style lang="css" scoped src="./index.css"></style>

+ 57 - 0
components/dengrq-datetime-picker/dateSelector/index.css

@@ -0,0 +1,57 @@
+.date-selector {
+  width: 100%;
+  font-size: 12px;
+  color: #333;
+}
+
+.select-date-wrapper {
+  margin-bottom: 8px;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.select-date {
+  padding: 10px;
+  flex: 1;
+  border-radius: 2px;
+  border: 1px solid rgba(6, 7, 46, 0.05);
+  font-size: 12px;
+}
+
+.select-date.active {
+  border-color: #6a7bff;
+}
+
+.select-date-placeholder {
+  color: rgba(6, 7, 46, 0.3);
+}
+
+.btn-group {
+  display: flex;
+  margin: 48rpx 0;
+  justify-content: space-between;
+}
+
+.btn-confirm {
+  width: 180px;
+  height: 40px;
+  line-height: 40px;
+  background: rgba(33, 58, 255, 0.85);
+  border-radius: 4px;
+  font-size: 14px;
+  color: #fff;
+  text-align: center;
+}
+
+.btn-cancel {
+  width: 144px;
+  height: 40px;
+  line-height: 38px;
+  text-align: center;
+  background: #fff;
+  border-radius: 4px;
+  border: 1px solid #979797;
+  font-size: 14px;
+  color: #06072e;
+}

+ 209 - 0
components/dengrq-datetime-picker/dateSelector/index.js

@@ -0,0 +1,209 @@
+import DateTimePicker from '../dateTimePicker/index.vue';
+import DateUtil from '../dateTimePicker/dateUtil';
+import { DATE_TYPES } from '../dateTimePicker/constant';
+
+export default {
+  components: {
+    DateTimePicker
+  },
+  data() {
+    return {
+      showStartDatePicker: false,
+      showEndDatePicker: false,
+      startDate: '',
+      endDate: '',
+      activeDate: 'startDate' // 正在处理哪一个日期值,startDate/endDate
+    };
+  },
+  props: {
+    // 日期筛选模式,1:年月日(默认),2:年月,3:年,4:年月日时分秒,5:时分秒,6:时分
+    mode: {
+      type: Number,
+      default: DATE_TYPES.YMD
+    },
+    // 默认开始日期
+    defaultStartDate: {
+      type: String,
+      default: ''
+    },
+    // 默认结束日期
+    defaultEndDate: {
+      type: String,
+      default: ''
+    },
+    // 可选的最小日期
+    minDate: {
+      type: String,
+      default: ''
+    },
+    // 可选的最大日期
+    maxDate: {
+      type: String,
+      default: ''
+    }
+  },
+  watch: {
+    mode() {
+      // 筛选模式更换时清空一下数据
+      this.resetData();
+    },
+    startDate() {
+      this.$emit('onChange', {
+        startDate: this.startDate,
+        endDate: this.endDate
+      });
+    },
+    endDate() {
+      this.$emit('onChange', {
+        startDate: this.startDate,
+        endDate: this.endDate
+      });
+    },
+    defaultStartDate: {
+      handler(defaultStartDate) {
+        if (!defaultStartDate) {
+          return;
+        }
+
+        if (this.mode == DATE_TYPES.HMS || this.mode == DATE_TYPES.HM) {
+          console.error('时分秒/时分模式不支持设置默认开始时间');
+          return;
+        }
+
+        if (DateUtil.isBefore(defaultStartDate, this.minDate)) {
+          console.warn(
+            `默认开始日期不可小于最小可选日期,已把默认开始日期设为最小可选日期。默认开始日期:${defaultStartDate},最小可选日期:${this.minDate}`
+          );
+          this.startDate = this.getModeFormatDateString(this.minDate);
+        } else {
+          this.startDate = this.getModeFormatDateString(defaultStartDate);
+        }
+      },
+      immediate: true
+    },
+    defaultEndDate: {
+      handler(defaultEndDate) {
+        if (!defaultEndDate) {
+          return;
+        }
+
+        if (this.mode == DATE_TYPES.HMS || this.mode == DATE_TYPES.HM) {
+          console.error('时分秒/时分模式不支持设置默认结束时间');
+          return;
+        }
+
+        if (DateUtil.isAfter(defaultEndDate, this.maxDate)) {
+          console.warn(
+            `默认结束日期不可大于最大可选日期,已把默认结束日期设为最大可选日期。默认结束日期:${defaultEndDate},最大可选日期:${this.maxDate}`
+          );
+          this.endDate = this.getModeFormatDateString(this.maxDate);
+        } else {
+          this.endDate = this.getModeFormatDateString(defaultEndDate);
+        }
+      },
+      immediate: true
+    },
+    minDate(val) {
+      if ((val && this.mode == DATE_TYPES.HMS) || this.mode == DATE_TYPES.HM) {
+        console.error('时分秒/时分模式不支持设置最小可选时间');
+        return;
+      }
+    },
+    maxDate(val) {
+      if ((val && this.mode == DATE_TYPES.HMS) || this.mode == DATE_TYPES.HM) {
+        console.error('时分秒/时分模式不支持设置最大可选时间');
+        return;
+      }
+    }
+  },
+  methods: {
+    onTapStartDate() {
+      this.showEndDatePicker = false;
+      if (!this.startDate) {
+        this.startDate = this.getModeFormatDateString(new Date());
+      }
+      this.activeDate = 'startDate';
+      this.showStartDatePicker = true;
+    },
+    onTapEndDate() {
+      this.showStartDatePicker = false;
+      if (!this.endDate) {
+        this.endDate = this.startDate;
+      }
+      this.activeDate = 'endDate';
+      this.showEndDatePicker = true;
+    },
+    onChangeStartDate(date) {
+      this.startDate = date;
+    },
+    onChangeEndDate(date) {
+      this.endDate = date;
+    },
+    validateInput() {
+      if (!this.startDate) {
+        uni.showToast({
+          title: '请选择开始时间',
+          icon: 'none'
+        });
+        return false;
+      } else if (!this.endDate) {
+        uni.showToast({
+          title: '请选择结束时间',
+          icon: 'none'
+        });
+        return false;
+      } else if (DateUtil.isAfter(this.startDate, this.endDate)) {
+        uni.showToast({
+          title: '结束时间不能小于开始时间',
+          icon: 'none'
+        });
+        return false;
+      }
+      return true;
+    },
+    onCancel() {
+      this.resetData();
+    },
+    onConfirm() {
+      if (this.validateInput()) {
+        this.$emit('onSubmit', {
+          startDate: this.startDate,
+          endDate: this.endDate
+        });
+        this.showStartDatePicker = false;
+        this.showEndDatePicker = false;
+      }
+    },
+    resetData() {
+      this.startDate = '';
+      this.endDate = '';
+      this.activeDate = 'startDate';
+      this.showStartDatePicker = false;
+      this.showEndDatePicker = false;
+    },
+    // 返回对应日期模式的时间字符串
+    getModeFormatDateString(date) {
+      let fmt = 'YYYY-MM-DD';
+      switch (this.mode) {
+        case DATE_TYPES.YM:
+          fmt = 'YYYY-MM';
+          break;
+        case DATE_TYPES.Y:
+          fmt = 'YYYY';
+          break;
+        case DATE_TYPES['YMD-HMS']:
+          fmt = 'YYYY-MM-DD HH:mm:ss';
+          break;
+        case DATE_TYPES.HMS:
+          fmt = 'HH:mm:ss';
+          break;
+        case DATE_TYPES.HM:
+          fmt = 'HH:mm';
+          break;
+        default:
+          break;
+      }
+      return DateUtil.formatDate(date, fmt);
+    }
+  }
+};

+ 41 - 0
components/dengrq-datetime-picker/dateSelector/index.vue

@@ -0,0 +1,41 @@
+<template>
+  <view class="date-selector">
+    <view class="select-date-wrapper">
+      <view class="select-date" :class="{ active: activeDate == 'startDate' }" @tap="onTapStartDate">
+        <view class="select-date-value" v-if="startDate">{{ startDate }}</view>
+        <view class="select-date-placeholder" v-else>请选择时间</view>
+      </view>
+      <view style="margin: 0 16px">至</view>
+      <view class="select-date" :class="{ active: activeDate == 'endDate' }" @tap="onTapEndDate">
+        <view class="select-date-value" v-if="endDate">{{ endDate }}</view>
+        <view class="select-date-placeholder" v-else>请选择时间</view>
+      </view>
+    </view>
+
+    <DateTimePicker
+      v-if="showStartDatePicker"
+      @onChange="onChangeStartDate"
+      :defaultDate="startDate"
+      :minDate="minDate || ''"
+      :maxDate="endDate || maxDate || ''"
+      :mode="mode"
+    />
+    <DateTimePicker
+      v-if="showEndDatePicker"
+      @onChange="onChangeEndDate"
+      :defaultDate="endDate"
+      :minDate="startDate || minDate || ''"
+      :maxDate="maxDate || ''"
+      :mode="mode"
+    />
+
+    <view class="btn-group" v-if="showStartDatePicker || showEndDatePicker">
+      <view class="btn-cancel" @tap="onCancel">取消</view>
+      <view class="btn-confirm" @tap="onConfirm">确定</view>
+    </view>
+  </view>
+</template>
+
+<script src="./index.js"></script>
+
+<style lang="css" scoped src="./index.css"></style>

+ 15 - 0
components/dengrq-datetime-picker/dateTimePicker/constant.js

@@ -0,0 +1,15 @@
+// 日期模式
+export const DATE_TYPES = {
+  // 年月日
+  YMD: 1,
+  // 年月
+  YM: 2,
+  // 年份
+  Y: 3,
+  // 年月日时分秒
+  'YMD-HMS': 4,
+  // 时分秒
+  HMS: 5,
+  // 时分
+  HM: 6
+};

+ 93 - 0
components/dengrq-datetime-picker/dateTimePicker/dateUtil.js

@@ -0,0 +1,93 @@
+/**
+ * 日期时间格式化
+ * @param {Date} date 要格式化的日期对象
+ * @param {String} fmt 格式化字符串,eg:YYYY-MM-DD HH:mm:ss
+ * @returns 格式化后的日期字符串
+ */
+function formatDate(date, fmt) {
+  if (typeof date == 'string') {
+    date = new Date(handleDateStr(date));
+  }
+
+  const o = {
+    'M+': date.getMonth() + 1, // 月份
+    'd+': date.getDate(), // 日
+    'D+': date.getDate(), // 日
+    'H+': date.getHours(), // 小时
+    'h+': date.getHours(), // 小时
+    'm+': date.getMinutes(), // 分
+    's+': date.getSeconds(), // 秒
+    'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
+    S: date.getMilliseconds() // 毫秒
+  };
+
+  if (/([y|Y]+)/.test(fmt)) {
+    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').slice(4 - RegExp.$1.length));
+  }
+
+  for (const k in o) {
+    if (new RegExp('(' + k + ')').test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).slice(('' + o[k]).length));
+    }
+  }
+
+  return fmt;
+}
+
+/**
+ * 处理时间字符串,兼容ios下new Date()返回NaN问题
+ * @param {*} dateStr 日期字符串
+ * @returns
+ */
+function handleDateStr(dateStr) {
+  return dateStr.replace(/\-/g, '/');
+}
+
+/**
+ * 判断日期1是否在日期2之前,即日期1小于日期2
+ * @param {Date} date1
+ * @param {Date} date2
+ * @returns
+ */
+function isBefore(date1, date2) {
+  if (typeof date1 == 'string') {
+    date1 = new Date(handleDateStr(date1));
+  }
+  if (typeof date2 == 'string') {
+    date2 = new Date(handleDateStr(date2));
+  }
+  return date1.getTime() < date2.getTime();
+}
+
+/**
+ * 判断日期1是否在日期2之后,即日期1大于日期2
+ * @param {Date} date1
+ * @param {Date} date2
+ * @returns
+ */
+function isAfter(date1, date2) {
+  if (typeof date1 == 'string') {
+    date1 = new Date(handleDateStr(date1));
+  }
+  if (typeof date2 == 'string') {
+    date2 = new Date(handleDateStr(date2));
+  }
+  return date1.getTime() > date2.getTime();
+}
+
+/**
+ * 检查传入的字符串是否能转换为有效的Date对象
+ * @param {String} date
+ * @returns {Boolean}
+ */
+function isValid(date) {
+  return new Date(date) !== 'Invalid Date' && !isNaN(new Date(date));
+}
+
+export default {
+  formatDate,
+  handleDateStr,
+  isBefore,
+  isAfter,
+  isValid
+};

+ 378 - 0
components/dengrq-datetime-picker/dateTimePicker/index.js

@@ -0,0 +1,378 @@
+import CustomPickerView from '../customPickerView/index.vue';
+import DateUtil from '../dateTimePicker/dateUtil';
+import { DATE_TYPES } from './constant';
+
+export default {
+  components: {
+    CustomPickerView
+  },
+  props: {
+    // 日期模式,1:年月日(默认),2:年月,3:年份,4:年月日时分秒,5:时分秒,6:时分
+    mode: {
+      type: Number,
+      default: DATE_TYPES.YMD
+    },
+    // 可选的最小日期,默认十年前
+    minDate: {
+      type: String,
+      default: ''
+    },
+    // 可选的最大日期,默认十年后
+    maxDate: {
+      type: String,
+      default: ''
+    },
+    // 默认选中日期(注意要跟日期模式对应)
+    defaultDate: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      selectYear: new Date().getFullYear(),
+      selectMonth: new Date().getMonth() + 1, // 选中的月份,1~12
+      selectDay: new Date().getDate(),
+      selectHour: new Date().getHours(),
+      selectMinute: new Date().getMinutes(),
+      selectSecond: new Date().getSeconds()
+    };
+  },
+  watch: {
+    defaultDate: {
+      immediate: true,
+      handler(val) {
+        if (val) {
+          if (this.mode == DATE_TYPES.YM && val.replace(/\-/g, '/').split('/').length == 2) {
+            // 日期模式为年月时有可能传进来的defaultDate是2022-02这样的格式,在ios下new Date会报错,加上日期部分做兼容
+            val += '-01';
+          } else if (this.mode == DATE_TYPES.HMS || this.mode == DATE_TYPES.HM) {
+            // 只有时分秒或者只有时分是不能调用new Date生成Date对象的,先加上一个假设的年月日(就取当年一月一日)来兼容
+            const now = new Date();
+            val = `${now.getFullYear()}-01-01 ${val}`;
+          }
+
+          let date = new Date(DateUtil.handleDateStr(val));
+          this.selectYear = date.getFullYear();
+          this.selectMonth = date.getMonth() + 1;
+          this.selectDay = date.getDate();
+          this.selectHour = date.getHours();
+          this.selectMinute = date.getMinutes();
+          this.selectSecond = date.getSeconds();
+        }
+      }
+    }
+  },
+  computed: {
+    minDateObj() {
+      let minDate = this.minDate;
+      if (minDate) {
+        if (this.mode == DATE_TYPES.YM && minDate.replace(/\-/g, '/').split('/').length == 2) {
+          // 日期模式为年月时有可能传进来的minDate是2022-02这样的格式,在ios下new Date会报错,加上日期部分做兼容
+          minDate += '-01';
+        } else if (this.mode == DATE_TYPES.HMS || this.mode == DATE_TYPES.HM) {
+          // 只有时分秒或者只有时分是不能调用new Date生成Date对象的,先加上一个假设的年月日(就取当年一月一日)来兼容
+          const now = new Date();
+          minDate = `${now.getFullYear()}-01-01 ${minDate}`;
+        }
+        return new Date(DateUtil.handleDateStr(minDate));
+      } else {
+        // 没有传最小日期,默认十年前
+        let year = new Date().getFullYear() - 10;
+        minDate = new Date(year, 0, 1);
+        return minDate;
+      }
+    },
+    maxDateObj() {
+      let maxDate = this.maxDate;
+      if (maxDate) {
+        if (this.mode == DATE_TYPES.YM && maxDate.replace(/\-/g, '/').split('/').length == 2) {
+          // 日期模式为年月时有可能传进来的maxDate是2022-02这样的格式,在ios下new Date会报错,加上日期部分做兼容
+          maxDate += '-01';
+        } else if (this.mode == DATE_TYPES.HMS || this.mode == DATE_TYPES.HM) {
+          // 只有时分秒或者只有时分是不能调用new Date生成Date对象的,先加上一个假设的年月日(就取当年一月一日)来兼容
+          const now = new Date();
+          maxDate = `${now.getFullYear()}-01-01 ${maxDate}`;
+        }
+        return new Date(DateUtil.handleDateStr(maxDate));
+      } else {
+        // 没有传最大日期,默认十年后
+        let year = new Date().getFullYear() + 10;
+        maxDate = new Date(year, 11, 31);
+        return maxDate;
+      }
+    },
+    years() {
+      let years = [];
+      let minYear = this.minDateObj.getFullYear();
+      let maxYear = this.maxDateObj.getFullYear();
+      for (let i = minYear; i <= maxYear; i++) {
+        years.push(i);
+      }
+
+      return years;
+    },
+    months() {
+      let months = [];
+      let minMonth = 1;
+      let maxMonth = 12;
+
+      // 如果选中的年份刚好是最小可选日期的年份,那月份就要从最小日期的月份开始
+      if (this.selectYear == this.minDateObj.getFullYear()) {
+        minMonth = this.minDateObj.getMonth() + 1;
+      }
+      // 如果选中的年份刚好是最大可选日期的年份,那月份就要在最大日期的月份结束
+      if (this.selectYear == this.maxDateObj.getFullYear()) {
+        maxMonth = this.maxDateObj.getMonth() + 1;
+      }
+
+      for (let i = minMonth; i <= maxMonth; i++) {
+        months.push(i);
+      }
+
+      return months;
+    },
+    days() {
+      // 一年中12个月每个月的天数
+      let monthDaysConfig = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+      // 闰年2月有29天
+      if (this.selectMonth == 2 && this.selectYear % 4 == 0) {
+        monthDaysConfig[1] = 29;
+      }
+
+      let minDay = 1;
+      let maxDay = monthDaysConfig[this.selectMonth - 1];
+
+      if (this.selectYear == this.minDateObj.getFullYear() && this.selectMonth == this.minDateObj.getMonth() + 1) {
+        minDay = this.minDateObj.getDate();
+      }
+      if (this.selectYear == this.maxDateObj.getFullYear() && this.selectMonth == this.maxDateObj.getMonth() + 1) {
+        maxDay = this.maxDateObj.getDate();
+      }
+
+      let days = [];
+      for (let i = minDay; i <= maxDay; i++) {
+        days.push(i);
+      }
+
+      return days;
+    },
+    hours() {
+      let hours = [];
+      let minHour = 0;
+      let maxHour = 23;
+
+      if (
+        this.selectYear == this.minDateObj.getFullYear() &&
+        this.selectMonth == this.minDateObj.getMonth() + 1 &&
+        this.selectDay == this.minDateObj.getDate()
+      ) {
+        minHour = this.minDateObj.getHours();
+      }
+      if (
+        this.selectYear == this.maxDateObj.getFullYear() &&
+        this.selectMonth == this.maxDateObj.getMonth() + 1 &&
+        this.selectDay == this.maxDateObj.getDate()
+      ) {
+        maxHour = this.maxDateObj.getHours();
+      }
+
+      for (let i = minHour; i <= maxHour; i++) {
+        hours.push(i);
+      }
+
+      return hours;
+    },
+    minutes() {
+      let mins = [];
+      let minMin = 0;
+      let maxMin = 59;
+
+      if (
+        this.selectYear == this.minDateObj.getFullYear() &&
+        this.selectMonth == this.minDateObj.getMonth() + 1 &&
+        this.selectDay == this.minDateObj.getDate() &&
+        this.selectHour == this.minDateObj.getHours()
+      ) {
+        minMin = this.minDateObj.getMinutes();
+      }
+      if (
+        this.selectYear == this.maxDateObj.getFullYear() &&
+        this.selectMonth == this.maxDateObj.getMonth() + 1 &&
+        this.selectDay == this.maxDateObj.getDate() &&
+        this.selectHour == this.maxDateObj.getHours()
+      ) {
+        maxMin = this.maxDateObj.getMinutes();
+      }
+
+      for (let i = minMin; i <= maxMin; i++) {
+        mins.push(i);
+      }
+
+      return mins;
+    },
+    seconds() {
+      let seconds = [];
+      let minSecond = 0;
+      let maxSecond = 59;
+
+      if (
+        this.selectYear == this.minDateObj.getFullYear() &&
+        this.selectMonth == this.minDateObj.getMonth() + 1 &&
+        this.selectDay == this.minDateObj.getDate() &&
+        this.selectHour == this.minDateObj.getHours() &&
+        this.selectMinute == this.minDateObj.getMinutes()
+      ) {
+        minSecond = this.minDateObj.getSeconds();
+      }
+      if (
+        this.selectYear == this.maxDateObj.getFullYear() &&
+        this.selectMonth == this.maxDateObj.getMonth() + 1 &&
+        this.selectDay == this.maxDateObj.getDate() &&
+        this.selectHour == this.maxDateObj.getHours() &&
+        this.selectMinute == this.maxDateObj.getMinutes()
+      ) {
+        maxSecond = this.maxDateObj.getSeconds();
+      }
+
+      for (let i = minSecond; i <= maxSecond; i++) {
+        seconds.push(i);
+      }
+
+      return seconds;
+    },
+    // 传给pickerView组件的数组,根据mode来生成不同的数据
+    dateConfig() {
+      let years = this.years.map((y) => y + '年');
+      let months = this.months.map((m) => m + '月');
+      let days = this.days.map((d) => d + '日');
+      let hours = this.hours.map((h) => h + '时');
+      let minutes = this.minutes.map((m) => m + '分');
+      let seconds = this.seconds.map((s) => s + '秒');
+
+      let ret = [];
+      switch (this.mode) {
+        case DATE_TYPES.YM:
+          ret = [years, months];
+          break;
+        case DATE_TYPES.Y:
+          ret = [years];
+          break;
+        case DATE_TYPES['YMD-HMS']:
+          ret = [years, months, days, hours, minutes, seconds];
+          break;
+        case DATE_TYPES.HMS:
+          ret = [hours, minutes, seconds];
+          break;
+        case DATE_TYPES.HM:
+          ret = [hours, minutes];
+          break;
+        default:
+          ret = [years, months, days];
+          break;
+      }
+
+      return ret;
+    },
+    selectVals() {
+      let ret = [];
+      switch (this.mode) {
+        case DATE_TYPES.YM:
+          ret = [this.selectYear + '年', this.selectMonth + '月'];
+          break;
+        case DATE_TYPES.Y:
+          ret = [this.selectYear + '年'];
+          break;
+        case DATE_TYPES['YMD-HMS']:
+          ret = [
+            this.selectYear + '年',
+            this.selectMonth + '月',
+            this.selectDay + '日',
+            this.selectHour + '时',
+            this.selectMinute + '分',
+            this.selectSecond + '秒'
+          ];
+          break;
+        case DATE_TYPES.HMS:
+          ret = [this.selectHour + '时', this.selectMinute + '分', this.selectSecond + '秒'];
+          break;
+        case DATE_TYPES.HM:
+          ret = [this.selectHour + '时', this.selectMinute + '分'];
+          break;
+        default:
+          ret = [this.selectYear + '年', this.selectMonth + '月', this.selectDay + '日'];
+          break;
+      }
+      return ret;
+    }
+  },
+  methods: {
+    onChangePickerValue(e) {
+      const { value } = e;
+
+      if (this.mode == DATE_TYPES.YM && value[0] && value[1]) {
+        // 年月模式
+        this.selectYear = Number(value[0].replace('年', ''));
+        this.selectMonth = Number(value[1].replace('月', ''));
+      } else if (this.mode == DATE_TYPES.Y && value[0]) {
+        // 只有年份模式
+        this.selectYear = Number(value[0].replace('年', ''));
+      } else if (this.mode == DATE_TYPES['YMD-HMS'] && value[0] && value[1] && value[2] != '' && value[3] && value[4] && value[5]) {
+        // 年月日时分秒模式
+        this.selectYear = Number(value[0].replace('年', ''));
+        this.selectMonth = Number(value[1].replace('月', ''));
+        this.selectDay = Number(value[2].replace('日', ''));
+        this.selectHour = Number(value[3].replace('时', ''));
+        this.selectMinute = Number(value[4].replace('分', ''));
+        this.selectSecond = Number(value[5].replace('秒', ''));
+      } else if (this.mode == DATE_TYPES.HMS && value[0] && value[1] && value[2]) {
+        // 时分秒模式
+        this.selectHour = Number(value[0].replace('时', ''));
+        this.selectMinute = Number(value[1].replace('分', ''));
+        this.selectSecond = Number(value[2].replace('秒', ''));
+      } else if (this.mode == DATE_TYPES.HM && value[0] && value[1]) {
+        // 时分模式
+        this.selectHour = Number(value[0].replace('时', ''));
+        this.selectMinute = Number(value[1].replace('分', ''));
+      } else if (value[0] && value[1] && value[2]) {
+        // 默认,年月日模式
+        this.selectYear = Number(value[0].replace('年', ''));
+        this.selectMonth = Number(value[1].replace('月', ''));
+        this.selectDay = Number(value[2].replace('日', ''));
+      } else {
+        // 其他情况可能是pickerView返回的数据有问题,不处理
+        console.log('onChangePickerValue其他情况');
+        return;
+      }
+
+      let formatTmpl = 'YYYY-MM-DD';
+      switch (this.mode) {
+        case DATE_TYPES.YM:
+          formatTmpl = 'YYYY-MM';
+          break;
+        case DATE_TYPES.Y:
+          formatTmpl = 'YYYY';
+          break;
+        case DATE_TYPES['YMD-HMS']:
+          formatTmpl = 'YYYY-MM-DD HH:mm';
+          break;
+        case DATE_TYPES.HMS:
+          formatTmpl = 'HH:mm:ss';
+          break;
+        case DATE_TYPES.HM:
+          formatTmpl = 'HH:mm';
+          break;
+        default:
+          break;
+      }
+
+      this.$emit(
+        'onChange',
+        DateUtil.formatDate(
+          new Date(`${this.selectYear}/${this.selectMonth}/${this.selectDay} ${this.selectHour}:${this.selectMinute}:${this.selectSecond}`),
+          formatTmpl
+        )
+      );
+    }
+  }
+};

+ 9 - 0
components/dengrq-datetime-picker/dateTimePicker/index.vue

@@ -0,0 +1,9 @@
+<template>
+  <view class="datetime-picker">
+    <CustomPickerView :columns="dateConfig" :selectVals="selectVals" @onChange="onChangePickerValue" />
+  </view>
+</template>
+
+<script src="./index.js"></script>
+
+<style scoped lang="css"></style>

+ 137 - 0
pages/saoCode/scan.vue

@@ -0,0 +1,137 @@
+<!-- 扫一扫 -->
+<template>
+	<view>
+		<view class="scanCode_box">
+			<view class="title">请扫描设备二维码</view>
+			<camera class='camera' mode="scanCode" @error="cameraError" @scancode='scancode'
+				frame-size='large'>
+				<cover-view class='animation' :animation="animation"></cover-view>
+			</camera>
+			<view @click="manualFun()" class="manual">手动选择设备</view>
+		</view>
+	</view>
+</template>
+<script>
+	let animation = uni.createAnimation({});
+	
+	export default {
+		data() {
+			return {
+				animation,
+				form:{},
+			}
+		},
+		onLoad(option) {
+			if(option.form){
+				this.form=JSON.parse(decodeURIComponent(option.form));
+			}
+		},
+		onShow() {
+			this.donghua()
+		},
+		methods: {
+			donghua() {
+				let that = this;
+				let scode = true
+				setInterval(function() {
+					if (scode) {
+						animation.translateY(250).step({
+							duration: 3000
+						})
+						scode = !scode;
+					} else {
+						animation.translateY(-10).step({
+							duration: 3000
+						})
+						scode = !scode;
+					}
+						that.animation = animation.export()
+					
+				}.bind(this), 3000)
+			},
+			//手动选择设备
+			manualFun(){
+				uni.redirectTo({
+				    url: '/pages_safetyExamine/examineManage/examineAddContent?form='+encodeURIComponent(JSON.stringify(this.form))+'&pageType=3'
+				});
+			},
+			scancode(e){
+				let self=this;
+			    // 扫描结果
+				let text = decodeURIComponent(e.detail.result)
+				let list = text.split("?")[1].split("&");
+				for(let i=0;i<list.length;i++){
+				    let newList = list[i].split("=");
+				    if(newList[0] == 'code'){
+				        self.code = newList[1];
+				    }else if(newList[0] == 'type'){
+				        self.type = newList[1];
+				    }
+				}
+				let joinHazardIds=[];
+				if(this.form.hazardIds){
+					joinHazardIds=this.form.hazardIds.split(',')
+					joinHazardIds.push(self.code)
+					this.form.joinHazardIds=joinHazardIds
+				}else{
+					this.form.joinHazardIds=self.code
+				}
+				uni.navigateTo({
+					url: '/pages_safetyExamine/examineManage/examineAddTow?form='+encodeURIComponent(JSON.stringify(this.form))+'&joinHazardIds='+self.code
+				});
+			  }
+		}
+	
+	}
+</script>
+<style>
+	.scanCode_box {
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+		background-color: #000000;
+		position: fixed;
+		align-items: center;
+	}
+	.title{
+		font-size: 34rpx;
+		font-family: PingFang SC-Medium, PingFang SC;
+		font-weight: 400;
+		color: #FFFFFF;
+		line-height: 48rpx;
+		margin-top: 256rpx;
+		text-align: center;
+	}
+	.camera {
+		width: 433rpx;
+		height: 434rpx;
+		border-radius: 6rpx;
+		margin: 30rpx;
+		overflow: hidden;
+	}
+	.animation {
+		position: absolute;
+		top: 10rpx;
+		left: 0rpx;
+		width: 430rpx;
+		height: 2rpx;
+		background-color: #4CD964;
+		border-radius: 50%;
+	}
+	.manual{
+		width: 300rpx;
+		height: 100rpx;
+		background: #0183FA;
+		border-radius: 60rpx 60rpx 60rpx 60rpx;
+		font-size: 34rpx;
+		font-family: PingFang SC-Medium, PingFang SC;
+		font-weight: 400;
+		color: #FFFFFF;
+		line-height: 100rpx;
+		text-align: center;
+		position: fixed;
+		bottom: 76rpx;
+		left: 226rpx;
+	}
+</style>

+ 312 - 0
pages_safetyExamine/examineManage/examineAddContent.vue

@@ -0,0 +1,312 @@
+<!-- 安全检查-发起巡查计划-选择内容 -->
+<template>
+  <view class="examine">
+	  <view class="lab_title">
+		<view class="lab_title_r">
+			<view class="lab_title_r_btn" @click="searchBtn">
+				<img src="@/pages_safetyExamine/images/icon_aqjc_ss.png"/>
+			</view>
+			<input type="text" v-model="getData.searchValue" placeholder="设备名称/型号" maxlength="50" placeholder-style="color: #CCCCCC;font-size:26rpx;">
+			<img class="scanBtn"  @click="scanBtn" src="@/pages_safetyExamine/images/icon_aqjc_sm.png"/>
+		</view>
+	  </view>
+	<scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
+		<view>
+			<view class="list">
+				<view class="list_li" v-for="(item,index) in  dataList" :key="index" @click="labSelete(index)">
+					<text :class="item.type?'color_B':'color_A'">{{item.chName}}</text>
+					<img v-if="item.type" src="@/pages_safetyExamine/images/icon_xzwt_xz.png">
+				</view>
+			</view>
+		</view>
+	</scroll-view>
+	<div class="bottom">
+		<view class="bottom_l" @click="clearForm">取消</view>
+		<view class="bottom_r" @click="submitForm">确定</view>
+	</div>
+  </view>
+
+</template>
+
+<script>
+import { config } from '@/api/request/config.js'
+import {conditionCollegeInfo,conditionSubjectInfo,findDeviceList,haveHazardInSub,getHazardInfoBySubId} from '@/api/index.js'
+export default {
+  name: "rectifyList",
+  components: {
+
+  },
+  data() {
+    return {
+	  pageType:0,
+      //列表请求参数
+      getData:{
+        pageNum:1,
+        pageSize:200,
+		searchValue:'',
+		subId:'',
+      },
+	  total:0,
+	  collegeIndex :0,
+	  collegeArray:[],
+	  collegeList:[],
+	  dataList:[],
+	  seleteListDevice:[],//临时存储选中的
+	  form:{},
+	}
+  },
+  onLoad(option) {
+	  if(option.form){
+		 this.form=JSON.parse(decodeURIComponent(option.form));
+	  }
+	  if(option.pageType){//pageType=1添加页面进入2编辑页面进入
+	  	 this.pageType=option.pageType
+	  }
+  },
+  onShow() {
+
+  },
+  mounted(){
+	  this.dataList=[];
+	  this.getList();
+  },
+  methods: {
+	  //滚动事件
+	  scrollGet(){
+		  // let self=this;
+	   //    if(self.total/self.getData.pageSize<=self.getData.pageNum){
+	   //        console.log('没有更多数据!')
+	   //    }else{
+			 //  setTimeout(function(){
+				//   self.getData.pageNum += 1;
+				//   self.getList();
+			 //  },1000)
+
+		  // }
+	  },
+	  //点击选择实验室
+	  labSelete(index){
+	  	this.dataList[index].type = !this.dataList[index].type
+
+		if(this.dataList[index].type){//判断是选中还是取消
+			if(this.seleteListDevice.length>0){
+				if(this.seleteListDevice.findIndex((item)=>item.joinHazardId===this.dataList[index].joinHazardId) ==-1){//等于-1说明数组里没有当前选中元素,可以添加
+					this.seleteListDevice.push(this.dataList[index])
+				}
+			}else{
+				this.seleteListDevice.push(this.dataList[index])
+			}
+		}else{
+			this.seleteListDevice.splice(this.seleteListDevice.indexOf(this.dataList[index]),1);
+		}
+	  },
+	  //实验室搜索
+	  searchBtn(){
+		  this.dataList=[];
+		  this.getList();
+	  },
+	  handleClick(doType){
+		  let self=this;
+		  if( doType=='subBtn'){//保存数据
+
+		  }
+	  },
+	  //扫码
+	  scanBtn(){
+		 uni.redirectTo({
+		 	url: '/pages/saoCode/scan?form='+encodeURIComponent(JSON.stringify(this.form))
+		 });
+	  },
+
+	  //取消
+	  clearForm(){
+		uni.navigateTo({
+			url: '/pages_safetyExamine/examineManage/examineAdd?form='+encodeURIComponent(JSON.stringify(this.form))
+		});
+	  },
+	  //设备-保存
+	  async submitForm(){
+	  	let _this = this;
+		let hazardIds=[];
+		let joinHazardIds=[];
+		//this.$set(this.form,'hazardNum', this.seleteListDevice.length)
+		//this.$set(this.form,'seleteListDevice', this.seleteListDevice)
+		if(this.seleteListDevice.length>0){
+			this.seleteListDevice.forEach(function(item){
+				hazardIds.push(item.hazardId)
+				joinHazardIds.push(item.joinHazardId)
+			})
+			this.$set(this.form,'hazardIds', hazardIds.join(','))
+			this.$set(this.form,'joinHazardIds', joinHazardIds.join(','))
+		}else{
+			this.$set(this.form,'hazardIds','')
+			this.$set(this.form,'joinHazardIds','')
+			uni.showToast({
+				title: '请选择检查内容!',
+				icon:"none",
+				mask:true,
+				duration: 2000
+			});
+			return
+		}
+
+		uni.navigateTo({
+			url: '/pages_safetyExamine/examineManage/examineAddTow?form='+encodeURIComponent(JSON.stringify(this.form))+'&joinHazardIds='+this.form.joinHazardIds
+		});
+
+
+	  },
+	  async getList(){
+	      let _this = this;
+		  this.getData.subId=this.form.subIds;
+	      const {data} = await getHazardInfoBySubId(this.getData);
+	      if(data.code==200){
+			  data.data.forEach(function(item){
+				  item.type=false;
+			  })
+			  this.dataList=[...this.dataList,...data.data]
+			  _this.total=data.total;
+			  if(this.form.joinHazardIds){
+				  let joinHazardIds=this.form.joinHazardIds.split(',')
+				 for( let i=0;i<this.dataList.length;i++){
+					 for( let b=0;b<joinHazardIds.length;b++){
+						if(this.dataList[i].joinHazardId==joinHazardIds[b]){
+							this.seleteListDevice.push(this.dataList[i]);
+							this.dataList[i].type=true;
+						}
+					 }
+				 }
+			  }
+		  }
+      }
+  }
+}
+</script>
+
+<style lang="stylus" scoped>
+.examine{
+	height:100%;
+	display flex;
+	.info-max-box{
+		flex: 1;
+		overflow: scroll;
+		padding: 120rpx 0rpx 100rpx;
+		box-sizing: border-box;
+	}
+	.lab_title{
+		width: 750rpx;
+		height: 100rpx;
+		background: #FFFFFF;
+		position: fixed;
+		top: 0;
+		padding: 10rpx 30rpx;
+		box-sizing: border-box;
+		display: flex;
+		justify-content: flex-start;
+		.lab_title_r{
+			width: 690rpx;
+			height: 80rpx;
+			position:relative;
+			border-radius: 10rpx;
+			border: 1rpx solid #E0E0E0;
+			.lab_title_r_btn{
+				width: 60rpx;
+				height: 80rpx
+				position: absolute;
+				top: 0rpx;
+				left:0rpx;
+				>img{
+					width: 26rpx;
+					height: 26rpx;
+					position: absolute;
+					top: 30rpx;
+					left: 24rpx;
+				}
+			}
+			>input{
+				width: 274rpx;
+				height: 80rpx;
+				position: absolute;
+				top: 0rpx;
+				left: 60rpx;
+			}
+			.scanBtn{
+				width: 30rpx;
+				height: 30rpx
+				position: absolute;
+				top: 26rpx;
+				right:26rpx;
+			}
+		}
+	}
+	.list{
+		background: #FFFFFF;
+		border-radius: 20rpx 20rpx 0rpx 0rpx;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		margin: 0 30rpx;
+		.list_li{
+			display: flex;
+			justify-content:space-between;
+			align-items: center;
+			height: 80rpx;
+			border-bottom: 1rpx solid #E0E0E0;
+			>text{
+				font-size: 28rpx;
+				font-family: PingFang SC-Medium, PingFang SC;
+				font-weight: 400;
+				line-height: 80rpx;
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+			}
+			>img{
+				width: 24rpx;
+				height: 16rpx;
+				margin-right: 14rpx;
+			}
+		}
+		.list_li:last-child{
+			border: none;
+		}
+		.color_A{
+			color: #333333;
+		}
+		.color_B{
+			color: #0183FA;
+		}
+	}
+	.bottom{
+		width: 750rpx;
+		height: 90rpx;
+		background: #FFFFFF;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		display: flex;
+		justify-content: flex-start;
+		.bottom_l{
+			font-size: 30rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 400;
+			color: #333333;
+			line-height: 90rpx;
+			width: 50%;
+			height: 90rpx;
+			background: #fff;
+			text-align: center;
+		}
+		.bottom_r{
+			font-size: 30rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 400;
+			color: #FFFFFF;
+			line-height: 90rpx;
+			width: 50%;
+			height: 90rpx;
+			background: #0183FA;
+			text-align: center;
+		}
+	}
+}
+</style>

BIN
pages_safetyExamine/images/clear.png


+ 369 - 0
pages_safetyExamine/patrolPlan/patrolPlanAddContent.vue

@@ -0,0 +1,369 @@
+<!-- 安全检查-发起巡查计划-选择内容 -->
+<template>
+  <view class="examine">
+	  <view class="lab_title">
+		<picker @change="collegeChange" :value="collegeIndex" :range="collegeArray" class="lab_title_l">
+			<view class="lab_title_l_n">
+				<view>{{getData.hazardTypeModeName?getData.hazardTypeModeName:'选择类型'}}</view>
+				<img src="@/pages_safetyExamine/images/icon_06.png">
+			</view>
+		</picker>
+		<view class="lab_title_r">
+			<input type="text" v-model="getData.searchValue" placeholder="请输入检查内容" name="search" @confirm='searchBtn'  confirm-type='search' maxlength="50" placeholder-style="color: #CCCCCC;font-size:26rpx;">
+			<view v-if="getData.searchValue>0" class="lab_title_r_btn" @click="clearBtn">
+				<img src="@/pages_safetyExamine/images/clear.png"/>
+			</view>
+		</view>
+	  </view>
+	<scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
+		<view>
+			<view class="list">
+				<view class="list_li" v-for="(item,index) in  dataList" :key="index" @click="labSelete(index)">
+					<text :class="item.type?'color_B':'color_A'">{{item.chName}}</text>
+					<img v-if="item.type" src="@/pages_safetyExamine/images/icon_xzwt_xz.png">
+				</view>
+			</view>
+		</view>
+	</scroll-view>	
+	<view class="bottom_btn" @click="submitForm">确定</view>
+  </view>
+
+</template>
+
+<script>
+import { config } from '@/api/request/config.js'
+import {conditionCollegeInfo,conditionSubjectInfo,dangerList,findDeviceList,haveHazardInSub} from '@/api/index.js'
+export default {
+  name: "rectifyList",
+  components: {
+   
+  },
+  data() {
+    return {
+	  pageType:0,
+      //列表请求参数
+      getData:{
+        pageNum:1,
+        pageSize:20,
+		hazardTypeMode:'',//类型id
+		hazardTypeModeName:'',
+		searchValue:'',
+		filtType:'',
+		hazardIds:[],
+		selectedHazardIds:[],
+      },
+	  total:0,
+	  collegeIndex :0,
+	  collegeArray:[],
+	  collegeList:[],
+	  dataList:[],
+	  seleteListDevice:[],//临时存储选中的 
+	  form:{},
+	}
+  },
+  onLoad(option) {
+      this.form=JSON.parse(decodeURIComponent(option.form));
+	  if(this.form.seleteListDevice.length>0){
+		  this.seleteListDevice=this.form.seleteListDevice;
+	  }
+	  if(option.pageType){//pageType=1添加页面进入2编辑页面进入
+	  	 this.pageType=option.pageType
+	  }
+  },
+  onShow() {
+      
+  },
+  mounted(){
+	  this.dataList=[];
+	  this.dangerList();
+	  this.getList(); 
+  },
+  methods: {
+	  //滚动事件
+	  scrollGet(){
+		  let self=this;
+	      if(self.total/self.getData.pageSize<=self.getData.pageNum){
+	          console.log('没有更多数据!')
+	      }else{
+			  setTimeout(function(){
+				  self.getData.pageNum += 1;
+				  self.getList(); 
+			  },1000)
+			 
+		  }
+	  },
+	  //选择学院
+	  collegeChange(e){
+		  this.collegeIndex = e.target.value;
+		  this.getData.hazardTypeMode=this.collegeList[e.target.value].dictValue
+		  this.getData.hazardTypeModeName=this.collegeList[e.target.value].dictLabel
+		  this.getData.pageNum=1;
+		  this.dataList=[];
+		  this.getList();
+	  },
+	  //点击选择实验室
+	  labSelete(index){
+	  	this.dataList[index].type = !this.dataList[index].type
+		
+		if(this.dataList[index].type){//判断是选中还是取消
+			if(this.seleteListDevice.length>0){
+				if(this.seleteListDevice.findIndex((item)=>item.id===this.dataList[index].id) ==-1){//等于-1说明数组里没有当前选中元素,可以添加
+					this.seleteListDevice.push(this.dataList[index])
+				}
+			}else{
+				this.seleteListDevice.push(this.dataList[index])
+			}
+		}else{
+			this.seleteListDevice.splice(this.seleteListDevice.indexOf(this.dataList[index]),1);
+		}
+	  },
+	  //实验室搜索
+	  searchBtn(){
+		  this.dataList=[];
+		  this.getList();
+	  },
+	  //清除
+	  clearBtn(){
+		  this.getData.pageNum=1;
+		  this.collegeIndex=0;
+		  this.getData.deptId='';
+		  this.getData.deptName='';
+		  this.getData.searchValue='';
+		  this.dataList=[];
+		  this.getList();
+	  },
+	  handleClick(doType){
+		  let self=this;
+		  if( doType=='subBtn'){//保存数据
+			
+		  }
+	  },
+	  //设备-保存
+	  async submitForm(){
+	  	let _this = this;
+		let hazardIds=[];
+		this.$set(this.form,'hazardNum', this.seleteListDevice.length)
+		this.$set(this.form,'seleteListDevice', this.seleteListDevice)
+		if(this.seleteListDevice.length>0){
+			this.seleteListDevice.forEach(function(item){
+				hazardIds.push(item.id)
+			})
+			this.$set(this.form,'hazardIds', hazardIds.join(','))
+		}else{
+			uni.showToast({
+			    title: '请选择检查内容!',
+			    icon:"none",
+			    mask:true,
+			    duration: 2000
+			});
+			return;
+		}
+		
+		//实验室是否有当前设备
+		let obj={
+		  "checkRange":this.form.checkRange,
+		  "collegeIds":this.form.checkRange==2?this.form.collegeIds+'':'',//学院ID转换字符串
+		  "subIds":this.form.checkRange == 3?this.form.subIds+'':'',//实验室ID
+		  "hazardIds":this.form.hazardIds,
+		}
+		const {data} = await haveHazardInSub(obj);
+		if(data.code == 200){
+			let pages=getCurrentPages();
+			let prevPage=pages[pages.length-2];//上一个页面
+			prevPage.onShow(encodeURIComponent(JSON.stringify(this.form)))
+			uni.navigateBack()
+			// if(this.pageType==1){
+			// 	uni.redirectTo({
+			// 		url: '/pages_safetyExamine/patrolPlan/patrolPlanAdd?form='+encodeURIComponent(JSON.stringify(this.form))
+			// 	});
+			// }else if(this.pageType==2){
+			// 	uni.redirectTo({
+			// 		url: '/pages_safetyExamine/patrolPlan/patrolPlanEdit?form='+encodeURIComponent(JSON.stringify(this.form))
+			// 	});
+			// }
+		}
+		
+	  		
+	  },
+	 
+	  //查询学院列表
+	  async dangerList(){
+	  	let _this = this;
+	  	const {data} = await dangerList();
+	  	if(data.code == 200){
+			for(let i=0;i<data.rows.length;i++){
+				_this.collegeArray.push(data.rows[i].dictLabel)
+			}
+			_this.collegeList=data.rows;
+	  	}
+	  },
+	  async getList(){
+	      let _this = this;
+	      const {data} = await findDeviceList(_this.getData);
+	      if(data.code==200){
+			  data.rows.forEach(function(item){
+				  item.type=false;
+			  })
+			  this.dataList=[...this.dataList,...data.rows]
+			  _this.total=data.total;
+			  if(this.seleteListDevice.length>0){//如果有选中的数据
+			  		for(let i=0;i<this.dataList.length;i++){
+			  			if(this.seleteListDevice.findIndex((item)=>item.id===this.dataList[i].id) !=-1){//不等于-1说明数组里有当前元素,可以改为选中
+			  				this.dataList[i].type=true;
+			  			}else{
+			  					  
+			  			}
+			  		}
+			  }
+		  }
+      }
+  }
+}
+</script>
+
+<style lang="stylus" scoped>
+.examine{
+	height:100%;
+	display flex;
+	.info-max-box{
+		flex: 1;
+		overflow: scroll;
+		padding: 120rpx 0rpx 30rpx;
+		box-sizing: border-box;
+	}
+	.lab_title{
+		width: 750rpx;
+		height: 100rpx;
+		background: #FFFFFF;
+		position: fixed;
+		top: 0;
+		padding: 10rpx 30rpx;
+		box-sizing: border-box;
+		display: flex;
+		justify-content: flex-start;
+		
+		.lab_title_l{
+			width: 250rpx;
+			height: 80rpx;
+			margin-right: 20rpx;
+			.lab_title_l_n{
+				width: 250rpx;
+				height: 80rpx;
+				border-radius: 10rpx;
+				border: 1rpx solid #E0E0E0;
+				display: flex;
+				justify-content: flex-start;
+				align-items: center;
+				>view{
+					flex:1;
+					line-height:80rpx;
+					margin-left:20rpx;
+					color: #999999;
+					font-size:28rpx;
+			        white-space: nowrap;
+					overflow: hidden;
+					text-overflow: ellipsis;
+				}
+				>img{
+					width: 14rpx;
+					height: 8rpx;
+					margin-right: 30rpx;
+				}
+			}
+		}
+		.lab_title_r{
+			width: 420rpx;
+			height: 80rpx;
+			position:relative;
+			border-radius: 10rpx;
+			border: 1rpx solid #E0E0E0;
+			.lab_title_r_btn{
+				width: 60rpx;
+				height: 80rpx
+				position: absolute;
+				top: 0rpx;
+				right:0rpx;
+				>img{
+					width: 20rpx;
+					height: 20rpx;
+					position: absolute;
+					top: 30rpx;
+					left: 24rpx;
+				}
+			}
+			>input{
+				width: 274rpx;
+				height: 80rpx;
+				position: absolute;
+				top: 0rpx;
+				left: 60rpx;
+			}
+			.clear{
+				width: 60rpx;
+				height: 80rpx
+				position: absolute;
+				top: 0rpx;
+				right:20rpx;
+				font-size: 30rpx;
+				font-family: PingFang SC-Medium, PingFang SC;
+				font-weight: 400;
+				color: #0183FA;
+				line-height: 80rpx;
+			}
+		}
+	}
+	.list{
+		background: #FFFFFF;
+		border-radius: 20rpx 20rpx 0rpx 0rpx;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		margin: 0 30rpx;
+		.list_li{
+			display: flex;
+			justify-content:space-between;
+			align-items: center;
+			height: 80rpx;
+			border-bottom: 1rpx solid #E0E0E0;
+			>text{
+				font-size: 28rpx;
+				font-family: PingFang SC-Medium, PingFang SC;
+				font-weight: 400;
+				line-height: 80rpx;
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+			}
+			>img{
+				width: 24rpx;
+				height: 16rpx;
+				margin-right: 14rpx;
+			} 
+		}
+		.list_li:last-child{
+			border: none;
+		}
+		.color_A{
+			color: #333333;
+		}
+		.color_B{
+			color: #0183FA;
+		}
+	}
+	.bottom_btn{
+		position: fixed;
+		bottom: 26rpx;
+		left: 30rpx;
+		font-size: 30rpx;
+		font-family: PingFang SC-Medium, PingFang SC;
+		font-weight: 400;
+		color: #FFFFFF;
+		line-height: 90rpx;
+		width: 690rpx;
+		height: 90rpx;
+		background: #0183FA;
+		border-radius: 20rpx;
+		text-align: center;
+		
+	}
+}
+</style>