|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<el-dialog
|
|
|
v-model="dialogVisible"
|
|
|
- title="领取设备结算单"
|
|
|
+ :title="issettlement?'领取设备结算单':'续借'"
|
|
|
width="75%"
|
|
|
:close-on-click-modal="false"
|
|
|
@close="handleClose"
|
|
@@ -45,6 +45,7 @@
|
|
|
<div class="form-content">{{ formData.expected_end_time }}</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
|
|
|
<div class="detail-title">借用明细表</div>
|
|
@@ -85,6 +86,18 @@
|
|
|
<div class="remark-info">
|
|
|
<div class="detail-title">备注</div>
|
|
|
<div class="form-content">{{ formData.remark || '-' }}</div>
|
|
|
+ </div>
|
|
|
+ <div v-if="isrenew">
|
|
|
+ <div style="margin-bottom: 8px; font-weight: bold;">续借理由</div>
|
|
|
+ <textarea
|
|
|
+ v-model="return_remark"
|
|
|
+ placeholder="请输入续借理由"
|
|
|
+ rows="3"
|
|
|
+ style="width: 100%; border: 1px solid #dcdfe6;padding: 8px; resize: vertical; box-sizing: border-box;"
|
|
|
+ ></textarea>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -93,7 +106,8 @@
|
|
|
|
|
|
<template #footer>
|
|
|
<el-button @click="handleClose">关闭</el-button>
|
|
|
- <el-button type="primary" @click="handlePrint">打印</el-button>
|
|
|
+ <el-button type="primary" @click="handlePrint" v-if="issettlement">打印</el-button>
|
|
|
+ <el-button type="primary" @click="handlerenew" v-if="isrenew">提交</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
@@ -101,6 +115,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref, defineProps, defineEmits, watch, computed } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import * as api from '../../api';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
visible: boolean;
|
|
@@ -110,9 +125,14 @@ const props = defineProps<{
|
|
|
|
|
|
const emit = defineEmits(['update:visible', 'update:modelValue']);
|
|
|
|
|
|
+const issettlement = computed(() => props.modelValue?.mode === 'settlement');
|
|
|
+const isrenew = computed(() => props.modelValue?.mode === 'renew');
|
|
|
+
|
|
|
const dialogVisible = ref(false);
|
|
|
const formData = ref<any>({});
|
|
|
|
|
|
+const return_remark = ref('')
|
|
|
+
|
|
|
watch(
|
|
|
() => props.visible,
|
|
|
(val) => {
|
|
@@ -148,6 +168,7 @@ const borrowType=computed(() => {
|
|
|
});
|
|
|
|
|
|
interface DeviceItem {
|
|
|
+ device:number;
|
|
|
device_code: string;
|
|
|
device_category_name: string;
|
|
|
device_name: string;
|
|
@@ -166,6 +187,36 @@ const handleClose = () => {
|
|
|
emit('update:modelValue', formData.value);
|
|
|
};
|
|
|
|
|
|
+//续借
|
|
|
+async function handlerenew(){
|
|
|
+ console.log("filteredItems::",filteredItems.value.length)
|
|
|
+ console.log("formData.value::",formData.value)
|
|
|
+ for (let i = 0; i < filteredItems.value.length; i++) {
|
|
|
+ const item = filteredItems.value[i]
|
|
|
+
|
|
|
+ const payload = {
|
|
|
+ device: item.device,
|
|
|
+ quantity: item.quantity,
|
|
|
+ return_remark: return_remark.value,
|
|
|
+ id: formData.value.id
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await api.RenewDevice(payload)
|
|
|
+ if(res.code===2000){
|
|
|
+ console.log(`设备 ${payload.device} 续借成功`, res)
|
|
|
+ emit('update:visible', false);
|
|
|
+ emit('update:modelValue', formData.value);
|
|
|
+ ElMessage.success("续借成功");
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.error(`设备 ${payload.device} 续借失败`, err)
|
|
|
+ ElMessage.success("续借失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/* const handlePrint = () => {
|
|
|
window.print();
|
|
|
}; */
|