yangkang
2023-09-12 3fb908f2d537a8a047388963202185e5844317cb
预测性维护
已添加21个文件
6051 ■■■■■ 文件已修改
src/views/eam/PredictiveWorkOrderList.vue 532 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/PredictiveWorkPlanList.vue 471 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/JSelectMaintenanceStandardSafetyRequirementModal.vue 261 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardPlanningMaterial.vue 232 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardPlanningMaterialModal.vue 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardSafetyRequirement.vue 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardSafetyRequirementModal.vue 259 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardWorkInstruction.vue 379 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/MaintenanceStandardWorkInstructionModal.vue 344 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/PlanSparePartSelect.vue 234 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/RepairOrderDetailList.vue 228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/common/RepairOrderDetailModal.vue 289 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/ParameterSelect.vue 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveParameterModal.vue 281 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveParameters.vue 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveSpareParts.vue 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveSparePartsModal.vue 302 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveWarn.vue 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveWarnModal.vue 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue 448 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/predictiveWorkPlan/WarnSelect.vue 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/PredictiveWorkOrderList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,532 @@
<template>
  <a-card
    :bordered="false"
    title="专业保养工单"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
          <a-col
            :md="6"
            :sm="8"
          >
            <a-form-item label="保养工单编码">
              <a-input
                placeholder="请输入保养工单编码"
                v-model="queryParam.num"
              ></a-input>
            </a-form-item>
          </a-col>
          <!-- <a-col
            :md="6"
            :sm="8"
          >
            <a-form-item label="点检方法名称">
              <j-input
                placeholder="请输入点检方法名称"
                v-model="queryParam.name"
              ></j-input>
            </a-form-item>
          </a-col> -->
          <a-col
            :md="6"
            :sm="8"
          >
            <span
              style="float: left;overflow: hidden;"
              class="table-page-search-submitButtons"
            >
              <a-button
                type="primary"
                @click="searchQuery"
                icon="search"
              >查询</a-button>
              <a-button
                type="primary"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
              >重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button
        @click="handleAdd"
        type="primary"
        icon="plus"
      >新增</a-button>
      <a-button
        v-if="selectedRowKeys.length > 0"
        type="primary"
        @click="batchAssign"
        style="margin-left: 8px"
      >工单派工</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <div
        class="ant-alert ant-alert-info"
        style="margin-bottom: 16px;"
      >
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a
          style="margin-left: 24px"
          @click="onClearSelected"
        >清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: 'calc(1900px + 50%)', y: 900 }"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定下发工单吗?"
            @confirm="() => handleOrderIssue(record)"
          >
            <a v-if="record.status == '1'">下发</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '1'"
            type="vertical"
          />
          <a-popconfirm
            title="确定撤回工单吗?"
            @confirm="() => handleOrderReset(record)"
          >
            <a v-if="record.status == '2'">撤回</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-popconfirm
            title="确定恢复工单吗?"
            @confirm="() => handleOrderRecover(record)"
          >
            <a v-if="record.status == '7'">恢复</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '7'"
            type="vertical"
          />
          <a-popconfirm
            title="确定作废工单吗?"
            @confirm="() => handleOrderCancel(record)"
          >
            <a v-if="record.status == '2'">作废</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-popconfirm
            title="确定领取工单吗?"
            @confirm="() => handleOrderGet(record)"
          >
            <a v-if="record.status == '2' && record.assignMode == '1'">领取</a>
          </a-popconfirm>
          <a
            v-if="record.status == '2' && record.assignMode == '2'  "
            @click="handleAssignOrder(record)"
          >派工</a>
          <a
            v-if="record.status == '2'&& record.assignMode == '3'  && record.inspectionUserName != null  "
            @click="handleAssignOrder(record)"
          >改派</a>
          <a
            v-if="record.status == '3'"
            @click="handleAssignOrder(record)"
          >改派</a>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-divider
            v-if="record.status === '3'"
            type="vertical"
          />
          <a
            v-if="record.status === '3' || record.status === '4'  "
            @click="handleOrderExe(record)"
          >执行</a>
          <a-divider
            v-if="record.status === '3' || record.status === '4' "
            type="vertical"
          />
          <a
            v-if="record.status === '1'"
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider
            v-if="record.status === '1'"
            type="vertical"
          />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a v-if="record.status === '1'">删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <span
          slot="num"
          slot-scope="text, record"
        >
          <a
            v-if="record.status === '3' || record.status === '4' ||record.status === '5'  ||record.status === '7' "
            class="lot"
            @click="handleOrderExe(record)"
          >{{record.num}}</a>
          <span v-else>{{record.num}}</span>
        </span>
      </a-table>
    </div>
    <maintenance-order-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></maintenance-order-modal>
    <inspection-order-assign-modal
      ref="InspectionOrderAssignModal"
      @ok="modalFormOk"
    ></inspection-order-assign-modal>
    <specialy-maintenance-order-exe-drawer
      ref="SpecialyMaintenanceOrderExeDrawer"
      @ok="modalFormOk"
    ></specialy-maintenance-order-exe-drawer>
    <specialty-maintenance-order-assign-modal
      ref="SpecialtyMaintenanceOrderAssignModal"
      @ok="modalFormOk"
    >
    </specialty-maintenance-order-assign-modal>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import MaintenanceOrderModal from './modules/specialtyMaintenanceOrder/MaintenanceOrderModal'
import InspectionOrderAssignModal from './modules/specialtyMaintenanceOrder/InspectionOrderAssignModal'
import SpecialyMaintenanceOrderExeDrawer from './modules/specialtyMaintenanceOrder/SpecialyMaintenanceOrderExeDrawer'
import { getAction, postAction, requestPut } from '@/api/manage'
import SpecialtyMaintenanceOrderAssignModal from './modules/specialtyMaintenanceOrder/SpecialtyMaintenanceOrderAssignModal.vue'
import SpecialtyInspectionOrderAssignModal from './modules/specialtyInspectionOrder/SpecialtyInspectionOrderAssignModal.vue'
export default {
  name: 'PredictiveWorkOrderList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    MaintenanceOrderModal,
    InspectionOrderAssignModal,
    SpecialyMaintenanceOrderExeDrawer,
    SpecialtyMaintenanceOrderAssignModal,
    SpecialtyInspectionOrderAssignModal
  },
  data() {
    return {
      description: '预测性维护工单',
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'statusName'
        },
        {
          title: '单据号',
          align: "center",
          dataIndex: 'num',
          scopedSlots: { customRender: 'num' }
        },
        {
          title: '监控类型',
          align: "center",
          dataIndex: 'maintenanceMode'
        },
        {
          title: '设备编码',
          align: "center",
          dataIndex: 'departName',
        },
        {
          title: '设备名称',
          align: "center",
          dataIndex: 'maintenanceTypeName',
        },
        {
          title: '型号',
          align: "center",
          dataIndex: 'maintenanceCycleName',
        },
        {
          title: '标准编码',
          align: 'center',
          dataIndex: 'assignModeName',
        },
        {
          title: '版本',
          align: "center",
          dataIndex: 'specialtyMaintenancePlanNum',
        },
        {
          title: '使用部门',
          align: "center",
          dataIndex: 'teamName',
        },
        {
          title: '派工方式',
          align: "center",
          dataIndex: 'sumOfWorkingHourQuota',
        },
        {
          title: '责任班组',
          align: "center",
          dataIndex: 'planStartTime',
          width: 170
        },
        {
          title: '责任人',
          align: "center",
          dataIndex: 'planEndTime',
          width: 170
        },
        {
          title: '工时定额(小时)',
          align: "center",
          dataIndex: 'planEndTime',
          width: 170
        },
        {
          title: '实际工时',
          align: "center",
          dataIndex: 'planEndTime',
          width: 170
        },
        {
          title: '实际开始时间',
          align: "center",
          dataIndex: 'actualStartTime',
          width: 170
        },
        {
          title: '实际结束时间',
          align: "center",
          dataIndex: 'actualEndTime',
          width: 170
        },
        {
          title: '创建人',
          align: "center",
          dataIndex: 'createBy'
        },
        {
          title: '创建日期',
          align: "center",
          dataIndex: 'createTime',
          width: 170
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 300,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/eam/predictiveworkorder/pageOrderList",
        delete: "/eam/specialtyMaintenanceOrder/delete",
        deleteBatch: "/eam/specialtyMaintenanceOrder/deleteBatch",
        exportXlsUrl: "/eam/specialtyMaintenanceOrder/exportXls",
        importExcelUrl: "eam/specialtyMaintenanceOrder/importExcel",
        edit: "/eam/specialtyMaintenanceOrder/editStatus",
        orderGet: "/eam/specialtyMaintenanceOrder/orderGet",
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys;
          this.onSelectChange(selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.distable
          },
        }),
        selectedRowKeys: this.selectedRowKeys,
      };
    },
  },
  methods: {
    batchAssign() {
      this.$refs.InspectionOrderAssignModal.visible = true
      this.$refs.InspectionOrderAssignModal.title = '工单派工'
      this.$refs.InspectionOrderAssignModal.selectionRows
      this.$refs.InspectionOrderAssignModal.handleShow()
      this.$bus.$emit('selectionRows', this.selectionRows);
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows;
    },
    handleOrderExe(record) {
      this.$refs.SpecialyMaintenanceOrderExeDrawer.visible = true
      this.$refs.SpecialyMaintenanceOrderExeDrawer.title = '专业保养工单执行'
      this.$refs.SpecialyMaintenanceOrderExeDrawer.handleShow(record)
      if (record.status === '3') {
        this.$refs.SpecialyMaintenanceOrderExeDrawer.buttonDistable = true//保存、暂存、报工
        this.$refs.SpecialyMaintenanceOrderExeDrawer.revocationDistable = true//撤销按钮
        this.$refs.SpecialyMaintenanceOrderExeDrawer.SWbuttonDistable = false//开工按钮
      } else if (record.status === '4') {
        this.$refs.SpecialyMaintenanceOrderExeDrawer.buttonDistable = false
        this.$refs.SpecialyMaintenanceOrderExeDrawer.revocationDistable = true
        this.$refs.SpecialyMaintenanceOrderExeDrawer.SWbuttonDistable = true
      } else if (record.status === '5') {
        this.$refs.SpecialyMaintenanceOrderExeDrawer.buttonDistable = true
        this.$refs.SpecialyMaintenanceOrderExeDrawer.revocationDistable = false
        this.$refs.SpecialyMaintenanceOrderExeDrawer.SWbuttonDistable = true
      } else if (record.status === '7') {
        this.$refs.SpecialyMaintenanceOrderExeDrawer.buttonDistable = true
        this.$refs.SpecialyMaintenanceOrderExeDrawer.revocationDistable = true
        this.$refs.SpecialyMaintenanceOrderExeDrawer.SWbuttonDistable = true
      }
    },
    handleOrderIssue(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '2' }).then((res) => {
        if (res.success) {
          that.$message.success("工单下发成功!")
          that.loadData()
        } else {
          that.$message.warning("工单下发失败!")
        }
      })
    },
    //撤回
    handleOrderReset(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '1' }).then((res) => {
        if (res.success) {
          that.$message.success("工单撤回成功!")
          that.loadData()
        } else {
          that.$message.warning("工单撤回失败!")
        }
      })
    },
    handleOrderGet(record) {
      const that = this;
      requestPut(that.url.orderGet, { id: record.id, status: '1' }).then((res) => {
        if (res.success) {
          that.$message.success("工单领取成功!")
          that.loadData()
        } else {
          that.$message.warning("工单领取失败!")
        }
      })
    },
    //作废
    handleOrderCancel(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '7' }).then((res) => {
        if (res.success) {
          that.$message.success("工单作废成功!")
          that.loadData()
        } else {
          that.$message.warning("工单作废失败!")
        }
      })
    },
    //恢复
    handleOrderRecover(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '2' }).then((res) => {
        if (res.success) {
          that.$message.success("工单恢复成功!")
          that.loadData()
        } else {
          that.$message.warning("工单恢复失败!")
        }
      })
    },
    handleAssignOrder: function (record) {
      this.$refs.SpecialtyMaintenanceOrderAssignModal.edit(record)
      this.$refs.SpecialtyMaintenanceOrderAssignModal.title = '工单改派'
      this.$refs.SpecialtyMaintenanceOrderAssignModal.disableSubmit = false
    },
    // modalFormOk() {
    //   alert(0)
    //   // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
    //   this.loadData();
    //   //清空列表选中
    //   this.onClearSelected()
    // },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/PredictiveWorkPlanList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,471 @@
