wangn 5 лет назад
Родитель
Сommit
cb4aef49f9
3 измененных файлов с 66 добавлено и 16 удалено
  1. 22 3
      ghs/src/components/module/item-list-layer.vue
  2. 21 1
      ghs/src/service/item/index.js
  3. 23 12
      ghs/src/views/item/list.vue

+ 22 - 3
ghs/src/components/module/item-list-layer.vue

@@ -20,11 +20,11 @@
               <el-checkbox
               <el-checkbox
                 v-if="scope.row.select == 2"
                 v-if="scope.row.select == 2"
                 disabled
                 disabled
-                :label="scope.row.index"
+                :label="scope.row"
               >{{scope.row.id}}</el-checkbox>
               >{{scope.row.id}}</el-checkbox>
               <el-checkbox
               <el-checkbox
                 v-else
                 v-else
-                :label="scope.row.index"
+                :label="scope.row"
               >{{scope.row.id}}</el-checkbox>
               >{{scope.row.id}}</el-checkbox>
             </div>
             </div>
           </template>
           </template>
@@ -50,6 +50,14 @@
             ></el-input>
             ></el-input>
           </template>
           </template>
 
 
+          <template #table-column-addPrice="{scope}">
+            <el-input
+              v-model="scope.row.addPrice"
+              placeholder="加价"
+              size="small"
+            ></el-input>
+          </template>
+
           <template #table-column-cover="{scope}">
           <template #table-column-cover="{scope}">
             <div>
             <div>
               <cl-avatar
               <cl-avatar
@@ -106,13 +114,19 @@ export default {
   },
   },
   watch: {
   watch: {
     show (val) {
     show (val) {
+      console.log(val)
       this.selDialog = val;
       this.selDialog = val;
     }
     }
   },
   },
   created () { },
   created () { },
   methods: {
   methods: {
     confirmFn () {
     confirmFn () {
-      this.$emit('confirm', this.list[this.checkList]);
+      if (this.checkList.length > 0) {
+        this.$emit('confirm', this.checkList);
+      } else {
+        this.$message.warning('请至少选择一项花材');
+      }
+
     },
     },
     resetForm () {
     resetForm () {
       this.$emit('cancel');
       this.$emit('cancel');
@@ -155,6 +169,11 @@ export default {
               label: '成本价',
               label: '成本价',
               align: 'center'
               align: 'center'
             },
             },
+            {
+              prop: 'addPrice',
+              label: '加价',
+              align: 'center'
+            },
             {
             {
               prop: 'select',
               prop: 'select',
               label: '已添加',
               label: '已添加',

+ 21 - 1
ghs/src/service/item/index.js

@@ -2,6 +2,26 @@ import { BaseService, Service } from '@/cool';
 
 
 @Service('item')
 @Service('item')
 export class ItemService extends BaseService {
 export class ItemService extends BaseService {
-
+    /**
+	 * 新增花材 b
+	 */
+	itemAdd(data) {
+		return this.request({
+			url: '/add',
+			method: 'POST',
+			data: data
+		});
+  }
+    /**
+	 * 批量新增花材 b
+	 */
+    batchAdd(data) {
+		return this.request({
+			url: '/batch-add',
+			method: 'POST',
+			data: data
+		});
+  }
+  
 }
 }
 export default new ItemService();
 export default new ItemService();

+ 23 - 12
ghs/src/views/item/list.vue

@@ -72,14 +72,13 @@
         #slot-add-goods-btn
         #slot-add-goods-btn
         v-if="showAddBtn"
         v-if="showAddBtn"
       >
       >
-  <el-button
-    type="primary"
-    size="mini"
-    @click="add()"
-  >添加</el-button>
-</template>
+        <el-button
+          type="primary"
+          size="mini"
+          @click="add()"
+        >添加</el-button>
+      </template>
     </x-crud>
     </x-crud>
-
     <item-list-layer
     <item-list-layer
       :show.sync="showItemModal"
       :show.sync="showItemModal"
       @confirm="selGoodsConfirmFn"
       @confirm="selGoodsConfirmFn"
@@ -122,11 +121,23 @@ export default {
   },
   },
   methods: {
   methods: {
     selGoodsConfirmFn (item) {
     selGoodsConfirmFn (item) {
-      return false
-      GhsService.bindGhs({ sjId: this.selectSjId, ghsSjId: item.id }).then(res => {
-        this.$message.success('操作成功!');
-        this.ghsModal = false;
-      });
+      let param = []
+      item.forEach(value => {
+        let newObj = {}
+        newObj.itemId = value.id
+        newObj.classId = this.classId
+        newObj.cost = value.cost
+        newObj.addPrice = value.addPrice
+        newObj.stockWarning = value.stockWarning
+        param.push(newObj)
+      })
+      param = JSON.stringify(param)
+      console.log(param)
+      this.$service.item.batchAdd({ data: param }).then(res => {
+        this.$message.success('操作成功!');
+        this.showItemModal = false
+        this.$router.go(0)
+      }).catch(err => { console.log(err) })
     },
     },
     add () {
     add () {
       this.showItemModal = true
       this.showItemModal = true