time-dialog.vue
3.27 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
143
<template>
<el-dialog
class="entryDialog classCUploadDialog"
title="增量数据同步"
:visible.sync="timeVisibleConfig"
:show-close="false"
width="450px"
:close-on-click-modal="false"
:destroy-on-close="true"
v-loading="loadings.dialogLoading"
@close="close(false)"
>
<div class="modelItem" style="margin-bottom: 10px">
<el-form
class="fedexFormStyle"
ref="formData"
:model="formData"
label-position="top"
size="small"
:rules="rules"
>
<el-row :gutter="5">
<el-col :span="24">
<Formitem label="同步日期" prop="beginDate" type="edit">
<el-date-picker
class="inputInner--beginDate"
id="inputInner-edit-beginDate"
v-model="formData.beginDate"
format="yyyy-MM-dd"
prefix-icon="none"
value-format="yyyy-MM-dd"
/>
</Formitem>
</el-col>
</el-row>
</el-form>
</div>
<div class="dialogOption entrySave">
<el-button
class="entrySaveButton"
:disabled="loadings.submitLoading"
@click="submit"
>确 定</el-button
>
<el-button class="entrySaveButton" @click="close(false)">关 闭</el-button>
</div>
</el-dialog>
</template>
<script>
import { getHsCodeIncr } from "@/api/arrivalList-api.js";
import { getYesterday } from "@/utils/index.js";
export default {
props: {
timeVisible: {
type: Boolean,
default: false,
},
},
data() {
return {
formData: {
beginDate: "",
},
timeVisibleConfig: false,
loadings: {
dialogLoading: false,
submitLoading: false,
},
loadingText: "",
logisticsTotal: 0,
rules: {
beginDate: [
{
required: true,
trigger: "change",
message: "同步日期不能为空!",
},
],
},
};
},
watch: {
timeVisible(val) {
if (val) {
console.log(getYesterday().substring(0, 10));
const time = getYesterday().substring(0, 10);
this.timeVisibleConfig = val;
this.formData = {
beginDate: time,
};
}
},
},
methods: {
//数据保存
submit() {
let obj = {
...this.formData,
};
this.$refs.formData.validate((valid) => {
if (valid) {
this.addapi(obj);
}
});
},
//新增 getHsCodeIncr
addapi(val) {
this.loadings.dialogLoading = true;
getHsCodeIncr(val)
.then((res) => {
if (res.code === "200") {
this.msgSuccess(res.message);
this.close(true);
} else {
this.alertWarningMsg(res.message);
this.loadings.dialogLoading = false;
}
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
close(flag) {
this.formData = {
beginDate: "",
};
this.loadings.dialogLoading = false;
this.timeVisibleConfig = false;
this.$emit("close", flag);
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
</style>