whj 11 月之前
父节点
当前提交
399b666f60
共有 5 个文件被更改,包括 391 次插入217 次删除
  1. 17 2
      src/api/sb/info.js
  2. 2 2
      src/utils/dict.js
  3. 11 1
      src/views/sb/info/SbInfoC.vue
  4. 247 212
      src/views/sb/info/modules/BaseForm.vue
  5. 114 0
      src/views/sb/info/modules/ImportMeasure.vue

+ 17 - 2
src/api/sb/info.js

@@ -244,7 +244,6 @@ export function updateSbInfo (parameter) {
   })
 }
 
-
 /**
  * update func
  * parameter: { }
@@ -562,7 +561,23 @@ export function importSbInfo (parameter) {
     data: parameter
   })
 }
-
+/**
+ * add batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function importBatchMeasure (parameter) {
+  return axios({
+    url: '/sb/measure-logs/template/longYan/batch',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
 export function importSbInfo2 (parameter) {
   return axios({
     url: '/sb/infos/import2',

+ 2 - 2
src/utils/dict.js

@@ -1442,8 +1442,8 @@ DictCache.COLOR = {
   SB_INFO_STATUS: {
     1: 'default', // 在库
     2: 'success', // 使用中
-    3: 'default', // 报废中
-    4: 'default', // 已报废
+    3: 'error', // 报废中
+    4: 'error', // 已报废
     5: 'warning', // 置换中
     6: 'default', // 已置换
     7: 'error', // 停用中

+ 11 - 1
src/views/sb/info/SbInfoC.vue

@@ -180,6 +180,10 @@
                 <a-icon type="upload" />
                 修改导入
               </a-button>
+              <a-button style="margin-left:8px;" type="primary" @click="doImportMeasure">
+                <a-icon type="upload" />
+                检定导入
+              </a-button>
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handleBackBatch(13)">批量退库</a-button>
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handleBackBatch(4)">批量报废</a-button>
@@ -312,6 +316,7 @@
     <download-modal ref="downloadModal" />
     <preview-modal ref="previewModal" />
     <import-form-add ref="importModal" @ok="handleOk" />
+    <ImportMeasure ref="importMeasure" @ok="handleOk" />
     <import-form-add-standard ref="importModalStandard" @ok="handleOk" />
     <import-form-update2 ref="importModalUpdate2" @ok="handleOk" />
     <print-sb-code ref="printSbCode" />
@@ -356,6 +361,7 @@ import { queryDept } from '@/api/upms/dept'
 import { generateSbCodeAll } from '@/api/upms/code'
 import { fetchSbTypeTree } from '@/api/sb/type'
 import ImportFormAdd from './modules/ImportFormAdd'
+import ImportMeasure from './modules/ImportMeasure'
 import ImportFormAddStandard from './modules/ImportFormAddStandard'
 import ImportFormUpdate2 from './modules/ImportFormUpdate2'
 import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
@@ -384,7 +390,8 @@ export default {
     BaseFormStatusLog,
     SbChangeLogSelectModal,
     ListModal,
-    BackForm
+    BackForm,
+    ImportMeasure
   },
   props: {
     filter: {
@@ -1154,6 +1161,9 @@ export default {
     doImportForUpdate () {
       this.$refs.importModalUpdate2.base(null, 2, 2)
     },
+    doImportMeasure () {
+      this.$refs.importMeasure.base()
+    },
     rowClassName (record, index) {
       if (record.measureStatus === 1 && record.status !== 7) return 'orange'
       switch (record.status) {

+ 247 - 212
src/views/sb/info/modules/BaseForm.vue

@@ -89,12 +89,25 @@
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="设备价格(原值)" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-input-number style="width: 100%" :min="0" :step="0.01" :formatter="BaseTool.Amount.formatter" :parser="BaseTool.Amount.parser" v-decorator="['initialValue']" />
+            <a-input-number
+              style="width: 100%"
+              :min="0"
+              :step="0.01"
+              :formatter="BaseTool.Amount.formatter"
+              :parser="BaseTool.Amount.parser"
+              v-decorator="['initialValue']" />
           </a-form-item>
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="设备类型" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-tree-select style="width: 100%" :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }" :treeData="sbTypeTreeData" :treeNodeFilterProp="'title'" :showSearch="true" v-decorator="['typeId', {rules: [{required: true, message: '设备类型不能为空'}]}]" placeholder="请选择">
+            <a-tree-select
+              style="width: 100%"
+              :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+              :treeData="sbTypeTreeData"
+              :treeNodeFilterProp="'title'"
+              :showSearch="true"
+              v-decorator="['typeId', {rules: [{required: true, message: '设备类型不能为空'}]}]"
+              placeholder="请选择">
             </a-tree-select>
           </a-form-item>
         </a-col>
@@ -153,11 +166,166 @@
           </a-form-item>
         </a-col>
       </a-row>
+      <title-divider title="检定周期信息" width="120px"></title-divider>
+      <div>
+
+        <!--        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="计量设备编号"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-input
+                v-decorator="['cardNo']" />
+            </a-form-item>
+          </a-col>
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="准确度等级"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-input
+                v-decorator="['fdjxh']" />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="检定单位"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-input
+                v-decorator="['dph']" />
+            </a-form-item>
+          </a-col>
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="检定人"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-input
+                v-decorator="['zaiz']" />
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="检定结论"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-select v-decorator="['rlType']" placeholder="请选择">
+                <a-select-option
+                  v-for="(label,value) in rlTypeMap"
+                  :key="value"
+                  :label="label"
+                  :value="parseInt(value)">{{ label }}
+                </a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="是否周检查"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-select v-decorator="['color']" placeholder="请选择">
+                <a-select-option
+                  v-for="(label,value) in colorMap"
+                  :key="value"
+                  :label="label"
+                  :value="parseInt(value)">{{ label }}
+                </a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item
+              label="检定证书编号"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-input
+                v-decorator="['sbdh']" />
+            </a-form-item>
+          </a-col>
+
+        </a-row>-->
+
+        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+          <a-col :lg="12" :md="24" :sm="24">
+            <a-form-item label="是否需要检定" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+              <a-select @change="isMeasureChange" v-decorator="['isMeasure', { rules: [{required: true, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
+                <a-select-option v-for="(label,value) in yesNoMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
+                </a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <template v-if="isSelfRequired">
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="上次检定日期" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-date-picker style="width: 100%" :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN" v-decorator="['checkDate', {rules: [{required: useType == 4, message: '上次检定日期不能为空'}]}]" />
+              </a-form-item>
+            </a-col>
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="检定周期" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-input style="width: 100%" suffix="月" :formatter="BaseTool.Amount.formatter" :parser="BaseTool.Amount.parser" v-decorator="['checkPeriod']" />
+              </a-form-item>
+            </a-col>
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="检定有效期至" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-date-picker style="width: 100%" :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN" v-decorator="['nextCheckDate']" />
+              </a-form-item>
+            </a-col>
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="预警天数" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-input-number
+                  style="width: 100%"
+                  :min="30"
+                  :step="1"
+                  :formatter="BaseTool.Amount.formatter"
+                  :parser="BaseTool.Amount.parser"
+                  v-decorator="['seatNumber']" />
+              </a-form-item>
+            </a-col>
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="检定单位" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-input v-decorator="['dph']" />
+              </a-form-item>
+            </a-col>
+
+            <a-col :lg="12" :md="24" :sm="24">
+              <a-form-item label="是否自检" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
+                <a-select v-decorator="['isSelf', { rules: [{required: isSelfRequired, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
+                  <a-select-option v-for="(label,value) in yesNoMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          </template>
+        </a-row>
+      </div>
       <title-divider title="数字地图配置" width="150px"></title-divider>
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="设备位置" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-tree-select style="width: 100%" :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }" :treeData="treeData" :treeNodeFilterProp="'title'" :showSearch="true" v-decorator="['positionId', {rules: [{required: true, message: '上层位置不能为空'}]}]" placeholder="请选择">
+            <a-tree-select
+              style="width: 100%"
+              :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+              :treeData="treeData"
+              :treeNodeFilterProp="'title'"
+              :showSearch="true"
+              v-decorator="['positionId', {rules: [{required: true, message: '上层位置不能为空'}]}]"
+              placeholder="请选择">
             </a-tree-select>
           </a-form-item>
         </a-col>
@@ -452,147 +620,7 @@
           </a-col>
         </a-row>
       </div>
-      <title-divider title="检定周期信息" width="90px"></title-divider>
-      <div>
-        <!--        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="计量设备编号"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input
-                v-decorator="['cardNo']" />
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="准确度等级"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input
-                v-decorator="['fdjxh']" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="检定单位"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input
-                v-decorator="['dph']" />
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="检定人"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input
-                v-decorator="['zaiz']" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="检定结论"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-select v-decorator="['rlType']" placeholder="请选择">
-                <a-select-option
-                  v-for="(label,value) in rlTypeMap"
-                  :key="value"
-                  :label="label"
-                  :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="是否周检查"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-select v-decorator="['color']" placeholder="请选择">
-                <a-select-option
-                  v-for="(label,value) in colorMap"
-                  :key="value"
-                  :label="label"
-                  :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item
-              label="检定证书编号"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input
-                v-decorator="['sbdh']" />
-            </a-form-item>
-          </a-col>
 
-        </a-row>-->
-        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="上次检定日期" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-date-picker style="width: 100%" :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN" v-decorator="['checkDate', {rules: [{required: useType == 4, message: '上次检定日期不能为空'}]}]" />
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="检定周期" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-input style="width: 100%" suffix="月" :formatter="BaseTool.Amount.formatter" :parser="BaseTool.Amount.parser" v-decorator="['checkPeriod']" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="检定有效期至" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-date-picker style="width: 100%" :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN" v-decorator="['nextCheckDate']" />
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="预警天数" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-input-number style="width: 100%" :min="30" :step="1" :formatter="BaseTool.Amount.formatter" :parser="BaseTool.Amount.parser" v-decorator="['seatNumber']" />
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="检定单位" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-input v-decorator="['dph']" />
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="是否需要检定" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-select @change="isMeasureChange" v-decorator="['isMeasure', { rules: [{required: true, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
-                <a-select-option v-for="(label,value) in yesNoMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :lg="12" :md="24" :sm="24">
-            <a-form-item label="是否自检" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-              <a-select v-decorator="['isSelf', { rules: [{required: isSelfRequired, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
-                <a-select-option v-for="(label,value) in yesNoMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </div>
       <title-divider title="文件信息" width="90px"></title-divider>
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
         <a-col :lg="12" :md="24" :sm="24">
@@ -620,7 +648,14 @@
         </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="设备图片" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
-            <a-upload :action="uploadUrl" :multiple="false" list-type="picture" :file-list="this.defaultSbFileList" @change="handleSbFileChange" accept="image/*" :headers="headers">
+            <a-upload
+              :action="uploadUrl"
+              :multiple="false"
+              list-type="picture"
+              :file-list="this.defaultSbFileList"
+              @change="handleSbFileChange"
+              accept="image/*"
+              :headers="headers">
               <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
             </a-upload>
           </a-form-item>
@@ -631,7 +666,7 @@
     <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd" />
     <firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected" />
     <param-form ref="paramForm" @ok="handleParamList" />
-    <PointModal ref='pointModal' @ok="handlePointSelect" />
+    <PointModal ref="pointModal" @ok="handlePointSelect" />
   </a-card>
 </template>
 
@@ -667,9 +702,9 @@ export default {
     ParamForm,
     DetailList,
     PointModal,
-    DetailListItem,
+    DetailListItem
   },
-  data() {
+  data () {
     return {
       confirmLoading: false,
       modalTitle: null,
@@ -720,25 +755,25 @@ export default {
       fileList: [],
       type: null,
       headers: {
-        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN),
-      },
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      }
     }
   },
   props: {
     useType: {
       type: Number,
-      default: 3,
+      default: 3
     },
     parentId: {
       type: String,
-      default: null,
+      default: null
     },
     parentName: {
       type: String,
-      default: null,
-    },
+      default: null
+    }
   },
-  created() {
+  created () {
     this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
     this.colorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_COLOR)
@@ -762,10 +797,10 @@ export default {
     })
   },
   methods: {
-    base(record, type) {
+    base (record, type) {
       if (this.parentId) {
         const {
-          form: { setFieldsValue },
+          form: { setFieldsValue }
         } = this
         // 日期处理
         this.$nextTick(() => {
@@ -773,7 +808,7 @@ export default {
             Object.assign({
               parentId: this.parentId,
               parentSbName: this.parentName,
-              isChild: this.BaseTool.Object.getField(this.isChildMap, this.DictCache.VALUE.SB_IS_CHILD.IS_CHILD),
+              isChild: this.BaseTool.Object.getField(this.isChildMap, this.DictCache.VALUE.SB_IS_CHILD.IS_CHILD)
             })
           )
         })
@@ -811,7 +846,7 @@ export default {
       }
 
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
       // 日期处理
       // record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
@@ -942,15 +977,15 @@ export default {
               'installUnit',
               'examResult',
               'usePosition',
-              'sbRegisterNo',
+              'sbRegisterNo'
             ])
           )
         )
       })
     },
-    save() {
+    save () {
       const {
-        form: { validateFieldsAndScroll },
+        form: { validateFieldsAndScroll }
       } = this
       this.confirmLoading = true
       validateFieldsAndScroll((errors, values) => {
@@ -1023,19 +1058,19 @@ export default {
         }
       })
     },
-    getQrcodeSrc() {
+    getQrcodeSrc () {
       // console.log(111, 22)
     },
-    handleCancel() {
+    handleCancel () {
       this.visible = false
       this.confirmLoading = false
       this.form.resetFields()
       this.$emit('ok')
     },
-    handleFresh() {
+    handleFresh () {
       fetchSbInfo({ id: this.id }).then((res) => {
         const {
-          form: { setFieldsValue },
+          form: { setFieldsValue }
         } = this
         const record = res.data
         this.$nextTick(() => {
@@ -1043,7 +1078,7 @@ export default {
         })
       })
     },
-    setTree(record = {}) {
+    setTree (record = {}) {
       fetchSbTypeTree().then((res) => {
         this.sbTypeTreeData = res.data
       })
@@ -1064,13 +1099,13 @@ export default {
       if (record.useArea != null) {
         getDeptsAllByParentId({
           deptId: record.useArea,
-          nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI,
+          nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
         }).then((res) => {
           this.companyList = res.data
         })
         getDeptsAllByParentId({
           deptId: record.useCompany,
-          nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU,
+          nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU
         }).then((res) => {
           this.projectList = res.data
         })
@@ -1092,15 +1127,15 @@ export default {
         this.userList = res.data
       })
     },
-    handleSbModelSelect() {
+    handleSbModelSelect () {
       const modal = this.$refs.sbModelSelectModal
       modal.base()
     },
-    handleSbModelSelected(keys, rows) {
+    handleSbModelSelected (keys, rows) {
       const [key] = keys
       const [row] = rows
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
 
       this.$nextTick(() => {
@@ -1118,12 +1153,12 @@ export default {
           producerId: row.producerId,
           producerName: row.producerName,
           unit: row.unit,
-          unitName: this.BaseTool.Object.getField(this.unitMap, row.unit),
+          unitName: this.BaseTool.Object.getField(this.unitMap, row.unit)
         })
       })
     },
 
-    beforeRecheckFileListUpload(file) {
+    beforeRecheckFileListUpload (file) {
       const reg = /\.(xls|xlsx)(\?.*)?$/
       return new Promise((resolve, reject) => {
         if (reg.test(file.name)) {
@@ -1136,7 +1171,7 @@ export default {
         }
       })
     },
-    beforeUploadPic(file) {
+    beforeUploadPic (file) {
       const reg = /\.(jpg|jpeg|png)(\?.*)?$/
       return new Promise((resolve, reject) => {
         if (reg.test(file.name)) {
@@ -1149,113 +1184,113 @@ export default {
         }
       })
     },
-    clearFileList() {
+    clearFileList () {
       this.repairFileList = []
       this.useFileList = []
       this.recheckFileList = []
       this.sbFileList = []
     },
-    handleRepairFileChange(info) {
+    handleRepairFileChange (info) {
       this.defaultRepairFileList = info.fileList
       this.repairFileList = this.setFileList(info, 1)
     },
-    handleUseFileChange(info) {
+    handleUseFileChange (info) {
       this.defaultUseFileList = info.fileList
       this.useFileList = this.setFileList(info, 2)
     },
-    handleAreaChange(value) {
+    handleAreaChange (value) {
       getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then((res) => {
         this.companyList = res.data
       })
     },
-    handleCompanyChange(value) {
+    handleCompanyChange (value) {
       getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then((res) => {
         this.projectList = res.data
       })
     },
-    handleProjectChange(value) {
+    handleProjectChange (value) {
       getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then((res) => {
         this.deptList = res.data
       })
     },
-    handleDeptChange(value) {
+    handleDeptChange (value) {
       getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then((res) => {
         this.groupList = res.data
       })
     },
-    handleGroupChange(value) {
+    handleGroupChange (value) {
       queryUserDeptByUserDeptId({ deptId: value }).then((res) => {
         this.userList = res.data
       })
     },
-    handlePointSelect(value) {
+    handlePointSelect (value) {
       if (!value) return
       console.log(value)
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(value, ['zjm', 'jbdh'])))
       })
     },
-    handleRecheckFileChange(info) {
+    handleRecheckFileChange (info) {
       this.defaultRecheckFileList = info.fileList
       this.recheckFileList = this.setFileList(info, 3)
     },
-    handleSbFileChange(info) {
+    handleSbFileChange (info) {
       this.defaultSbFileList = info.fileList
       this.sbFileList = this.setFileList(info, 4)
     },
-    clearParent() {
+    clearParent () {
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
       // 日期处理
       this.$nextTick(() => {
         setFieldsValue(
           Object.assign({
             parentId: null,
-            parentSbName: null,
+            parentSbName: null
           })
         )
       })
     },
     // 主子设备切换
-    childChange(value) {
+    childChange (value) {
       if (
         value === this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT ||
         value === this.DictCache.VALUE.SB_IS_CHILD.IS_NORMAL
       ) {
         const {
-          form: { setFieldsValue },
+          form: { setFieldsValue }
         } = this
         // 日期处理
         this.$nextTick(() => {
           setFieldsValue(
             Object.assign({
               parentId: null,
-              parentSbName: null,
+              parentSbName: null
             })
           )
         })
       }
     },
     // 设置为需要检定的,是否自检也要设置
-    isMeasureChange(value) {
+    isMeasureChange (value) {
       if (value === this.DictCache.VALUE.YES_NO.YES) {
         this.isSelfRequired = true
       } else {
         this.isSelfRequired = false
       }
     },
-    handleSbSelect() {
+    handleSbSelect () {
       this.$refs.sbInfoSelectModal.base({}, { isChild: this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT })
     },
-    handleSbSelectd(keys, rows) {
+    handleSbSelectd (keys, rows) {
       const [key] = keys
       const [row] = rows
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
       // 日期处理
       this.$nextTick(() => {
@@ -1263,33 +1298,33 @@ export default {
           Object.assign({
             parentId: key,
             parentSbName: row.name,
-            ppNo: row.positionNo,
+            ppNo: row.positionNo
           })
         )
       })
     },
-    handleChange(value) {
+    handleChange (value) {
       this.useType = value
     },
-    handleProducerSelect() {
+    handleProducerSelect () {
       const modal = this.$refs.producerSelectModal
       modal.base({}, { type: 1 })
     },
-    handleProducerSelected(record, selectedRowKeys, selectedRow) {
+    handleProducerSelected (record, selectedRowKeys, selectedRow) {
       const {
-        form: { setFieldsValue },
+        form: { setFieldsValue }
       } = this
       const [key] = selectedRowKeys
       const [row] = selectedRow
       setFieldsValue({
         producerId: key,
-        producerName: row.name,
+        producerName: row.name
       })
     },
-    filterOptionProducer(input, option) {
+    filterOptionProducer (input, option) {
       return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
     },
-    setFileList(info, type) {
+    setFileList (info, type) {
       // { file, fileList }
 
       const file = info.file
@@ -1307,9 +1342,9 @@ export default {
         return null
       }
     },
-    handlePoint() {
+    handlePoint () {
       const {
-        form: { getFieldValue },
+        form: { getFieldValue }
       } = this
       const zjm = getFieldValue('zjm')
       const jbdh = getFieldValue('jbdh')
@@ -1321,7 +1356,7 @@ export default {
         id: this.id,
         positionId: positionId,
         zjm: zjm,
-        jbdh: jbdh,
+        jbdh: jbdh
       })
 
       // const a = document.createElement('a')
@@ -1329,21 +1364,21 @@ export default {
       // a.target = '_blank'
       // a.click()
     },
-    handleParam() {
+    handleParam () {
       const modal = this.$refs.paramForm
       modal.base(this.model)
     },
-    handleParamList(values) {
+    handleParamList (values) {
       // console.log(values)
       if (this.paramList == null) {
         this.paramList = []
       }
       this.paramList.push(values)
     },
-    handleDelParam(index) {
+    handleDelParam (index) {
       // console.log(index)
       this.paramList.splice(index, 1)
-    },
-  },
+    }
+  }
 }
 </script>

+ 114 - 0
src/views/sb/info/modules/ImportMeasure.vue

@@ -0,0 +1,114 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="640"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <a-form-item
+        label="上传文件"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-upload :fileList="fileList" @change="handleChange" :remove="handleRemove" :beforeUpload="beforeUpload">
+          <a-button> <a-icon type="upload" />选择上传文件</a-button>
+        </a-upload>
+      </a-form-item>
+    </a-form>
+    <p style="color: red">注意事项:<br/>
+      1:请确保设备编号、名称、型号的准确填写<br/>
+      2:请确保数据都未导入,重新导入成功不会覆盖原有数据,导致存在多台同样设备<br/>
+      3:导入如出现问题,请及时联系<br/>
+    </p>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { importBatchMeasure } from '@/api/sb/info'
+
+export default {
+  name: 'SbModelBomImportForm',
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      useCompany: null,
+      useProject: null,
+      type: null,
+      fileList: []
+    }
+  },
+  methods: {
+    base () {
+      this.visible = true
+      this.modalTitle = '检定导入'
+    },
+    handleRemove (file) {
+      const index = this.fileList.indexOf(file)
+      const newFileList = this.fileList.slice()
+      newFileList.splice(index, 1)
+      this.fileList = newFileList
+    },
+    beforeUpload (file) {
+      const reg = /\.(xls|xlsx)(\?.*)?$/
+      return new Promise((resolve, reject) => {
+        if (reg.test(file.name)) {
+          this.fileList = [file]
+          return false
+        } else {
+          this.$message.error(`请上传正确的excel文件`)
+          reject(new Error('请上传正确的excel文件'))
+          return false
+        }
+      })
+    },
+    handleChange (info) {
+      if (info.file.status !== 'uploading') {
+        console.log(info.file, info.fileList)
+      }
+      if (info.file.status === 'done') {
+        this.$message.success(`${info.file.name} file uploaded successfully`)
+      } else if (info.file.status === 'error') {
+        this.$message.error(`${info.file.name} file upload failed.`)
+      }
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        const formData = new FormData()
+        formData.append('file', this.fileList[0])
+        importBatchMeasure(formData)
+          .then((res) => {
+            this.$message.success(res.data)
+            this.handleCancel(values)
+            this.BaseTool.ListForm.clearOneList(this)
+            this.BaseTool.ListForm.pushOneListAddMore(this, res.data)
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.fileList = []
+      this.form.resetFields()
+      this.storeId = null
+      this.$emit('ok', values)
+    }
+
+  }
+}
+</script>