Quellcode durchsuchen

完善计量的功能

hfxc226 vor 2 Jahren
Ursprung
Commit
ab090ee070

+ 32 - 0
src/api/sb/position.js

@@ -156,3 +156,35 @@ export function getSbPositionSbTree (parameter) {
     }
   })
 }
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function selectCountByPosition (parameter) {
+  return axios({
+    url: '/sb/positions/num/code/' + parameter.code,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function selectCountByPositionGroupBySbType (parameter) {
+  return axios({
+    url: '/sb/positions/num/type/' + parameter.code,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}

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

@@ -47,6 +47,8 @@ const constantRouterComponents = {
   'SbType': () => import('@/views/sb/type/SbType'),
   // 设备位置
   'SbPosition': () => import('@/views/sb/position/SbPosition'),
+  // 设备位置数量统计
+  'SbPositionNum': () => import('@/views/sb/position/SbPositionNum'),
   // 设别规格
   'SbGuige': () => import('@/views/sb/guige/SbGuige'),
   // 设别基础信息

+ 1 - 0
src/views/sb/info/SbInfo.vue

@@ -266,6 +266,7 @@ export default {
         filter: this.filter,
         useType: this.useType,
         id: this.$route.query.id,
+        typeId: this.$route.query.typeId,
         status: this.$route.query.status
       },
       depreciationTypeMap: {},

+ 101 - 0
src/views/sb/position/SbPositionNum.vue

@@ -0,0 +1,101 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+    <h1 style="margin:20px auto; text-align: center"> 设备位置统计数据 </h1>
+    <a-card title="厂区统计">
+      <a-card-grid v-for="position in sbPositionData" v-if="position.type === 1" :key="position.id" style="cursor: pointer;width:25%;text-align:center" @click="selectCountByPosition(position)">
+        {{ position.name + '(数量:' + num + ')' }}
+      </a-card-grid>
+    </a-card>
+
+    <a-card title="车间统计">
+      <a-card-grid v-for="position in sbPositionData" v-if="position.type === 2" :key="position.id" style="cursor: pointer;width:25%;text-align:center" @click="selectCountByPositionGroupBySbType(position)">
+        {{ position.name  + '(数量:' + lineNum + ')' }}
+      </a-card-grid>
+    </a-card>
+
+    <a-card title="类型统计">
+      <a-card-grid v-for="type in typeData" :key="type.id" style="cursor: pointer;width:25%;text-align:center" @click="jumpSbInfo(type)">
+        {{ type.typeName +  '(数量:' + type.num + ')'  }}
+      </a-card-grid>
+    </a-card>
+
+    <a-row :gutter="48">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right;margin-top: 10px">
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+  </a-card>
+</template>
+
+<script>
+
+import { querySbPosition, selectCountByPosition, selectCountByPositionGroupBySbType } from '@/api/sb/position'
+
+export default {
+  name: 'SbPositionNum',
+  components: {
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      configMap: {},
+      num: null,
+      lineNum: null,
+      sbPositionData: [],
+      typeData: [],
+      factoryStr: null,
+      form: this.$form.createForm(this),
+      visible: true,
+      user: this.$store.getters.userInfo
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+    querySbPosition().then(res => {
+      this.sbPositionData = res.data
+    })
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        this.data = []
+      }
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    },
+    selectCountByPosition (position) {
+      selectCountByPosition(position).then(res => {
+        this.num = res.data
+      })
+    },
+    selectCountByPositionGroupBySbType (position) {
+      selectCountByPosition(position).then(res => {
+        this.lineNum = res.data
+      })
+      selectCountByPositionGroupBySbType(position).then(res => {
+        this.typeData = res.data
+      })
+    },
+    jumpSbInfo (type) {
+      const routeUrl = this.$router.resolve({ path: '/sb/info/company', query: { typeId: type.typeId } })
+      window.open(routeUrl.href, '_blank')
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/sb/position/modules/BaseForm.vue

@@ -64,7 +64,7 @@
         :wrapperCol="BaseTool.Constant.wrapperCol"
       >
         <a-input
-          v-decorator="['code', {rules: [{required: true, message: '父子关联编码不能为空'}]}]" />
+          v-decorator="['code', {rules: [{required: false, message: '父子关联编码不能为空'}]}]" />
       </a-form-item>
       <a-form-item
         label="区域维修负责人"