detail.vue
3.55 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
<div class="editPage">
<el-form
:model="editForm"
:loading="loading"
ref="editForm"
label-position="right"
label-width="auto"
style="padding-right:50px;"
v-loading="loading"
element-loading-text="操作中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.9)"
>
<el-form-item
label="关键词"
prop="keyword"
:rules="{ required: true, message: '关键词不能为空', trigger: 'blur' }"
>
<el-input v-model="editForm.keyword" placeholder="请输入关键词"></el-input>
</el-form-item>
<el-form-item label="排序值">
<el-input-number v-model="editForm.orderId" :min="0"></el-input-number>
</el-form-item>
<el-form-item
label="是否在线"
prop="onlineStatus"
:rules="{ required: true, message: '请选择状态', trigger: 'blur' }"
>
<el-switch
v-model="editForm.onlineStatus"
inactive-color="rgb(234,236,240)"
></el-switch>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="padding-right:30px">
<el-button @click="componentClose">取 消</el-button>
<el-button type="primary" @click="componentSubmit" :disabled="loading" :loading="loading">确定</el-button>
</div>
</div>
</template>
<script>
import UploadImg from "@/components/UploadImg/index.vue";
export default {
props: [],
components: { UploadImg },
data() {
return {
isLinkDialog: false,
searchLoading: false,
title: "轮播图",
submitUrl: "",
loading: false,
dialogVisiable: false,
editForm: {
primaryCode: "",
keyword: "",
onlineStatus: true,
orderId: 0
},
// 连接值的候选项
valueCandidates: [],
getForm: {
query: null,
page: 0,
size: 10
},
candidatesEnd: false,
fetchUrl: "",
labelKey: "",
valueKey: ""
};
},
mounted() {
this.initData();
},
methods: {
async initData() {
this.submitUrl = app.api.setArticleKeywordList;
if (this.$route.query.pojo != "null") {
this.editForm = JSON.parse(this.$route.query.pojo);
this.editForm.onlineStatus = this.editForm.onlineStatus ? true : false;
this.editForm.onShow = this.editForm.onShow ? true : false;
}
this.dialogVisiable = true;
},
componentClose() {
this.$router.go(-1);
},
componentClosed() {
this.$emit("closed");
},
componentSubmit() {
this.$refs["editForm"].validate(valid => {
if (valid) {
if (this.loading) {
return;
}
this.loading = true;
let editForm = JSON.parse(JSON.stringify(this.editForm));
editForm.onlineStatus = this.editForm.onlineStatus ? 1 : 0;
editForm.onShow = this.editForm.onShow ? 1 : 0;
app
.post({
url: this.submitUrl,
data: editForm
})
.then(res => {
this.loading = false;
this.$notify({
title: "成功",
message: "操作成功",
type: "success"
});
this.$router.go(-1);
})
.catch(e => {
this.loading = false;
});
}
});
}
}
};
</script>
<style lang="scss" scoped>
.commoditySelect {
width: 100%;
max-width: auto;
}
.tablePage {
margin: 0 auto;
}
</style>