Kaynağa Gözat

Merge branch 'develop-2.0.0' of http://shw.themoretech.com:30196/zhaohurui/Jeff.RFID.UI into develop-2.0.0

Purpose 5 ay önce
ebeveyn
işleme
039c6e9266

+ 17 - 0
src/api/MaterialDetailApi.js

@@ -1,6 +1,23 @@
 import BaseCurdApi from './BaseCurdApi'
 
 class MaterialDetailApi extends BaseCurdApi {
+  importData = (data) => {
+    const formData = new FormData()
+    formData.append('file', data.file)
+    return this.api({
+      url: `${this.basePath}/tag/data/import`,
+      method: 'POST',
+      data: formData,
+      headers: {
+        'Content-Type': 'multipart/form-data'
+      }
+    })
+  }
+  downloadTemplateTag = (query) => this.api({
+    url: `${this.basePath}/tag/download/template`,
+    method: 'GET',
+    responseType: 'blob'
+  })
   constructor () {
     super('/materiel')
   }

+ 1 - 1
src/api/MessageCenterApi.js

@@ -2,7 +2,7 @@ import BaseCurdApi from './BaseCurdApi'
 
 class MessageCenterApi extends BaseCurdApi {
   constructor () {
-    super('/messagecenter')
+    super('/message/center')
   }
 }
 

+ 9 - 0
src/api/TagDistributeApi.js

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

+ 123 - 0
src/components/DialogImportTag.vue

@@ -0,0 +1,123 @@
+<template>
+    <el-dialog
+      :visible.sync="visible"
+      title="导入数据"
+      append-to-body
+      width="500px"
+    >
+      <el-form
+        ref="form"
+        :model="uploadData"
+        label-width="80px"
+      >
+      <el-row :gutter="0">
+              <el-col :span="24">
+                <el-form-item prop="file" label="上传文件" :rules="[{
+                  required: true,
+                  message: '请选择需要上传的文件'
+                }]">
+                  <el-input :value="uploadData.file ? uploadData.file.name : ''" read-only>
+                    <template #append>
+                      <el-upload
+                        ref="upload"
+                        action=""
+                        :auto-upload="false"
+                        :multiple="false"
+                        :show-file-list="false"
+                        accept=".xls,.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+                        :on-change="onFileChange"
+                      >
+                        <div class="el-button el-button--primary" style="border-radius: 0 4px 4px 0;">浏览</div>
+                      </el-upload>
+                    </template>
+                  </el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+      </el-form>
+
+      <template #footer>
+        <div class="flex center dialog-footer">
+          <el-button
+            @click="onCloseBtnClick"
+          >取消</el-button>
+
+          <el-button
+            type="primary"
+            @click="onImportDataBtnClick"
+          >确定</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </template>
+
+<script>
+import BasePage from '@@/utils/BasePage'
+
+export default {
+  name: 'DialogImportTag',
+  extends: BasePage,
+  props: {
+    api: {
+      required: true,
+      type: Function
+    }
+  },
+  data: () => ({
+    visible: false,
+    uploadData: {
+      file: null
+    }
+  }),
+  methods: {
+    open () {
+      this.uploadData = {
+        file: null
+      }
+
+      this.visible = true
+      this.$nextTick(() => {
+        this.$refs.upload.clearFiles()
+        this.$refs.form.resetFields()
+      })
+    },
+    onFileChange (event) {
+      this.uploadData.file = event.raw
+      const uploadEl = this.$refs.upload
+      const { uploadFiles } = uploadEl
+      uploadFiles.splice(0, uploadFiles.length, event)
+    },
+    onImportDataBtnClick () {
+      this.$refs.form.validate(flag => {
+        if (!flag) {
+          return
+        }
+
+        this.$$request(this.api, this.uploadData).then((flag) => {
+          if (flag) {
+            this.$notify({
+              title: '成功',
+              message: '上传成功',
+              type: 'success',
+              position: 'bottom-right'
+            })
+
+            this.close()
+            this.$emit('imported')
+          }
+        }).catch(console.error).finally(() => {})
+      })
+    },
+    close () {
+      this.$refs.upload.clearFiles()
+      this.uploadData.file = null
+      this.visible = false
+    },
+    onCloseBtnClick () {
+      this.close()
+    }
+  }
+}
+</script>
+
+  <style lang="scss"></style>

+ 135 - 0
src/components/DialogMaterialDetail.vue

@@ -0,0 +1,135 @@
+<template>
+    <el-dialog
+      :visible.sync="visible"
+      :title="`${operatorType.name}物料详情`"
+      append-to-body
+      width="750px"
+    >
+      <el-form
+        v-if="data"
+        ref="form"
+        :model="data"
+        label-width="105px"
+      >
+        <el-collapse v-model="activeCollapseName" class="form-collapse">
+          <el-collapse-item title="物料详情" name="1" class="form-collapse-item">
+            <div class="overflow-auto" style="padding:0 10px;">
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="物料商品编码">
+                      <el-input v-model="data.goodsCode" readonly/>
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="物料名称">
+                      <el-input v-model="data.name" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="物料编码">
+                      <el-input v-model="data.materielCode" readonly />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="大类">
+                      <el-input v-model="data.bigCategoryName" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="中类">
+                      <el-input v-model="data.middleCategoryName" readonly />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="小类">
+                      <el-input v-model="data.smallCategoryName" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="物料描述">
+                      <el-input v-model="data.materielDescribe" readonly />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="品牌">
+                      <el-input v-model="data.brand" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="生产商名称">
+                      <el-input v-model="data.manufacturer" readonly />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="规格">
+                      <el-input v-model="data.specifications" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="最小包装单元">
+                      <el-input v-model="data.minimumPackingUnit" readonly />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="最小包装数量">
+                      <el-input v-model="data.minimumPackingNumber" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row
+                  :gutter="$$Constant.LAYOUT_GAP"
+                >
+                  <el-col :span="12">
+                    <el-form-item label="标签类型">
+                      <el-input v-model="data.tagTypeName" readonly />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+            </div>
+          </el-collapse-item>
+        </el-collapse>
+      </el-form>
+
+    </el-dialog>
+  </template>
+
+<script>
+import BaseCurdEditor from '@@/utils/BaseCurdEditor'
+import MaterialDetail from '@@/entries/MaterialDetail'
+
+export default {
+  name: 'DialogMaterialDetail',
+  extends: BaseCurdEditor(MaterialDetail),
+  props: {
+    // optionGroup: {
+    //   required: true,
+    //   type: Object
+    // }
+  }
+}
+</script>
+
+<style lang="scss"></style>

+ 2 - 2
src/entries/MaterialDetail.js

@@ -1,6 +1,6 @@
 import BaseCurdEntry from './BaseCurdEntry'
 import MaterialCategory from './MaterialCategory'
-import materialDetailApiApi from '@@/api/MaterialDetailApi'
+import materialDetailApi from '@@/api/MaterialDetailApi'
 
 export default class MaterialDetail extends BaseCurdEntry {
   id
@@ -27,7 +27,7 @@ export default class MaterialDetail extends BaseCurdEntry {
   }
 
   static get $$api () {
-    return materialDetailApiApi
+    return materialDetailApi
   }
 
   static $$getQuery = () => ({

+ 24 - 0
src/entries/MaterialTag.js

@@ -0,0 +1,24 @@
+import BaseCurdEntry from './BaseCurdEntry'
+import materialDetailApi from '@@/api/MaterialDetailApi'
+
+export default class MaterialTag extends BaseCurdEntry {
+  id
+
+  materielCode
+
+  goodsCode
+
+  name
+
+  smallCategoryName
+
+  tagTypeName
+
+  static get $$api () {
+    return materialDetailApi
+  }
+
+  static get $$name () {
+    return 'MaterialTag'
+  }
+}

+ 2 - 2
src/entries/ProviderDetail.js

@@ -1,6 +1,6 @@
 import BaseCurdEntry from './BaseCurdEntry'
 
-import providerDetailApiApi from '@@/api/ProviderDetailApi'
+import providerDetailApi from '@@/api/ProviderDetailApi'
 
 export default class ProviderDetail extends BaseCurdEntry {
   id
@@ -24,7 +24,7 @@ export default class ProviderDetail extends BaseCurdEntry {
   }
 
   static get $$api () {
-    return providerDetailApiApi
+    return providerDetailApi
   }
 
   static $$getQuery = () => ({

+ 81 - 0
src/entries/TagDistribute.js

@@ -0,0 +1,81 @@
+import BaseCurdEntry from './BaseCurdEntry'
+
+import tagDistributeApi from '@@/api/TagDistributeApi'
+
+import Provider from './Provider'
+
+import TagApplyState from './TagApplyState'
+
+export default class TagDistribute extends BaseCurdEntry {
+  id
+
+  orderNo
+
+  dataTime
+  get formatDataTime () {
+    return new Date(this.dataTime).format('YYYY-MM-DD')
+  }
+
+  expectedReceiptDate
+  get formatExpectedReceiptDate () {
+    return new Date(this.expectedReceiptDate).format('YYYY-MM-DD')
+  }
+
+  providerId
+  get providerName () {
+    const config = TagDistribute.$$optionData.Provider
+    if (config) {
+      const option = config.map[this.providerId]
+      if (option) {
+        return option[Provider.$$nameProp]
+      }
+    }
+
+    return ''
+  }
+
+  tagTypeName
+
+  number
+
+  amount
+
+  tagApplyStateId
+  get tagApplyStateName () {
+    const config = TagDistribute.$$optionData.TagApplyState
+    if (config) {
+      const option = config.map[this.tagApplyStateId]
+      if (option) {
+        return option[TagApplyState.$$nameProp]
+      }
+    }
+
+    return ''
+  }
+
+  operatorName
+
+  static get $$name () {
+    return 'TagDistribute'
+  }
+
+  static get $$api () {
+    return tagDistributeApi
+  }
+
+  static $$getQuery = () => ({
+    tagApplyStateId: '',
+    order: [['dataTime', 'DESC']]
+  })
+
+  static $$optionTargetConfigGroup = [
+    [{
+      Target: TagApplyState,
+      getQuery: () => ({})
+    }, {
+      Target: Provider
+    }]
+  ]
+
+  static $$optionData = {}
+}

+ 0 - 12
src/mock/index.js

@@ -186,16 +186,4 @@ Mock.mock(/\/tag\/code\/page/, 'post', {
     }]
   }
 })
-
-Mock.mock(/\/messagecenter\/page/, 'post', {
-  type: 'success',
-  data: {
-    'count|10-40': 1,
-    'list|1-20': [{
-      'dataTime|1': ['2024/01/01 16:00:00', '2024/02/01 16:00:00', '2024/03/01 16:00:00'],
-      'content|1': ['测试消息', '测试消息1']
-    }]
-  }
-})
-
 export default Mock

+ 16 - 0
src/router/index.js

@@ -75,6 +75,22 @@ export default new Router({
           permission: 'isAuthenticated'
         },
         component: () => import('@@/views/MaterialDetail.vue')
+      }, {
+        path: '/page-in-src/material-tag',
+        name: 'MaterialTag',
+        meta: {
+          title: '入库物资标签',
+          permission: 'isAuthenticated'
+        },
+        component: () => import('@@/views/MaterialTag.vue')
+      }, {
+        path: '/page-in-src/tag-distribute',
+        name: 'TagDistribute',
+        meta: {
+          title: '标签发放',
+          permission: 'isAuthenticated'
+        },
+        component: () => import('@@/views/TagDistribute.vue')
       }]
     }
   ]

+ 8 - 2
src/views/MaterialDetail.vue

@@ -166,7 +166,7 @@
               >
                 <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-tickets">详情</edit-button>
                   </div>
                 </template>
               </el-table-column>
@@ -180,7 +180,10 @@
           />
         </div>
       </el-card>
-
+      <dialog-material-detail
+        ref="editor"
+         @saved="loadList"
+    ></dialog-material-detail>
     </div>
   </template>
 
@@ -207,6 +210,9 @@ export default {
       this.$$request(materialCategoryApi.getList, {parentId: id}).then(dataList => {
         this.middleCategories = Object.freeze(dataList)
       }).catch(console.error)
+    },
+    onOpenDetailEditorBtnClick (data) {
+      this.onOpenEditorBtnClick(data, true)
     }
   }
 }

+ 132 - 0
src/views/MaterialTag.vue

@@ -0,0 +1,132 @@
+<template>
+    <div class="wrapper flex column layout-gap">
+      <el-card
+        shadow="hover"
+        class="z-card flex column flex-1 fit-size"
+      >
+        <div class="wrapper flex column layout-gap">
+            <div class="flex valign-center">
+                <el-button
+                  plain
+                  icon="el-icon-upload2"
+                  type="primary"
+                  size="small"
+                  class="custom-plain-button"
+                  @click="onOpenEditorBtnClick"
+                >批量导入</el-button>
+                <el-button
+                  icon="el-icon-download"
+                  plain
+                  type="primary"
+                  size="small"
+                  class="custom-plain-button"
+                  @click="onDownloadTemplateBtnClick"
+                >下载模版
+                </el-button>
+            </div>
+
+          <!-- <div class="flex column flex-1 fit-size"></div> -->
+          <div class="flex-1 fit-size">
+            <el-table
+              ref="table"
+              :data="list"
+              stripe
+              border
+              highlight-current-row
+              height="100%"
+              size="small"
+              class="custom-el-table-style"
+              @selection-change="onSelectionChange"
+              @row-click="onRowClick"
+            >
+              <el-table-column
+                type="index"
+                label="序号"
+                width="60"
+                align="center"
+                fixed
+              ></el-table-column>
+              <el-table-column
+                label="商品Id"
+                prop="goodsCode"
+                align="center"
+                min-width="100"
+                header-align="center"
+                fixed
+              ></el-table-column>
+              <el-table-column
+                label="物料编码"
+                prop="materielCode"
+                min-width="100"
+                header-align="center"
+                align="center"
+              ></el-table-column>
+              <el-table-column
+                label="物料名称"
+                prop="name"
+                min-width="150"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+              <el-table-column
+                label="商品名称"
+                prop="providerName"
+                min-width="150"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+              <el-table-column
+                label="物料小类"
+                prop="smallCategoryName"
+                min-width="120"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+              <el-table-column
+                label="标签类型"
+                prop="tagTypeName"
+                min-width="120"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+            </el-table>
+          </div>
+
+          <my-pagination
+            :total="total"
+            :pagination="pagination"
+            @current-change="currentPageNoChange"
+          />
+        </div>
+      </el-card>
+      <dialog-import-tag
+        ref="dialogImportTag"
+        :api="$$api.importData"
+        @imported="onSaved"
+      ></dialog-import-tag>
+    </div>
+    </template>
+
+<script>
+import BaseCurdList from '@@/utils/BaseCurdList'
+import MaterialTag from '@@/entries/MaterialTag'
+
+export default {
+  name: 'MaterialTag',
+  extends: BaseCurdList(MaterialTag),
+  data: () => ({
+    editorName: 'dialogImportTag'
+  }),
+  methods: {
+    onImportDataBtnClick () {
+      this.$refs.dialogImportTag.open()
+    },
+    onDownloadTemplateBtnClick () {
+      this.$$request(this.$$api.downloadTemplateTag).then(() => {
+      }).catch(console.error).finally(() => {})
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 155 - 0
src/views/TagDistribute.vue

@@ -0,0 +1,155 @@
+<template>
+    <div class="wrapper flex column layout-gap">
+      <el-card shadow="hover" class="filter-card">
+        <el-form label-width="100px">
+          <el-row :gutter="$$Constant.LAYOUT_GAP">
+            <el-col :span="8">
+                <el-form-item label="申领状态">
+                    <my-select
+                        v-model="query.tagApplyStateId"
+                        :options="optionGroup.TagApplyState ? optionGroup.TagApplyState.list : []"
+                        @change="onSearchBtnClick"
+                    >
+              <el-option label="全部" value=""></el-option>
+            </my-select>
+          </el-form-item>
+            </el-col>
+            <el-col :span="16" class="text-right">
+              <el-button
+                plain
+                class="filter-button"
+                @click="onResetBtnClick"
+              >重置</el-button>
+              <el-button
+                type="primary"
+                class="filter-button"
+                @click="onSearchBtnClick"
+              >查询</el-button>
+            </el-col>
+          </el-row>
+        </el-form>
+      </el-card>
+
+      <el-card
+        shadow="hover"
+        class="z-card flex column flex-1 fit-size"
+      >
+        <div class="wrapper flex column layout-gap">
+
+          <div class="flex-1 fit-size">
+            <el-table
+              ref="table"
+              :data="list"
+              stripe
+              border
+              highlight-current-row
+              height="100%"
+              size="small"
+              class="custom-el-table-style"
+            >
+              <el-table-column
+                type="index"
+                label="序号"
+                width="60"
+                align="center"
+                fixed
+              ></el-table-column>
+              <el-table-column
+                label="订单编号"
+                prop="orderNo"
+                align="center"
+                min-width="110"
+                header-align="center"
+              ></el-table-column>
+              <el-table-column
+                label="申领日期"
+                prop="formatDataTime"
+                min-width="80"
+                header-align="center"
+                align="center"
+              ></el-table-column>
+              <el-table-column
+                label="预期收货日期"
+                prop="formatExpectedReceiptDate"
+                min-width="80"
+                header-align="center"
+                align="center"
+              ></el-table-column>
+              <el-table-column
+                label="供应商名称"
+                prop="providerName"
+                min-width="160"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+              <el-table-column
+                label="标签类型"
+                prop="tagTypeName"
+                min-width="120"
+                header-align="center"
+                align="left"
+              ></el-table-column>
+              <el-table-column
+                label="需求数量"
+                prop="number"
+                min-width="70"
+                header-align="center"
+                align="center"
+              ></el-table-column>
+              <el-table-column
+                label="费用"
+                prop="amount"
+                align="right"
+                min-width="70"
+                header-align="center"
+              ></el-table-column>
+              <el-table-column
+                label="状态"
+                prop="tagApplyStateName"
+                align="center"
+                min-width="70"
+                header-align="center"
+              ></el-table-column>
+              <el-table-column
+                label="操作员"
+                prop="operatorName"
+                align="center"
+                min-width="70"
+                header-align="center"
+              ></el-table-column>
+              <el-table-column
+                label="操作栏"
+                min-width="80"
+                header-align="center"
+                align="center"
+              >
+                <template v-slot="{ row }">
+                  <div class="flex center layout-gap">
+                    <edit-button :data="row" :on-click="onOpenDetailEditorBtnClick">详情</edit-button>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+
+          <my-pagination
+            :total="total"
+            :pagination="pagination"
+            @current-change="currentPageNoChange"
+          />
+        </div>
+      </el-card>
+    </div>
+  </template>
+
+<script>
+import BaseCurdList from '@@/utils/BaseCurdList'
+import TagDistribute from '@@/entries/TagDistribute'
+
+export default {
+  name: 'TagDistribute',
+  extends: BaseCurdList(TagDistribute)
+}
+</script>
+
+<style lang="scss" scoped></style>