From 32c5fc95afbb2241d80b986e385e17ee553c258c Mon Sep 17 00:00:00 2001
From: 唐耀东 <18861537@qq.com>
Date: 星期五, 13 五月 2022 22:04:32 +0800
Subject: [PATCH] 提交代码
---
src/views/components/building/index.vue | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 44 insertions(+), 11 deletions(-)
diff --git a/src/views/components/building/index.vue b/src/views/components/building/index.vue
index 964dcf6..948e0e5 100644
--- a/src/views/components/building/index.vue
+++ b/src/views/components/building/index.vue
@@ -1,21 +1,28 @@
<template>
<div>
- <el-input placeholder="璇烽�夋嫨閫傜敤鍦扮偣" :value="buildingName" disabled>
+ <el-input placeholder="璇烽�夋嫨" :value="name" disabled>
<el-button slot="append" icon="el-icon-thumb" @click="handleBuilding"></el-button>
</el-input>
<el-dialog title="寤虹瓚鍗曞厓" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
- <building-form @choice="choice"></building-form>
+ <buildList v-if="open" ref="buildRef" :schoolId="schoolId"></buildList>
+ <div slot="footer" class="dialog-footer">
+ <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+ <el-button @click="open = false">鍙� 娑�</el-button>
+ </div>
</el-dialog>
</div>
</template>
<script>
-import buildingForm from './form'
-
+import buildList from "./buildList";
+import { getBuilding } from "@/api/oa/building";
+/**
+ * 楂樻牎寤虹瓚鍗曞厓
+ */
export default {
name: "BuildInput",
components: {
- buildingForm
+ buildList
},
model: {
prop: 'value',
@@ -26,12 +33,33 @@
type: [Number],
default: undefined
},
+ schoolId: {
+ type: Number,
+ default: undefined
+ }
},
data() {
return {
- message: undefined,
open: false,
- buildingName: ''
+ name: ''
+ }
+ },
+ watch: {
+ 'value': function (v) {
+ if (v) {
+ getBuilding(v).then(response => {
+ this.name = response.data.name;
+ });
+ }else {
+ this.name = '';
+ }
+ }
+ },
+ created() {
+ if (this.value) {
+ getBuilding(this.value).then(response => {
+ this.name = response.data.name;
+ });
}
},
methods: {
@@ -39,11 +67,16 @@
handleBuilding() {
this.open = true;
},
- // 閫変腑寤虹瓚鍗曞厓
- choice(r) {
- this.buildingName = r.name;
+ submitForm() {
+ if (!this.$refs.buildRef.currentRow) {
+ this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�")
+ this.buttonLoading = false;
+ return;
+ }
+ const row = this.$refs.buildRef.currentRow;
+ this.name = row.name;
this.open = false;
- this.$emit("change", r.id);
+ this.$emit("change", row.id);
}
}
}
--
Gitblit v1.9.1