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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
| <template>
| <div>
| <el-form
| ref="editPram"
| :rules="rules"
| label-position="right"
| label-width="70px"
| :model="editPram"
| inline=""
| >
| <el-form-item prop="sort" label="排序">
| <el-input-number
| v-model="editPram.sort"
| label="描述文字"
| ></el-input-number>
| </el-form-item>
| </el-form>
|
| <div class="form-item-right">
| <el-button @click="close">取消</el-button>
| <el-button
| type="primary"
| :loading="loadingBtn"
| @click="handlerSubmit('editPram')"
| >确定</el-button
| >
| </div>
| </div>
| </template>
| <!--创建和编辑公用一个组件-->
| <script>
| import { putQueueSortApi, putQueueReQueueApi } from "@/api/vehicle.js";
| export default {
| // name: "edit"
| props: {
| editData: {
| type: Object,
| },
| isReQueue: {
| type: Boolean,
| default: false,
| },
| },
| data() {
| return {
| editPram: {
| sort: "",
| id: "",
| },
| loadingBtn: false,
| rules: {
| sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
| },
| };
| },
| mounted() {
| this.editPram.sort = this.editData.sort;
| this.editPram.id = this.editData.id;
| this.editPram.masterId = this.editData.masterId;
| },
| methods: {
| close() {
| this.$emit("hideEditDialog");
| },
|
| handlerSubmit(formName) {
| this.$refs[formName].validate((valid) => {
| if (!valid) return;
|
| console.log("handlerSubmithandlerSubmithandlerSubmithandlerSubmit");
| this.loadingBtn = true;
| const api = this.isReQueue ? putQueueReQueueApi : putQueueSortApi;
|
| api(
| this.isReQueue ? this.editPram.masterId : this.editPram.id,
| this.editPram.sort
| )
| .then((res) => {
| this.loadingBtn = false;
| this.$message.success(
| this.isReQueue ? "重新排队成功" : "调整排序成功"
| );
| this.$emit("editSuccess");
| })
| .catch(() => {
| this.loadingBtn = false;
| });
| });
| },
| },
| };
| </script>
|
| <style scoped>
| /* .el-form--inline .el-form-item {
| width: 49%;
| margin-right: 0px;
| }
| ::v-deep .el-form--inline .el-form-item__content {
| width: calc(100% - 80px);
| } */
|
| .selWidth {
| width: 400px;
| }
|
| .form-item-right {
| display: flex;
| justify-content: flex-end; /* 使内容靠右 */
| }
| </style>
|
|