|
@@ -8,7 +8,7 @@
|
|
|
<el-option
|
|
|
v-for="course in weeklyCourses"
|
|
|
:key="course.id"
|
|
|
- :label="`${course.classdetail} - ${course.teacher_name}`"
|
|
|
+ :label="`${course.classdetail} - ${course.teacher_name} - ${course.classroom} - ${course.time_label}`"
|
|
|
:value="course.classdetail"
|
|
|
/>
|
|
|
</el-select>
|
|
@@ -18,12 +18,12 @@
|
|
|
<!-- <el-col :span="3">
|
|
|
<el-button>手动输入</el-button>
|
|
|
</el-col> -->
|
|
|
- <el-col :span="6">
|
|
|
+ <!-- <el-col :span="6">
|
|
|
<el-input v-model="form.course_input" placeholder="请输入课程名称" />
|
|
|
</el-col>
|
|
|
<el-col :span="3">
|
|
|
<el-button type="primary">搜索</el-button>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-row>
|
|
|
<div style="max-height: 400px; overflow-y: auto; border: 1px solid #eee; padding: 8px; margin-bottom:0px">
|
|
|
<timetablemanage />
|
|
@@ -52,8 +52,8 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="信用部门" prop="borrower_dept">
|
|
|
- <el-input v-model="form.borrower_dept" placeholder="请输入信用部门" />
|
|
|
+ <el-form-item label="借用部门" prop="borrower_dept">
|
|
|
+ <el-input v-model="form.borrower_dept" placeholder="请输入借用部门" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
@@ -94,14 +94,26 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-button type="primary" @click="addItem">添加设备</el-button>
|
|
|
+
|
|
|
<div style="margin: 16px 0 8px 0; font-weight: bold">附件</div>
|
|
|
- <el-upload action="#" list-type="text">
|
|
|
- <el-button type="primary">点击或拖拽上传</el-button>
|
|
|
+ <el-upload
|
|
|
+ action="#"
|
|
|
+ drag
|
|
|
+ list-type="text"
|
|
|
+ accept=".bmp,.gif,.jpeg,.jpg,.png,.webp,.svg"
|
|
|
+ multiple
|
|
|
+ :show-file-list="true"
|
|
|
+ :on-success="handleUploadSuccess"
|
|
|
+ :on-error="handleUploadError"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或 <em>点击上传</em></div>
|
|
|
</el-upload>
|
|
|
+
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
- <el-button @click="onCancel">取消</el-button>
|
|
|
- <el-button v-if="!isViewMode" type="primary" @click="onSave">保存</el-button>
|
|
|
+ <el-button @click="onCancel">关闭</el-button>
|
|
|
+ <el-button v-if="!isViewMode" type="primary" @click="onSave">提交</el-button>
|
|
|
</template>
|
|
|
<SelectDeviceDialog v-model:visible="showSelectDeviceDialog" @confirm="onDeviceSelected" />
|
|
|
</el-dialog>
|
|
@@ -126,8 +138,23 @@ const visible = ref(props.visible);
|
|
|
const formRef = ref();
|
|
|
|
|
|
|
|
|
-function handleCourseSelected({ course_name, expected_start_time }) {
|
|
|
- form.value.purpose = course_name;
|
|
|
+const lastFormSnapshot = ref<any>(null);
|
|
|
+
|
|
|
+function handleUploadSuccess(response, file, fileList) {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.log('上传成功:', file.name);
|
|
|
+}
|
|
|
+
|
|
|
+function handleUploadError(err, file, fileList) {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.error('上传失败:', file.name);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function handleCourseSelected({ course_id, course_Name,expected_start_time }) {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ // console.log("course_name:::",course_Name)
|
|
|
+ form.value.purpose = course_Name;
|
|
|
form.value.expected_start_time = expected_start_time;
|
|
|
}
|
|
|
|
|
@@ -213,10 +240,43 @@ onMounted(() => {
|
|
|
fetchWeeklySchedule();
|
|
|
});
|
|
|
|
|
|
-watch(
|
|
|
- () => props.visible,
|
|
|
- (v) => (visible.value = v)
|
|
|
-);
|
|
|
+
|
|
|
+
|
|
|
+function resetForm() {
|
|
|
+ form.value = {
|
|
|
+ application_no: '',
|
|
|
+ emergency_contact: '',
|
|
|
+ purpose: '',
|
|
|
+ emergency_phone: '',
|
|
|
+ app_user_borrower: 1,
|
|
|
+ borrower_dept: '',
|
|
|
+ team_type: 1,
|
|
|
+ team_members_count: 1,
|
|
|
+ team_members: '',
|
|
|
+ expected_start_time: '',
|
|
|
+ expected_end_time: '',
|
|
|
+ applicant_remark: '',
|
|
|
+ return_location: '',
|
|
|
+ items: [],
|
|
|
+ borrow_type: 1,
|
|
|
+ course_input: ''
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+watch(() => props.visible, (v) => {
|
|
|
+ visible.value = v;
|
|
|
+ if (v) {
|
|
|
+ if (lastFormSnapshot.value) {
|
|
|
+ form.value = { ...lastFormSnapshot.value };
|
|
|
+ } else {
|
|
|
+ resetForm(); // 如果没有快照,初始化表单
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
watch(
|
|
|
() => props.modelValue,
|
|
|
(v) => {
|
|
@@ -260,6 +320,7 @@ function onSave() {
|
|
|
emit('submit', { ...form.value });
|
|
|
emit('update:visible', false);
|
|
|
ElMessage.success("添加成功!");
|
|
|
+ lastFormSnapshot.value = { ...form.value }; //用于记忆上次记录
|
|
|
}
|
|
|
});
|
|
|
}
|