qushaowei
2025-06-10 15a40c01ab09810f0f79351f06d6951e305d8ec9
src/views/eam/modules/maintenancePlan/StandardSelect.vue
@@ -8,7 +8,7 @@
    @cancel="close"
    style="top:50px"
    cancelText="关闭"
    :width="1050"
    :width="1600"
  >
    <a-card :bordered="false">
      <div class="table-page-search-wrapper">
@@ -18,15 +18,59 @@
        >
          <a-row :gutter="24">
            <a-col
              :md="8"
              :md="6"
              :sm="6"
            >
              <a-form-item label="检验项目名称">
              <a-form-item label="统一编码">
                <a-input
                  placeholder="请输入检验项目名称"
                  placeholder="请输入统一编码"
                  v-model="queryParam.num"
                />
              </a-form-item>
            </a-col>
            <a-col
              :md="6"
              :sm="6"
            >
              <a-form-item label="设备名称">
                <a-input
                  placeholder="设备名称"
                  v-model="queryParam.name"
                />
              </a-form-item>
            </a-col>
            <!-- 按中心查询 -->
            <a-col
              :md="6"
              :sm="6"
            >
              <a-form-item label="中心">
                <j-dict-select-tag
                  allow-clear
                  placeholder="请选择中心"
                  :triggerChange="true"
                  dictCode="mom_base_area,name,id,del_flag!='1' and type='1'"
                  v-model="queryParam.workCenterId"
                />
              </a-form-item>
            </a-col>
            <a-col
              :md="6"
              :sm="6"
            >
              <a-form-model-item
                label="下次三保时间"
                prop="ranges"
              >
                <a-range-picker
                  v-model="ranges"
                  style="width:100%"
                  format="YYYY-MM-DD HH:mm:ss"
                  showTime
                  :placeholder="[ '开始时间', '结束时间']"
                  @change="changeDate"
                />
              </a-form-model-item>
            </a-col>
            <a-col :md="3">
@@ -77,16 +121,22 @@
  mixins: [JeecgListMixin],
  components: {},
  props: {
    maintenanceType: {
      type: String,
      default: '',
      required: true
    }
  },
  data() {
    return {
      queryParam: {
      },
      ranges: [],
      columns: [
        {
          title: '#',
          dataIndex: '',
          dataIndex: 'id',
          key: 'rowIndex',
          width: 50,
          align: 'center',
@@ -94,41 +144,67 @@
            return parseInt(index) + 1
          }
        },
        {
          title: '标准编码',
          align: 'center',
          dataIndex: 'num',
        },
        {
          title: '使用部门',
          align: 'center',
          dataIndex: 'useDepartName',
        },
        {
          title: '统一编码',
          align: 'center',
          dataIndex: 'equipmentNum',
          dataIndex: 'num',
          // width: 200
        },
        {
          title: '设备名称',
          align: 'center',
          dataIndex: 'equipmentName',
          dataIndex: 'name',
          // width: 200
        },
        {
          title: '设备型号',
          align: 'center',
          dataIndex: 'equipmentModel',
          dataIndex: 'model',
          // width: 200
        },
        {
          title: '版本',
          title: '设备规格',
          align: 'center',
          dataIndex: 'version',
          dataIndex: 'specification',
          // width: 200
        },
        {
          title: '版本状态',
          title: 'ABC标识',
          align: "center",
          dataIndex: 'equipmentImportanceId',
          // width: 100
        },
        {
          title: '关键设备标识',
          align: "center",
          dataIndex: 'specificEquipment_dictText',
          width: 100
        },
        {
          title: '设备状态',
          align: 'center',
          dataIndex: 'versionStatusName',
          // dataIndex: 'equipmentStatus_dictText',
          // width: 100
        },
        {
          title: '技术状态',
          align: 'center',
          dataIndex: 'technologyStatus_dictText',
          // width: 100
        },
        //下次三保时间
        {
          title: '下次三保时间',
          align: 'center',
          dataIndex: 'nextThirdMaintenanceTime',
          // width: 200
        },
        //中心
        {
          title: '中心',
          align: 'center',
          dataIndex: 'workCenterId_dictText',
          // width: 200
        },
      ],
      selectedRowKeys: [],
@@ -156,7 +232,8 @@
      visible: false,
      loading: false,
      url: {
        list: '/eam/maintenanceStandard/getMaintenanceStandardList',
        list: '/eam/equipment/planEquipmentList',
        getStandards: '/eam/equipmentMaintenancePlan/getStandards'
      },
    }
  },
@@ -190,8 +267,9 @@
      }
      let that = this
      this.loading = true
      this.queryParam.versionStatus = '2'
      this.queryParam.type = 'daily'
      // this.queryParam.versionStatus = '2'
      // this.queryParam.type = 'daily'
      this.queryParam.isLine = 'no';
      let params = this.getQueryParams()//查询条件
      await getAction(this.url.list, params).then((res) => {
        if (res.success) {
@@ -234,9 +312,11 @@
    searchReset(num) {
      let that = this;
      this.queryParam = [];
      this.ranges = [];
      if (num !== 0) {
        that.loadData(1);
      }
      that.selectborrowIds = [];
    },
    close() {
@@ -254,9 +334,56 @@
      this.loadData();
    },
    handleSubmit() {
      this.$emit('selectionRows', this.selectionRows);
      this.searchReset(0)
      this.close();
      this.loading = true
      let that = this;
      var ids = '';
      if (this.selectionRows.length == 0) {
        that.$message.warning("请选择保养设备");
        this.loading = false;
        return false;
      }
      for (var i = 0; i < this.selectionRows.length; i++) {
        ids = ids + this.selectionRows[i].id + ',';
      }
      getAction(this.url.getStandards, { ids: ids, maintenanceType: this.maintenanceType }).then(res => {
        if (res.success) {
          if (res.result.records.length !== that.selectionRows.length) {
            that.$message.warning(res.result.message);
          }
          that.$emit('selectionEquipmentRows', res.result.records);
          that.searchReset(0)
          that.close();
        }
      }).finally(res => {
        this.loading = false;
      })
    },
    changeDate(date, dateString) {
      // this.queryParam.startTime = dateString[0].format('YYYY-MM-DD HH:mm:ss');
      // this.queryParam.endTime = dateString[1].format('YYYY-MM-DD HH:mm:ss');
      this.queryParam.startTime = this.formattedTime(dateString[0]);
      this.queryParam.endTime = this.formattedTime(dateString[1]);
      debugger
    },
    formattedTime(originalTime) {
      // 创建 Date 对象
      const date = new Date(originalTime)
      // 检查 Date 对象是否有效
      if (isNaN(date.getTime())) return '无效时间'
      // 获取年、月、日、时、分
      const year = date.getFullYear()
      const month = String(date.getMonth() + 1).padStart(2, '0')
      const day = String(date.getDate()).padStart(2, '0')
      const hours = String(date.getHours()).padStart(2, '0')
      const minutes = String(date.getMinutes()).padStart(2, '0')
      const seconds = String(date.getSeconds()).padStart(2, '0')
      // 拼接成指定格式
      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows;