소스 검색

no message

linwenxin 9 달 전
부모
커밋
fee7ac3bdb
2개의 변경된 파일136개의 추가작업 그리고 94개의 파일을 삭제
  1. 4 1
      src/api/salesPurchasing/goodsInventory.js
  2. 132 93
      src/views/salesPurchasing/goodsInventory/index.vue

+ 4 - 1
src/api/salesPurchasing/goodsInventory.js

@@ -16,4 +16,7 @@ export function pageExport(data, name) {
     data,
     name
   })
-}
+}
+export function jxGoodsImportStock(data) {
+  return handleImport('/jx/goods/importStock', data.formdata, data.id || '')
+}

+ 132 - 93
src/views/salesPurchasing/goodsInventory/index.vue

@@ -1,12 +1,22 @@
 <template>
-	<zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
-		<template slot-scope="{activeKey, data}">
-			<template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-			  :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing" :operationColumnWidth="80"
-			  :operation="operation()" :exportList="exportList">
-			</template-page>
-		</template>
-	</zj-tab-page>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
+    <template slot-scope="{ activeKey, data }">
+      <template-page
+        v-if="activeKey == 'list'"
+        ref="pageRef"
+        :get-list="getList"
+        :table-attributes="tableAttributes"
+        :table-events="tableEvents"
+        :options-evens-group="optionsEvensGroup"
+        :moreParameters="moreParameters"
+        :column-parsing="columnParsing"
+        :operationColumnWidth="80"
+        :operation="operation()"
+        :exportList="exportList"
+      >
+      </template-page>
+    </template>
+  </zj-tab-page>
 </template>
 
 <script>
@@ -15,100 +25,129 @@ import import_mixin from '@/components/template/import_mixin.js'
 import ImageUpload from '@/components/file-upload'
 import { downloadFiles } from '@/utils/util'
 import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
-import { listPageV2, pageExport, getDetail, listImport } from "@/api/salesPurchasing/goodsInventory";
+import { listPageV2, pageExport, jxGoodsImportStock } from '@/api/salesPurchasing/goodsInventory'
 import { commonTemplateDownload } from '@/api/common.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
-	components: { TemplatePage, ImageUpload },
-	mixins: [import_mixin, operation_mixin],
-	data() {
-		return {
-			// 表格属性
-			tableAttributes: {
-				// 启用勾选列
-				selectColumn: true
-			},
-			// 表格事件
-			tableEvents: {
-				'selection-change': this.selectionChange
-			},
-			// 勾选选中行
-			recordSelected: [],
-			/** 表单变量 */
-			formDialogType: 0,
-			formDialogTitles: ["新增", "编辑", "详情"],
-			formDialog: false,
-			formData: {},
-			formType: 'add',
-			formVisible: false,
-		}
-	},
-	computed: {
-		// 事件组合
-		optionsEvensGroup() {
-			return []
-		},
-		// 更多参数
-		moreParameters() {
-			return []
-		},
+  components: { TemplatePage, ImageUpload },
+  mixins: [import_mixin, operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑', '详情'],
+      formDialog: false,
+      formData: {},
+      formType: 'add',
+      formVisible: false
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('kucunchushihua', ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(jxGoodsImportStock, moduleName)
+                }
+              }
+            })
+          ],
+          [
+            this.optionsEvensAuth('xiazaikucunchushihua', {
+              click: () => {
+                commonTemplateDownload({ name: '初始化商品库存.xlsx' }, `${this.$route.meta.title}`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
 
-		formItems() {
-			return []
-		}
-	},
-	methods: {
-		// 列表请求函数
-		getList(p, cb) {
-			try {
-				var pam = JSON.parse(JSON.stringify(p))
-				cb && cb(pam)
-				return listPageV2(pam)
-			} catch (error) {
-				console.log(error)
-			}
-		},
-		// 列表导出函数
-		exportList: pageExport,
-		// 表格列解析渲染数据更改
-		columnParsing(item, defaultData) {
-			return defaultData
-		},
-		// 监听勾选变化
-		selectionChange(data) {
-			this.recordSelected = data
-		},
+    formItems() {
+      return []
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList(p, cb) {
+      try {
+        var pam = JSON.parse(JSON.stringify(p))
+        cb && cb(pam)
+        return listPageV2(pam)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 列表导出函数
+    exportList: pageExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
 
-		operation() {
-			return this.operationBtn({
-				detail: {
-					conditions: ({ row, index, column }) => {
-						return JSON.parse(localStorage.getItem('greemall_user')).joinCode === "CODE"
-					},
-					click: ({ row, index, column }) => {
-						this.$router.push({
-							name: 'goodsCodeMachineAccount',
-							params: {
-								pageName: row.goodsMaterialId,
-								pageType: '-',
-								pageCode: row.goodsMaterialId
-							},
-						})
-					}
-				},
-			})
-		},
-		formCancel() {
-			this.formVisible = false
-			this.$refs?.formRef?.resetFields()
-			this.$data.formData = this.$options.data().formData
-		}
-	}
+    operation() {
+      return this.operationBtn({
+        detail: {
+          conditions: ({ row, index, column }) => {
+            return JSON.parse(localStorage.getItem('greemall_user')).joinCode === 'CODE'
+          },
+          click: ({ row, index, column }) => {
+            this.$router.push({
+              name: 'goodsCodeMachineAccount',
+              params: {
+                pageName: row.goodsMaterialId,
+                pageType: '-',
+                pageCode: row.goodsMaterialId
+              }
+            })
+          }
+        }
+      })
+    },
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+    }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .tab {
-	padding: 20px 20px 0 20px;
+  padding: 20px 20px 0 20px;
 }
 </style>