shish пре 2 година
родитељ
комит
f99126c157
2 измењених фајлова са 98 додато и 20 уклоњено
  1. 7 0
      ghs/src/service/check-order/index.js
  2. 91 20
      ghs/src/views/book/components/loan-item.vue

+ 7 - 0
ghs/src/service/check-order/index.js

@@ -24,5 +24,12 @@ export class CheckOrderService extends BaseService {
 		});
 		});
 	}
 	}
 
 
+	loan(data) {
+		return this.request({
+			url: '/loan',
+			params: data
+		});
+	}
+
 }
 }
 export default new CheckOrderService();
 export default new CheckOrderService();

+ 91 - 20
ghs/src/views/book/components/loan-item.vue

@@ -1,9 +1,40 @@
 <template>
 <template>
 	<div>
 	<div>
-		<el-drawer :visible.sync="showArea" size="55vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr">
+		<el-drawer :visible.sync="showArea" size="44vw" :before-close="closeFn" custom-class="drawer-class" direction="ltr">
 			<div>
 			<div>
-				<div style="margin-left:2px;font-weight:bold;">【{{ currentData.customName?currentData.customName:'' }}】{{ currentData.itemName?currentData.itemName:'' }} 借库存</div>
                 <x-crud @load="onLoad">
                 <x-crud @load="onLoad">
+
+                    <template #table-column-cover="{ scope }">
+                        <el-popover placement="right" width="200" trigger="hover">
+                            <div style="width:200px;height:200px;">
+                                <img style="width:100%;height:100%;object-fit: cover;" :src="scope.row.bigCover" />
+                            </div>
+                            <div style="width:40px;" slot="reference">
+                                <img style="width:100%;height:100%;object-fit: cover;border-radius:5px;" :src="scope.row.cover" />
+                            </div>
+                        </el-popover>
+                    </template>
+
+                    <template #table-column-name="{ scope }">
+                        <span style="font-size:16px;">{{ scope.row.name }}</span>
+                    </template>
+
+                    <template #table-column-stock="{ scope }">
+                        <span style="font-size:13px;">{{ scope.row.stock?parseFloat(scope.row.stock):0 }}</span>
+                    </template>
+
+                    <template #table-column-bigCount="{ scope }">
+                        <el-input v-model="scope.row.bigCount" placeholder="数量"></el-input>
+                    </template>
+
+                    <template #slot-column-option="{scope}">
+                        <el-button @click.stop="confirmLoan(scope.row)" size="medium" type="primary">借用</el-button>
+                    </template>
+
+                    <template #slot-option-area-list>
+                        <el-input v-model="search" placeholder="搜索花材" size="big" style="width:200px;" :clearable="true" ref="itemSearchRef" @input="changeSearch()" @focus="search=''"></el-input>
+                        <span style="margin-left:10px;font-size:27px;">【{{ currentData.customName?currentData.customName:'' }}】{{ currentData.itemName?currentData.itemName:'' }} 借库存</span>
+                    </template>
                 </x-crud>
                 </x-crud>
 			</div>
 			</div>
 		</el-drawer>
 		</el-drawer>
@@ -20,24 +51,54 @@ export default {
 	},
 	},
 	data() {
 	data() {
 		return {
 		return {
-			showArea: false
+			showArea: false,
+            search:''
 		};
 		};
 	},
 	},
 	methods: {
 	methods: {
+		changeSearch(){
+            let that = this
+            if(this.T != null){
+                clearTimeout(this.T)
+            }
+            this.T = setTimeout(function(){
+                that.app.refresh({name:this.search})
+            },650)
+		},
 		init() {
 		init() {
 			this.showArea = true
 			this.showArea = true
+            this.search = ''
 			if(this.app){
 			if(this.app){
-				this.app.refresh()
+				this.app.refresh({name:this.search})
 			}
 			}
+            this.$nextTick(() => {
+                this.$refs.itemSearchRef.focus()
+            })
 		},
 		},
 		closeFn() {
 		closeFn() {
 			this.showArea = false;
 			this.showArea = false;
 		},
 		},
+        confirmLoan(info){
+			let that = this
+			if(Number(info.bigCount)<=0){
+                this.$message.error('请填写数量')
+				return false
+			}
+            let params = {inId:this.currentData.itemId,outId:info.id,num:info.bigCount,bookItemCustomId:this.currentData.id}
+            this.$confirm('确认借用?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
+                this.$service.checkOrder.loan(params).then(res => {
+					that.$message.success('操作成功')
+					setTimeout(()=>{
+						this.showArea = false
+					},1300)
+                })
+            })
+        },
 		onLoad({ ctx, app }) {
 		onLoad({ ctx, app }) {
 			this.app = app;
 			this.app = app;
 
 
 			let logHost = () => {
 			let logHost = () => {
-				return this.$service.item.getLoanList()
+				return this.$service.item.getLoanList({name:this.search})
 			};
 			};
 			ctx.service({
 			ctx.service({
 				page: logHost
 				page: logHost
@@ -45,49 +106,55 @@ export default {
 
 
 			.set('table', {
 			.set('table', {
 				columns: [
 				columns: [
-					{
-						label: '日期',
-						prop: 'addTime',
+                    {
+						label: 'ID',
+						prop: 'id',
 						align: 'center',
 						align: 'center',
+                        width:80
 					},
 					},
 					{
 					{
-						label: '名称',
-						prop: 'relateName',
+						label: '图片',
+						prop: 'cover',
 						align: 'center',
 						align: 'center',
+                        width:65
 					},
 					},
 					{
 					{
-						label: '事项',
-						prop: 'typeName',
+						label: '名称',
+						prop: 'name',
 						align: 'center',
 						align: 'center',
+                        width:300
 					},
 					},
 					{
 					{
-						label: '变动',
-						prop: 'bigNumOrder',
+						label: '可借',
+						prop: 'stock',
 						align: 'center',
 						align: 'center',
+                        width:100
 					},
 					},
 					{
 					{
-						label: '剩余',
-						prop: 'bigNumStock',
+						label: '要借',
+						prop: 'bigCount',
 						align: 'center',
 						align: 'center',
+                        width:130
 					}
 					}
 				],
 				],
 				op: {
 				op: {
 					visible: true,
 					visible: true,
 					props: {
 					props: {
-						width: 160,
+						width: 130,
 						align: 'center',
 						align: 'center',
 						fixed: 'right',
 						fixed: 'right',
 						label: '操作'
 						label: '操作'
 					},
 					},
-					layout: []
+					layout: ['slot-column-option']
 				}
 				}
 			})
 			})
 			.set('layout', [
 			.set('layout', [
+                ['slot-option-area-list'],
 				[ 'data-table' ],
 				[ 'data-table' ],
-				['flex1', 'pagination']
+				['flex1']
 			])
 			])
 			.done()
 			.done()
-			app.refresh()
+			app.refresh({name:this.search})
 		}
 		}
 	}
 	}
 };
 };
@@ -96,4 +163,8 @@ export default {
 .drawer-class{
 .drawer-class{
 	height:100vh;
 	height:100vh;
 }
 }
+::v-deep .el-input__inner {
+  padding:0;
+  text-align:center;
+}
 </style>
 </style>