whj 6 місяців тому
батько
коміт
c25e233d79

+ 13 - 0
src/api/repair/application-form.js

@@ -401,6 +401,19 @@ export function batchBack (parameter) {
     data: parameter
   })
 }
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function batchOut (parameter) {
+  return axios({
+    url: '/sb/infos/yiBiao/batch/out-store',
+    method: 'PUT',
+    data: parameter
+  })
+}
 /**
  * update func
  * parameter: { }

+ 14 - 14
src/utils/dict.js

@@ -9,57 +9,57 @@ const DictCache = {
   DICT_OBJ_BY_VALUE: 'dict:value:obj',
   DICT_CHILDREN_ALL: 'dict:children-all',
   CONFIG_OPEN_VALUE: 'config:open:value',
-  baseGet(key) {
+  baseGet (key) {
     return Vue.ls.get(this.BASE_DATA_CACHE)[key]
   },
-  getConfigValueByType(type) {
+  getConfigValueByType (type) {
     return this.baseGet(this.CONFIG_OPEN_VALUE)[type]
   },
-  getChildren(type, value, childValue) {
+  getChildren (type, value, childValue) {
     const children = this.baseGet(this.DICT_CHILDREN)[type]
     const child = children[value]
     return child[childValue]
   },
-  getChildrenMapByType(type, value) {
+  getChildrenMapByType (type, value) {
     const children = this.baseGet(this.DICT_CHILDREN)[type]
     return children[value]
   },
-  getLabelByValue(type, value) {
+  getLabelByValue (type, value) {
     const child = this.baseGet(this.DICT_LABEL_BY_VALUE)[type]
     return child[value]
   },
-  getObjByValue(type, value) {
+  getObjByValue (type, value) {
     const child = this.baseGet(this.DICT_OBJ_BY_VALUE)[type]
     return child[value]
   },
-  getLabelByValueMapByType(type) {
+  getLabelByValueMapByType (type) {
     return this.baseGet(this.DICT_LABEL_BY_VALUE)[type]
   },
-  getValueByLabel(type, label) {
+  getValueByLabel (type, label) {
     const child = this.baseGet(this.DICT_LABEL_BY_LABEL)[type]
     return child[label]
   },
-  getValueByLabelMapByType(type) {
+  getValueByLabelMapByType (type) {
     return this.baseGet(this.DICT_LABEL_BY_LABEL)[type]
   },
-  getValueByCode(type, code) {
+  getValueByCode (type, code) {
     const child = this.baseGet(this.DICT_VALUE_BY_CODE)[type]
     return child[code]
   },
-  getValueByCodeMapByType(type) {
+  getValueByCodeMapByType (type) {
     return this.baseGet(this.DICT_VALUE_BY_CODE, type)
   },
-  getChildrenList(type) {
+  getChildrenList (type) {
     return this.baseGet(this.DICT_CHILDREN_ALL)[type]
   },
-  whetherLabel(b) {
+  whetherLabel (b) {
     if (b) {
       return DictCache.TYPE.WHETHER[1]
     } else {
       return DictCache.TYPE.WHETHER[0]
     }
   },
-  whetherColor(b) {
+  whetherColor (b) {
     if (b) {
       return DictCache.COLOR.WHETHER[1]
     } else {

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

@@ -88,7 +88,7 @@
                     <a-form-item label="设备状态">
                       <a-select v-model="queryParam.status" placeholder="请选择">
                         <a-select-option
-                          v-for="(label,value) in statusMap"
+                          v-for="{label,value} in statusList"
                           :key="value"
                           :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE"
                           :label="label"
@@ -186,8 +186,12 @@
                 检定导入
               </a-button>
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
-              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(13)">批量退库</a-button>
-              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(4)">批量报废</a-button>
+              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(1,1)">批量在库</a-button>
+              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(4,1)">批量报废</a-button>
+              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(2,2)">批量出库</a-button>
+              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(45,2)">批量调拨</a-button>
+              <a-button style="margin-left: 8px" type="primary" @click="handleBackBatch(46,2)">批量外销</a-button>
+
               <a-button style="margin-left: 8px" v-if="isMeasure===1" type="primary" icon="reload" @click="batchIncorrect()">批量检定</a-button>
               <a-button style="margin-left: 8px" v-if="$auth('sb-infos-generate-code-all')" :loading="confirmLoading" type="primary" @click="batchGenerate()">重新生成二维码</a-button>
               <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
@@ -312,7 +316,7 @@
         </a-col>
       </a-row>
     </a-card>
-    <base-form ref="baseModal" :parent-id="queryParam.parentId" :parent-name="queryParam.parentName" @ok="handleOk" />
+    <base-form ref="baseModal" :isMeter="true" :parent-id="queryParam.parentId" :parent-name="queryParam.parentName" @ok="handleOk" />
     <base-form-status-log ref="baseModalStatusLog" @ok="handleOk" />
     <detail ref="detailModal" @ok="handleOk" />
     <download-modal ref="downloadModal" />
@@ -463,6 +467,7 @@ export default {
       confirmLoading: false,
       useTypeMap: {},
       statusMap: {},
+      statusList: [],
       yesNoMap: {},
       createdUserName: '',
       expandedKeys: [],
@@ -847,12 +852,13 @@ export default {
     this.queryParam.parentName = this.$route.query.parentName
     this.tableOption()
     this.otherTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_MEASURE_OTHER_TYPE)
-    console.log(11)
-    console.log(this.otherTypeMap)
     this.checkTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_TYPE)
     this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    this.statusList = this.DictCache.getChildrenList(this.DictCache.TYPE.SB_INFO_STATUS).filter(item => {
+      return !['置换中', '已置换', '维修中', '调拨中', '校准中', '丢失', '备用', '已退库', '报废驳回'].includes(item.label)
+    })
     this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
     this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
     this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
@@ -860,9 +866,9 @@ export default {
     this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
     this.lineMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_LINE)
     this.yesNoMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
-    querySbPosition().then((res) => {
-      this.sbPositionData = res.data
-    })
+    // querySbPosition().then((res) => {
+    //   this.sbPositionData = res.data
+    // })
   },
   methods: {
     tableOption () {
@@ -993,9 +999,9 @@ export default {
         modal.base(res.data)
       })
     },
-    handleBackBatch (status) {
+    handleBackBatch (status, type) {
       const modal = this.$refs.backForm
-      modal.base(status)
+      modal.base(status, type)
     },
     handleStart (record) {
       const modal = this.$refs.baseModalStatusLog

+ 41 - 14
src/views/sb/info/modules/BackForm.vue

@@ -7,6 +7,8 @@
     @cancel="handleCancel"
   >
     <a-button icon="plus" type="primary" @click="$refs.sbSelect.base()">选择设备</a-button>
+    <br>
+    <br>
     <a-table
       bordered
       :data-source="dataList"
@@ -19,7 +21,24 @@
     </a-table>
     <br>
     <a-form :form="form">
-      <row-list :col="1">
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="设备位置"
+            :labelCol="BaseTool.Constant.labelCol2"
+            :wrapperCol="BaseTool.Constant.wrapperCol2"
+          >
+            <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>
+        </row-item>
         <row-item>
           <a-form-item
             label="备注"
@@ -41,8 +60,9 @@
 </template>
 
 <script>
-import { batchBack } from '@/api/repair/application-form'
+import { batchBack, batchOut } from '@/api/repair/application-form'
 import SbInfoSelectModal from './SbInfoSelectModal2.vue'
+import { getSbPositionTree } from '@/api/sb/position'
 export default {
   name: 'BackForm',
   components: {
@@ -57,6 +77,7 @@ export default {
       // 下拉框map
       sbIds: [],
       dataList: [],
+      treeData: [],
       columns: [
         {
           title: '状态',
@@ -66,12 +87,6 @@ export default {
           width: 100,
           scopedSlots: { customRender: 'status' }
         },
-        {
-          title: '车间',
-          checked: true,
-          width: 150,
-          dataIndex: 'positionName'
-        },
         {
           title: '父位号',
           dataIndex: 'no',
@@ -104,6 +119,7 @@ export default {
         }
       ],
       status: 0,
+      type: 1,
       statusMap: {}
     }
   },
@@ -112,13 +128,17 @@ export default {
   created () {
     // 下拉框map
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    getSbPositionTree().then((res) => {
+      this.treeData = res.data
+    })
   },
   methods: {
-    base (status) {
+    base (status, type) {
       this.visible = true
       // 如果是空标识添加
-      this.modalTitle = status === 4 ? '报废' : '退库'
+      this.modalTitle = this.statusMap[status]
       this.status = status
+      this.type = type
       this.dataList = []
     },
     save () {
@@ -131,10 +151,17 @@ export default {
         }
         values.sbIds = this.dataList.map((value) => value.id)
         values.status = this.status
-        batchBack(values).then(res => {
-          this.confirmLoading = false
-          this.handleCancel()
-        })
+        if (this.type === 1) {
+          batchBack(values).then(res => {
+            this.confirmLoading = false
+            this.handleCancel()
+          })
+        } else {
+          batchOut(values).then(res => {
+            this.confirmLoading = false
+            this.handleCancel()
+          })
+        }
       })
     },
     handleSelected (keys, rows) {

+ 13 - 3
src/views/sb/info/modules/BaseForm.vue

@@ -122,7 +122,7 @@
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item label="状态" :labelCol="BaseTool.Constant.labelCol" :wrapperCol="BaseTool.Constant.wrapperCol">
             <a-select v-decorator="['status', {rules: [{required: true, message: '状态不能为空'}]}]" placeholder="请选择">
-              <a-select-option v-for="(label,value) in statusMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
+              <a-select-option v-for="{label,value} in statusMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
               </a-select-option>
             </a-select>
           </a-form-item>
@@ -728,7 +728,7 @@ export default {
       rlTypeMap: {},
       colorMap: {},
       useTypeMap: {},
-      statusMap: {},
+      statusMap: [],
       checkTypeMap: {},
       isChildMap: {},
       isShowMap: {},
@@ -771,6 +771,10 @@ export default {
     parentName: {
       type: String,
       default: null
+    },
+    isMeter: {
+      type: Boolean,
+      default: false
     }
   },
   created () {
@@ -778,7 +782,13 @@ export default {
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
     this.colorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_COLOR)
     this.rlTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.RANLIAO_TYPE)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
+    if (this.isMeter) {
+      this.statusMap = this.DictCache.getChildrenList(this.DictCache.TYPE.SB_INFO_STATUS).filter(item => {
+        return !['置换中', '已置换', '维修中', '调拨中', '校准中', '丢失', '备用', '已退库', '报废驳回'].includes(item.label)
+      })
+    } else {
+      this.statusMap = this.DictCache.getChildrenList(this.DictCache.TYPE.SB_INFO_STATUS)
+    }
     this.checkTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_TYPE)
     this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
     this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)