Purpose 9 months ago
parent
commit
3ee01a83f7

+ 6 - 0
src/api/TagPurchaseApi.js

@@ -24,6 +24,12 @@ class TagPurchaseApi extends BaseCurdApi {
     })
   }
 
+  inStorage = tagPurchaseIds => this.api({
+    url: `${this.basePath}/in-storage`,
+    method: 'PUT',
+    data: tagPurchaseIds
+  })
+
   constructor () {
     super('/tag/purchase')
   }

+ 4 - 15
src/components/DialogTagPurchase.vue

@@ -47,7 +47,7 @@
             </template>
             <template v-else>
               <el-row :gutter="$$Constant.LAYOUT_GAP">
-                <el-col :span="8">
+                <el-col :span="12">
                   <el-form-item label="标签类型" prop="tagTypeId">
                     <my-select
                       v-model="data.tagTypeId"
@@ -56,7 +56,7 @@
                   </el-form-item>
                 </el-col>
 
-                <el-col :span="8">
+                <el-col :span="12">
                   <el-form-item label="标签数量" prop="number" :rules="[{
                     required: true,
                     message: '请输入标签数量'
@@ -64,25 +64,14 @@
                     <integer-input v-model="data.number" placeholder="输入标签数量"></integer-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="8">
+                <!-- <el-col :span="8">
                   <el-form-item label="标签单价" prop="price" :rules="[{
                     required: true,
                     message: '请输入标签单价'
                   }]">
                     <el-input v-model="data.price" type="number" placeholder="输入标签单价"></el-input>
                   </el-form-item>
-                </el-col>
-              </el-row>
-
-              <el-row :gutter="$$Constant.LAYOUT_GAP">
-                <el-col :span="12">
-                  <el-form-item label="采购状态" prop="tagPurchaseStateId">
-                    <my-radio-button-group
-                      v-model="data.tagPurchaseStateId"
-                      :options="optionGroup.TagPurchaseState ? optionGroup.TagPurchaseState.list : []"
-                    ></my-radio-button-group>
-                  </el-form-item>
-                </el-col>
+                </el-col> -->
               </el-row>
             </template>
           </div>

+ 5 - 0
src/mock/index.js

@@ -100,4 +100,9 @@ Mock.mock(/\/tag\/purchase\/.+/, 'get', {
   }
 })
 
+Mock.mock(/\/tag\/purchase\/in-storage/, 'put', {
+  type: 'success',
+  data: true
+})
+
 export default Mock

+ 11 - 0
src/utils/BaseCurdList.js

@@ -8,10 +8,15 @@ export default (Target, hasPagination = true) => ({
   data: () => ({
     optionGroup: Object.freeze({}),
     query: Target.$$getQuery(),
+    oQuery: {},
     pagination: {
       pageNo: 0,
       pageSize: 20
     },
+    oPagination: {
+      pageNo: 0,
+      pageSize: 20
+    },
     list: Object.freeze([]),
     total: 0,
     selectedData: null,
@@ -56,6 +61,11 @@ export default (Target, hasPagination = true) => ({
     currentPageNoChange () {
       this.loadList()
     },
+    onResetBtnClick () {
+      this.query = JSON.parse(JSON.stringify(this.oQuery))
+      this.pagination = { ...this.oPagination }
+      this.loadList()
+    },
     onSearchBtnClick () {
       this.pagination.pageNo = 1
       this.loadList()
@@ -151,6 +161,7 @@ export default (Target, hasPagination = true) => ({
       this.getOptionGroup(Target).then(optionGroup => {
         this.optionGroup = optionGroup
         Target.$$optionData = optionGroup
+        this.oQuery = Object.freeze(JSON.parse(JSON.stringify(this.query)))
         this.loadList()
       })
     }

+ 14 - 1
src/views/TagPurchase.vue

@@ -27,6 +27,7 @@
             <el-button
               plain
               class="filter-button"
+              @click="onResetBtnClick"
             >重置</el-button>
             <el-button
               type="primary"
@@ -54,6 +55,7 @@
           >新建采购</el-button>
 
           <el-button
+            :disabled="selectedList.length === 0"
             plain
             icon="el-icon-finished"
             type="primary"
@@ -184,7 +186,18 @@ export default {
   name: 'TagPurchase',
   extends: BaseCurdList(TagPurchase),
   methods: {
-    onInStorageBtnClick () {}
+    onInStorageBtnClick () {
+      const { selectedList } = this
+      if (selectedList === 0) {
+        return
+      }
+
+      this.$$request(this.$$api.inStorage, selectedList.map(data => data.id)).then(flag => {
+        if (flag) {
+          this.loadList()
+        }
+      }).catch(console.error).finally(() => {})
+    }
   }
 }
 </script>