hfxc226 il y a 2 ans
Parent
commit
f514b5d8b0

+ 19 - 0
src/api/sb/info.js

@@ -464,6 +464,25 @@ export function importMeasure (parameter) {
     data: parameter
   })
 }
+
+/**
+ * add batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function importMeasureInStore (parameter) {
+  return axios({
+    url: '/sb/measure-logs/longYan/in/batch',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
 /**
  * add batch func
  * parameter: { }

+ 28 - 4
src/views/sb/info/SbInfo.vue

@@ -169,11 +169,14 @@
                   <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
                     <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
                   </a-popconfirm>
-                  <a-popconfirm v-if="isMeasure===1 || correctType===2" :visible="false" @visibleChange="batchIncorrect()">
+                  <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrect()">
                     <a-menu-item key="2"><my-icon type="icon-pandian" /><a>检定</a></a-menu-item>
                   </a-popconfirm>
+                  <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrectInStore()">
+                    <a-menu-item key="3"><my-icon type="icon-pandian" /><a>入库</a></a-menu-item>
+                  </a-popconfirm>
                   <a-popconfirm :visible="false" @visibleChange="batchLocation()">
-                    <a-menu-item key="3"><my-icon type="icon-pandian" /><a>设备位号</a></a-menu-item>
+                    <a-menu-item key="4"><my-icon type="icon-pandian" /><a>设备位号</a></a-menu-item>
                   </a-popconfirm>
                 </a-menu>
                 <a-button style="margin-left: 8px">
@@ -215,9 +218,12 @@
                         <a-menu-item key="1">
                           <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
                         </a-menu-item>
-                        <a-menu-item key="2" v-if="isMeasure===1 || correctType===2" >
+                        <a-menu-item key="2" v-if="isMeasure===1" >
                           <a @click="batchIncorrect(record)">检定</a>
                         </a-menu-item>
+                        <a-menu-item key="3" v-if="isMeasure===1" >
+                          <a @click="batchIncorrectInStore(record)">入库</a>
+                        </a-menu-item>
                         <a-menu-item v-if="record.status != 2" key="2">
                           <a-popconfirm title="是否要启用该设备?" @confirm="handleStart(record)">
                             <a>启用</a>
@@ -267,6 +273,7 @@
     <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
     <detail-sb-measure ref="detailSbMeasureModal" @ok="handleOk"/>
     <base-form-measure ref="baseModalMeasure" @ok="handleOk"/>
+    <base-form-measure-in-store ref="baseModalMeasureInStore" @ok="handleOk"/>
     <base-form-location ref="baseFormLocation" @ok="handleOk" />
     <SbChangeRecordSelectModal ref="sbChangeRecordSelectModal" @ok="handleOk" />
   </div>
@@ -279,6 +286,7 @@ import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
 import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
 import Detail from './modules/Detail'
 import BaseFormMeasure from './modules/BaseFormMeasure'
+import BaseFormMeasureInStore from './modules/BaseFormMeasureInStore'
 import BaseFormLocation from './modules/BaseFormLocation'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
@@ -309,6 +317,7 @@ export default {
     ImportFormUpdate,
     PrintInSbInfoBatch,
     BaseFormMeasure,
+    BaseFormMeasureInStore,
     BaseFormLocation,
     BaseFormStatusLog,
     SbChangeRecordSelectModal
@@ -732,11 +741,26 @@ export default {
       } else {
         ids = [id]
       }
-      console.log(ids)
       this.visible = false
       const modal = this.$refs.baseModalMeasure
       modal.base(ids, this.correctType)
     },
+    batchIncorrectInStore (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要填报的设备')
+          return
+        }
+        ids = this.selectedRows
+      } else {
+        ids = [id]
+      }
+      this.visible = false
+      const modal = this.$refs.baseModalMeasureInStore
+      modal.base(ids, this.correctType)
+    },
     handleMeasureBatch () {
       const modal = this.$refs.detailSbMeasureModal
       modal.base()

+ 1 - 1
src/views/sb/info/SbInfoTree.vue

@@ -23,7 +23,7 @@
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="型号">
-                    <a-input v-model="queryParam.model" placeholder="请输入厂编号"/>
+                    <a-input v-model="queryParam.model" placeholder="请输入厂编号"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="8" :sm="24">

+ 60 - 54
src/views/sb/info/modules/BaseFormMeasure.vue

@@ -19,13 +19,13 @@
             <tr>
               <th width="100px">序号</th>
               <th width="150px">是否在库</th>
-              <th width="150px">设备位号</th>
               <th width="150px">设备名称</th>
               <th width="150px">型号</th>
-              <th width="150px">厂编号</th>
-              <th width="150px">是否是子设备</th>
+              <th width="150px">厂编号</th>
+              <!--              <th width="150px">是否是子设备</th>-->
               <th width="150px">设备位置</th>
               <th width="350px">选择父设备</th>
+              <th width="150px">设备位号</th>
               <th width="150px">检定周期</th>
               <th width="150px">检定日期</th>
               <th width="150px">下次检定日期</th>
@@ -42,19 +42,15 @@
                 <a-icon slot="checkedChildren" type="check" />
                 <a-icon slot="unCheckedChildren" type="close" />
               </a-switch></td>
-              <td>
-                <div v-if="item.sbStatus"> {{ item.sbPositionNo }}</div>
-                <div v-else style="width:250px">
-                  <a-input
-                    style="width: 60%"
-                    v-model="item.sbPositionNo"/>
-                  <a-button v-if="item.isChild === 1" type="primary" @click="handleSbNoSelect(item.sbParentId,i)">选择</a-button>
-                </div>
-              </td>
               <td>{{ item.sbName }}</td>
               <td>{{ item.sbModel }}</td>
-              <td><div v-if="item.sbStatus"> {{ item.zzh }}</div><a-input style="width: 150px" v-else v-model="item.zzh" /></td>
-              <td>{{ item.isChild === 1?'是':'否' }}</td>
+              <td><div> {{ item.zzh }}</div></td>
+              <!--              <td>
+                <a-switch v-model="item.isChild" >
+                  <a-icon slot="checkedChildren" type="check" />
+                  <a-icon slot="unCheckedChildren" type="close" />
+                </a-switch>
+              </td>-->
               <td>
                 <div v-if="item.sbStatus">{{ item.sbPositionName }}</div>
                 <a-tree-select
@@ -68,31 +64,39 @@
                   @change="handleSbPosition(item)"
                   placeholder="请选择"
                 >
-                </a-tree-select></td>
-              <td> <div v-if="item.isChild === 1&&!item.sbStatus" style="width:250px">
-                     <a-input
-                       disabled
-                       style="width: 60%"
-                       v-model="item.parentSbName"/>
-                     <a-button type="primary" @click="handleSbSelect(item.sbPositionId,i)">选择</a-button>
-                   </div>
-                <div v-else-if="item.isChild === 1&&item.sbStatus">{{ item.parentSbName }}</div>
+                </a-tree-select>
+              </td>
+              <td>
+                <div v-if="!item.sbStatus" style="width:250px">
+                  <a-input
+                    disabled
+                    style="width: 60%"
+                    v-model="item.parentSbName"/>
+                  <a-button type="primary" @click="handleSbSelect(item.sbPositionId,i)">选择</a-button>
+                </div>
                 <div v-else>无</div>
               </td>
-
-              <td><div v-if="item.sbStatus"> {{ item.checkPeriod }}月</div><a-input v-else v-model="item.checkPeriod" suffix="月" /></td>
               <td>
-                <div v-if="item.sbStatus"> {{ item.lastDate instanceof Object? BaseTool.Date.formatter(item.lastDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN): item.lastDate }}</div>
+                <div v-if="item.sbStatus"> {{ item.sbPositionNo }}</div>
+                <div v-else style="width:250px">
+                  <a-input
+                    style="width: 60%"
+                    v-model="item.sbPositionNo"/>
+                  <a-button v-if="item.isChild === 1" type="primary" @click="handleSbNoSelect(item.sbParentId,i)">选择</a-button>
+                </div>
+              </td>
+              <td><a-input v-model="item.checkPeriod" suffix="月" /></td>
+              <td>
                 <a-date-picker
-                  v-else
                   placeholder="日期"
                   style="width: 150px"
                   :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
-                  v-model="item.lastDate" /></td>
+                  v-model="item.lastDate" />
+              </td>
               <td>{{ validity(item.lastDate,item.checkPeriod) }}</td>
-              <td><div v-if="item.sbStatus"> {{ item.no }}</div><a-input v-else style="width: 150px" v-model="item.no" /></td>
-              <td><div v-if="item.sbStatus"> {{ item.requirement }}</div><a-input v-else style="width: 150px" v-model="item.requirement" /></td>
-              <td><div v-if="item.sbStatus"> {{ item.remark }}</div><a-input v-else style="width: 150px" v-model="item.remark" /></td>
+              <td><a-input style="width: 150px" v-model="item.no" /></td>
+              <td><a-input style="width: 150px" v-model="item.requirement" /></td>
+              <td><a-input style="width: 150px" v-model="item.remark" /></td>
               <td>
                 <a-button type="link" @click="uploadImg(item,i)">上传图片</a-button>
                 <a-button type="link" @click="uploadFile(item,i)">上传文件</a-button>
@@ -144,12 +148,11 @@
 import { getSbPositionTree } from '@/api/sb/position'
 import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
 import SbPositionNoModal from '@/views/sb/location/modules/LocationSelectModal'
-import { importMeasure } from '@/api/sb/info'
+import { importMeasureInStore } from '@/api/sb/info'
 
 import { uploadUrl } from '@/api/upms/file'
 import Vue from 'vue'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
-import { status } from 'nprogress'
 
 export default {
   name: 'BaseFillGatherTask',
@@ -206,6 +209,9 @@ export default {
       lastDate = this.BaseTool.Date.formatter(lastDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN).split('-')
       lastDate[1] = (parseInt(lastDate[1]) + parseInt(checkPeriod)) % 12
       lastDate[0] = +lastDate[0] + Math.floor((parseInt(lastDate[1]) + parseInt(checkPeriod)) / 12)
+      if (lastDate[1] === 0) {
+        lastDate[1] = 12
+      }
       return lastDate.join('-')
     },
     base (record, type) {
@@ -350,7 +356,7 @@ export default {
         sbMeasureLogDTOList: this.ListForm.filter(item => !(!item.sbStatus && item.requirement === '' && item.lastDate === ''))
       }
       console.log(params)
-      importMeasure(params).then(res => {
+      importMeasureInStore(params).then(res => {
         this.$message.success('检定完成!')
         this.handleCancel()
       })
@@ -364,30 +370,30 @@ export default {
 }
 </script>
 <style lang="less" scoped>
-  .tables{
+.tables{
   margin: 20px 0px;
   width: 100%;
   overflow-x:auto;
   table {
-        min-width:100%;
-        margin: 0 auto;
-        border: 1px solid #D6D6D6;
-        border-collapse: collapse;
-        font-size: 16px;
-        font-weight: 400;
-        table-layout:fixed;
-    }
-    th{
-      background: #fafafa;
-      font-weight: 500;
+    min-width:100%;
+    margin: 0 auto;
+    border: 1px solid #D6D6D6;
+    border-collapse: collapse;
+    font-size: 16px;
+    font-weight: 400;
+    table-layout:fixed;
+  }
+  th{
+    background: #fafafa;
+    font-weight: 500;
 
-    }
-    th,
-    td {
-        border: 1px solid #D6D6D6;
-        text-align: center;
-        padding: 5px 10px;
-        white-space: nowrap;
-    }
+  }
+  th,
+  td {
+    border: 1px solid #D6D6D6;
+    text-align: center;
+    padding: 5px 10px;
+    white-space: nowrap;
+  }
 }
 </style>

+ 393 - 0
src/views/sb/info/modules/BaseFormMeasureInStore.vue

@@ -0,0 +1,393 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card">
+    <a-row :gutter="48" style="position:fixed;bottom:150px;z-index:999;display:flex; justify-content: center;width: 90%;">
+      <a-col :md="48" :sm="48">
+        <span>
+          <a-button type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <div>
+      <div class="tables">
+        <div style="text-align:center;padding-bottom:10px;font-size:32px;">时代思康检定表</div>
+        <div style="display:flex; justify-content: space-between;">
+          <div> 检定人:{{ username }}</div>
+        </div>
+        <table>
+          <thead border="1px">
+            <tr>
+              <th width="100px">序号</th>
+              <!--              <th width="150px">是否在库</th>-->
+              <th width="150px">设备位号</th>
+              <th width="150px">设备名称</th>
+              <th width="150px">型号</th>
+              <th width="150px">出厂编号</th>
+              <th width="150px">是否是子设备</th>
+              <th width="150px">设备位置</th>
+              <th width="350px">选择父设备</th>
+              <th width="150px">检定周期</th>
+              <th width="150px">检定日期</th>
+              <th width="150px">下次检定日期</th>
+              <th width="150px">检定单号</th>
+              <th width="150px">检定单位</th>
+              <th width="150px">备注</th>
+              <th width="150px">操作</th>
+            </tr>
+          </thead>
+          <tbody v-if="ListForm.length>0">
+            <tr v-for="(item,i) in ListForm" :key="item.id">
+              <td>{{ i+1 }}</td>
+              <!--              <td> <a-switch v-model="item.sbStatus" >
+              <a-icon slot="checkedChildren" type="check" />
+              <a-icon slot="unCheckedChildren" type="close" />
+            </a-switch></td>-->
+              <td>
+                <div> {{ item.sbPositionNo }}</div>
+              <!-- <div v-if="item.sbStatus"> {{ item.sbPositionNo }}</div>
+             <div v-else style="width:250px">
+                <a-input
+                  style="width: 60%"
+                  v-model="item.sbPositionNo"/>
+                <a-button v-if="item.isChild === 1" type="primary" @click="handleSbNoSelect(item.sbParentId,i)">选择</a-button>
+              </div>-->
+              </td>
+              <td>{{ item.sbName }}</td>
+              <td>{{ item.sbModel }}</td>
+              <td><div>{{ item.zzh }}</div></td>
+              <!--<td><div v-if="item.sbStatus"> {{ item.zzh }}</div><a-input style="width: 150px" v-else v-model="item.zzh" /></td>-->
+              <td>{{ item.isChild === 1?'是':'否' }}</td>
+              <td>
+                <div>{{ item.sbPositionName }}</div>
+              <!--                <a-tree-select
+                                v-else
+                                style="width: 150px"
+                                :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                                :treeData="treeData"
+                                :treeNodeFilterProp="'title'"
+                                :showSearch="true"
+                                v-model="item.sbPositionId"
+                                @change="handleSbPosition(item)"
+                                placeholder="请选择"
+                              >
+                              </a-tree-select>-->
+              </td>
+              <td>
+                <div v-if="item.isChild === 1&&item.sbStatus">{{ item.parentSbName }}</div>
+                <div v-else>无</div>
+              </td>
+
+              <td><div v-if="item.sbStatus"> {{ item.checkPeriod }}月</div><a-input v-else v-model="item.checkPeriod" suffix="月" /></td>
+              <td>
+                <div v-if="item.sbStatus"> {{ item.lastDate instanceof Object? BaseTool.Date.formatter(item.lastDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN): item.lastDate }}</div>
+                <a-date-picker
+                  v-else
+                  placeholder="日期"
+                  style="width: 150px"
+                  :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+                  v-model="item.lastDate" /></td>
+              <td>{{ validity(item.lastDate,item.checkPeriod) }}</td>
+              <td><div v-if="item.sbStatus"> {{ item.no }}</div><a-input v-else style="width: 150px" v-model="item.no" /></td>
+              <td><div v-if="item.sbStatus"> {{ item.requirement }}</div><a-input v-else style="width: 150px" v-model="item.requirement" /></td>
+              <td><div v-if="item.sbStatus"> {{ item.remark }}</div><a-input v-else style="width: 150px" v-model="item.remark" /></td>
+              <td>
+                <a-button type="link" @click="uploadImg(item,i)">上传图片</a-button>
+                <a-button type="link" @click="uploadFile(item,i)">上传文件</a-button>
+                <a-modal v-model="uploadVisible" title="上传图片" :footer="null" @cancel="uploadVisible = false">
+                  <a-upload
+                    :action="uploadUrl"
+                    list-type="picture-card"
+                    :file-list="defaultApplicationFileList"
+                    @change="handleApplicationFileChange"
+                    @preview="handlePreview"
+                    accept="image/*"
+                    :headers="headers"
+                  >
+                    <div>
+                      <a-icon type="plus" />
+                      <div class="ant-upload-text">
+                        Upload
+                      </div>
+                    </div>
+                  </a-upload>
+                </a-modal>
+                <a-modal v-model="uploadFiledVisible" title="上传文件" :footer="null" @cancel="uploadFiledVisible = false">
+                  <a-upload
+                    :action="uploadUrl"
+                    :multiple="true"
+                    :file-list="defaultCheckFileList"
+                    @change="handleCheckFileChange"
+                    :headers="headers"
+                  >
+                    <a-button> <a-icon type="upload" /> 上传 </a-button>
+                  </a-upload>
+                </a-modal>
+                <a-modal :visible="previewVisible" :footer="null" @cancel="previewVisible = false" @ok="previewVisible = false">
+                  <img alt="example" style="width: 100%" :src="previewImage" />
+                </a-modal>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+    <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
+    <sb-position-no-modal ref="sbPositionNoModal" @selected="handleSbNoSelectd"/>
+
+  </a-card>
+</template>
+
+<script>
+import { getSbPositionTree } from '@/api/sb/position'
+import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
+import SbPositionNoModal from '@/views/sb/location/modules/LocationSelectModal'
+import { importMeasureInStore } from '@/api/sb/info'
+
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { status } from 'nprogress'
+
+export default {
+  name: 'BaseFillGatherTask',
+  components: {
+    SbInfoSelectModal,
+    SbPositionNoModal
+  },
+  data () {
+    return {
+      uploadUrl: uploadUrl,
+      defaultApplicationFileList: [],
+      defaultCheckFileList: [],
+      checkFileList: [], // 文档
+      applicationFileList: [],
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      visible: false,
+      username: this.$store.getters.userInfo.username,
+      uploadVisible: false,
+      uploadFiledVisible: false,
+      previewVisible: false,
+      previewImage: '',
+      treeData: [],
+      sbParentOPt: 0,
+      model: {},
+      listPage: {
+        pageNum: 1,
+        pageSize: 10,
+        total: 0
+      },
+      pagination: {
+        pageNum: 1,
+        pageSize: 10,
+        total: 0
+      },
+      imgId: '',
+      fileId: '',
+      ListForm: [],
+      id: '',
+      updatesInfo: []
+      // 下拉框map
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+
+  },
+  methods: {
+    validity (lastDate, checkPeriod) {
+      if (lastDate === '') return ''
+      lastDate = this.BaseTool.Date.formatter(lastDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN).split('-')
+      lastDate[1] = (parseInt(lastDate[1]) + parseInt(checkPeriod)) % 12
+      lastDate[0] = +lastDate[0] + Math.floor((parseInt(lastDate[1]) + parseInt(checkPeriod)) / 12)
+      if (lastDate[1] === 0) {
+        lastDate[1] = 12
+      }
+      return lastDate.join('-')
+    },
+    base (record, type) {
+      this.visible = true
+      this.model = record
+      this.ListForm = record.map(item => {
+        const data = {
+          sbName: item.name,
+          sbModel: item.model,
+          checkPeriod: item.checkPeriod || 0,
+          isChild: item.isChild,
+          parentSbName: item.parentSbName,
+          sbParentId: item.parentId,
+          sbPositionId: item.positionId,
+          sbPositionName: item.positionName,
+          no: '',
+          lastDate: '',
+          sbStatus: false,
+          sbPositionNo: item.positionNo,
+          requirement: '',
+          remark: '',
+          name: this.username,
+          sbId: item.id,
+          type,
+          zzh: item.zzh,
+          checkImgList: [],
+          checkFileList: []
+        }
+        return data
+      })
+      getSbPositionTree().then(res => {
+        this.treeData = res.data
+      })
+    },
+    handleSbPosition (item) {
+      item.parentSbName = ''
+      item.sbParentId = ''
+      item.sbPositionNo = ''
+    },
+    handleSbSelect (positionId, i) {
+      if (positionId === '' || positionId === null) {
+        this.$message.warning('请选择设备位置!')
+        return
+      }
+      this.sbParentOPt = i
+      this.$refs.sbInfoSelectModal.base({}, { isChild: this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT, positionId })
+    },
+    handleSbNoSelect (sbId, i) {
+      if (sbId === '' || sbId === null) {
+        this.$message.warning('请选择父设备!')
+        return
+      }
+      this.sbParentOPt = i
+      this.$refs.sbPositionNoModal.base({ sbId })
+    },
+    handleSbSelectd (keys, rows) {
+      console.log(keys, rows)
+      this.ListForm[ this.sbParentOPt ].sbParentId = keys[0]
+      this.ListForm[ this.sbParentOPt ].parentSbName = rows[0].name
+      this.ListForm[ this.sbParentOPt ].sbPositionNo = ''
+    },
+    handleSbNoSelectd (keys, rows) {
+      console.log(keys, rows)
+      this.ListForm[ this.sbParentOPt ].sbPositionNo = rows[0].no
+    },
+    uploadFile (val, i) {
+      this.uploadFiledVisible = true
+      this.fileId = i
+      console.log(val)
+      this.defaultCheckFileList = this.BaseTool.UPLOAD.transImg(val.checkFileList)
+    },
+    uploadImg (val, i) {
+      this.uploadVisible = true
+      console.log(val)
+      this.imgId = i
+      this.defaultApplicationFileList = this.BaseTool.UPLOAD.transImg(val.checkImgList)
+    },
+    getBase64 (file) {
+      return new Promise((resolve, reject) => {
+        const reader = new FileReader()
+        reader.readAsDataURL(file)
+        reader.onload = () => resolve(reader.result)
+        reader.onerror = error => reject(error)
+      })
+    },
+    async handlePreview (file) {
+      if (!file.url && !file.preview) {
+        file.preview = await this.getBase64(file.originFileObj)
+      }
+      this.previewImage = file.url || file.preview
+      this.previewVisible = true
+    },
+    handleApplicationFileChange (info) {
+      this.defaultApplicationFileList = info.fileList
+      this.applicationFileList = this.setFileList(info, 11)
+      this.ListForm[this.imgId].checkImgList = this.applicationFileList
+    },
+    handleCheckFileChange (info) {
+      this.defaultCheckFileList = info.fileList
+      this.checkFileList = this.setFileList(info, 32)
+
+      this.ListForm[this.fileId].checkFileList = this.checkFileList
+      console.log(this.checkFileList)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    },
+    save () {
+      let status = false
+      this.ListForm.forEach(item => {
+        switch (true) {
+          case item.sbStatus || (item.requirement === '' && (item.lastDate === '' || item.lastDate === null)) :
+            break
+          case item.requirement === '':
+            this.$message.warning(item.sbName + '的检定单位不能为空!')
+            status = true
+            break
+          case item.lastDate === '' || item.lastDate === null:
+            this.$message.warning(item.sbName + '的检定日期不能为空!')
+            status = true
+            break
+        }
+        item.lastDate = item.lastDate !== '' && item.lastDate !== null ? this.BaseTool.Date.formatter(item.lastDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) : ''
+        item.checkFileList.forEach(item => {
+          item.id = null
+        })
+        item.checkImgList.forEach(item => {
+          item.id = null
+        })
+      })
+      if (status) return
+      const params = {
+        sbMeasureLogDTOList: this.ListForm.filter(item => !(!item.sbStatus && item.requirement === '' && item.lastDate === ''))
+      }
+      console.log(params)
+      importMeasureInStore(params).then(res => {
+        this.$message.success('检定完成!')
+        this.handleCancel()
+      })
+    },
+    handleCancel () {
+      this.visible = false
+      this.ListForm = []
+      this.$emit('ok')
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+.tables{
+  margin: 20px 0px;
+  width: 100%;
+  overflow-x:auto;
+  table {
+    min-width:100%;
+    margin: 0 auto;
+    border: 1px solid #D6D6D6;
+    border-collapse: collapse;
+    font-size: 16px;
+    font-weight: 400;
+    table-layout:fixed;
+  }
+  th{
+    background: #fafafa;
+    font-weight: 500;
+
+  }
+  th,
+  td {
+    border: 1px solid #D6D6D6;
+    text-align: center;
+    padding: 5px 10px;
+    white-space: nowrap;
+  }
+}
+</style>

+ 393 - 0
src/views/sb/info/modules/BaseFormMeasureInStoreBak.vue

@@ -0,0 +1,393 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card">
+    <a-row :gutter="48" style="position:fixed;bottom:150px;z-index:999;display:flex; justify-content: center;width: 90%;">
+      <a-col :md="48" :sm="48">
+        <span>
+          <a-button type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <div>
+      <div class="tables">
+        <div style="text-align:center;padding-bottom:10px;font-size:32px;">时代思康检定表</div>
+        <div style="display:flex; justify-content: space-between;">
+          <div> 检定人:{{ username }}</div>
+        </div>
+        <table>
+          <thead border="1px">
+            <tr>
+              <th width="100px">序号</th>
+              <th width="150px">是否在库</th>
+              <th width="150px">设备位号</th>
+              <th width="150px">设备名称</th>
+              <th width="150px">型号</th>
+              <th width="150px">出厂编号</th>
+              <th width="150px">是否是子设备</th>
+              <th width="150px">设备位置</th>
+              <th width="350px">选择父设备</th>
+              <th width="150px">检定周期</th>
+              <th width="150px">检定日期</th>
+              <th width="150px">下次检定日期</th>
+              <th width="150px">检定单号</th>
+              <th width="150px">检定单位</th>
+              <th width="150px">备注</th>
+              <th width="150px">操作</th>
+            </tr>
+          </thead>
+          <tbody v-if="ListForm.length>0">
+            <tr v-for="(item,i) in ListForm" :key="item.id">
+              <td>{{ i+1 }}</td>
+              <td> <a-switch v-model="item.sbStatus" >
+                <a-icon slot="checkedChildren" type="check" />
+                <a-icon slot="unCheckedChildren" type="close" />
+              </a-switch></td>
+              <td>
+                <div v-if="item.sbStatus"> {{ item.sbPositionNo }}</div>
+                <div v-else style="width:250px">
+                  <a-input
+                    style="width: 60%"
+                    v-model="item.sbPositionNo"/>
+                  <a-button v-if="item.isChild === 1" type="primary" @click="handleSbNoSelect(item.sbParentId,i)">选择</a-button>
+                </div>
+              </td>
+              <td>{{ item.sbName }}</td>
+              <td>{{ item.sbModel }}</td>
+              <td><div v-if="item.sbStatus"> {{ item.zzh }}</div><a-input style="width: 150px" v-else v-model="item.zzh" /></td>
+              <td>{{ item.isChild === 1?'是':'否' }}</td>
+              <td>
+                <div v-if="item.sbStatus">{{ item.sbPositionName }}</div>
+                <a-tree-select
+                  v-else
+                  style="width: 150px"
+                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                  :treeData="treeData"
+                  :treeNodeFilterProp="'title'"
+                  :showSearch="true"
+                  v-model="item.sbPositionId"
+                  @change="handleSbPosition(item)"
+                  placeholder="请选择"
+                >
+                </a-tree-select></td>
+              <td> <div v-if="item.isChild === 1&&!item.sbStatus" style="width:250px">
+                     <a-input
+                       disabled
+                       style="width: 60%"
+                       v-model="item.parentSbName"/>
+                     <a-button type="primary" @click="handleSbSelect(item.sbPositionId,i)">选择</a-button>
+                   </div>
+                <div v-else-if="item.isChild === 1&&item.sbStatus">{{ item.parentSbName }}</div>
+                <div v-else>无</div>
+              </td>
+
+              <td><div v-if="item.sbStatus"> {{ item.checkPeriod }}月</div><a-input v-else v-model="item.checkPeriod" suffix="月" /></td>
+              <td>
+                <div v-if="item.sbStatus"> {{ item.lastDate instanceof Object? BaseTool.Date.formatter(item.lastDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN): item.lastDate }}</div>
+                <a-date-picker
+                  v-else
+                  placeholder="日期"
+                  style="width: 150px"
+                  :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+                  v-model="item.lastDate" /></td>
+              <td>{{ validity(item.lastDate,item.checkPeriod) }}</td>
+              <td><div v-if="item.sbStatus"> {{ item.no }}</div><a-input v-else style="width: 150px" v-model="item.no" /></td>
+              <td><div v-if="item.sbStatus"> {{ item.requirement }}</div><a-input v-else style="width: 150px" v-model="item.requirement" /></td>
+              <td><div v-if="item.sbStatus"> {{ item.remark }}</div><a-input v-else style="width: 150px" v-model="item.remark" /></td>
+              <td>
+                <a-button type="link" @click="uploadImg(item,i)">上传图片</a-button>
+                <a-button type="link" @click="uploadFile(item,i)">上传文件</a-button>
+                <a-modal v-model="uploadVisible" title="上传图片" :footer="null" @cancel="uploadVisible = false">
+                  <a-upload
+                    :action="uploadUrl"
+                    list-type="picture-card"
+                    :file-list="defaultApplicationFileList"
+                    @change="handleApplicationFileChange"
+                    @preview="handlePreview"
+                    accept="image/*"
+                    :headers="headers"
+                  >
+                    <div>
+                      <a-icon type="plus" />
+                      <div class="ant-upload-text">
+                        Upload
+                      </div>
+                    </div>
+                  </a-upload>
+                </a-modal>
+                <a-modal v-model="uploadFiledVisible" title="上传文件" :footer="null" @cancel="uploadFiledVisible = false">
+                  <a-upload
+                    :action="uploadUrl"
+                    :multiple="true"
+                    :file-list="defaultCheckFileList"
+                    @change="handleCheckFileChange"
+                    :headers="headers"
+                  >
+                    <a-button> <a-icon type="upload" /> 上传 </a-button>
+                  </a-upload>
+                </a-modal>
+                <a-modal :visible="previewVisible" :footer="null" @cancel="previewVisible = false" @ok="previewVisible = false">
+                  <img alt="example" style="width: 100%" :src="previewImage" />
+                </a-modal>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      </div>
+    </div>
+    <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
+    <sb-position-no-modal ref="sbPositionNoModal" @selected="handleSbNoSelectd"/>
+
+  </a-card>
+</template>
+
+<script>
+import { getSbPositionTree } from '@/api/sb/position'
+import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
+import SbPositionNoModal from '@/views/sb/location/modules/LocationSelectModal'
+import { importMeasureInStore } from '@/api/sb/info'
+
+import { uploadUrl } from '@/api/upms/file'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { status } from 'nprogress'
+
+export default {
+  name: 'BaseFillGatherTask',
+  components: {
+    SbInfoSelectModal,
+    SbPositionNoModal
+  },
+  data () {
+    return {
+      uploadUrl: uploadUrl,
+      defaultApplicationFileList: [],
+      defaultCheckFileList: [],
+      checkFileList: [], // 文档
+      applicationFileList: [],
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      visible: false,
+      username: this.$store.getters.userInfo.username,
+      uploadVisible: false,
+      uploadFiledVisible: false,
+      previewVisible: false,
+      previewImage: '',
+      treeData: [],
+      sbParentOPt: 0,
+      model: {},
+      listPage: {
+        pageNum: 1,
+        pageSize: 10,
+        total: 0
+      },
+      pagination: {
+        pageNum: 1,
+        pageSize: 10,
+        total: 0
+      },
+      imgId: '',
+      fileId: '',
+      ListForm: [],
+      id: '',
+      updatesInfo: []
+      // 下拉框map
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+
+  },
+  methods: {
+    validity (lastDate, checkPeriod) {
+      if (lastDate === '') return ''
+      lastDate = this.BaseTool.Date.formatter(lastDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN).split('-')
+      lastDate[1] = (parseInt(lastDate[1]) + parseInt(checkPeriod)) % 12
+      lastDate[0] = +lastDate[0] + Math.floor((parseInt(lastDate[1]) + parseInt(checkPeriod)) / 12)
+      return lastDate.join('-')
+    },
+    base (record, type) {
+      this.visible = true
+      this.model = record
+      this.ListForm = record.map(item => {
+        const data = {
+          sbName: item.name,
+          sbModel: item.model,
+          checkPeriod: item.checkPeriod || 0,
+          isChild: item.isChild,
+          parentSbName: item.parentSbName,
+          sbParentId: item.parentId,
+          sbPositionId: item.positionId,
+          sbPositionName: item.positionName,
+          no: '',
+          lastDate: '',
+          sbStatus: false,
+          sbPositionNo: item.positionNo,
+          requirement: '',
+          remark: '',
+          name: this.username,
+          sbId: item.id,
+          type,
+          zzh: item.zzh,
+          checkImgList: [],
+          checkFileList: []
+        }
+        return data
+      })
+      getSbPositionTree().then(res => {
+        this.treeData = res.data
+      })
+    },
+    handleSbPosition (item) {
+      item.parentSbName = ''
+      item.sbParentId = ''
+      item.sbPositionNo = ''
+    },
+    handleSbSelect (positionId, i) {
+      if (positionId === '' || positionId === null) {
+        this.$message.warning('请选择设备位置!')
+        return
+      }
+      this.sbParentOPt = i
+      this.$refs.sbInfoSelectModal.base({}, { isChild: this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT, positionId })
+    },
+    handleSbNoSelect (sbId, i) {
+      if (sbId === '' || sbId === null) {
+        this.$message.warning('请选择父设备!')
+        return
+      }
+      this.sbParentOPt = i
+      this.$refs.sbPositionNoModal.base({ sbId })
+    },
+    handleSbSelectd (keys, rows) {
+      console.log(keys, rows)
+      this.ListForm[ this.sbParentOPt ].sbParentId = keys[0]
+      this.ListForm[ this.sbParentOPt ].parentSbName = rows[0].name
+      this.ListForm[ this.sbParentOPt ].sbPositionNo = ''
+    },
+    handleSbNoSelectd (keys, rows) {
+      console.log(keys, rows)
+      this.ListForm[ this.sbParentOPt ].sbPositionNo = rows[0].no
+    },
+    uploadFile (val, i) {
+      this.uploadFiledVisible = true
+      this.fileId = i
+      console.log(val)
+      this.defaultCheckFileList = this.BaseTool.UPLOAD.transImg(val.checkFileList)
+    },
+    uploadImg (val, i) {
+      this.uploadVisible = true
+      console.log(val)
+      this.imgId = i
+      this.defaultApplicationFileList = this.BaseTool.UPLOAD.transImg(val.checkImgList)
+    },
+    getBase64 (file) {
+      return new Promise((resolve, reject) => {
+        const reader = new FileReader()
+        reader.readAsDataURL(file)
+        reader.onload = () => resolve(reader.result)
+        reader.onerror = error => reject(error)
+      })
+    },
+    async handlePreview (file) {
+      if (!file.url && !file.preview) {
+        file.preview = await this.getBase64(file.originFileObj)
+      }
+      this.previewImage = file.url || file.preview
+      this.previewVisible = true
+    },
+    handleApplicationFileChange (info) {
+      this.defaultApplicationFileList = info.fileList
+      this.applicationFileList = this.setFileList(info, 11)
+      this.ListForm[this.imgId].checkImgList = this.applicationFileList
+    },
+    handleCheckFileChange (info) {
+      this.defaultCheckFileList = info.fileList
+      this.checkFileList = this.setFileList(info, 32)
+
+      this.ListForm[this.fileId].checkFileList = this.checkFileList
+      console.log(this.checkFileList)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    },
+    save () {
+      let status = false
+      this.ListForm.forEach(item => {
+        switch (true) {
+          case item.sbStatus || (item.requirement === '' && (item.lastDate === '' || item.lastDate === null)) :
+            break
+          case item.requirement === '':
+            this.$message.warning(item.sbName + '的检定单位不能为空!')
+            status = true
+            break
+          case item.lastDate === '' || item.lastDate === null:
+            this.$message.warning(item.sbName + '的检定日期不能为空!')
+            status = true
+            break
+        }
+        item.lastDate = item.lastDate !== '' && item.lastDate !== null ? this.BaseTool.Date.formatter(item.lastDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) : ''
+        item.checkFileList.forEach(item => {
+          item.id = null
+        })
+        item.checkImgList.forEach(item => {
+          item.id = null
+        })
+      })
+      if (status) return
+      const params = {
+        sbMeasureLogDTOList: this.ListForm.filter(item => !(!item.sbStatus && item.requirement === '' && item.lastDate === ''))
+      }
+      console.log(params)
+      importMeasureInStore(params).then(res => {
+        this.$message.success('检定完成!')
+        this.handleCancel()
+      })
+    },
+    handleCancel () {
+      this.visible = false
+      this.ListForm = []
+      this.$emit('ok')
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .tables{
+  margin: 20px 0px;
+  width: 100%;
+  overflow-x:auto;
+  table {
+        min-width:100%;
+        margin: 0 auto;
+        border: 1px solid #D6D6D6;
+        border-collapse: collapse;
+        font-size: 16px;
+        font-weight: 400;
+        table-layout:fixed;
+    }
+    th{
+      background: #fafafa;
+      font-weight: 500;
+
+    }
+    th,
+    td {
+        border: 1px solid #D6D6D6;
+        text-align: center;
+        padding: 5px 10px;
+        white-space: nowrap;
+    }
+}
+</style>

+ 4 - 0
src/views/sb/measurelog/MeasureLog.vue

@@ -141,6 +141,10 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
+ /*       {
+          title: '设备位号',
+          dataIndex: 'sbPositionNo'
+        },*/
         {
           title: '设备名称',
           dataIndex: 'sbName'

+ 1 - 1
src/views/sb/secondscrap/modules/Detail.vue

@@ -22,7 +22,7 @@
       <detail-list-item term="备件价值">{{ BaseTool.Amount.formatter(model.initialValue) }}</detail-list-item>
       <detail-list-item term="生产商">{{ model.producerName }}</detail-list-item>
       <detail-list-item term="供应商">{{ model.supplierName }}</detail-list-item>
-      <detail-list-item term="厂编号">{{ model.initNo }}</detail-list-item>
+      <detail-list-item term="厂编号">{{ model.initNo }}</detail-list-item>
       <detail-list-item term="计量单位">{{ model.unit }}</detail-list-item>
       <detail-list-item term="包装单位">{{ model.unitBz }}</detail-list-item>
       <detail-list-item term="折算系数">{{ model.unitRate }}</detail-list-item>