<template>
  <a-card
    title="预测性维护方案"
    :bordered='false'
  >
    <div class='table-page-search-wrapper'>
      <a-form
        layout='inline'
        @keyup.enter.native='searchQuery'
      >
        <a-row :gutter='24'>
          <a-col
            :xl='6'
            :lg='7'
            :md='8'
            :sm='24'
          >
            <a-form-item label='方案编码'>
              <a-input
                placeholder='请输入方案编码'
                v-model='queryParam.planNum'
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col
            :xl='6'
            :lg='7'
            :md='8'
            :sm='24'
          >
            <a-form-item label='设备名称'>
              <a-input
                placeholder='请输入设备名称'
                v-model='queryParam.deviceName'
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="10"
            :sm="8"
          >
            <a-form-item label="版本状态">
              <a-radio-group
                v-model="queryParam.versionStatus"
                @change="onChange"
                default-value="2"
              >
                <a-radio-button value="1">
                  æœªç”Ÿæ•ˆ
                </a-radio-button>
                <a-radio-button value="2">
                  å·²ç”Ÿæ•ˆ
                </a-radio-button>
                <a-radio-button value="3">
                  å·²å¤±æ•ˆ
                </a-radio-button>
              </a-radio-group>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <div class="table-operator">
      <a-button
        @click='handleAdd'
        type='primary'
        icon='plus'
      >新增
      </a-button>
      <a-button
        type='primary'
        @click='searchQuery'
        icon='search'
      >查询
      </a-button>
      <a-button
        type='primary'
        @click='searchReset'
        icon='reload'
        style='margin-left: 8px'
      >重置
      </a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <div
        class='ant-alert ant-alert-info'
        style='margin-bottom: 16px;'
      >
        <i class='anticon anticon-info-circle ant-alert-icon'></i> å·²é€‰æ‹© <a style='font-weight: 600'>{{
        selectedRowKeys.length }}</a>项
        <a
          style='margin-left: 24px'
          @click='onClearSelected'
        >清空</a>
      </div>
      <a-table
        ref='table'
        size='middle'
        bordered
        rowKey='id'
        :scroll="{ x: 'calc(1400px + 50%)', y: 900 }"
        :columns='columns'
        :dataSource='dataSource'
        :pagination='ipagination'
        :loading='loading'
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio' }"
        :customRow='clickThenSelect'
        @change='handleTableChange'
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a
            v-if="record.status == '2'"
            @click="handleRevise(record)"
          >升版</a>
          <a
            v-if="record.status == '1'"
            @click="handleTakeEffect(record)"
          >生效</a>
          <a-divider type="vertical"/>
          <a
            v-if="record.status == '1'"
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider type="vertical"/>
          <a-popconfirm
            v-if="record.status == '1'"
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
      <a-tabs
        type="card"
        defaultActiveKey="1"
      >
        <a-tab-pane
          tab='触发条件'
          key="1" forceRender
        >
          <div
            class="table-operator"
            style="margin:-16px"
          >
            <predictive-spare-parts :planId='planId' :isEdit="isEdit" :isAdd="isAdd" :isDel="isDel"/>
            <!--            v-if="selectionRows[0].monitorType == 'smkz'"-->
            <predictive-parameters :planId='planId' :equipmentId='equipmentId' :isEdit="isEdit" :isAdd="isAdd"
                                   :isDel="isDel"/>
            <!--            v-if="selectionRows[0].monitorType == 'cskz'" -->
            <predictive-warn :planId='planId' :equipmentId='equipmentId' :isEdit="isEdit" :isAdd="isAdd"
                             :isDel="isDel"/>
            <!--            v-if="selectionRows[0].monitorType == 'bjkz'"-->
          </div>
        </a-tab-pane>
        <a-tab-pane
          tab='维护内容'
          key="2" forceRender
        >
          <div
            class="table-operator"
            style="margin:-16px"
          >
            <repair-order-detail-list :mainId='planId' :isEdit="isEdit" :isAdd="isAdd" :isDel="isDel"/>
          </div>
        </a-tab-pane>
        <a-tab-pane
          tab='计划用料'
          key="3" forceRender
        >
          <div
            class="table-operator"
            style="margin:-16px"
          >
            <maintenance-standard-planning-material :maintenanceStandardId='planId' :isEdit="isEdit" :isAdd="isAdd"
                                                    :isDel="isDel"/>
          </div>
        </a-tab-pane>
        <a-tab-pane
          tab='危险防控'
          key="4" forceRender
        >
          <div
            class="table-operator"
            style="margin:-16px"
          >
            <maintenance-standard-safety-requirement :maintenanceStandardId='planId' :isEdit="isEdit" :isAdd="isAdd"
                                                     :isDel="isDel"/>
          </div>
        </a-tab-pane>
        <a-tab-pane
          tab='作业指导书'
          key="5" forceRender
        >
          <div
            class="table-operator"
            style="margin:-16px"
          >
            <maintenance-standard-work-instruction :maintenanceStandardId='planId' :isEdit="isEdit" :isAdd="isAdd"
                                                   :isDel="isDel"/>
          </div>
        </a-tab-pane>
      </a-tabs>
    </div>
    <predictive-work-plan-modal
      ref='modalForm'
      @ok='modalFormOk'
    ></predictive-work-plan-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { requestPut } from '@/api/manage'
  import DailyMaintenanceStandardDetail from './modules/dailyMaintenanceStandard/DailyMaintenanceStandardDetail'
  //计划用料
  import MaintenanceStandardPlanningMaterial from '@/views/eam/common/MaintenanceStandardPlanningMaterial'
  //危险防控
  import MaintenanceStandardSafetyRequirement from '@/views/eam/common/MaintenanceStandardSafetyRequirement'
  //新增编辑
  import PredictiveWorkPlanModal from './modules/predictiveWorkPlan/PredictiveWorkPlanModal'
  //参数
  import PredictiveParameters from './modules/predictiveWorkPlan/PredictiveParameters'
  //报警
  import PredictiveWarn from './modules/predictiveWorkPlan/PredictiveWarn'
  //备件
  import PredictiveSpareParts from './modules/predictiveWorkPlan/PredictiveSpareParts'
  //作业指导书
  import MaintenanceStandardWorkInstruction from '@/views/eam/common/MaintenanceStandardWorkInstruction'
  //维护内容
  import RepairOrderDetailList from '@/views/eam/common/RepairOrderDetailList'
  import '@/assets/less/TableExpand.less'
  export default {
    name: 'PredictiveWorkPlanList',
    mixins: [JeecgListMixin],
    components: {
      DailyMaintenanceStandardDetail,
      PredictiveWorkPlanModal,
      MaintenanceStandardPlanningMaterial,
      MaintenanceStandardSafetyRequirement,
      MaintenanceStandardWorkInstruction,
      PredictiveSpareParts,
      PredictiveParameters,
      PredictiveWarn,
      RepairOrderDetailList
    },
    data() {
      return {
        equipmentId: '',
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '版本状态',
            align: 'center',
            dataIndex: 'statusName'
          },
          // {
          //   title: '审批状态',
          //   align: 'center',
          //   dataIndex: 'versionStatusName'
          // },
          {
            title: '版本',
            align: 'center',
            dataIndex: 'planVersion'
          },
          {
            title: '方案编码',
            align: 'center',
            dataIndex: 'num'
          },
          {
            title: '方案名称',
            align: 'center',
            dataIndex: 'name'
          },
          {
            title: '监控类型',
            align: 'center',
            dataIndex: 'monitorTypeName'
          },
          {
            title: '设备编码',
            align: 'center',
            dataIndex: 'deviceNum'
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'deviceName'
          },
          {
            title: '设备型号',
            align: 'center',
            dataIndex: 'deviceModel'
          },
          {
            title: '维保方式',
            align: 'center',
            dataIndex: 'maintenanceMethodName'
          },
          {
            title: '派工方式',
            align: 'center',
            dataIndex: 'assignModeName'
          },
          {
            title: '责任班组',
            align: 'center',
            dataIndex: 'teamName'
          },
          {
            title: '创建人',
            align: 'center',
            dataIndex: 'createBy'
          },
          {
            title: '创建日期',
            align: 'center',
            dataIndex: 'createTime'
          },
          // {
          //   title: '更新人',
          //   align: 'center',
          //   dataIndex: 'updateBy',
          // },
          // {
          //   title: '更新日期',
          //   align: 'center',
          //   dataIndex: 'updateTime',
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            scopedSlots: { customRender: 'action' },
            width: 200
          }
        ],
        monitorType: '',
        planId: '',
        isEdit: false,
        isAdd: false,
        isDel: false,
        url: {
          list: '/eam/predictiveworkplan/pagePredictiveWorkPlan',
          delete: '/eam/maintenanceStandard/delete',
          deleteBatch: '/eam/maintenanceStandard/deleteBatch',
          versionTakeEffect: '/eam/maintenanceStandard/versionTakeEffect'
        }
      }
    },
    methods: {
      clickThenSelect(record) {
        return {
          on: {
            click: () => {
              this.onSelectChange(record.id.split(','), [record])
            }
          }
        }
      },
      onClearSelected() {
        this.selectedRowKeys = []
        this.selectionRows = []
        this.planId = ''
        this.equipmentId = ''
        this.isAdd = false
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectionRows = selectionRows
        this.planId = this.selectedRowKeys[0]
        this.equipmentId = selectionRows[0].equipment_id
        this.isAdd = true
      },
      onChange(e) {
        this.queryParam.status = e.target.value
        this.loadData()
      },
      handleEdit: function(record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.isRevise = false
      },
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '新增'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.isRevise = false
      },
      //升版
      handleRevise: function(record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '保养标准版本升级'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.isRevise = true
      },
      //生效
      handleTakeEffect(record) {
        const that = this
        that.confirmLoading = true
        this.$confirm({
          title: '日常保养标准版本生效!',
          content: '提示:版本生效后上一版本将自动失效,请谨慎操作!',
          okText: '确认',
          cancelText: '取消',
          onOk() {
            requestPut(that.url.versionTakeEffect, {
              id: record.id,
              num: record.num,
              versionStatus: '2'
            }).then((res) => {
              if (res.success) {
                that.$message.success('版本生效成功!')
                that.loadData(1)
              } else {
                that.$message.warning('版本生效失败!')
              }
            }).finally(() => {
              that.confirmLoading = false
            })
          }
        })
      },
      searchReset() {
        this.loadData(1)
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .table-operator .ant-btn {
    margin: 10px 8px 8px 10px;
  }
</style>
src/views/eam/common/JSelectMaintenanceStandardSafetyRequirementModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,261 @@
<template>
  <!--支持全屏缩放-->
  <a-modal
    :visible='visible'
    :title='title'
    switchFullscreen
    @ok='handleSubmit'
    @cancel='close'
    style='top:50px'
    cancelText='关闭'
    :width='1050'
  >
    <a-card :bordered='false'>
      <div class='table-page-search-wrapper'>
        <a-form
          layout='inline'
          @keyup.enter.native='searchQuery'
        >
          <a-row :gutter='24'>
            <a-col
              :md='8'
              :sm='6'
            >
              <a-form-item label='危险源编码'>
                <a-input
                  placeholder='请输入危险源编码'
                  v-model='queryParam.num'
                />
              </a-form-item>
            </a-col>
            <a-col :md='3'>
              <span
                style='float: left;overflow: hidden;'
                class='table-page-search-submitButtons'
              >
                <a-button
                  type='primary'
                  @click='searchQuery'
                  icon='search'
                >查询</a-button>
                <a-button
                  @click='searchReset'
                  icon='reload'
                  style='margin-left: 10px'
                >重置</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <a-table
        ref='table'
        :scroll='scrollTrigger'
        size='middle'
        rowKey='id'
        bordered
        :columns='columns'
        :dataSource='dataSource'
        :pagination='ipagination'
        :rowSelection='rowSelection'
        :loading='loading'
        @change='handleTableChange'
      >
      </a-table>
    </a-card>
  </a-modal>
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'JSelectMaintenanceStandardSafetyRequirementModal',
  mixins: [JeecgListMixin],
  components: {},
  props: {},
  data() {
    return {
      queryParam: {},
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '危险源编码',
          align: 'center',
          dataIndex: 'num'
        },
        {
          title: '危险源',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '危险描述',
          align: 'center',
          dataIndex: 'description'
        },
        {
          title: '防控措施',
          align: 'center',
          dataIndex: 'measure'
        },
      ],
      selectedRowKeys: [],
      oldSelectRows: [],
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      title: '根据查询结果选择危险防控',
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['5', '10', '30', '50', '100'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      isorter: {
        column: 'num',
        order: 'desc'
      },
      visible: false,
      loading: false,
      url: {
        list: '/eam/riskPrevention/list'
      }
    }
  },
  computed: {
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys
          this.onSelectChange(selectedRows)
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.distable
          }
        }),
        selectedRowKeys: this.selectedRowKeys
      }
    }
  },
  methods: {
    async loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1
      }
      let that = this
      this.loading = true
      let params = this.getQueryParams()//查询条件
      await getAction(this.url.list, params).then((res) => {
        if (res.success) {
          for (let i = 0; i < res.result.records.length; i++) {
            if (that.oldSelectRows.indexOf(res.result.records[i].id) > -1) {
              res.result.records[i].distable = true
            } else {
              res.result.records[i].distable = false
            }
          }
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false
      })
    },
    showModals(oldSelectRows) {
      this.oldSelectRows = oldSelectRows
      this.visible = true
      this.loadData(1)
    },
    getQueryParams() {
      let param = Object.assign({}, this.queryParam, this.isorter)
      param.field = this.getQueryField()
      param.pageNo = this.ipagination.current
      param.pageSize = this.ipagination.pageSize
      return filterObj(param)
    },
    //查询条件处理
    getQueryField() {
      let str = 'id,'
      for (let a = 0; a < this.columns.length; a++) {
        str += ',' + this.columns[a].dataIndex
      }
      return str
    },
    searchReset(num) {
      let that = this
      this.queryParam = []
      if (num !== 0) {
        that.loadData(1)
      }
      that.selectborrowIds = []
    },
    close() {
      this.searchReset(0)
      this.selectedRowKeys = []
      this.visible = false
    },
    handleTableChange(pagination, filters, sorter) {
      //TODO ç­›é€‰
      if (Object.keys(sorter).length > 0) {
        this.isorter.column = sorter.field
        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
      }
      this.ipagination = pagination
      this.loadData()
    },
    handleSubmit() {
      this.$bus.$emit('selection2Rows', this.selectionRows)
      this.searchReset(0)
      this.close()
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows
    },
    searchQuery() {
      this.loadData(1)
    }
  }
}
</script>
<style scoped>
.ant-table-tbody .ant-table-row td {
  padding-top: 10px;
  padding-bottom: 10px;
}
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}
</style>
src/views/eam/common/MaintenanceStandardPlanningMaterial.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,232 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="maintenanceStandardId !='' && isAdd "
    >新增
    </a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <maintenance-standard-planning-material-modal
      ref="modalForm"
      @ok="modalFormOk"
      :mainId="maintenanceStandardId"
    ></maintenance-standard-planning-material-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction, deleteAction } from '@/api/manage'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import MaintenanceStandardPlanningMaterialModal from './MaintenanceStandardPlanningMaterialModal'
  export default {
    name: 'MaintenanceStandardPlanningMaterial',
    components: {
      Tooltip,
      MaintenanceStandardPlanningMaterialModal
    },
    mixins: [JeecgListMixin],
    props: {
      maintenanceStandardId: {
        type: String,
        required: false
      },
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
    },
    watch: {
      maintenanceStandardId: function(val) {
        this.clearList()
        if (this.maintenanceStandardId) {
          this.queryParam.maintenanceStandardId = val
          this.queryParam.delFlag = 0
          this.loadData(1)
        }
      }
    },
    data() {
      return {
        disableMixinCreated:true,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '备件编号',
            dataIndex: 'num',
            align: 'center'
          },
          {
            title: '备件名称',
            dataIndex: 'name',
            align: 'center'
          },
          {
            title: '备件规格',
            dataIndex: 'specification',
            align: 'center'
          },
          {
            title: '备件型号',
            dataIndex: 'model',
            align: 'center'
          },
          {
            title: '制造商',
            dataIndex: 'constructorName',
            align: 'center'
          },
          {
            title: '数量',
            dataIndex: 'quantity',
            align: 'center'
          },
          {
            title: '单位',
            dataIndex: 'unitName',
            align: 'center'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 250,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/eam/maintenanceStandardPlanningMaterial/getMaintenanceStandardPlanningMaterialList',
          delete: '/eam/maintenanceStandardPlanningMaterial/delete'
        }
      }
    },
    methods: {
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '计划用料'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.maintenanceStandardId = this.maintenanceStandardId
      },
      handleDelete: function(id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message)
            that.loadData()
            that.alterFlag = new Date()
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      },
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        var params = this.getQueryParams()//查询条件
        this.loading = true
        // this.originTargetKeys = [];
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          } else {
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/common/MaintenanceStandardPlanningMaterialModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,262 @@
<template>
  <a-modal
    :title="title"
    :width="900"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row style="width: 100%">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="备件编号"
            >
              <a-input-search
                placeholder="请选择备件"
                enter-button
                @search="onSearchSparePart()"
                v-decorator="['sparePartNum',validatorRules.sparePartNum]"
                :read-only="true"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2" >
            <a-form-item label="备件名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['sparePartName', validatorRules.sparePartName]" placeholder="请输入设备名称" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2" >
            <a-form-item label="备件型号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true"  v-decorator="['sparePartModel', validatorRules.sparePartModel]" placeholder="请输入设备型号" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2" >
            <a-form-item label="备件规格" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true"  v-decorator="['sparePartSpecification', validatorRules.sparePartSpecification]" placeholder="请输入设备规格" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2" >
            <a-form-item label="制造商" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true"  v-decorator="['constructorName', validatorRules.constructorName]" placeholder="请输入制造商" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2" >
            <a-form-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true"  v-decorator="['mainUnitName', validatorRules.mainUnitName]" placeholder="请输入单位" ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="数量"
            >
              <a-input-number
                style="width: 100%"
                placeholder="请输入数量"
                v-decorator="['quantity', validatorRules.quantity]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel"
      >
        å…³é—­
      </a-button>
      <a-button
        :disabled="disableSubmit || confirmLoading"
        :loading="confirmLoading"
        @click="handleOk"
        type="primary"
      >确定</a-button>
    </template>
    <plan-spare-part-select
      ref="planSparePartSelect"
      @sendSparePartRecord='sendSparePartRecord'
    ></plan-spare-part-select>
  </a-modal>
</template>
<script>
import pick from 'lodash.pick'
import { postAction, requestPut } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
import PlanSparePartSelect from './PlanSparePartSelect.vue'
export default {
  name: 'MaintenanceStandardPlanningMaterialModal',
  components: {
    PlanSparePartSelect
  },
  props:{
    mainId:{
        type:String,
        required:false,
        default:''
      }
  },
  data() {
    return {
      title: "操作",
      visible: false,
      codeDisable: true,
      disableSubmit: false,
      maintenanceStandardId: '',
      sparePartId: '',
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules: {
        sparePartName: {
          rules: [
            { required: true, message: '请选择备件!' },
          ]
        },
        quantity: {
          rules: [
            { required: true, message: '请输入数量!' },
          ]
        }
      },
      url: {
        add: "/eam/maintenanceStandardPlanningMaterial/add",
        edit: "/eam/maintenanceStandardPlanningMaterial/edit"
      },
      //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
      alterFlag: "",
    }
  },
  created() {
  },
  methods: {
    add() {
      this.edit({});
    },
    edit(record) {
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.visible = true;
      this.disableSubmit = false;
      this.$nextTick(() => {
        this.form.setFieldsValue(pick(this.model,
          'sparePartNum',
          'sparePartName',
          'sparePartModel',
          'sparePartSpecification',
          'mainUnitName',
          'constructorName',
          'quantity'));
      });
      if (record.id) {
        this.codeDisable = true;
      } else {
        this.codeDisable = false;
      }
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    //保存并新增按钮触发
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let formData = Object.assign(this.model, values);
          formData.maintenanceStandardId = this.mainId;
          formData.sparePartId = this.sparePartId
          let obj;
          if (!this.model.id) {
            obj = postAction(this.url.add, formData);
          } else {
            obj = requestPut(this.url.edit, formData, { id: this.model.id });
          }
          obj.then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
              that.alterFlag = new Date();
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      })
    },
    onSearchSparePart() {
      this.$refs.planSparePartSelect.list();
      this.$refs.planSparePartSelect.title = "选择备件";
    },
    sendSparePartRecord(data) {
      let record = data.record;
      this.sparePartId = record.id;
      this.form.setFieldsValue({ sparePartId : record.id,sparePartNum: record.num,sparePartName: record.name,sparePartModel: record.model,
        sparePartSpecification: record.specification,mainUnitId:record.mainUnitId,mainUnitName: record.mainUnitId_dictText,constructorName:record.constructorId_dictText });
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>
<style scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
</style>
src/views/eam/common/MaintenanceStandardSafetyRequirement.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,215 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="maintenanceStandardId !='' && isAdd "
    >新增
    </a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <maintenance-standard-safety-requirement-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></maintenance-standard-safety-requirement-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction, deleteAction } from '@/api/manage'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import MaintenanceStandardSafetyRequirementModal from './MaintenanceStandardSafetyRequirementModal'
  export default {
    name: 'MaintenanceStandardPlanningMaterial',
    components: {
      Tooltip,
      MaintenanceStandardSafetyRequirementModal
    },
    mixins: [JeecgListMixin],
    props: {
      maintenanceStandardId: {
        type: String,
        required: false
      },
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
    },
    watch: {
      maintenanceStandardId: function(val) {
        this.clearList()
        if (this.maintenanceStandardId) {
          this.queryParam.maintenanceStandardId = val
          this.queryParam.delFlag = 0
          this.loadData(1)
        }
      }
    },
    data() {
      return {
        disableMixinCreated:true,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 100,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '危险源编码',
            align: 'center',
            dataIndex: 'num'
          },
          {
            title: '危险源',
            align: 'center',
            dataIndex: 'name'
          },
          {
            title: '危险描述',
            align: 'center',
            dataIndex: 'description'
          },
          {
            title: '防控措施',
            align: 'center',
            dataIndex: 'measure'
          },
          {
            title: '操作',
            align: 'center',
            dataIndex: 'action',
            scopedSlots: {
              customRender: 'action'
            }
          }
        ],
        url: {
          list: '/eam/maintenanceStandardSafetyRequirement/getMaintenanceStandardSafetyRequirementList',
          delete: '/eam/maintenanceStandardSafetyRequirement/delete'
        }
      }
    },
    methods: {
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '危险防控'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.maintenanceStandardId = this.maintenanceStandardId
      },
      handleDelete: function(id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message)
            that.loadData()
            that.alterFlag = new Date()
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      },
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        var params = this.getQueryParams()//查询条件
        this.loading = true
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records || res.result
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          } else {
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/common/MaintenanceStandardSafetyRequirementModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,259 @@
<template>
  <a-modal
    :title="title"
    :width="1050"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
      </a-form>
    </a-spin>
    <a-button
      type="primary"
      :style="{ marginRight: '8px',marginBottom:'8px' }"
      :loading="confirmLoading"
      @click="selectSafetyRequirement()"
    >危险防控</a-button>
    <a-table
      ref="table"
      bordered
      size="middle"
      rowKey='id'
      :columns="columns"
      :dataSource="dataSource"
    >
      <span
        slot="action"
        slot-scope="text, record, index"
      >
        <a-popconfirm
          title="确定删除吗?"
          @confirm="() => handleDelete(text,record, index)"
        >
          <a>删除</a>
        </a-popconfirm>
      </span>
    </a-table>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel"
      >
        å…³é—­
      </a-button>
      <a-button
        :disabled="disableSubmit || confirmLoading"
        :loading="confirmLoading"
        @click="handleOk"
        type="primary"
      >确定</a-button>
    </template>
    <j-select-maintenance-standard-safety-requirement-modal ref="maintenanceStandardSafetyRequirementModalForm"></j-select-maintenance-standard-safety-requirement-modal>
  </a-modal>
</template>
<script>
import pick from 'lodash.pick'
import { postAction, requestPut } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
import JSelectMaintenanceStandardSafetyRequirementModal from './JSelectMaintenanceStandardSafetyRequirementModal'
export default {
  name: 'MaintenanceStandardSafetyRequirementModal',
  components: {
    JSelectMaintenanceStandardSafetyRequirementModal
  },
  data() {
    return {
      title: "操作",
      visible: false,
      codeDisable: true,
      disableSubmit: false,
      maintenanceStandardId: '',
      dataSource: [],
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
          width: 50,
        },
        {
          title: '危险源编码',
          align: 'center',
          dataIndex: 'num'
        },
        {
          title: '危险源',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '危险描述',
          align: 'center',
          dataIndex: 'description'
        },
        {
          title: '防控措施',
          align: 'center',
          dataIndex: 'measure'
        },
        {
          title: '操作',
          align: 'center',
          dataIndex: 'action',
          scopedSlots: {
            customRender: 'action'
          },
        }
      ],
      url: {
        add: "/eam/maintenanceStandardSafetyRequirement/add",
        edit: "/eam/maintenanceStandardSafetyRequirement/edit"
      },
      //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
      alterFlag: "",
    }
  },
  created() {
  },
  mounted() {
    this.$bus.$on('selection2Rows', (data) => {
      for (let i = 0; i < data.length; i++) {
        this.dataSource.push({
          id: data[i].id,
          num: data[i].num,
          name: data[i].name,
          description: data[i].description,
          measure: data[i].measure,
        })
      }
    })
  },
  methods: {
    add() {
      this.dataSource = [];
      this.edit({});
    },
    edit(record) {
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.visible = true;
      this.disableSubmit = false;
      if (record.id) {
        this.codeDisable = true;
      } else {
        this.codeDisable = false;
      }
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    //保存并新增按钮触发
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let formData = Object.assign(this.model, values);
          formData.maintenanceStandardId = this.maintenanceStandardId;
          formData.riskPreventionList = this.dataSource;
          let obj;
          if (!this.model.id) {
            obj = postAction(this.url.add, formData);
          } else {
            obj = requestPut(this.url.edit, formData, { id: this.model.id });
          }
          obj.then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
              that.alterFlag = new Date();
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    handleDelete(text, record, index) {
      this.dataSource.splice(index, 1);
    },
    selectSafetyRequirement: function () {
      let ids = [];
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].id);
      }
      this.$refs.maintenanceStandardSafetyRequirementModalForm.showModals(ids);
      this.$refs.maintenanceStandardSafetyRequirementModalForm.title = '选择危险防控';
      this.$refs.maintenanceStandardSafetyRequirementModalForm.disableSubmit = false;
    },
  },
}
</script>
<style scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
</style>
src/views/eam/common/MaintenanceStandardWorkInstruction.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,379 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="maintenanceStandardId !='' && isAdd "
    >新增</a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="size"
          slot-scope="text"
          class="error"
        >
          {{sizeConvert(text)}}
        </span>
        <!-- <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span> -->
        <span
          slot="action"
          slot-scope="text, record"
        >
          <Tooltip
            placement="top"
            title="预览图片"
          >
            <img
              v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif')"
              width="30"
              height="14"
              border="1"
              draggable="false"
              preview="1"
              :preview-text="''"
              :src="record.upload.src"
            />
          </Tooltip>
          <a
            v-if="record.upload.path && record.upload.format.toLowerCase()=='pdf'"
            href="javascript:;"
            @click="view(record)"
          >
            é¢„览
          </a>
          <a-divider
            v-if="record.upload.path && (record.upload.format.toLowerCase()=='jpg'||record.upload.format.toLowerCase()=='bmp'||record.upload.format.toLowerCase()=='png'||record.upload.format.toLowerCase()=='jpeg'||record.upload.format.toLowerCase()=='gif'||record.upload.format.toLowerCase()=='pdf')"
            type="vertical"
          />
          <a
            href="javascript:;"
            @click="handleDownload(record)"
          >下载</a>
          <a-divider type="vertical" />
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <pdf-view ref="pdfview"></pdf-view>
    <maintenance-standard-work-instruction-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></maintenance-standard-work-instruction-modal>
  </a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, deleteAction, downFile } from '@/api/manage'
