Purpose 3 miesięcy temu
rodzic
commit
ea95ad4df7

+ 9 - 0
src/api/TagSerialApi.js

@@ -0,0 +1,9 @@
+import BaseCurdApi from './BaseCurdApi'
+
+class TagSerialApi extends BaseCurdApi {
+  constructor () {
+    super('/tag/serial')
+  }
+}
+
+export default new TagSerialApi()

+ 4 - 0
src/assets/main.scss

@@ -67,3 +67,7 @@
   padding-top: var(--layout-gap);
   border-top: 1px solid var(--dialog-footer-border-color);
 }
+
+.height-text-color {
+  color: var(--height-text-color);
+}

+ 107 - 0
src/components/DialogTagCodeSerialDetail.vue

@@ -0,0 +1,107 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    :title="`订单详情 ${oData ? oData.orderNo : ''}`"
+    append-to-body
+    width="800px"
+  >
+    <div class="flex column" style="padding-bottom:20px;height:600px">
+      <div class="font-size-14 height-text-color" style="text-align: right;">{{ oData ? oData.number : 0 }}个</div>
+      <div class="flex-1 fit-size">
+        <el-table
+          ref="table"
+          :data="list"
+          stripe
+          border
+          height="100%"
+          size="small"
+          class="custom-el-table-style"
+          @selection-change="onSelectionChange"
+        >
+          <el-table-column
+            type="index"
+            label="序号"
+            width="60"
+            align="center"
+            fixed
+          ></el-table-column>
+          <el-table-column
+            label="流水号"
+            prop="serialNumber"
+            header-align="center"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="芯片编码"
+            prop="chipCode"
+            header-align="center"
+            align="center"
+          ></el-table-column>
+        </el-table>
+      </div>
+
+      <my-pagination
+        :total="total"
+        :pagination="pagination"
+        @current-change="currentPageNoChange"
+      />
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import BaseCurdList from '@@/utils/BaseCurdList'
+import bindPrototype from '@@/utils/bindPrototype'
+
+import TagSerial from '@@/entries/TagSerial'
+
+export default {
+  name: 'DialogTagCodeSerialDetail',
+  extends: BaseCurdList(TagSerial),
+  data: () => ({
+    visible: false,
+    oData: null
+  }),
+  methods: {
+    open (data) {
+      this.oData = data
+      this.pagination.pageNo = 1
+      this.visible = true
+      this.loadList()
+    },
+    close () {
+      this.oData = null
+      this.visible = true
+      this.total = 0
+      this.list = Object.freeze([])
+    },
+    loadList () {
+      const { oData } = this
+
+      if (!oData) {
+        return
+      }
+
+      this.$$request(TagSerial.$$api.getPagination, {
+        tagId: this.oData.id
+      }, this.pagination)
+        .then(data => {
+          const { count, list } = data
+          const { pagination } = this
+          const { pageSize } = pagination
+          if (list.length > 0 || pagination.pageNo === 1) {
+            this.total = count
+            this.list = Object.freeze(bindPrototype(data.list, TagSerial))
+            this.afterLoadList()
+            return
+          }
+
+          pagination.pageNo = Math.floor(count / pageSize)
+          this.loadList()
+        }).catch(console.error).finally(() => {})
+    }
+  }
+}
+</script>
+
+<style lang="scss"></style>

+ 1 - 1
src/components/MyPagination.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="flex valign-center layout-gap font-size-12">
-    <div><span>总计</span><span style="color:var(--height-text-color);">({{ total }})条</span></div>
+    <div><span>总计</span><span class="height-text-color">({{ total }})条</span></div>
 
     <div class="flex align-right flex-1 fit-size">
       <el-pagination

+ 21 - 0
src/entries/TagSerial.js

@@ -0,0 +1,21 @@
+import BaseCurdEntry from './BaseCurdEntry'
+import tagSerialApi from '@@/api/TagSerialApi'
+
+export default class TagSerial extends BaseCurdEntry {
+  id
+
+  serialNumber
+
+  chipCode
+
+  constructor (id, serialNumber, chipCode) {
+    super()
+    this.id = id
+    this.serialNumber = serialNumber
+    this.chipCode = chipCode
+  }
+
+  static get $$api () {
+    return tagSerialApi
+  }
+}

+ 42 - 30
src/mock/index.js

@@ -1,5 +1,5 @@
 import Mock from 'mockjs'
-import TagApplyState from '@@/entries/TagApplyState'
+// import TagApplyState from '@@/entries/TagApplyState'
 import TagType from '@@/entries/TagType'
 import TagPurchaseState from '@@/entries/TagPurchaseState'
 import Provider from '@@/entries/Provider'
@@ -7,36 +7,36 @@ import Constant from '@/utils/Constant'
 
 const API_BASE_PATH = Constant.REQUEST_PREFIX
 
-Mock.mock(`${API_BASE_PATH}/tag/apply/state/list`, 'post', {
-  type: 'success',
-  data: [
-    new TagApplyState(0, '待支付'),
-    new TagApplyState(1, '待发货'),
-    new TagApplyState(2, '已发货')
-  ]
-})
+// Mock.mock(`${API_BASE_PATH}/tag/apply/state/list`, 'post', {
+//   type: 'success',
+//   data: [
+//     new TagApplyState(0, '待支付'),
+//     new TagApplyState(1, '待发货'),
+//     new TagApplyState(2, '已发货')
+//   ]
+// })
 
