Ver Fonte

完善opc

whj há 1 ano atrás
pai
commit
8e967a307a

+ 28 - 1
src/api/sb/info.js

@@ -306,7 +306,34 @@ export function querySbInfo (parameter) {
     }
   })
 }
-
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getLogBySbId (parameter) {
+  return axios({
+    url: '/sb/measure-logs/getLogBySbId?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateLogBySbId (parameter) {
+  return axios({
+    url: '/sb/update-logs',
+    method: 'post',
+    data: parameter
+  })
+}
 /**
  * delete batch func
  * parameter: { }

+ 6 - 1
src/components/Table/index.js

@@ -84,6 +84,10 @@ export default {
     pageURI: {
       type: Boolean,
       default: false
+    },
+    onExpand: {
+      type: Function,
+      default: false
     }
   }),
   watch: {
@@ -428,7 +432,8 @@ export default {
     props.columns = myColumns
     const myClass = this.widthSpace ? 'future-table-width-space' : ''
     const table = (
-      <a-table class={myClass} {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData}>
+
+      <a-table class={myClass} {...{ props, scopedSlots: { ...this.$scopedSlots } }} onChange={this.loadData} onExpand={this.onExpand} >
         { Object.keys(this.$slots).map(name => (<template slot={name}>{this.$slots[name]}</template>)) }
       </a-table>
     )

+ 139 - 7
src/views/sb/info/SbInfoC.vue

@@ -193,7 +193,7 @@
 
             <s-table
               ref="table"
-              @expand="onExpand"
+              :onExpand="onExpand"
               size="default"
               rowKey="id"
               :widthSpace="true"
@@ -263,6 +263,20 @@
                   :status="DictCache.COLOR.SB_MEASURE_STATUS[text]"
                   :text="yesNoMap[text]" />
               </span>
+              <div slot="expandedRowRender" slot-scope="record" style="width:100%;">
+
+                <a-card title="检定记录" :bordered="false" style="width:100%;position: relative; z-inde:9999">
+                  <a slot="extra" @click="addLogBySb(record)">新增</a>
+                  <a-table :columns="childColumns1" :data-source="childMap[1]">
+                  </a-table>
+                </a-card>
+
+                <a-card title="设备更改记录" :bordered="false" style="width:100%">
+                  <a-table :columns="childColumns2" :data-source="childMap[2]">
+                  </a-table>
+                </a-card>
+
+              </div>
             </s-table>
           </div>
         </a-col>
@@ -283,12 +297,14 @@
     <base-form-measure-in-store ref="baseModalMeasureInStore" @ok="handleOk"/>
     <base-form-location ref="baseFormLocation" @ok="handleOk" />
     <SbChangeLogSelectModal ref="sbChangeRecordSelectModal" @ok="handleOk" />
+    <AddLogForm ref="addLogForm" @ok="handleLogOk" />
   </div>
 </template>
 
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+import AddLogForm from './modules/AddLogForm'
 import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
 import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
 import Detail from './modules/Detail'
@@ -297,7 +313,7 @@ import BaseFormMeasureInStore from './modules/BaseFormMeasureInStore'
 import BaseFormLocation from './modules/BaseFormLocation'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
-import { getSbInfoPage, deleteSbInfos, querySbInfo, fetchSbInfo, fetchSbInfos, exportSbInfo, batchLocationList } from '@/api/sb/info'
+import { getSbInfoPage, deleteSbInfos, querySbInfo, getLogBySbId, updateLogBySbId, 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'
@@ -313,6 +329,7 @@ export default {
   components: {
     STable,
     Ellipsis,
+    AddLogForm,
     BaseForm,
     DetailSbMeasure,
     Detail,
@@ -382,6 +399,7 @@ export default {
       lineMap: {},
       unitMap: {},
       areaList: {},
+      childMap: {},
       companyList: {},
       projectList: {},
       isChildMap: {},
@@ -567,7 +585,6 @@ export default {
         {
           title: '检定有效期',
           dataIndex: 'nextCheckDate',
-          fixed: 'right',
           width: 150,
           checked: true
         },
@@ -604,12 +621,117 @@ export default {
           title: '操作',
           key: 'action',
           checked: true,
-          fixed: 'right',
           align: 'center',
           width: '120',
           scopedSlots: { customRender: 'action' }
         }
       ],
+      childColumns1: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return index + 1
+          }
+        },
+        {
+          title: '设备名称',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备位号',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbPositionNo'
+        },
+        {
+          title: '设备位置',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbPositionName'
+        },
+        {
+          title: '设备类型',
+          checked: true,
+          width: 200,
+          dataIndex: 'typeName'
+        },
+        {
+          title: '规格型号',
+          checked: true,
+          width: 200,
+          dataIndex: 'guige'
+        },
+        {
+          title: '更改内容',
+          checked: true,
+          width: 200,
+          dataIndex: 'content'
+        },
+        {
+          title: '操作时间',
+          checked: true,
+          width: 200,
+          dataIndex: 'updateTime'
+        }
+      ],
+      childColumns2: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return index + 1
+          }
+        },
+        {
+          title: '设备名称',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备位号',
+          checked: true,
+          width: 200,
+          dataIndex: 'positionNo'
+        },
+        {
+          title: '设备位置',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbPositionName'
+        },
+        {
+          title: '设备类型',
+          checked: true,
+          width: 200,
+          dataIndex: 'typeName'
+        },
+        {
+          title: '规格型号',
+          checked: true,
+          width: 200,
+          dataIndex: 'sbModel'
+        },
+        {
+          title: '检定有效期',
+          checked: true,
+          width: 200,
+          dataIndex: 'youXiaoQi'
+        },
+        {
+          title: '操作时间',
+          checked: true,
+          width: 200,
+          dataIndex: 'updateTime'
+        }
+      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         parameter = {
@@ -899,13 +1021,22 @@ export default {
       this.$refs.table.refresh(true)
     },
     onExpand (expanded, record) { // expanded判断展开or收缩操作,record当前行数据
-      console.log(expanded)
+      console.log(expanded, record)
+      this.childMap = {}
       if (expanded) {
-        querySbInfo({ positionNo: record.positionNo }).then(res => {
-          record.children = res.data
+        getLogBySbId({ sbId: record.id }).then(res => {
+          this.childMap = res.data
         })
       }
     },
+    addLogBySb (record) {
+      this.$refs.addLogForm.base(record)
+    },
+    handleLogOk (val) {
+      getLogBySbId({ sbId: val.id }).then(res => {
+        this.childMap = res.data
+      })
+    },
     doImport () {
       this.$refs.importModal.base(null, null)
     },
@@ -950,5 +1081,6 @@ export default {
 }
 /deep/ .orange{
   background:rgb(245, 132, 91);
+
 }
 </style>

+ 68 - 0
src/views/sb/info/modules/AddLogForm.vue

@@ -0,0 +1,68 @@
+<template>
+  <a-modal
+    title="新增"
+    :visible="visible"
+    :confirm-loading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 17 }">
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+      </a-form-item>
+      <a-form-item label="更改内容">
+        <a-textarea
+          v-decorator="['content', { rules: [{ required: true, message: '请输入更改内容' }] }]"
+        />
+      </a-form-item>
+    </a-form>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { updateLogBySbId } from '@/api/sb/info'
+
+export default {
+  data () {
+    return {
+      visible: false,
+      confirmLoading: false,
+      form: this.$form.createForm(this)
+    }
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      const { form: { setFieldsValue } } = this
+      setFieldsValue(Object.assign(pick(record, ['id'])))
+      console.log(record)
+    },
+    handleOk (e) {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          this.$message.error(errors)
+        }
+        updateLogBySbId(values).then(res => {
+          this.visible = false
+          this.$message.success('操作成功')
+          this.$emit('ok', values)
+
+          this.confirmLoading = false
+        })
+      })
+    },
+    handleCancel (e) {
+      this.visible = false
+    }
+  }
+}
+</script>
+
+<style>
+
+</style>