Explorar o código

增加遥测记录表

hfxc226 %!s(int64=2) %!d(string=hai) anos
pai
achega
370960524d

+ 143 - 0
src/api/remote/measure-log.js

@@ -0,0 +1,143 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getRemoteMeasureLogPage (parameter) {
+  return axios({
+    url: '/remote/measure-logs/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryRemoteMeasureLogMonthOrDayReport (parameter) {
+  return axios({
+    url: '/remote/measure-logs/report/' + parameter.isDay + '?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteRemoteMeasureLogs (parameter) {
+  return axios({
+    url: '/remote/measure-logs',
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportRemoteMeasureLog (parameter) {
+  return axios({
+    url: '/remote/measure-logs/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}

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

@@ -352,6 +352,7 @@ const constantRouterComponents = {
   'SparePartUsedSelectTable': () => import('@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'), // 备件使用记录
   // 电度和遥测数据
   'RemoteMeasure': () => import('@/views/remote/measure/RemoteMeasure'),
+  'RemoteMeasureLog': () => import('@/views/remote/measure-log/RemoteMeasureLog'),
   'RemoteDegree': () => import('@/views/remote/degree/RemoteDegree'),
   'RemoteDegreeLog': () => import('@/views/remote/degree-log/RemoteDegreeLog'),
   // 初始化导入

+ 339 - 0
src/views/remote/measure-log/RemoteMeasureLog.vue

@@ -0,0 +1,339 @@
+<template>
+  <a-card :bordered="false">
+    <div v-show="visible">
+      <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+        <a-form layout="inline">
+          <a-row :gutter="48" v-show="advanced">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称" />
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="48">
+            <a-col :md="24 || 24" :sm="24" style="text-align: right">
+              <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>
+                <a @click="()=>{ this.advanced = !this.advanced}" style="margin-left: 8px">
+                  {{ advanced ? '收起' : '展开' }}
+                  <a-icon :type="advanced ? 'up' : 'down'" />
+                </a>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator" style="margin-bottom: 8px;">
+        <a-row>
+          <a-col :md="16">
+            <a-button v-if="$auth('remote-degree-logs-add')" type="primary" icon="plus" @click="handleAdd()">新增
+            </a-button>
+            <a-button
+              style="margin-left: 8px"
+              v-if="$auth('remote-degree-logs-export')"
+              type="primary"
+              icon="download"
+              @click="doExport">导出
+            </a-button>
+            <a-button
+              style="margin-left: 8px"
+              type="primary"
+              icon="download"
+              @click="testDay(0)">测试月报表
+            </a-button>
+            <a-button
+              style="margin-left: 8px"
+              type="primary"
+              icon="download"
+              @click="testDay(1)">测试日报表
+            </a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('remote-degree-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>
+          </a-col>
+        </a-row>
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :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('remote-degree-logs-edit')"
+              @click="handleEdit(record)"
+            >修改</operation-button>
+            <operation-button
+              v-if="$auth('remote-degree-logs-del')"
+              :type="2"
+              title="是否要删除该条数据?"
+              @confirm="batchDelete(record.id)">删除</operation-button>
+          </template>
+        </span>
+      </s-table>
+    </div>
+    <base-form ref="baseModal" @ok="handleOk" />
+    <detail ref="detailModal" @ok="handleOk" />
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import {
+  getRemoteMeasureLogPage,
+  deleteRemoteMeasureLogs,
+  fetchRemoteMeasureLog,
+  exportRemoteMeasureLog,
+  queryRemoteMeasureLogMonthOrDayReport
+} from '@/api/remote/measure-log'
+
+export default {
+  name: 'RemoteMeasureLogList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      advanced: false,
+      visible: true,
+      map: {},
+      // 查询参数
+      queryParam: {
+        sbId: this.$route.query.sbId
+      },
+      // 表头
+      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: 'positionNum'
+        },
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.map, text)
+          }
+        },
+        {
+          title: '单位',
+          dataIndex: 'unit'
+        },
+        {
+          title: '系数',
+          dataIndex: 'ratio'
+        },
+        {
+          title: '描述',
+          dataIndex: 'description'
+        },
+        {
+          title: '年',
+          dataIndex: 'year'
+        },
+        {
+          title: '月',
+          dataIndex: 'month'
+        },
+        {
+          title: '日',
+          dataIndex: 'day'
+        },
+        {
+          title: '时',
+          dataIndex: 'hour'
+        },
+        {
+          title: '实时数值',
+          dataIndex: 'result'
+        },
+        {
+          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: 'update_time'
+          }
+        }
+        return getRemoteMeasureLogPage(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
+    }
+  },
+  created () {
+    // 下拉框map
+    this.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_MEASURE)
+    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]
+      }
+      deleteRemoteMeasureLogs(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
+    handleEdit (record) {
+      this.visible = false
+      fetchRemoteMeasureLog({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      this.visible = false
+      fetchRemoteMeasureLog({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    testDay (isDay) {
+      queryRemoteMeasureLogMonthOrDayReport({ isDay: isDay, year: 2022, month: 10, day: 1 }).then(res => {
+        console.log(res.data)
+      })
+    },
+    handleOk (values) {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+        sbId: this.$route.query.sbId
+      }
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportRemoteMeasureLog(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 301 - 0
src/views/remote/measure-log/modules/BaseForm.vue

@@ -0,0 +1,301 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right">
+          <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <a-form :form="form">
+
+      <a-form-item v-show="false">
+        <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['sbId']" type="hidden"/>
+
+      </a-form-item>
+
+      <row-list :col="2">
+        <row-item>
+
+          <a-form-item
+            label="设备名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              style="width: 70%"
+              disabled
+              v-decorator="['sbName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+            <a-button style="width: 30%" type="primary" @click="handleSbSelect">选择</a-button>
+          </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%"
+              disabled
+              v-decorator="['positionNum', {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"
+              :formatter="BaseTool.Amount.formatter"
+              :parser="BaseTool.Amount.parser"
+              v-decorator="['type', {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
+              disabled
+              v-decorator="['description', {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%"
+              disabled
+              v-decorator="['ratio', {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
+              disabled
+              v-decorator="['unit', {rules: [{required: true, message: '单位不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="类型"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-select disabled v-decorator="['type', {initialValue:1, rules: [{required: true, message: '类型不能为空'}]}]" placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in map"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="年"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              style="width: 100%"
+              v-decorator="['year', {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
+              style="width: 100%"
+              v-decorator="['month', {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
+              style="width: 100%"
+              v-decorator="['day', {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
+              style="width: 100%"
+              v-decorator="['hour', {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="['result', {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="['remark', {rules: [{required: true, message: '备注不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <remote-degree-select-modal ref="remoteDegreeSelectModal" @selected="handleSbSelectd"/>
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addRemoteMeasureLog, updateRemoteMeasureLog } from '@/api/remote/measure-log'
+import RemoteDegreeSelectModal from '@/views/remote/degree/modules/RemoteDegreeSelectModal'
+export default {
+  name: 'BaseRemoteMeasureLog',
+  components: {
+    RemoteDegreeSelectModal
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      map: {},
+      form: this.$form.createForm(this),
+      visible: false
+      // 下拉框map
+    }
+  },
+  props: {},
+  created () {
+    // 下拉框map
+    this.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_MEASURE)
+  },
+  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',
+          'sbName',
+          'positionNum',
+          'type',
+          'description',
+          'result',
+          'year',
+          'month',
+          'day',
+          'hour',
+          'ratio',
+          'unit',
+          '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)) {
+          addRemoteMeasureLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateRemoteMeasureLog(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
+      })
+    },
+    handleSbSelect () {
+      this.$refs.remoteDegreeSelectModal.base({}, {})
+    },
+    handleSbSelectd (keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      this.sbId = key
+      // 日期处理
+      console.log(keys, rows)
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'sbId': row.sbId,
+          'positionNum': row.positionNum,
+          'sbName': row.sbName,
+          'description': row.description,
+          'ratio': row.ratio,
+          'type': row.type,
+          'unit': row.unit
+        }))
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    }
+  }
+}
+</script>

+ 87 - 0
src/views/remote/measure-log/modules/Detail.vue

@@ -0,0 +1,87 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right">
+          <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <detail-list title="" :col="2">
+      <detail-list-item term="设备id">{{ model.sbId }}</detail-list-item>
+      <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
+      <detail-list-item term="点位">{{ model.positionNum }}</detail-list-item>
+      <detail-list-item term="类型">
+        {{ BaseTool.Object.getField(map,model.type) }}</detail-list-item>
+      <detail-list-item term="描述">{{ model.description }}</detail-list-item>
+      <detail-list-item term="系数">{{ model.ratio }}</detail-list-item>
+      <detail-list-item term="单位">{{ model.unit }}</detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="年">{{ model.year }}</detail-list-item>
+      <detail-list-item term="月">{{ model.month }}</detail-list-item>
+      <detail-list-item term="日">{{ model.day }}</detail-list-item>
+      <detail-list-item term="时">{{ model.hour }}</detail-list-item>
+      <detail-list-item term="实时数值">{{ model.result }}</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>
+  </a-card>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'RemoteMeasureLogDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      map: {},
+      visible: false,
+      // 下拉框map
+      model: {
+        'sbId': null,
+        'sbName': null,
+        'positionNum': null,
+        'type': null,
+        'description': null,
+        'result': null,
+        'ratio': null,
+        'unit': null,
+        'year': null,
+        'month': null,
+        'day': null,
+        'hour': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    this.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_MEASURE)
+
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+  }
+}
+</script>

+ 311 - 0
src/views/remote/measure-log/modules/RemoteMeasureLogSelectModal.vue

@@ -0,0 +1,311 @@
+<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="6" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6 || 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>
+                <a @click="()=>{ this.advanced = !this.advanced}" style="margin-left: 8px">
+                  {{ advanced ? '收起' : '展开' }}
+                  <a-icon :type="advanced ? 'up' : 'down'"/>
+                </a>
+              </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="record1">
+          <template>
+            <a @click="handleView(record1)">查看</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 { getRemoteMeasureLogPage, fetchRemoteMeasureLog } from '@/api/remote/measure-log'
+
+export default {
+  name: 'RemoteMeasureLogSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      advanced: false,
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      // 查询参数
+      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: '设备id',
+          dataIndex: 'sbId'
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '点位',
+          dataIndex: 'positionNum',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.map, text)
+          }
+        },
+        {
+          title: '描述',
+          dataIndex: 'description'
+        },
+        {
+          title: '实时数值',
+          dataIndex: 'result'
+        },
+        {
+          title: '系数',
+          dataIndex: 'ratio',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '单位',
+          dataIndex: 'unit'
+        },
+        {
+          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: 'description',
+            sortName: 'update_time'
+          }
+        }
+        return getRemoteMeasureLogPage(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.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_MEASURE)
+  },
+  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) {
+      fetchRemoteMeasureLog({ 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 (record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.record = record
+      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.record, 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>

+ 0 - 4
src/views/sb/info/ParentSbInfo.vue

@@ -499,10 +499,6 @@ export default {
       this.queryParam.id = selectedKeys.length > 0 ? selectedKeys[0] : ''
       this.$refs.table.refresh(true)
     },
-    onExpand (expandedKeys) {
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
     handleRepairFilePreview (record) {
       console.log(record, 87878)
       this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)

+ 25 - 48
src/views/sb/info/SbInfo.vue

@@ -2,16 +2,6 @@
   <div>
     <a-card :bordered="false" v-show="visible">
       <a-row :gutter="8" >
-        <!--      <a-col :span="4">
-        <a-tree
-          @expand="onExpand"
-          :expandedKeys="expandedKeys"
-          :autoExpandParent="true"
-          @select="onSelect"
-          :selectedKeys="selectedKeys"
-          :treeData="treeData"
-        />
-      </a-col>-->
         <a-col :span="24">
           <div>
             <div class="table-page-search-wrapper">
@@ -85,12 +75,12 @@
                   </a-col>-->
                   <a-col :md="6" :sm="24">
                     <a-form-item label="检定日期范围">
-                      <a-range-picker v-model="dateRangeCheck" :style="{width: '256px'}" />
+                      <a-range-picker v-model="dateRangeCheck" />
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
                     <a-form-item label="有效日期范围">
-                      <a-range-picker v-model="dateRange" :style="{width: '256px'}" />
+                      <a-range-picker v-model="dateRange"/>
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
@@ -194,6 +184,7 @@
 
             <s-table
               ref="table"
+              @expand="onExpand"
               size="default"
               rowKey="id"
               :widthSpace="true"
@@ -282,7 +273,7 @@ import BaseFormMeasure from './modules/BaseFormMeasure'
 import BaseFormLocation from './modules/BaseFormLocation'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
-import { getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo, batchLocationList } from '@/api/sb/info'
+import { getSbInfoPage, deleteSbInfos, querySbInfo, fetchSbInfo, fetchSbInfos, exportSbInfo, batchLocationList } from '@/api/sb/info'
 import { queryDept } from '@/api/upms/dept'
 import { generateSbCodeAll } from '@/api/upms/code'
 import { fetchSbTypeTree } from '@/api/sb/type'
@@ -374,7 +365,7 @@ export default {
       treeData: [],
       // 表头
       columns: [
-        {
+        /* {
           title: '序号',
           dataIndex: 'index',
           width: 100,
@@ -382,7 +373,7 @@ export default {
           customRender: (text, record, index) => {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
-        },
+        }, */
         {
           title: '设备编号',
           dataIndex: 'no',
@@ -416,7 +407,7 @@ export default {
             return record.typeName
           }
         },
-        {
+        /* {
           title: '设备等级',
           checked: true,
           dataIndex: 'level',
@@ -424,14 +415,14 @@ export default {
           customRender: (text, record, index) => {
             return this.BaseTool.Object.getField(this.levelMap, text)
           }
-        },
+        }, */
         {
           title: '规格型号',
           dataIndex: 'model',
           width: 150,
           checked: true
         },
-        {
+        /* {
           title: '自定义类型',
           checked: true,
           dataIndex: 'useType',
@@ -439,14 +430,14 @@ export default {
           customRender: (text, record, index) => {
             return this.BaseTool.Object.getField(this.useTypeMap, text)
           }
-        },
+        }, */
         {
           title: '设备位置',
           checked: true,
           width: 200,
           dataIndex: 'positionName'
         },
-        {
+        /* {
           title: '使用机台',
           checked: true,
           width: 200,
@@ -457,7 +448,7 @@ export default {
           dataIndex: 'producerId',
           width: 120,
           checked: true
-        },
+        }, */
         /* {
           title: '大小尺寸',
           dataIndex: 'zz',
@@ -491,7 +482,7 @@ export default {
             return this.BaseTool.Object.getField(this.isChildMap, text)
           }
         }, */
-        {
+        /* {
           title: '资产编号',
           dataIndex: 'financingNo',
           width: 120,
@@ -517,7 +508,7 @@ export default {
           dataIndex: 'startDate',
           width: 120,
           checked: true
-        },
+        }, */
         /* {
           title: '检定日期',
           dataIndex: 'checkDate',
@@ -536,14 +527,15 @@ export default {
               return text + '月'
             }
           }
-        },
+        }, */
         {
           title: '检定有效期',
           dataIndex: 'nextCheckDate',
+          fixed: 'right',
           width: 150,
           checked: true
         },
-        {
+        /*  {
           title: '检定截止',
           dataIndex: 'restDay',
           width: 100,
@@ -560,6 +552,7 @@ export default {
           title: '状态',
           checked: true,
           dataIndex: 'status',
+          fixed: 'right',
           width: 100,
           scopedSlots: { customRender: 'status' }
         },
@@ -583,7 +576,6 @@ export default {
             sortName: 'no'
           }
         }
-        console.log(parameter)
         return getSbInfoPage(Object.assign(parameter, this.queryParam))
           .then(res => {
             return res.data
@@ -841,28 +833,13 @@ export default {
       this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
       this.$refs.table.refresh(true)
     },
-    onExpand (expandedKeys) {
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-    handleRepairFilePreview (record) {
-      console.log(record, 87878)
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
-    },
-    handleRepairFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
-    },
-    handleUseFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
-    },
-    handleUseFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
-    },
-    handleCheckFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
-    },
-    handleCheckFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
+    onExpand (expanded, record) { // expanded判断展开or收缩操作,record当前行数据
+      console.log(expanded)
+      if (expanded) {
+        querySbInfo({ positionNo: record.positionNo }).then(res => {
+          record.children = res.data
+        })
+      }
     },
     doImport () {
       this.$refs.importModal.base(null, null)

+ 0 - 19
src/views/sb/info/SbInfoDebug.vue

@@ -1,16 +1,6 @@
 <template>
   <a-card :bordered="false">
     <a-row :gutter="8" v-show="visible">
-      <!--      <a-col :span="4">
-        <a-tree
-          @expand="onExpand"
-          :expandedKeys="expandedKeys"
-          :autoExpandParent="true"
-          @select="onSelect"
-          :selectedKeys="selectedKeys"
-          :treeData="treeData"
-        />
-      </a-col>-->
       <a-col :span="24">
         <div>
           <div class="table-page-search-wrapper">
@@ -610,15 +600,6 @@ export default {
         this.treeData = res.data
       })
     },
-    onSelect: function (selectedKeys, info) {
-      this.selectedKeys = selectedKeys
-      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
-      this.$refs.table.refresh(true)
-    },
-    onExpand (expandedKeys) {
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
     handleRepairFilePreview (record) {
       console.log(record, 87878)
       this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)

+ 4 - 4
src/views/sb/info/modules/Detail.vue

@@ -203,9 +203,9 @@
           <a-card >
             <div style="margin:0; padding:15px 30px; background:#EFEFFB;font-size:16px; color: #1890ff"><b>人员信息</b></div>
             <a-descriptions bordered :column="3">
-              <a-descriptions-item label="使用人">{{ model.saveUserName }}</a-descriptions-item>
-              <a-descriptions-item label="第一维修人">{{ model.repairUserName }}</a-descriptions-item>
-              <a-descriptions-item label="第二维修人">{{ model.repairUserNameSecond }}</a-descriptions-item>
+              <a-descriptions-item label="使用人">{{ model.saveUser }}</a-descriptions-item>
+<!--              <a-descriptions-item label="第一维修人">{{ model.repairUserName }}</a-descriptions-item>
+              <a-descriptions-item label="第二维修人">{{ model.repairUserNameSecond }}</a-descriptions-item>-->
               <a-descriptions-item label="购置日期">{{ model.buyDate }}</a-descriptions-item>
               <a-descriptions-item label="投用日期">{{ model.startDate }}</a-descriptions-item>
             </a-descriptions>
@@ -402,7 +402,7 @@ export default {
         'useGroupName': null,
         'useUserName': null,
         'saveDeptName': null,
-        'saveUserName': null,
+        'saveUser': null,
         'repairUserName': null,
         'repairUserNameSecond': null,
         'totalMiles': null,