1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
| <template>
| <div>
| <el-input placeholder="请选择" :value="name" disabled>
| <el-button slot="append" icon="el-icon-thumb" @click="handleClick"></el-button>
| </el-input>
| <el-dialog title="施工批次" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
| <construction-batch-form v-if="open" ref="batchRef" :schoolId="schoolId"></construction-batch-form>
| <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 constructionBatchForm from './list'
| import { getConstructionBatch } from "@/api/oa/constructionBatch";
|
| export default {
| name: "BuildInput",
| components: {
| constructionBatchForm
| },
| model: {
| prop: 'value',
| event: 'change'
| },
| props: {
| value: {
| type: [Number],
| default: undefined
| },
| schoolId: {
| type: Number,
| default: undefined
| }
| },
| data() {
| return {
| open: false,
| name: ''
| }
| },
| watch: {
| 'value': function (v) {
| if (v) {
| getConstructionBatch(v).then(response => {
| this.name = response.data.batch;
| });
| }else {
| this.name = '';
| }
| }
| },
| created() {
| if (this.value) {
| getConstructionBatch(this.value).then(response => {
| this.name = response.data.batch;
| });
| }
| },
| methods: {
| // 选择
| handleClick() {
| this.open = true;
| },
| // 确定
| submitForm() {
| const row = this.$refs.batchRef.currentRow;
| if (!row) {
| this.$message.warning("请选择一条数据")
| return;
| }
| this.name = row.batch;
| this.open = false;
| this.$emit("change", row.id);
| }
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|