Sfoglia il codice sorgente

设备状态记录+停机记录

xiongchao 3 anni fa
parent
commit
a62ae46331

+ 128 - 0
src/api/sb/status-log.js

@@ -0,0 +1,128 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getSbStatusLogPage (parameter) {
+    return axios({
+        url: '/sb/status-logs/page?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addSbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs',
+        method: 'POST',
+        headers: {
+            'Accept': 'application/json',
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        data: parameter
+    })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateSbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs/' + parameter.id,
+        method: 'PUT',
+        data: parameter
+    })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchSbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs/' + parameter.id,
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function querySbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteSbStatusLogs (parameter) {
+    return axios({
+        url: '/sb/status-logs',
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteSbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs/' + parameter.id,
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportSbStatusLog (parameter) {
+    return axios({
+        url: '/sb/status-logs/export?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        responseType: 'blob'
+    })
+}

+ 128 - 0
src/api/sb/stop-logs.js

@@ -0,0 +1,128 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getSbStopLogPage (parameter) {
+    return axios({
+        url: '/sb/stop-logs/page?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addSbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs',
+        method: 'POST',
+        headers: {
+            'Accept': 'application/json',
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        data: parameter
+    })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateSbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs/' + parameter.id,
+        method: 'PUT',
+        data: parameter
+    })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchSbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs/' + parameter.id,
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function querySbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        }
+    })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteSbStopLogs (parameter) {
+    return axios({
+        url: '/sb/stop-logs',
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteSbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs/' + parameter.id,
+        method: 'DELETE',
+        data: parameter
+    })
+}
+
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportSbStopLog (parameter) {
+    return axios({
+        url: '/sb/stop-logs/export?' + stringify(parameter),
+        method: 'get',
+        headers: {
+            'Content-Type': 'application/json;charset=UTF-8'
+        },
+        responseType: 'blob'
+    })
+}

+ 5 - 1
src/router/generator-platform-routers.js

@@ -286,7 +286,11 @@ const constantRouterComponents = {
   'SbStoreCheckPlan': () => import('@/views/sb/storecheckplan/StoreCheckPlan'),
   'SbStoreCheckJob': () => import('@/views/sb/storecheckjob/StoreCheckJob'),
   // 保养任务日程表
-  'CheckJobCalendar': () => import('@/views/check/checkjob/CheckJobCalendar')
+  'CheckJobCalendar': () => import('@/views/check/checkjob/CheckJobCalendar'),
+  // 设备状态变更表
+  'SbStatusLog': () => import('@/views/sb/status-log/SbStatusLog'),
+  // 设备停机记录表
+  'SbStopLog': () => import('@/views/sb/stop-logs/SbStopLog'),
 }
 
 // 前端未找到页面路由(固定不用改)

+ 8 - 8
src/utils/dict.js