import Tooltip from 'ant-design-vue/es/tooltip'
import MaintenanceStandardWorkInstructionModal from './MaintenanceStandardWorkInstructionModal'
import JInput from '@/components/jeecg/JInput'
import JEllipsis from "@/components/jeecg/JEllipsis";
import { preview } from 'vue-photo-preview'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import Vue from 'vue'
import PdfView from '@views/common/PdfView'
import { getFileAccessHttpUrl } from '@/api/manage';
import store from '@/store/'
export default {
  name: "MaintenanceStandardWorkInstruction",
  components: {
    Tooltip,
    MaintenanceStandardWorkInstructionModal,
    JInput,
    JEllipsis,
    PdfView,
    preview,
  },
  mixins: [JeecgListMixin],
  props: {
    maintenanceStandardId: {
      type: String,
      required: false
    },
    isEdit: {
      type: Boolean,
      default: false
    },
    isAdd: {
      type: Boolean,
      default: false
    },
    isDel: {
      type: Boolean,
      default: false
    }
  },
  mounted() {
  },
  watch: {
    maintenanceStandardId: function(val) {
      this.clearList()
      if (this.maintenanceStandardId) {
        this.queryParam.maintenanceStandardId = val
        this.queryParam.delFlag = 0
        this.loadData(1)
      }
    }
  },
  data() {
    return {
      disableMixinCreated:true,
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 100,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '文档编码',
          align: 'center',
          dataIndex: 'num'
        },
        {
          title: '文档名称',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '文档类型',
          align: 'center',
          dataIndex: 'typeName'
        },
        {
          title: '文档大小',
          align: 'center',
          dataIndex: 'size',
          scopedSlots: { customRender: 'size' },
        },
        {
          title: '操作',
          align: 'center',
          dataIndex: 'action',
          scopedSlots: {
            customRender: 'action'
          },
        }
      ],
      url: {
        list: "/eam/maintenanceStandardWorkInstruction/getMaintenanceStandardWorkInstructionList",
        delete: "/eam/maintenanceStandardWorkInstruction/delete",
        urlDownload: window._CONFIG['staticDomainURL'],
        download: '/sys/upload/downloadFile',
      },
    }
  },
  methods: {
    handleAdd: function () {
      this.$refs.modalForm.add();
      this.$refs.modalForm.title = "作业指导书";
      this.$refs.modalForm.disableSubmit = false;
      this.$refs.modalForm.maintenanceStandardId = this.maintenanceStandardId
    },
    handleDelete: function (id) {
      if (!this.url.delete) {
        this.$message.error("请设置url.delete属性!")
        return
      }
      var that = this;
      deleteAction(that.url.delete, { id: id }).then((res) => {
        if (res.success) {
          //重新计算分页问题
          that.reCalculatePage(1)
          that.$message.success(res.message);
          that.loadData();
          that.alterFlag = new Date();
        } else {
          that.$message.warning(res.message);
        }
      });
    },
    clearList() {
      this.dataSource = []
      this.selectedRowKeys = []
      this.ipagination.current = 1
    },
    loadData(arg) {
      if (!this.url.list) {
        this.$message.error("请设置url.list属性!")
        return
      }
      //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          for (let i = 0; i < res.result.records.length; i++) {
            let r = res.result.records[i].upload;
            r.src = this.getSrc(res.result.records[i].upload);
          }
          this.dataSource = res.result.records || res.result;
          if (res.result.total) {
            this.ipagination.total = res.result.total;
          } else {
            this.ipagination.total = 0;
          }
          //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
        } else {
          this.$message.warning(res.message)
        }
      }).finally(() => {
        this.loading = false
      })
    },
    handleDownload(record) {
      downFile(this.url.download, { id: record.upload.id }).then((res) => {
        if (!res) {
          this.$message.warning('文件下载失败')
          return
        } else {
          let fileName = record.name;
          if (typeof window.navigator.msSaveBlob !== 'undefined') {
            window.navigator.msSaveBlob(new Blob([res]), fileName);
          } else {
            let url = window.URL.createObjectURL(new Blob([res]));
            let link = document.createElement('a');
            link.style.display = 'none';
            link.href = url;
            link.setAttribute('download', fileName);
            document.body.appendChild(link);
            link.click()
            document.body.removeChild(link) //下载完成移除元素
            window.URL.revokeObjectURL(url) //释放掉blob对象
          }
        }
      })
    },
    //拼装src
    getSrc(record) {
      if (!record.path) {
        return '';
      }
      //本地:local\Minio:minio\阿里云:alioss
      if (record.uploadType == 'local') {
        let ssoLoginFlag = Vue.ls.get("ssoLoginFlag");
        let deployMode = Vue.ls.get("deployMode");
        if (ssoLoginFlag && deployMode == "container") {
          var baseProject = Vue.ls.get("baseProject");
          console.log("baseProject==>" + baseProject)
          var hostname = window.location.protocol + "//" + window.location.host;
          var url = hostname + '/' + baseProject + '/sys/common/static';
          return getFileAccessHttpUrl(record.path + record.encodeName, url, window._CONFIG['hyperTextTransfer'])
        } else {
          //根据发布状态修改https æˆ– http
          return getFileAccessHttpUrl(record.path + record.encodeName, this.url.urlDownload, window._CONFIG['hyperTextTransfer'])
        }
      } else if (record.uploadType == 'alioss') {
        const OSS = require('ali-oss')
        const client = new OSS({
          // region以杭州为例(oss-cn-hangzhou),其他region按实际情况填写。
          region: window._CONFIG['region'],
          // é˜¿é‡Œäº‘主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录RAM控制台创建RAM账号。
          accessKeyId: window._CONFIG['accessKeyId'],
          accessKeySecret: window._CONFIG['accessKeySecret'],
          bucket: window._CONFIG['bucket'],
        })
        // object-key表示从OSS下载文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。
        return client.signatureUrl(record.path)
      }
    },
    sizeConvert(limit) {
      var size = "";
      if (limit < 0.1 * 1024) {
        size = parseFloat(limit).toFixed(2) + "B";//小于0.1KB,则转化成B
      } else if (limit < 0.1 * 1024 * 1024) {
        size = (parseFloat(limit) / 1024).toFixed(2) + "KB";//小于0.1MB,则转化成KB
      } else if (limit < 0.1 * 1024 * 1024 * 1024) {
        size = (parseFloat(limit) / (1024 * 1024)).toFixed(2) + "MB";//小于0.1GB,则转化成MB
      } else {
        size = (parseFloat(limit) / (1024 * 1024 * 1024)).toFixed(2) + "GB";//其他转化成GB
      }
      var sizeStr = size + "";//转成字符串
      var index = sizeStr.indexOf(".");//获取小数点处的索引
      var dou = sizeStr.substr(index + 1, 2);//获取小数点后两位的值
      if (dou == "00") {//判断后两位是否为00,如果是则删除00
        return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2);
      }
      return size;
    },
    view(record) {
      this.$refs.pdfview.showPdf(record.upload.src);
    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
src/views/eam/common/MaintenanceStandardWorkInstructionModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,344 @@
<template>
  <a-modal
    :title="title"
    :width="850"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
              label="文档编码"
            >
              <a-input
                :disabled="disableSubmit"
                placeholder="请输入文档编码"
                v-decorator="['num', validatorRules.num ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="文件类型"
            >
              <a-radio-group
                v-for="(item,index) in fileTypes"
                :key="index"
                button-style="solid"
                v-decorator="['fileType', validatorRules.fileType ]"
                :disabled="disableSubmit"
              >
                <a-radio-button :value="item.value">
                  {{item.text}}
                </a-radio-button>
              </a-radio-group>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
              label="文件上传"
            >
              <a-upload-dragger
                name="file"
                :customRequest="customRequest"
                @change="handleChange"
                :file-list="fileList"
                :multiple="false"
              >
                <p class="ant-upload-drag-icon">
                  <a-icon type="inbox" />
                </p>
                <p class="ant-upload-text">
                  ç‚¹å‡»ä¸Šä¼ æˆ–拖拽文件至该区域进行上传
                </p>
                <p class="ant-upload-hint">
                  ä»…支持单文件上传
                </p>
              </a-upload-dragger>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
              label="文件名称"
            >
              <a-input
                :disabled="true "
                placeholder="请输入文件名称"
                v-decorator="['name', validatorRules.name ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:4}"
              :wrapperCol="{span:18}"
              label="文件描述"
            >
              <a-textarea
                :disabled="disableSubmit"
                placeholder="请输入文件描述"
                allow-clear
                v-decorator="['description', validatorRules.description]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import { getAction, postAction, postFileAction } from '@/api/manage'
import Vue from 'vue'
import JInput from '@/components/jeecg/JInput'
import Tooltip from 'ant-design-vue/es/tooltip'
import JEllipsis from "@/components/jeecg/JEllipsis";
import { ajaxGetDictItems } from '@/api/api'
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
export default {
  name: "UploadModel",
  components: {
    JInput,
    Tooltip,
    JEllipsis,
  },
  data() {
    return {
      title: "操作",
      visible: false,
      disableSubmit: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      headers: {},
      validatorRules: {
        num: {
          rules: [
            { required: true, message: '请输入编码!' },
            { min: 0, max: 150, message: '最长 30 ä¸ªå­—符', trigger: 'blur' },
          ]
        },
        fileType: {
          rules: [
            { required: true, message: '请输入选择类型!' },
          ]
        },
        name: {
          rules: [
            { required: true, message: '请输入名称!' },
          ]
        },
      },
      url: {
        add: "/eam/maintenanceStandardWorkInstruction/add",
        edit: "/eam/maintenanceStandardWorkInstruction/edit",
        listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType",
      },
      //用于展示文件
      fileList: [],
      fileObject: {},
      fileTypes: [],
      //用于判断附件的状态  add:新增页面的附件  edit:编辑页面的附件为被修改i   editUpdate:编辑页面的附件被修改
      isFileChange: false,
      uploadId: '',
      maintenanceStandardId: '',
    }
  },
  methods: {
    customRequest(val) {
      if (this.fileList.length == 0) {
        this.fileObject = val;
      }
    },
    handleChange(info) {
      //默认给附件状态,仅控制样式
      let file = info.file;
      //文件更改,标记更新
      if (this.model.id) {
        this.isFileChange = true;
      }
      //删除
      if (file.status == "removed") {
        this.fileList = [];
        this.fileObject.file = {};
        this.form.setFieldsValue({ name: '' });
        return false;
      }
      //单文件控制
      if (this.fileList.length > 0) {
        this.$message.warning("当前仅允许上传一个文件!");
        return false;
      }
      file.status = 'done';
      //页面展示上传文件
      this.fileList.push(file);
      this.form.setFieldsValue({ name: file.name });
    },
    add() {
      this.edit({})
    },
    edit(record) {
      let that = this;
      that.visible = true;
      that.isFileChange = false;
      that.model = Object.assign({}, record);
      that.fileList = [];
      that.form.resetFields();
      that.uploadId = ''
      if (record.isNoPhotoFlag) {
        //获取当前文件对应附件
        getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'maintenance_standard_work_instruction' }).then((res) => {
          if (res.success) {
            for (let i = 0; i < res.result.length; i++) {
              that.fileList.push({
                uid: res.result[i].upload.id,
                name: res.result[i].upload.name,
                status: "done",
              })
              that.$nextTick(() => {
                that.form.setFieldsValue({ name: res.result[i].upload.name });
              });
            }
          }
        })
      }
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      that.form.validateFields((err, values) => {
        if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) {
          that.$message.warning("请上传文件");
          return false
        }
        if (!err) {
          that.confirmLoading = true;
          let httpurl = ''
          let method = ''
          if (!that.model.id) {
            httpurl += that.url.add;
            method = 'post';
          } else {
            httpurl += that.url.edit;
            method = 'put';
          }
          let formData = Object.assign(that.model, values);
          formData.type = "maintenance_standard_work_instruction";
          formData.uploadId = that.uploadId;
          // formData.fileType = "7";//文件类型  7:图片
          formData.maintenanceStandardId = this.maintenanceStandardId;
          var saveDate = new FormData();
          formData.isFileChange = that.isFileChange;
          saveDate.append("file", that.fileObject.file);
          saveDate.append('data', JSON.stringify(formData));
          postFileAction(httpurl, saveDate, this.headers).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      }).catch((e) => { })
    },
    handleCancel() {
      this.close();
    },
    initFileTypes() {
      ajaxGetDictItems("common_upload_type", null).then((res) => {
        if (res.success) {
          this.fileTypes = res.result;
        }
      })
    },
  },
  created() {
    this.initFileTypes();
    const token = Vue.ls.get(ACCESS_TOKEN);
    const tenantid = Vue.ls.get(TENANT_ID)
    this.headers = {
      'Content-Type': 'multipart/form-data',
      "X-Access-Token": token,
      'X-Access-Tenant': tenantid
    };
  },
}
</script>
<style scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
</style>
src/views/eam/common/PlanSparePartSelect.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,234 @@
<template>
  <a-modal
    :title="title"
    :width="1000"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <!-- æŸ¥è¯¢åŒºåŸŸ -->
        <div class="table-page-search-wrapper">
          <a-form
            layout="inline"
            @keyup.enter.native="searchQuery"
          >
            <a-row :gutter="24">
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="备件编码">
                  <j-input
                    placeholder="请输入备件编码"
                    v-model="queryParam.num"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="备件名称">
                  <j-input
                    placeholder="请输入备件名称"
                    v-model="queryParam.name"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-button
                  type="primary"
                  @click="searchQuery"
                  icon="search"
                >查询</a-button>
                <a-button
                  @click="searchReset"
                  icon="reload"
                  style="margin-left:8px;"
                >重置</a-button>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="24">
              </a-col>
            </a-row>
          </a-form>
        </div>
        <div style="margin-top:8px;">
          <a-table
            ref="table"
            bordered
            size="middle"
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
            @change="handleTableChange"
            :customRow="clickThenCheck"
          >
          </a-table>
        </div>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JInput from '@/components/jeecg/JInput'