-Mock.mock(/\/tag\/apply\/page/, 'post', {
-  type: 'success',
-  data: {
-    'count|10-40': 1,
-    'list|1-20': [{
-      'id|1-20': 1,
-      dataTime: '2024/01/01 00:00:00',
-      orderNo: '123456',
-      expectedReceiptDate: '2024/01/02 00:00:00',
-      'providerName|1': ['人民电器集团有限公司', '上海东生供用电器材厂', '上海辉电电力设备工程有限公司'],
-      'tagTypeName|1': ['高性能不干胶标签', '柔性抗金属标签', '扎带标签'],
-      number: 123,
-      'amount|1-100.1-2': 30,
-      'tagApplyStateId|0-2': 0,
-      operatorName: '操作员',
-      applicantName: '申领人',
-      'unitPrice|1-100.1-2': 10,
-      createTime: '2024/01/01 00:00:00'
-    }]
-  }
-})
+// Mock.mock(/\/tag\/apply\/page/, 'post', {
+//   type: 'success',
+//   data: {
+//     'count|10-40': 1,
+//     'list|1-20': [{
+//       'id|1-20': 1,
+//       dataTime: '2024/01/01 00:00:00',
+//       orderNo: '123456',
+//       expectedReceiptDate: '2024/01/02 00:00:00',
+//       'providerName|1': ['人民电器集团有限公司', '上海东生供用电器材厂', '上海辉电电力设备工程有限公司'],
+//       'tagTypeName|1': ['高性能不干胶标签', '柔性抗金属标签', '扎带标签'],
+//       number: 123,
+//       'amount|1-100.1-2': 30,
+//       'tagApplyStateId|0-2': 0,
+//       operatorName: '操作员',
+//       applicantName: '申领人',
+//       'unitPrice|1-100.1-2': 10,
+//       createTime: '2024/01/01 00:00:00'
+//     }]
+//   }
+// })
 
 Mock.mock(`${API_BASE_PATH}/provider/list`, 'post', {
   type: 'success',
@@ -142,4 +142,16 @@ Mock.mock(`${API_BASE_PATH}/data/statistics/tag/type/count`, 'get', {
   }]
 })
 
+Mock.mock(/\/tag\/serial\/page/, 'post', {
+  type: 'success',
+  data: {
+    'count|20-40': 1,
+    'list|1-20': [{
+      'id|1-20': 1,
+      'serialNumber|1-1000000': 1,
+      'chipCode|1-10000000': 1
+    }]
+  }
+})
+
 export default Mock

+ 2 - 0
src/utils/BaseCurdEditor.js

@@ -19,6 +19,7 @@ export default (Target) => ({
   data: () => ({
     visible: false,
     data: null,
+    oData: null,
     operatorTypeId: 1,
     refFormName: 'form',
     activeCollapseName: '1'
@@ -44,6 +45,7 @@ export default (Target) => ({
       this.onOpen(data).then(() => {
         if (data) {
           this.operatorTypeId = isView ? operatorTypes[2].id : operatorTypes[1].id
+          this.oData = data
           this.getDetail(data)
         } else {
           this.operatorTypeId = operatorTypes[0].id

+ 2 - 4
src/utils/BaseCurdList.js

@@ -10,11 +10,11 @@ export default (Target, hasPagination = true) => ({
     query: Target.$$getQuery() || {},
     oQuery: {},
     pagination: {
-      pageNo: 0,
+      pageNo: 1,
       pageSize: 20
     },
     oPagination: {
-      pageNo: 0,
+      pageNo: 1,
       pageSize: 20
     },
     list: Object.freeze([]),
@@ -32,9 +32,7 @@ export default (Target, hasPagination = true) => ({
       }, 0)
     },
     loadList () {
-      let query = Object.assign({}, this.query)
       if (hasPagination) {
-        Object.assign(query, this.pagination)
         this.$$request(Target.$$api.getPagination, this.query, this.pagination)
           .then(data => {
             const { count, list } = data

+ 3 - 2
src/views/TagCode.vue

@@ -138,13 +138,12 @@
             ></el-table-column>
             <el-table-column
               label="操作栏"
-              min-width="260"
+              min-width="200"
               header-align="center"
               align="center"
             >
               <template v-slot="{ row }">
                 <div class="flex center layout-gap">
-                  <edit-button :data="row" :on-click="onOpenEditorBtnClick" icon="el-icon-edit">编辑</edit-button>
                   <edit-button :data="row" :on-click="onOpenDetailEditorBtnClick" icon="el-icon-view">详情</edit-button>
                   <edit-button :data="row" :on-click="onPreviewBtnClick" icon="el-icon-view">预览</edit-button>
                   <edit-button :data="row" :on-click="onPrintBtnClick" icon="el-icon-view">
@@ -187,6 +186,8 @@
         <div></div>
       </div>
     </el-card>
+
+    <dialog-tag-code-serial-detail ref="editor"></dialog-tag-code-serial-detail>
   </div>
 </template>