yzx 5 miesięcy temu
rodzic
commit
03031d3b83

+ 6 - 13
app/admin/controller/Ajax.php

@@ -80,19 +80,12 @@ class Ajax extends Backend
     //保存电子签名
     public function getSign(): void
     {
-            $id =  $this->auth->id;
-            $result  = false;
-            $result = Db::name('sign')->where('uid',$id)->find();
-            if (!$result) {
-                $this->error(__('Parameter %s can not be empty', ['']));
-            }
-            if (isset($result['sign']) && $result['sign']) {
-                $this->success('签名获取成功!', [
-                    'file' => $result ?? []
-                ]);
-            }else{
-                $this->error('更新失败!');
-            }
+        $id = $this->auth->id;
+        $result = Db::query('SELECT * FROM yx_borrow WHERE user_id = ? ORDER BY id DESC LIMIT 1', [$id]);
+        $this->success('签名获取成功!', [
+            'sign' => $result ?? []
+        ]);
+
     }
 
     /**

+ 0 - 1
app/admin/controller/borrow/BorrowApply.php

@@ -180,7 +180,6 @@ class BorrowApply extends Backend
                 $this->error(__('No rows were added'));
             }
         }
-
     }
 
     public function del($ids = null): void

+ 1 - 0
app/admin/controller/borrow/BorrowRecord.php

@@ -181,6 +181,7 @@ class BorrowRecord extends Backend
         $row['asset'] = $rows;
 
         $row['fileList'] = Db::name('borrow_img')->where('borrow_id',$id)->field('*,url as sign')->select();
+        $row['accessories'] = Db::name('accessories')->where('borrow_id', $id)->find();
 
         if ($this->request->isPost()) {
             $data = $this->request->post();

+ 2 - 0
app/admin/controller/borrow/BorrowUseing.php

@@ -182,6 +182,7 @@ class BorrowUseing extends Backend
         $row['asset'] = $rows;
 
         $row['fileList'] = Db::name('borrow_img')->where('borrow_id', $id)->field('*,url as sign')->select();
+        $row['accessories'] = Db::name('accessories')->where('borrow_id', $id)->find();
 
         if ($this->request->isPost()) {
             $data = $this->request->post();
@@ -407,6 +408,7 @@ class BorrowUseing extends Backend
                 $thisStatus = 1;
             } else {
                 $back = Db::name('asset')->where('asset_id', $old_asset_id)->data(['status' => 0])->update();
+                $toUse = Db::name('asset')->where('asset_id', $new_asset_id)->data(['status' => 1])->update();
                 $thisStatus = 3;
             }
 

+ 26 - 59
uniapp/pages/teacher/application.vue

@@ -60,39 +60,6 @@
 								<superwei-combox :candidates="candidates" :isJSON="true" keyName="value"
 									placeholder="请选择或输入" v-model="item.model" @input="input_json" @select="select_json">
 								</superwei-combox>
-
-								<!-- <uv-form-item label="预计归还时间" required="required" borderBottom  prop="expected_end_time" labelWidth="100" @click="showDateSelect" ref="formdata">
-									<uv-input v-model="formdata.expected_end_time" disabled disabledColor="#ffffff"  border="none"></uv-input>
-									<uv-datetime-picker :minDate="new Date()" ref="datetimePicker" mode="datetime" @confirm="showDateconfirm"></uv-datetime-picker>
-									<template v-slot:right>
-										<uv-icon name="arrow-right"></uv-icon>
-									</template><strong></strong>
-								</uv-form-item> -->
-
-								<!-- <uni-combox label="所在城市" :candidates="candidates" placeholder="请选择所在城市" v-model="item.model"></uni-combox> -->
-								<!-- <superwei-combox :candidates="candidates" :isJSON="true" keyName="model" placeholder="请选择或输入"
-								    v-model="item.model" @input="input_json" @select="select_json">
-								</superwei-combox> -->
-								<!-- <uni-combox :candidates="candidates" placeholder="请选择仪器" v-model="item.model"></uni-combox> -->
-								<!-- <picker @change="bindPickerChange" :value="index" :range="item.origins">
-									<view class="uni-input">{{origins[index]}}</view>
-								</picker> -->
-
-								<!-- <uni-section title="本地数据" type="line">
-									<view class="uni-px-5 uni-pb-5">
-										<uni-data-picker
-											placeholder="请选择班级"
-											popup-title="请选择"
-											:localdata="candidates"
-											v-model="item.model"
-											@change="onchange"
-											@nodeclick="onnodeclick"
-											@popupopened="onpopupopened"
-											@popupclosed="onpopupclosed"
-											@inputclick="inputclick"
-										></uni-data-picker>
-									</view>
-								</uni-section> -->
 								<uv-input v-model="item.num" placeholder="数量"></uv-input>
 								<button class="button" size="mini" type="default"
 									@click="onDelArrayItem(idx)">删除</button>
@@ -320,7 +287,7 @@
 						<button type="primary" size="mini" @click="goSign('worker1')" class="add_anniu">去签名</button>
 					</view>
 					<!-- <image style="width: 200px; height: 200px; background-color: #eeeeee;" @load='imgOnCan' @error='imgOnError' :src="signSrc" v-if="signShow"></image> -->
-					<image style="width: 200px; height: 200px; background-color: #eeeeee;" :src="signSrc"
+					<image style="width: 200px; height: 200px; background-color: #eeeeee;" :src="formdata.sign"
 						v-show="signShow" @load='imgOnCan' @error='imgOnError'></image>
 
 				</uv-form>
@@ -368,8 +335,8 @@ export default {
 			this.pImg = data
 		})
 		uni.$on('q-sign', data => {
-			console.log('tempFilePath', data);
-			this.signSrc = data.tempFilePath;
+			// console.log('tempFilePath', data);
+			formdata.sign = data.tempFilePath;
 
 			const ctx2 = uni.createCanvasContext('myCanvasr');
 			ctx2.drawImage(data.tempFilePath, 0, 0, 200, 200);
@@ -390,31 +357,31 @@ export default {
 			).then(d => {
 				var responseObject = JSON.parse(d);
 				var fileUrl = responseObject.data.file.url;
-				// 传图片接口;
-				const returndata = requestApi(
-					'admin/ajax/saveSign?server=1',
-					{
-						sign: fileUrl
-					},
-					'POST'
-				).then(ret => {
-					this.signShow = true;
-				})
+				// // 传图片接口;
+				// const returndata = requestApi(
+				// 	'admin/ajax/saveSign?server=1',
+				// 	{
+				// 		sign: fileUrl
+				// 	},
+				// 	'POST'
+				// ).then(ret => {
+				// 	this.signShow = true;
+				// })
 			})
 		})
-		// 获取电子签字
-		const returndata = requestApi(
-			'admin/ajax/getSign?server=1', 'GET'
-		).then(ret => {
-			console.log(ret)
-			if (ret.code == 1) {
-				this.signSrc = "https://yxy.glut.cc/" + ret.data.file.sign
-
-				if (ret.data.file.sign !== '') {
-					this.signShow = true
-				}
-			}
-		})
+		// // 获取电子签字
+		// const returndata = requestApi(
+		// 	'admin/ajax/getSign?server=1', 'GET'
+		// ).then(ret => {
+		// 	console.log(ret)
+		// 	if (ret.code == 1) {
+		// 		this.signSrc = "https://yxy.glut.cc/" + ret.data.file.sign
+
+		// 		if (ret.data.file.sign !== '') {
+		// 			this.signShow = true
+		// 		}
+		// 	}
+		// })
 
 		const getUserData = requestApi(
 			'admin/borrow.BorrowApp/add?server=1', 'GET'

BIN
web/src/views/backend/borrow.zip


+ 10 - 2
web/src/views/backend/borrow/borrowApply/index.vue

@@ -65,6 +65,7 @@ import {useAdminInfo} from "/@/stores/adminInfo";
 import {defaultOptButtons} from "/@/components/table/index";
 import baTableClass from "/@/utils/baTable";
 import {baTableApi} from "/@/api/common";
+import {getSign} from "/@/api/backend/borrow/borrowApply";
 
 
 defineOptions({
@@ -179,7 +180,11 @@ const baTable = new baTableClass(
     {
         toggleForm: () => {
             if (baTable.form.operate == 'Add') {
-                console.log(baTable.form.operate)
+                getSignLoad().then((data) => {
+                    if(baTable.form.items!.sign == null){
+                        baTable.form.items!.sign = data['sign'][0]["sign"]
+                    }
+                })
                 baTable.form.items!.asset = [
                     {
                         model: '',
@@ -228,7 +233,10 @@ const baTable = new baTableClass(
         },
     }
 )
-
+const getSignLoad = async () => {
+    const data = await getSign();
+    return data?.data || []
+}
 provide('baTable', baTable)
 
 baTable.mount()

+ 0 - 12
web/src/views/backend/borrow/borrowApply/popupForm.vue

@@ -615,10 +615,6 @@ const loadAll = async () => {
     const data = await getAssetGroup()
     return data?.data || []
 }
-const getSignLoad = async () => {
-    const data = await getSign();
-    return data?.data || []
-}
 const getProtocolLoad = async () => {
     const data = await getProtocol();
     return data || []
@@ -629,14 +625,6 @@ onMounted(() => {
     loadAll().then((linksData) => {
         links.value = linksData
     })
-    // getSignLoad().then((data) => {
-    //     if(baTable.form.items!.sign == null){
-    //         baTable.form.items!.sign = data['file']['sign']
-    //         thisSign.value = data['file']['sign']
-    //     }else{
-    //         thisSign.value = baTable.form.items!.sign
-    //     }
-    // })
     getProtocolLoad().then((data) => {
         protocol.value = data['data']['data'];
     })

+ 0 - 1
web/src/views/backend/borrow/borrowRecord/popupForm.vue

@@ -137,7 +137,6 @@
                                 <FormItem
                                     v-for="(item, index) in filteredAccessories" :key="index"
                                     :label="item.name"
-                                    required="required"
                                     :prop="item.quantity"
                                     v-model="item.quantity"
                                     type="number"

+ 0 - 1
web/src/views/backend/borrow/borrowUseing/popupForm.vue

@@ -124,7 +124,6 @@
                                 <FormItem
                                     v-for="(item, index) in filteredAccessories" :key="index"
                                     :label="item.name"
-                                    required="required"
                                     :prop="item.quantity"
                                     v-model="item.quantity"
                                     type="number"