export default {
  name: "PlanSparePartSelectTable",
  mixins: [JeecgListMixin],
  components: {
    JInput
  },
  data() {
    return {
      title: "操作",
      visible: false,
      model: {},
      confirmLoading: false,
      form: this.$form.createForm(this),
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '备件编号',
          align: 'center',
          dataIndex: 'num',
          sorter: true,
        },
        {
          title: '备件名称',
          align: 'center',
          dataIndex: 'name',
          sorter: true,
        },
        {
          title: '备件规格',
          align: 'center',
          dataIndex: 'specification',
          sorter: true,
        },
        {
          title: '备件型号',
          align: 'center',
          dataIndex: 'model',
          sorter: true,
        },
        {
          title: '制造商',
          align: 'center',
          dataIndex: 'constructorId_dictText',
          sorter: true,
        },
        {
          title: '单位',
          align: 'center',
          dataIndex: 'mainUnitId_dictText',
          sorter: true,
        },
      ],
      url: {
        list: "/spare/sparePart/list",
      },
      index: '',
    }
  },
  methods: {
    searchQuery() {
      this.loadData(1);
    },
    list(index) {
      this.visible = true;
      this.index = index;
      this.loadData(1);
    },
    clickThenCheck(record) {
      return {
        on: {
          click: (e) => {
            this.selectedRowRecord = record;
            this.onSelectChange(record.id.split(","), [record]);
          }
        }
      };
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectedRowRecord = selectedRows[0];
    },
    close() {
      this.queryParam = {};
      this.$emit('close');
      this.visible = false;
      this.selectedRowKeys = [];
    },
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      if (that.selectedRowKeys.length > 0) {
        if (that.selectedRowRecord.id != null && that.selectedRowRecord.id != "") {
          that.$emit('sendSparePartRecord', { index: this.index, record: that.selectedRowRecord });
          that.close();
        } else {
          that.$message.error("请选择备件!")
        }
      } else {
        that.$message.error("请选择备件!")
      }
    },
    handleCancel() {
      this.close();
    },
  }
}
</script>
<style>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.fontweight {
  font-weight: bold;
}
.fontweightfrozen {
  font-weight: bold;
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
</style>
src/views/eam/common/RepairOrderDetailList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,228 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" v-if="mainId">
      <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="mainId !='' && isAdd "
      >新增</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record" >
          <a @click="handleEdit(record)" v-if="addStatus" >编辑</a>
          <a-divider type="vertical"  v-if="addStatus" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" >
            <a v-if="addStatus">删除</a>
          </a-popconfirm>
          <a style="font-size: 12px;font-style: italic;" v-if="!addStatus">该状态不可操作</a>
        </span>
      </a-table>
    </div>
    <repairOrderDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></repairOrderDetail-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import RepairOrderDetailModal from './RepairOrderDetailModal'
  export default {
    name: "RepairOrderDetailList",
    mixins:[JeecgListMixin],
    components: { RepairOrderDetailModal },
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      },
      maintenanceStandardId: {
        type: String,
        required: false
      },
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            this.queryParam['repairOrderId'] = val
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        disableMixinCreated:true,
        repairOrderSelectionRows:[],
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'部位',
            align:"center",
            dataIndex: 'location'
          },
          {
            title:'示意图',
            align:"center",
            scopedSlots: {customRender: 'imgSlot'},
            dataIndex: 'sketchMap'
          },
          // {
          //   title:'维修项目',
          //   align:"center",
          //   dataIndex: 'maintenanceItem'
          // },
          {
            title:'维修要求',
            align:"center",
            dataIndex: 'maintenanceRequire'
          },
          {
            title:'方法',
            align:"center",
            dataIndex: 'maintenanceWay'
          },
          {
            title:'工具',
            align:"center",
            dataIndex: 'maintenanceTooling'
          },
          {
            title:'安全要求',
            align:"center",
            dataIndex: 'safetyRequirement'
          },
          // {
          //   title:'维修周期',
          //   align:"center",
          //   dataIndex: 'repairCycle'
          // },
          {
            title:'工时定额',
            align:"center",
            dataIndex: 'timeQuota'
          },
          {
            title:'维保专业',
            align:"center",
            dataIndex: 'mamaintenanceSpecialtyId_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/eam/repairOrder/pageRepairOrderDetailByMainId",
          delete: "/eam/repairOrder/deleteRepairOrderDetail",
          deleteBatch: "/eam/repairOrder/deleteBatchRepairOrderDetail",
          exportXlsUrl: "/eam/repairOrder/exportRepairOrderDetail",
          importUrl: "/eam/repairOrder/importRepairOrderDetail",
        },
        dictOptions:{
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    mounted() {
    this.$bus.$on('repairOrderSelectionRows', (data) => {
      this.repairOrderSelectionRows = data
    })
  },
    methods: {
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/common/RepairOrderDetailModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,289 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model
        ref="form"
        :model="model"
        :rules="validatorRules"
      >
        <a-row>
          <a-col :span="24">
            <a-form-model-item
              label="部位"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="location"
            >
              <a-input
                v-model="model.location"
                placeholder="请输入部位"
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item
              label="示意图"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="sketchMap"
            >
              <j-image-upload
                :isMultiple="false"
                v-model="model.sketchMap"
              ></j-image-upload>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="24">
            <a-form-model-item
              label="维修项目"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="maintenanceItem"
            >
              <a-input
                v-model="model.maintenanceItem"
                placeholder="请输入维修项目"
              ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="24">
            <a-form-model-item
              label="维修要求"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="maintenanceRequire"
            >
              <a-input
                v-model="model.maintenanceRequire"
                placeholder="请输入维修要求"
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item
              label="方法"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="maintenanceWay"
            >
              <a-input
                v-model="model.maintenanceWay"
                placeholder="请输入维修方法"
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item
              label="工具"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="maintenanceTooling"
            >
              <a-input
                v-model="model.maintenanceTooling"
                placeholder="请输入维修工具"
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item
              label="安全要求"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="safetyRequirement"
            >
              <a-input
                v-model="model.safetyRequirement"
                placeholder="请输入安全要求"
              ></a-input>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="24">
            <a-form-model-item
              label="维修周期"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="repairCycle"
            >
              <a-input-number
                style="width: 100%"
                v-model="model.repairCycle"
                placeholder="请输入维修周期"
                :min="0"
                :max="99999"
              ></a-input-number>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="24">
            <a-form-model-item
              label="工时定额"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="timeQuota"
            >
              <a-input-number
                style="width: 100%"
                v-model="model.timeQuota"
                placeholder="请输入工时定额"
                :min="0"
                :max="99999"
              ></a-input-number>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item
              label="维保专业"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="mamaintenanceSpecialtyId"
            >
              <j-dict-select-tag
                placeholder="请选择维保专业"
                :triggerChange="true"
                dictCode="mom_eam_maintenance_specialty,name,id,del_flag!='1'"
                v-model="model.mamaintenanceSpecialtyId"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
  name: "RepairOrderDetailModal",
  components: {
  },
  props: {
    mainId: {
      type: String,
      required: false,
      default: ''
    }
  },
  data() {
    return {
      title: "操作",
      width: 800,
      visible: false,
      model: {
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      confirmLoading: false,
      validatorRules: {
        location: [
          { required: true, message: '请输入部位!' },
          { max: 32, message: '超过最大输入限制,请缩减长度' }
        ],
        sketchMap: [
          { required: true, message: '请上传!' },
        ],
        // maintenanceItem: [{ required: true, message: '请输入维修项目!' },
        // { max: 32, message: '超过最大输入限制,请缩减长度' }
        // ],
        maintenanceRequire: [{ required: true, message: '请输入维修要求!' },
        { max: 32, message: '超过最大输入限制,请缩减长度' }
        ],
        maintenanceTooling: [{ required: true, message: '请输入维修工具!' },
        { max: 32, message: '超过最大输入限制,请缩减长度' }
        ],
        safetyRequirement: [{ required: true, message: '请输入安全要求!' },
        { max: 32, message: '超过最大输入限制,请缩减长度' }
        ],
        timeQuota: [{ required: true, message: '请输入工时定额!' },
        ],
        // repairCycle: [{ required: true, message: '请输入维修周期!' }],
        // mamaintenanceSpecialtyId: [{ required: true, message: '请选择维保专业!' },
        // ],
        maintenanceWay: [{ required: true, message: '请输入方法!' },
        { max: 32, message: '超过最大输入限制,请缩减长度' }
        ],
      },
      url: {
        add: "/eam/repairOrder/addRepairOrderDetail",
        edit: "/eam/repairOrder/editRepairOrderDetail",
      }
    }
  },
  created() {
    //备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
  },
  methods: {
    add() {
      this.edit(this.modelDefault);
    },
    edit(record) {
      this.model = Object.assign({}, record);
      this.visible = true;
    },
    close() {
      this.$emit('close');
      this.visible = false;
      this.$refs.form.clearValidate();
    },
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          if (!this.model.id) {
            httpurl += this.url.add;
            method = 'post';
          } else {
            httpurl += this.url.edit;
            method = 'put';
          }
          this.model['repairOrderId'] = this.mainId
          httpAction(httpurl, this.model, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        } else {
          return false
        }
      })
    },
    handleCancel() {
      this.close()
    },
  }
}
</script>
src/views/eam/modules/predictiveWorkPlan/ParameterSelect.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,225 @@
<template>
  <a-modal
    :title="title"
    :width="1000"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <!-- æŸ¥è¯¢åŒºåŸŸ -->
        <div class="table-page-search-wrapper">
          <a-form
            layout="inline"
            @keyup.enter.native="searchQuery"
          >
            <a-row :gutter="24">
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="参数代码">
                  <j-input
                    placeholder="请输入参数代码"
                    v-model="queryParam.parameterCode"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="参数名称">
                  <j-input
                    placeholder="请输入参数名称"
                    v-model="queryParam.parameterName"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-button
                  type="primary"
                  @click="searchQuery"
                  icon="search"
                >查询
                </a-button>
                <a-button
                  @click="searchReset"
                  icon="reload"
                  style="margin-left:8px;"
                >重置
                </a-button>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="24">
              </a-col>
            </a-row>
          </a-form>
        </div>
        <div style="margin-top:8px;">
          <a-table
            ref="table"
            bordered
            size="middle"
            rowKey="parameterId"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="false"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
            @change="handleTableChange"
            :customRow="clickThenCheck"
          >
          </a-table>
        </div>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  export default {
    name: 'ParameterSelect',
    mixins: [JeecgListMixin],
    components: {
      JInput
    },
    data() {
      return {
        title: '操作',
        visible: false,
        model: {},
        confirmLoading: false,
        form: this.$form.createForm(this),
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 50,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '参数代码',
            dataIndex: 'parameterCode',
            align: 'center'
          },
          {
            title: '参数名称',
            dataIndex: 'parameterName',
            align: 'center'
          },
          {
            title: '表名',
            dataIndex: 'saveTableName',
            align: 'center'
          },
        ],
        url: {
          list: '/eam/predictiveworkplanparameter/listPredictiveWorkPlanParameter'
        }
      }
    },
    methods: {
      searchQuery() {
        this.loadData()
      },
      list(equipmentId) {
        this.queryParam.equipmentId = equipmentId
        this.visible = true
        this.loadData()
      },
      loadData() {
        let that = this
        getAction(this.url.list, this.queryParam).then((res) => {
          if (res.success) {
            that.dataSource = res.result
          }
        })
      },
      clickThenCheck(record) {
        return {
          on: {
            click: (e) => {
              this.selectedRowRecord = record
              this.onSelectChange(record.id.split(','), [record])
            }
          }
        }
      },
      onSelectChange(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectedRowRecord = selectedRows[0]
      },
      close() {
        this.queryParam = {}
        this.$emit('close')
        this.visible = false
        this.selectedRowKeys = []
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        if (that.selectedRowKeys.length > 0) {
          if (that.selectedRowRecord.parameterId != null && that.selectedRowRecord.parameterId != '') {
            that.$emit('sendParameter', { record: that.selectedRowRecord })
            that.close()
          } else {
            that.$message.error('请选择参数!')
          }
        } else {
          that.$message.error('请选择参数!')
        }
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style>
  @import '~@assets/less/common.less';
  .frozenRowClass {
    color: #c9c9c9;
  }
  .fontweight {
    font-weight: bold;
  }
  .fontweightfrozen {
    font-weight: bold;
    color: #c9c9c9;
  }
  .success {
    color: green;
  }
  .error {
    color: red;
  }
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveParameterModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,281 @@
<template>
  <a-modal
    :title="title"
    :width="900"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row style="width: 100%">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="条件"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请选择条件'"
                :triggerChange="true"
                dictCode="conditional_relation"
                v-decorator="['parameterCondition', validatorRules.parameterCondition]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="参数代码"
            >
              <a-input-search
                placeholder="请选择参数代码"
                enter-button
                @search="onSearchParameterCode()"
                v-decorator="['parameterCode',validatorRules.parameterCode]"
                :read-only="true"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="参数名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['parameterName', validatorRules.parameterName]"
                       placeholder="请输入参数名称"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="表名" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['saveTableName', validatorRules.saveTableName]"
                       placeholder="请输入表名"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-model-item label='参数单位' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='mainUnitId'>
              <j-dict-select-tag
                allow-clear
                :placeholder="'请选择参数单位'"
                v-model='model.parameterUnit'
                dictCode="mom_base_unit,name,id,del_flag!='1'"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="参数上限值" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number
                style="width: 100%"
                placeholder="请输入参数上限值"
                v-decorator="['upperLimitValue', validatorRules.upperLimitValue]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="参数下限值" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number
                style="width: 100%"
                placeholder="请输入参数下限值"
                v-decorator="['lowerLimitValue', validatorRules.lowerLimitValue]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel"
      >
        å…³é—­
      </a-button>
      <a-button
        :disabled="disableSubmit || confirmLoading"
        :loading="confirmLoading"
        @click="handleOk"
        type="primary"
      >确定
      </a-button>
    </template>
    <parameter-select ref="parameterSelect" @sendParameter='sendParameter'></parameter-select>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import { postAction, requestPut } from '@/api/manage'
  import ParameterSelect from './ParameterSelect'
  export default {
    name: 'PredictiveSparePartsModal',
    components: {
      ParameterSelect
    },
    data() {
      return {
        title: '操作',
        visible: false,
        codeDisable: true,
        disableSubmit: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          parameterCondition: {
            rules: [
              { required: true, message: '请选择条件!' }
            ]
          },
          parameterCode: {
            rules: [
              { required: true, message: '请输入参数代码!' }
            ]
          },
          upperLimitValue: {
            rules: [
              { required: true, message: '请输入参数上限值!' }
            ]
          },
          lowerLimitValue: {
            rules: [
              { required: true, message: '请输入参数下限值!' }
            ]
          }
        },
        url: {
          add: '/eam/predictiveworkplanparameter/add',
          edit: '/eam/predictiveworkplanparameter/edit'
        },
        //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
        alterFlag: '',
        planId: '',
        equipmentId: ''
      }
    },
    created() {
    },
    methods: {
      add() {
        this.edit({})
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.disableSubmit = false
        this.model.sparePartId = record.sparePartId
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,
            'sparePartNum',
            'sparePartName',
            'sparePartModel',
            'sparePartSpecification',
            'mainUnitName',
            'constructorName',
            'supportingQuantity',
            'ratedLife',
            'lifeWarning'))
        })
        if (record.id) {
          this.codeDisable = true
        } else {
          this.codeDisable = false
        }
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      //保存并新增按钮触发
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            formData.workPlanId = this.planId
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, { id: this.model.id })
            }
            obj.then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
                that.alterFlag = new Date()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      onSearchParameterCode() {
        this.$refs.parameterSelect.list(this.equipmentId)
        this.$refs.parameterSelect.title = '选择备件'
      },
      sendParameter(data) {
        let record = data.record
        this.model.parameterId = record.parameterId
        this.form.setFieldsValue({
          parameterName: record.parameterName,
          parameterCode: record.parameterCode,
          saveTableName: record.saveTableName
        })
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveParameters.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,194 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="planId != '' && isAdd "
    >新增
    </a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <predictive-parameter-modal ref="modalForm" @ok="modalFormOk"></predictive-parameter-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { deleteAction } from '@/api/manage'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import PredictiveParameterModal from './PredictiveParameterModal'
  export default {
    name: 'PredictiveParameters',
    components: {
      Tooltip,
      PredictiveParameterModal
    },
    mixins: [JeecgListMixin],
    props: {
      planId: {
        type: String,
        required: false
      },
      equipmentId: {
        type: String,
        required: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
    },
    watch: {
      planId: function(val) {
        this.clearList()
        if (this.planId) {
          this.queryParam.planId = val
          this.queryParam.delFlag = 0
          this.loadData(1)
        }
      }
    },
    data() {
      return {
        disableMixinCreated: true,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '条件',
            dataIndex: 'conditionalRelationName',
            align: 'center'
          },
          {
            title: '参数代码',
            dataIndex: 'parameterCode',
            align: 'center'
          },
          {
            title: '参数名称',
            dataIndex: 'parameterName',
            align: 'center'
          },
          {
            title: '参数单位',
            dataIndex: 'unitName',
            align: 'center'
          },
          {
            title: '参数上限',
            dataIndex: 'upperLimitValue',
            align: 'center'
          },
          {
            title: '参数下限',
            dataIndex: 'lowerLimitValue',
            align: 'center'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 250,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/eam/predictiveworkplanparameter/pagePredictiveWorkPlanParameter',
          delete: '/eam/predictiveworkplanparameter/delete'
        }
      }
    },
    methods: {
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '参数控制'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.planId = this.planId
        this.$refs.modalForm.equipmentId = this.equipmentId
      },
      handleDelete: function(id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message)
            that.loadData()
            that.alterFlag = new Date()
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveSpareParts.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,204 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="planId != '' && isAdd "
    >新增
    </a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <predictive-spare-parts-modal ref="modalForm" @ok="modalFormOk"></predictive-spare-parts-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction, deleteAction } from '@/api/manage'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import PredictiveSparePartsModal from './PredictiveSparePartsModal'
  export default {
    name: 'PredictiveSpareParts',
    components: {
      Tooltip,
      PredictiveSparePartsModal
    },
    mixins: [JeecgListMixin],
    props: {
      planId: {
        type: String,
        required: false
      },
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
    },
    watch: {
      planId: function(val) {
        this.clearList()
        if (this.planId) {
          this.queryParam.planId = val
          this.queryParam.delFlag = 0
          this.loadData(1)
        }
      }
    },
    data() {
      return {
        disableMixinCreated: true,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '备件编号',
            dataIndex: 'sparePartNum',
            align: 'center'
          },
          {
            title: '备件名称',
            dataIndex: 'sparePartName',
            align: 'center'
          },
          {
            title: '备件规格',
            dataIndex: 'sparePartSpecification',
            align: 'center'
          },
          {
            title: '备件型号',
            dataIndex: 'sparePartModel',
            align: 'center'
          },
          {
            title: '单位',
            dataIndex: 'mainUnitName',
            align: 'center'
          },
          {
            title: '配套数量',
            dataIndex: 'supportingQuantity',
            align: 'center'
          },
          {
            title: '额定寿命/小时',
            dataIndex: 'ratedLife',
            align: 'center'
          },
          {
            title: '寿命控制限',
            dataIndex: 'lifeWarning',
            align: 'center'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 250,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/eam/predictiveworkplansparepart/pagePredictiveWorkPlanSparePart',
          delete: '/eam/predictiveworkplansparepart/delete'
        }
      }
    },
    methods: {
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '计划用料'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.planId = this.planId
      },
      handleDelete: function(id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message)
            that.loadData()
            that.alterFlag = new Date()
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveSparePartsModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,302 @@
<template>
  <a-modal
    :title="title"
    :width="900"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row style="width: 100%">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="备件编号"
            >
              <a-input-search
                placeholder="请选择备件"
                enter-button
                @search="onSearchSparePart()"
                v-decorator="['sparePartNum',validatorRules.sparePartNum]"
                :read-only="true"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="备件名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['sparePartName', validatorRules.sparePartName]"
                       placeholder="请输入设备名称"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="备件型号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['sparePartModel', validatorRules.sparePartModel]"
                       placeholder="请输入设备型号"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="备件规格" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['sparePartSpecification', validatorRules.sparePartSpecification]"
                       placeholder="请输入设备规格"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="制造商" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['constructorName', validatorRules.constructorName]"
                       placeholder="请输入制造商"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['mainUnitName', validatorRules.mainUnitName]"
                       placeholder="请输入单位"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item
              :labelCol="labelCol" :wrapperCol="wrapperCol"
              label="配套数量"
            >
              <a-input-number
                style="width: 100%"
                placeholder="请输入配套数量"
                v-decorator="['supportingQuantity', validatorRules.supportingQuantity]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item
              :labelCol="labelCol" :wrapperCol="wrapperCol"
              label="额定寿命/小时"
            >
              <a-input-number
                style="width: 100%"
                placeholder="请输入额定寿命/小时"
                v-decorator="['ratedLife', validatorRules.ratedLife]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item
              :labelCol="labelCol" :wrapperCol="wrapperCol"
              label="寿命控制限"
            >
              <a-input-number
                style="width: 100%"
                placeholder="请输入寿命控制限"
                v-decorator="['lifeWarning', validatorRules.lifeWarning]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel"
      >
        å…³é—­
      </a-button>
      <a-button
        :disabled="disableSubmit || confirmLoading"
        :loading="confirmLoading"
        @click="handleOk"
        type="primary"
      >确定
      </a-button>
    </template>
    <plan-spare-part-select ref="planSparePartSelect"
                            @sendSparePartRecord='sendSparePartRecord'></plan-spare-part-select>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import { postAction, requestPut } from '@/api/manage'
  import PlanSparePartSelect from '@/views/eam/common/PlanSparePartSelect'
  export default {
    name: 'PredictiveSparePartsModal',
    components: {
      PlanSparePartSelect
    },
    props: {
      mainId: {
        type: String,
        required: false,
        default: ''
      }
    },
    data() {
      return {
        title: '操作',
        visible: false,
        codeDisable: true,
        disableSubmit: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          sparePartName: {
            rules: [
              { required: true, message: '请选择备件!' }
            ]
          },
          supportingQuantity: {
            rules: [
              { required: true, message: '请输入配套数量!' }
            ]
          },
          ratedLife: {
            rules: [
              { required: true, message: '请输入额定寿命/小时!' }
            ]
          },
          lifeWarning: {
            rules: [
              { required: true, message: '请输入寿命控制限/小时!' }
            ]
          }
        },
        url: {
          add: '/eam/predictiveworkplansparepart/add',
          edit: '/eam/predictiveworkplansparepart/edit'
        },
        //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
        alterFlag: '',
        planId: ''
      }
    },
    created() {
    },
    methods: {
      add() {
        this.edit({})
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.disableSubmit = false
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,
            'sparePartNum',
            'sparePartName',
            'sparePartModel',
            'sparePartSpecification',
            'mainUnitName',
            'constructorName',
            'supportingQuantity',
            'ratedLife',
            'lifeWarning'))
        })
        if (record.id) {
          this.codeDisable = true
        } else {
          this.codeDisable = false
        }
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      //保存并新增按钮触发
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            formData.workPlanId = this.planId
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, { id: this.model.id })
            }
            obj.then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
                that.alterFlag = new Date()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      onSearchSparePart() {
        this.$refs.planSparePartSelect.list()
        this.$refs.planSparePartSelect.title = '选择备件'
      },
      sendSparePartRecord(data) {
        let record = data.record
        this.model.sparePartId = record.id
        this.form.setFieldsValue({
          sparePartId: record.id,
          sparePartNum: record.num,
          sparePartName: record.name,
          sparePartModel: record.model,
          sparePartSpecification: record.specification,
          mainUnitId: record.mainUnitId,
          mainUnitName: record.mainUnitId_dictText,
          constructorName: record.constructorId_dictText
        })
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveWarn.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,194 @@
<template>
  <a-card
    :bordered="false"
    :class="'cust-erp-sub-tab'"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <a-button
      @click="handleAdd"
      type="primary"
      icon="plus"
      v-if="planId != '' && isAdd "
    >新增
    </a-button>
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定删除吗?"
            @confirm="() => handleDelete(record.id)"
          >
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <predictive-warn-modal ref="modalForm" @ok="modalFormOk"></predictive-warn-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { deleteAction } from '@/api/manage'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import PredictiveWarnModal from './PredictiveWarnModal'
  export default {
    name: 'PredictiveWarn',
    components: {
      Tooltip,
      PredictiveWarnModal
    },
    mixins: [JeecgListMixin],
    props: {
      planId: {
        type: String,
        required: false
      },
      equipmentId: {
        type: String,
        required: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      isDel: {
        type: Boolean,
        default: false
      }
    },
    mounted() {
    },
    watch: {
      planId: function(val) {
        this.clearList()
        if (this.planId) {
          this.queryParam.planId = val
          this.queryParam.delFlag = 0
          this.loadData(1)
        }
      }
    },
    data() {
      return {
        disableMixinCreated: true,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '条件',
            dataIndex: 'conditionalRelationName',
            align: 'center'
          },
          {
            title: '报警代码',
            dataIndex: 'warnCode',
            align: 'center'
          },
          {
            title: '报警名称',
            dataIndex: 'warnName',
            align: 'center'
          },
          {
            title: '报警周期',
            dataIndex: 'warnCycle',
            align: 'center'
          },
          {
            title: '报警周期单位',
            dataIndex: 'cycleUnitName',
            align: 'center'
          },
          {
            title: '报警次数',
            dataIndex: 'times',
            align: 'center'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            fixed: 'right',
            width: 250,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: '/eam/predictiveworkplanwarn/pagePredictiveWorkPlanWarn',
          delete: '/eam/predictiveworkplanwarn/delete'
        }
      }
    },
    methods: {
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '报警控制'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.planId = this.planId
        this.$refs.modalForm.equipmentId = this.equipmentId
      },
      handleDelete: function(id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        var that = this
        deleteAction(that.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message)
            that.loadData()
            that.alterFlag = new Date()
          } else {
            that.$message.warning(res.message)
          }
        })
      },
      clearList() {
        this.dataSource = []
        this.selectedRowKeys = []
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveWarnModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,277 @@
<template>
  <a-modal
    :title="title"
    :width="900"
    :visible="visible"
    :maskClosable="false"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row style="width: 100%">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="条件"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请选择条件'"
                :triggerChange="true"
                dictCode="conditional_relation"
                v-decorator="['parameterCondition', validatorRules.parameterCondition]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="报警代码"
            >
              <a-input-search
                placeholder="请选择报警代码"
                enter-button
                @search="onSearchWarnCode()"
                v-decorator="['warnCode',validatorRules.warnCode]"
                :read-only="true"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="报警名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['warnName', validatorRules.warnName]"
                       placeholder="请输入报警名称"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="报警周期" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number
                style="width: 100%"
                placeholder="请输入报警周期"
                v-decorator="['warnCycle', validatorRules.warnCycle]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-model-item label='报警周期单位' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='mainUnitId'>
              <j-dict-select-tag
                allow-clear
                :placeholder="'请选择报警周期单位'"
                v-decorator="['cycleUnit', validatorRules.cycleUnit]"
                dictCode="warn_cycle_unit"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24/2">
            <a-form-item label="报警次数" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number
                style="width: 100%"
                placeholder="请输入报警次数"
                v-decorator="['times', validatorRules.times]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel"
      >
        å…³é—­
      </a-button>
      <a-button
        :disabled="disableSubmit || confirmLoading"
        :loading="confirmLoading"
        @click="handleOk"
        type="primary"
      >确定
      </a-button>
    </template>
    <warn-select ref="warnSelect" @sendWarn='sendWarn'></warn-select>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import { postAction, requestPut } from '@/api/manage'
  import WarnSelect from './WarnSelect'
  export default {
    name: 'PredictiveWarnModal',
    components: {
      WarnSelect
    },
    data() {
      return {
        title: '操作',
        visible: false,
        codeDisable: true,
        disableSubmit: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          parameterCondition: {
            rules: [
              { required: true, message: '请选择条件!' }
            ]
          },
          warnCode: {
            rules: [
              { required: true, message: '请输入报警代码!' }
            ]
          },
          warnCycle: {
            rules: [
              { required: true, message: '请输入报警周期!' }
            ]
          },
          cycleUnit: {
            rules: [
              { required: true, message: '请选择报警周期单位!' }
            ]
          },
          times: {
            rules: [
              { required: true, message: '请输入报警次数!' }
            ]
          }
        },
        url: {
          add: '/eam/predictiveworkplanwarn/add',
          edit: '/eam/predictiveworkplanwarn/edit'
        },
        //新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
        alterFlag: '',
        planId: '',
        equipmentId: ''
      }
    },
    created() {
    },
    methods: {
      add() {
        this.edit({})
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.disableSubmit = false
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,
            'sparePartNum',
            'sparePartName',
            'sparePartModel',
            'sparePartSpecification',
            'mainUnitName',
            'constructorName',
            'supportingQuantity',
            'ratedLife',
            'lifeWarning'))
        })
        if (record.id) {
          this.codeDisable = true
        } else {
          this.codeDisable = false
        }
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      //保存并新增按钮触发
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            formData.workPlanId = this.planId
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, { id: this.model.id })
            }
            obj.then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
                that.alterFlag = new Date()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      onSearchWarnCode() {
        this.$refs.warnSelect.list(this.equipmentId)
        this.$refs.warnSelect.title = '选择备件'
      },
      sendWarn(data) {
        let record = data.record
        this.model.warnId = record.warnCode
        this.model.mdcEquipmentId = record.mdcEquipmentId
        this.form.setFieldsValue({
          warnCode: record.warnCode,
          warnName: record.warnName
        })
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/eam/modules/predictiveWorkPlan/PredictiveWorkPlanModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,448 @@
<template>
  <a-modal
    :title="title"
    :width="1500"
    :visible="visible"
    :maskClosable="false"
    @ok="handleOk"
    cancelText="关闭"
    @cancel="handleCancel"
    :confirmLoading="confirmLoading"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              label="方案编码"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input
                allowClear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请输入方案编码'"
                v-decorator="[ 'num', validatorRules.num]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              label="方案名称"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input
                allowClear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请输入方案名称'"
                v-decorator="[ 'name', validatorRules.name]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              label="监控类型"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请选择监控类型'"
                :triggerChange="true"
                dictCode="monitor_type"
                v-decorator="['monitorType', validatorRules.monitorType]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              label="设备名称"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input-search
                :disabled="disableSubmit"
                placeholder="请选择设备"
                enter-button
                @search="onEquipmentList()"
                :read-only="true"
                v-decorator="['equipmentName', validatorRules.equipmentName]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              label="维保方式"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请选择维保方式'"
                :triggerChange="true"
                dictCode="maintenance_method"
                v-decorator="['maintenanceMethod', validatorRules.maintenanceMethod]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              label="派工方式"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <j-dict-select-tag
                allow-clear
                :disabled="disableSubmit"
                :placeholder="disableSubmit?'':'请选择派工方式'"
                :triggerChange="true"
                dictCode="assign_mode"
                v-decorator="['assignMode', validatorRules.assignMode]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              label="责任班组"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input
                allow-clear
                :disabled="true"
                :placeholder="disableSubmit?'':'请输入责任班组'"
                v-decorator="['teamName', {} ]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              label="版本"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input
                allowClear
                :disabled="true"
                :placeholder="disableSubmit?'':'请输入版本号'"
                v-decorator="[ 'planVersion', validatorRules.planVersion]"
              />
            </a-form-item>
          </a-col>
          <a-col
            v-if="this.isRevise == true"
            :span="12"
          >
            <a-form-item
              label="历史版本"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <a-input
                allowClear
                :disabled="true"
                :placeholder="disableSubmit?'':'请输入历史版本号'"
                v-decorator="[ 'historyVersion', validatorRules.historyVersion]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <template slot="footer">
      <a-button
        :style="{marginRight: '8px'}"
        @click="handleCancel()"
      >
        å…³é—­
      </a-button>
      <a-button
        @click="handleOk()"
        type="primary"
        :loading="confirmLoading"
      >确定
      </a-button>
    </template>
    <equipment-list
      ref="EquipmentList"
      @sendEquipmentRecord='sendEquipmentRecord'
    ></equipment-list>
    <!--    <j-select-maintenance-standard-modal ref="maintenanceStandardModalForm"></j-select-maintenance-standard-modal>-->
  </a-modal>
</template>
<script>
  import { getAction, postAction, requestPut, deleteAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
  import { duplicateCheck } from '@/api/api'
  import Tooltip from 'ant-design-vue/es/tooltip'
  // import JSelectMaintenanceStandardModal from './JSelectMaintenanceStandardModal'
  import { preview } from 'vue-photo-preview'
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  import Vue from 'vue'
  import PdfView from '@views/common/PdfView'
  import { getFileAccessHttpUrl } from '@/api/manage'
  import EquipmentList from '.././dailyInspectionStandard/EquipmentList'
  export default {
    name: 'MaintenanceStandardModal',
    components: {
      JMultiSelectTag,
      Tooltip,
      // JSelectMaintenanceStandardModal,
      // UploadModel,
      PdfView,
      preview,
      EquipmentList
    },
    data() {
      return {title: '操作',
        visible: false,
        visible4Confirm: false,
        disableSubmit: false,
        codeDisable: true,
        isRevise: false,
        model: {},
        upload: {},
        treeData: [],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 18 }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          num: {
            rules: [
              { required: true, message: '请输入编码!' }
            ]
          },
          teamName: {
            rules: [
              { required: true, message: '请选择责任班组!' }
            ]
          },
          useDepartName: {
            rules: [
              { required: true, message: '请选择对象部门!' }
            ]
          },
          equipmentName: {
            rules: [
              { required: true, message: '请选择设备!' }
            ]
          },
          assignMode: {
            rules: [
              { required: true, message: '请选择派工方式!' }
            ]
          },
          version: {
            rules: [
              { required: true, message: '请输入版本!' }
            ]
          },
          historyVersion: {
            rules: [
              { required: true, message: '请输入历史版本!' }
            ]
          }
        },
        url: {
          list: '/eam/maintenanceStandardDetail/getMaintenanceStandardDetailListByIds',
          add: '/eam/predictiveworkplan/add',
          edit: '/eam/predictiveworkplan/edit',
          addDetail: '/eam/maintenanceStandardDetail/add',
          revise: '/eam/maintenanceStandard/revise',
          getReviseVersion: '/eam/maintenanceStandard/getReviseVersion',
          loadOptions: '/sys/sysDepart/loadDepartTreeOptions'
        },
        dataSource: [],
        departId: ''
      }
    },
    mounted() {
    },
    created() {
    },
    methods: {
      add() {
        this.edit({ maintenanceStandardDetaillist: [] })
      },
      edit(record) {
        let that = this
        this.initOptions()
        this.dataSource = []
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        if (record.maintenanceStandardDetaillist != undefined) {
          const temp = [...record.maintenanceStandardDetaillist]
          // for (let i = 0; i < temp.length; i++) {
          //   let r = temp[i].upload;
          //   r.src = this.getSrc(temp[i].upload);
          // }
          that.dataSource = temp
        }
        that.$nextTick(() => {
          that.model.equipmentId = record.id
          that.model.teamId = record.teamId
          if (!record.status) {
            that.model.status = 1
          }
          that.form.setFieldsValue(pick(that.model, 'num', 'equipmentName', 'useDepartName', 'teamName', 'assignMode', 'planVersion', 'remark'))
        })
        if (record.id) {
          this.codeDisable = true
          that.$nextTick(() => {
            if (that.isRevise) {
              requestPut(that.url.getReviseVersion, record).then((res) => {
                if (res.success) {
                  that.form.setFieldsValue({ planVersion: res.result, historyVersion: record.version })
                }
              })
            }
          }, 200)
        } else {
          this.codeDisable = false
          that.$nextTick(() => {
            that.form.setFieldsValue({ 'planVersion': '1.0' })
          })
        }
      },
      initOptions() {
        getAction(this.url.loadOptions).then(res => {
          if (res.success) {
            this.treeData = res.result
          } else {
            this.$message.warning(res.message)
          }
        })
      },
      onEquipmentList() {
        this.$refs.EquipmentList.list()
        this.$refs.EquipmentList.title = '选择设备信息'
      },
      sendEquipmentRecord(data) {
        this.dataSource = []
        let record = data.record
        this.model.equipmentId = record.id
        this.model.teamId = record.teamId
        this.form.setFieldsValue({
          equipmentName: record.num + '/' + record.name + '/' + record.model,
          teamName: record.teamId_dictText
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      handleOk() {
        const that = this
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let obj
            if (!this.model.id) {
              formData.planVersion = '1'
              obj = postAction(this.url.add, formData)
            } else {
              if (this.isRevise) {
                formData.planVersion = '1'
                obj = postAction(this.url.revise, formData)
              } else {
                obj = requestPut(this.url.edit, formData, { id: this.model.id })
              }
            }
            obj.then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      getUuiD(randomLength) {
        return Number(
          Math.random()
            .toString()
            .substr(2, randomLength) + Date.now()
        ).toString(36)
      }
    }
  }
</script>
<style lang="less" scoped>
  /deep/ .frozenRowClass {
    color: #c9c9c9;
  }
  .fontweight {
    font-weight: bold;
  }
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/eam/modules/predictiveWorkPlan/WarnSelect.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,220 @@
<template>
  <a-modal
    :title="title"
    :width="1000"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <!-- æŸ¥è¯¢åŒºåŸŸ -->
        <div class="table-page-search-wrapper">
          <a-form
            layout="inline"
            @keyup.enter.native="searchQuery"
          >
            <a-row :gutter="24">
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="报警代码">
                  <j-input
                    placeholder="请输入报警代码"
                    v-model="queryParam.warnCode"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-form-item label="报警名称">
                  <j-input
                    placeholder="请输入报警名称"
                    v-model="queryParam.warnName"
                  ></j-input>
                </a-form-item>
              </a-col>
              <a-col
                :md="6"
                :sm="8"
              >
                <a-button
                  type="primary"
                  @click="searchQuery"
                  icon="search"
                >查询
                </a-button>
                <a-button
                  @click="searchReset"
                  icon="reload"
                  style="margin-left:8px;"
                >重置
                </a-button>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :span="24">
              </a-col>
            </a-row>
          </a-form>
        </div>
        <div style="margin-top:8px;">
          <a-table
            ref="table"
            bordered
            size="middle"
            rowKey="warnCode"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="false"
            :loading="loading"
            :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"
            @change="handleTableChange"
            :customRow="clickThenCheck"
          >
          </a-table>
        </div>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  export default {
    name: 'WarnSelect',
    mixins: [JeecgListMixin],
    components: {
      JInput
    },
    data() {
      return {
        title: '操作',
        visible: false,
        model: {},
        confirmLoading: false,
        form: this.$form.createForm(this),
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 50,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '报警代码',
            dataIndex: 'warnCode',
            align: 'center'
          },
          {
            title: '报警名称',
            dataIndex: 'warnName',
            align: 'center'
          },
        ],
        url: {
          list: '/eam/predictiveworkplanwarn/listPredictiveWorkPlanWarn'
        }
      }
    },
    methods: {
      searchQuery() {
        this.loadData()
      },
      list(equipmentId) {
        this.queryParam.equipmentId = equipmentId
        this.visible = true
        this.loadData()
      },
      loadData() {
        let that = this
        getAction(this.url.list, this.queryParam).then((res) => {
          if (res.success) {
            that.dataSource = res.result
          }
        })
      },
      clickThenCheck(record) {
        return {
          on: {
            click: (e) => {
              this.selectedRowRecord = record
              this.onSelectChange(record.id.split(','), [record])
            }
          }
        }
      },
      onSelectChange(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectedRowRecord = selectedRows[0]
      },
      close() {
        this.queryParam = {}
        this.$emit('close')
        this.visible = false
        this.selectedRowKeys = []
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        if (that.selectedRowKeys.length > 0) {
          if (that.selectedRowRecord.warnCode != null && that.selectedRowRecord.warnCode != '') {
            that.$emit('sendWarn', { record: that.selectedRowRecord })
            that.close()
          } else {
            that.$message.error('请选择参数!')
          }
        } else {
          that.$message.error('请选择参数!')
        }
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>
<style>
  @import '~@assets/less/common.less';
  .frozenRowClass {
    color: #c9c9c9;
  }
  .fontweight {
    font-weight: bold;
  }
  .fontweightfrozen {
    font-weight: bold;
    color: #c9c9c9;
  }
  .success {
    color: green;
  }
  .error {
    color: red;
  }
</style>