@@ -1162,14 +1162,14 @@ DictCache.COLOR = {
    * 设备状态
    */
   SB_INFO_STATUS: {
-    1: 'green', // 在库
-    2: 'blue', // 使用中
-    3: 'orange', // 报废中
-    4: 'red', // 已报废
-    5: 'cran', // 置换中
-    6: 'geekblue', // 已置换
-    7: 'gold', // 停用中
-    8: 'blue' // 维修中
+    1: 'default', // 在库
+    2: 'success', // 使用中
+    3: 'default', // 报废中
+    4: 'default', // 已报废
+    5: 'warning', // 置换中
+    6: 'default', // 已置换
+    7: 'error', // 停用中
+    8: 'error' // 维修中
   },
   /**
    * 备件状态

+ 2 - 3
src/views/sb/info/MeasureSbInfo.vue

@@ -122,7 +122,7 @@
 
 <script>
 import { STable, Ellipsis } from '@/components'
-import BaseForm from './modules/BaseForm'
+/*import BaseForm from './modules/BaseForm'*/
 import BaseFormMeasureRelation from './modules/BaseFormMeasureRelation'
 /*import Detail from './modules/Detail'*/
 import Detail from './modules/DetailMeasureRelation'
@@ -139,7 +139,6 @@ export default {
   components: {
     STable,
     Ellipsis,
-    BaseForm,
     BaseFormMeasureRelation,
     Detail,
     DownloadModal,
@@ -334,7 +333,7 @@ export default {
     handleEdit (record) {
       fetchSbInfo({ id: record.id }).then(res => {
         this.visible = false
-        const modal = this.$refs.baseModal
+        const modal = this.$refs.baseModalMeasureRelation
         modal.base(res.data)
       })
     },

+ 6 - 4
src/views/sb/info/MeasureSbInfoWarn.vue

@@ -108,7 +108,8 @@
 
       </a-col>
     </a-row>
-    <base-form ref="baseModal" :useType="4" @ok="handleOk"/>
+    <!--    <base-form ref="baseModal" :useType="4" @ok="handleOk"/>-->
+    <base-form-measure-relation ref="baseModalMeasureRelation" :useType="4" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
     <download-modal ref="downloadModal"/>
     <preview-modal ref="previewModal"/>
@@ -120,7 +121,8 @@
 
 <script>
 import { STable, Ellipsis } from '@/components'
-import BaseForm from './modules/BaseForm'
+/*import BaseForm from './modules/BaseForm'*/
+import BaseFormMeasureRelation from './modules/BaseFormMeasureRelation'
 /*import Detail from './modules/Detail'*/
 import Detail from './modules/DetailMeasureRelation'
 import DownloadModal from '@/views/download/DownloadModal'
@@ -136,7 +138,7 @@ export default {
   components: {
     STable,
     Ellipsis,
-    BaseForm,
+    BaseFormMeasureRelation,
     Detail,
     DownloadModal,
     PreviewModal,
@@ -330,7 +332,7 @@ export default {
     handleEdit (record) {
       fetchSbInfo({ id: record.id }).then(res => {
         this.visible = false
-        const modal = this.$refs.baseModal
+        const modal = this.$refs.baseModalMeasureRelation
         modal.base(res.data)
       })
     },

+ 48 - 0
src/views/sb/modelbom/modules/BaseForm.vue

@@ -78,6 +78,50 @@
               v-decorator="['num', {initialValue:1, rules: [{required: true, message: '数量不能为空'}]}]" />
           </a-form-item>
         </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="更换日期"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-decorator="['checkDate']" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="下次更换日期"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-decorator="['nextCheckDate']" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="更换里程/台时"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['changeNum']" />
+          </a-form-item>
+        </a-col>
+        <a-col :lg="12" :md="24" :sm="24">
+          <a-form-item
+            label="下次更换里程/台时"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['nextChangeNum']" />
+          </a-form-item>
+        </a-col>
       </a-row>
     </a-form>
 
@@ -153,6 +197,10 @@ export default {
           'id',
           'modelId',
           'spareId',
+          'checkDate',
+          'nextCheckDate',
+          'changeNum',
+          'nextChangeNum',
           'spareName',
           'period',
           'periodType',

+ 8 - 0
src/views/sb/modelbom/modules/Detail.vue

@@ -127,6 +127,14 @@ export default {
           title: '数量',
           dataIndex: 'num'
         },
+        {
+          title: '更换日期',
+          dataIndex: 'checkDate'
+        },
+        {
+          title: '下次更换日期',
+          dataIndex: 'nextCheckDate'
+        },
         {
           title: '助记码',
           dataIndex: 'zjm'

+ 8 - 0
src/views/sb/modelbom/modules/DetailSbBom.vue

@@ -142,6 +142,14 @@ export default {
             return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
           }
         },
+        {
+          title: '更换日期',
+          dataIndex: 'checkDate'
+        },
+        {
+          title: '下次更换日期',
+          dataIndex: 'nextCheckDate'
+        },
         {
           title: '数量',
           dataIndex: 'num'

+ 265 - 0
src/views/sb/status-log/SbStatusLog.vue

@@ -0,0 +1,265 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="8" :sm="24">
+            <a-form-item label="关键字">
+              <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8 || 24" :sm="24">
+            <span class="table-page-search-submitButtons">
+              <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <div class="table-operator">
+      <a-button v-if="$auth('sb-status-logs-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
+      <a-button style="margin-left: 8px" v-if="$auth('sb-status-logs-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+      <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-status-logs-del')">
+        <a-menu slot="overlay">
+          <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+            <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+          </a-popconfirm>
+        </a-menu>
+        <a-button style="margin-left: 8px">
+          批量操作 <a-icon type="down" />
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      :bordered="this.MyGlobalConstant.BORDERED"
+      :columns="columns"
+      :data="loadData"
+      :alert="options.alert"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            v-if="$auth('sb-status-logs-edit')"
+            @click="handleEdit(record)"
+          >修改</operation-button>
+          <operation-button
+            v-if="$auth('sb-status-logs-del')"
+            :type="2"
+            title="是否要删除该条数据?"
+            @confirm="batchDelete(record.id)">删除</operation-button>
+        </template>
+      </span>
+      <span slot="status" slot-scope="text">
+        <badge
+          :status="DictCache.COLOR.SB_INFO_STATUS[text]"
+          :text="statusMap[text]" />
+      </span>
+    </s-table>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import { getSbStatusLogPage, deleteSbStatusLogs, fetchSbStatusLog, exportSbStatusLog } from '@/api/sb/status-log'
+
+export default {
+  name: 'SbStatusLogList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      statusMap: {},
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'sbNo'
+        },
+        {
+          title: '设备型号',
+          dataIndex: 'sbModel'
+        },
+        {
+          title: '变更时间',
+          dataIndex: 'changeTime'
+        },
+        /*        {
+                 title: '变更原因',
+                 dataIndex: 'changeReason'
+               },
+              {
+                 title: '变更人',
+                 dataIndex: 'changeUserId'
+               },*/
+        {
+          title: '变更前状态',
+          dataIndex: 'preStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '变更后状态',
+          dataIndex: 'afterStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'created_time'
+          }
+        }
+        return getSbStatusLogPage(parameter)
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    // 下拉框map
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteSbStatusLogs(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchSbStatusLog({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      fetchSbStatusLog({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportSbStatusLog(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 183 - 0
src/views/sb/status-log/modules/BaseForm.vue

@@ -0,0 +1,183 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <row-list :col="1" v-show="false">
+        <row-item>
+          <a-form-item>
+            <a-input v-decorator="['id']" type="hidden"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="设备id"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['sbId', {rules: [{required: true, message: '设备id不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="变更时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="变更原因"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['changeReason', {rules: [{required: true, message: '变更原因不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="变更人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['changeUserId', {rules: [{required: true, message: '变更人不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="变更前状态"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input-number
+              style="width: 100%"
+              :min="1"
+              v-decorator="['preStatus', {rules: [{required: true, message: '变更前状态不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="变更后状态"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input-number
+              style="width: 100%"
+              :min="1"
+              v-decorator="['afterStatus', {rules: [{required: true, message: '变更后状态不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['remark']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSbStatusLog, updateSbStatusLog } from '@/api/sb/status-log'
+
+export default {
+  name: 'BaseSbStatusLog',
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false
+      // 下拉框map
+    }
+  },
+  props: {},
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'sbId',
+          'changeTime',
+          'changeReason',
+          'changeUserId',
+          'preStatus',
+          'afterStatus',
+          'remark'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSbStatusLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateSbStatusLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      }
+    }
+
+  }
+}
+</script>

+ 77 - 0
src/views/sb/status-log/modules/Detail.vue

@@ -0,0 +1,77 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="850"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <detail-list title="" :col="2">
+      <detail-list-item term="设备id">{{ model.sbId }}</detail-list-item>
+      <detail-list-item term="变更时间">{{ model.changeTime }}</detail-list-item>
+      <detail-list-item term="变更原因">{{ model.changeReason }}</detail-list-item>
+      <detail-list-item term="变更人">{{ model.changeUserId }}</detail-list-item>
+      <detail-list-item term="变更前状态"><badge :status="DictCache.COLOR.SB_INFO_STATUS[model.preStatus]" :text="statusMap[model.status]"></badge></detail-list-item>
+      <detail-list-item term="变更后状态"><badge :status="DictCache.COLOR.SB_INFO_STATUS[model.afterStatus]" :text="statusMap[model.status]"></badge></detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
+      <detail-list-item term="更新人">{{ model.updateUserId }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+    </detail-list>
+
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'SbStatusLogDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      model: {
+        'sbId': null,
+        'changeTime': null,
+        'changeReason': null,
+        'changeUserId': null,
+        'preStatus': null,
+        'afterStatus': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null
+      }
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    // 下拉框map
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+
+  }
+}
+</script>

+ 293 - 0
src/views/sb/status-log/modules/SbStatusLogSelectModal.vue

@@ -0,0 +1,293 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1000"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 24" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator">
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :customRow="options.customRow"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleView(record)">查看</a>
+          </template>
+        </span>
+        <span slot="status" slot-scope="text">
+          <badge
+            :status="DictCache.COLOR.SB_INFO_STATUS[text]"
+            :text="statusMap[text]" />
+        </span>
+      </s-table>
+      <detail ref="detailModal"/>
+    </a-card>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { getSbStatusLogPage, fetchSbStatusLog } from '@/api/sb/status-log'
+
+export default {
+  name: 'SbStatusLogSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    }
+  },
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      extraModel: {},
+      // 查询参数
+      queryParam: {
+      },
+      extraQueryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'sbNo'
+        },
+        {
+          title: '设备型号',
+          dataIndex: 'sbModel'
+        },
+        {
+          title: '变更时间',
+          dataIndex: 'changeTime'
+        },
+        {
+          title: '变更原因',
+          dataIndex: 'changeReason'
+        },
+   /*     {
+          title: '变更人',
+          dataIndex: 'changeUserId'
+        },*/
+        {
+          title: '变更前状态',
+          dataIndex: 'preStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '变更后状态',
+          dataIndex: 'afterStatus',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSbStatusLogPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    // 下拉框map
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView (record) {
+      fetchSbStatusLog({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    base (extraModel, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.extraModel = extraModel
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.extraModel, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      if (this.type === 'radio') {
+        this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+        this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+      } else {
+        let mySelectedRowKeys
+        let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+        if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+          mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+        } else {
+          mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+          mySelectedRows = [...mySelectedRows, ...selectedRows]
+        }
+        this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+        this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+      }
+    }
+  }
+}
+</script>

+ 269 - 0
src/views/sb/stop-logs/SbStopLog.vue

@@ -0,0 +1,269 @@
+<template>
+  <a-card :bordered="false">
+    <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+      <a-form layout="inline">
+        <a-row :gutter="48">
+          <a-col :md="8" :sm="24">
+            <a-form-item label="关键字">
+              <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8 || 24" :sm="24">
+            <span class="table-page-search-submitButtons">
+              <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <div class="table-operator">
+      <a-button v-if="$auth('sb-stop-logs-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
+      <a-button style="margin-left: 8px" v-if="$auth('sb-stop-logs-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+      <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-stop-logs-del')">
+        <a-menu slot="overlay">
+          <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+            <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+          </a-popconfirm>
+        </a-menu>
+        <a-button style="margin-left: 8px">
+          批量操作 <a-icon type="down" />
+        </a-button>
+      </a-dropdown>
+    </div>
+
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      :bordered="this.MyGlobalConstant.BORDERED"
+      :columns="columns"
+      :data="loadData"
+      :alert="options.alert"
+      :rowSelection="options.rowSelection"
+      showPagination="auto"
+    >
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            v-if="$auth('sb-stop-logs-edit')"
+            @click="handleEdit(record)"
+          >修改</operation-button>
+          <operation-button
+            v-if="$auth('sb-stop-logs-del')"
+            :type="2"
+            title="是否要删除该条数据?"
+            @confirm="batchDelete(record.id)">删除</operation-button>
+        </template>
+      </span>
+    </s-table>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import { getSbStopLogPage, deleteSbStopLogs, fetchSbStopLog, exportSbStopLog } from '@/api/sb/stop-logs'
+
+export default {
+  name: 'SbStopLogList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      statusMap: {},
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'sbNo'
+        },
+        {
+          title: '设备型号',
+          dataIndex: 'sbModel'
+        },
+        {
+          title: '停用时间',
+          dataIndex: 'stopTime'
+        },
+ /*       {
+          title: '停用原因',
+          dataIndex: 'stopReason'
+        },
+        {
+          title: '停用人',
+          dataIndex: 'stopUserId'
+        },*/
+        {
+          title: '启用时间',
+          dataIndex: 'startTime'
+        },
+       /* {
+          title: '启用原因',
+          dataIndex: 'startReason'
+        },
+        {
+          title: '启用人',
+          dataIndex: 'startUserId'
+        },*/
+        {
+          title: '停机时长分钟',
+          dataIndex: 'stopDuration',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+          sortBy: 'desc',
+            sortName: 'created_time'
+        }
+        }
+        return getSbStopLogPage(parameter)
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    // 下拉框map
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteSbStopLogs(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      fetchSbStopLog({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      fetchSbStopLog({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportSbStopLog(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 205 - 0
src/views/sb/stop-logs/modules/BaseForm.vue

@@ -0,0 +1,205 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <row-list :col="1" v-show="false">
+        <row-item>
+          <a-form-item>
+            <a-input v-decorator="['id']" type="hidden"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="设备id"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['sbId', {rules: [{required: true, message: '设备id不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="停用时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="停用原因"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['stopReason', {rules: [{required: true, message: '停用原因不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="停用人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['stopUserId', {rules: [{required: true, message: '停用人不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="启用时间"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="启用原因"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['startReason', {rules: [{required: true, message: '启用原因不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="启用人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['startUserId', {rules: [{required: true, message: '启用人不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="停机时长分钟"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input-number
+              style="width: 100%"
+              :min="0"
+              :step="0.01"
+              :formatter="BaseTool.Amount.formatter"
+              :parser="BaseTool.Amount.parser"
+              v-decorator="['stopDuration', {rules: [{required: true, message: '停机时长分钟不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="1">
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <a-textarea
+              :rows="4"
+              v-decorator="['remark']"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSbStopLog, updateSbStopLog } from '@/api/sb/stop-logs'
+
+export default {
+  name: 'BaseSbStopLog',
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false
+      // 下拉框map
+    }
+  },
+  props: {},
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'sbId',
+          'stopTime',
+          'stopReason',
+          'stopUserId',
+          'startTime',
+          'startReason',
+          'startUserId',
+          'stopDuration',
+          'remark'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSbStopLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateSbStopLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      }
+    }
+
+  }
+}
+</script>

+ 82 - 0
src/views/sb/stop-logs/modules/Detail.vue

@@ -0,0 +1,82 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="850"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <detail-list title="" :col="2">
+      <detail-list-item term="设备id">{{ model.sbId }}</detail-list-item>
+      <detail-list-item term="停用时间">{{ model.stopTime }}</detail-list-item>
+      <detail-list-item term="停用原因">{{ model.stopReason }}</detail-list-item>
+      <detail-list-item term="停用人">{{ model.stopUserId }}</detail-list-item>
+      <detail-list-item term="启用时间">{{ model.startTime }}</detail-list-item>
+      <detail-list-item term="启用原因">{{ model.startReason }}</detail-list-item>
+      <detail-list-item term="启用人">{{ model.startUserId }}</detail-list-item>
+      <detail-list-item term="停机时长分钟">{{ BaseTool.Amount.formatter(model.stopDuration) }}</detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
+      <detail-list-item term="更新人">{{ model.updateUserId }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+    </detail-list>
+
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'SbStopLogDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      model: {
+        'sbId': null,
+        'stopTime': null,
+        'stopReason': null,
+        'stopUserId': null,
+        'startTime': null,
+        'startReason': null,
+        'startUserId': null,
+        'stopDuration': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+
+  }
+}
+</script>

+ 297 - 0
src/views/sb/stop-logs/modules/SbStopLogSelectModal.vue

@@ -0,0 +1,297 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1000"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 24" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator">
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :customRow="options.customRow"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleView(record)">查看</a>
+          </template>
+        </span>
+      </s-table>
+      <detail ref="detailModal"/>
+    </a-card>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { getSbStopLogPage, fetchSbStopLog } from '@/api/sb/stop-logs'
+
+export default {
+  name: 'SbStopLogSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    }
+  },
+  data () {
+    return {
+      statusMap: {},
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      extraModel: {},
+      // 查询参数
+      queryParam: {
+      },
+      extraQueryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'sbNo'
+        },
+        {
+          title: '设备型号',
+          dataIndex: 'sbModel'
+        },
+        {
+          title: '停用时间',
+          dataIndex: 'stopTime'
+        },
+        {
+          title: '停用原因',
+          dataIndex: 'stopReason'
+        },
+        {
+          title: '停用人',
+          dataIndex: 'stopUserId'
+        },
+        {
+          title: '启用时间',
+          dataIndex: 'startTime'
+        },
+        {
+          title: '启用原因',
+          dataIndex: 'startReason'
+        },
+        {
+          title: '启用人',
+          dataIndex: 'startUserId'
+        },
+        {
+          title: '停机时长分钟',
+          dataIndex: 'stopDuration',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSbStopLogPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView (record) {
+      fetchSbStopLog({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    base (extraModel, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.extraModel = extraModel
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.extraModel, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      if (this.type === 'radio') {
+        this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+        this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+      } else {
+        let mySelectedRowKeys
+        let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+        if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+          mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+        } else {
+          mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+          mySelectedRows = [...mySelectedRows, ...selectedRows]
+        }
+        this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+        this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+      }
+    }
+  }
+}
+</script>

+ 20 - 0
src/views/sqarepartmanage/sparepartinfo/modules/BaseForm.vue

@@ -218,6 +218,26 @@
               v-decorator="['unitRate']" />
           </a-form-item>
         </row-item>
+        <row-item>
+          <a-form-item
+            label="采购周期"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input suffix="天"
+              v-decorator="['purchasePeriod']" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="使用周期"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input suffix="月"
+              v-decorator="['usePeriod']" />
+          </a-form-item>
+        </row-item>
         <row-item>
           <a-form-item
             label="最高库存"

+ 4 - 0
src/views/sqarepartmanage/sparepartinfo/modules/Detail.vue

@@ -33,6 +33,8 @@
       <detail-list-item term="包装单位">{{ model.unitBz }}</detail-list-item>
       <detail-list-item term="折算系数">{{ model.unitRate }}</detail-list-item>
       <detail-list-item term="当前库存">{{ model.currentStock }}</detail-list-item>
+      <detail-list-item term="采购周期">{{ model.purchasePeriod }}</detail-list-item>
+      <detail-list-item term="使用周期">{{ model.usePeriod }}</detail-list-item>
       <detail-list-item term="最高库存">{{ model.maxStock }}</detail-list-item>
       <detail-list-item term="最低库存">{{ model.minStock }}</detail-list-item>
       <detail-list-item term="英文名称">{{ model.englishName }}</detail-list-item>
@@ -84,6 +86,8 @@ export default {
         'unitBz': null,
         'unitRate': null,
         'currentStock': null,
+        'purchasePeriod': null,
+        'usePeriod': null,
         'maxStock': null,
         'qrCode': null,
         'applicationFileList': [],