batchModify.vue
4.5 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<template>
<el-dialog
class="entryDialog classCUploadDialog"
title="批量修改"
:visible.sync="batchModifyVisible"
:show-close="false"
width="60%"
:close-on-click-modal="false"
>
<div>
<el-form class="fedexFormStyle"
ref="batchModifyForm"
:model="batchModifyFormData"
:rules="batchModifyFormRules"
label-position="left"
size="small"
>
<Formitem label="修改数据" prop="modifyData">
<el-select
type="text"
v-model="batchModifyFormData.modifyData"
clearable
placeholder=""
>
<el-option
v-for="(item, index) in modifyDataList"
:key="index"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</Formitem>
<Formitem label="修改内容" prop="modifyContent">
<el-input
type="text"
class="inputShadow"
resize="none"
v-model="batchModifyFormData.modifyContent"
clearable
placeholder="请输入修改内容"
></el-input>
</Formitem>
</el-form>
</div>
<div class="dialogOption entrySave revokeOperation">
<el-button
class="entrySaveButton entrySaveButton-background revokeSubmitBtn"
type="primary"
@click="formSubmit"
>确定</el-button>
<el-button
class="entrySaveButton"
@click="cancelModify"
>关闭</el-button>
</div>
</el-dialog>
</template>
<script>
import { bathDeclareDate } from "@/api/declareData-api.js";
export default {
props: {
showDialog: {
type: Boolean,
default: false,
},
selectedDatas:{
type:Array,
default:() => []
},
},
data() {
return {
batchModifyVisible:false,
batchModifyFormData:{
modifyData:'',
modifyContent:''
},
batchModifyFormRules: {
modifyData: [{ required: true, message: '请选择修改数据', trigger: 'change' }],
modifyContent: [{ required: true, message: '请输入修改内容', trigger: 'blur' }],
},
modifyDataList:[
{name:'提运单号',value:'BILLNO'},
{name:'航班航次号',value:'FLIGHT_NUMBER'},
]
};
},
watch: {
showDialog(val) {
if (val) {
this.batchModifyVisible = val
this.batchModifyFormData.modifyData=""
this.batchModifyFormData.modifyContent=""
}
},
},
created() {
},
methods: {
formSubmit(){
this.$refs.batchModifyForm.validate((valid) => {
if (valid) {
let obj = {
declareIds: [],
modifyData: this.batchModifyFormData.modifyData,
modifyContent: this.batchModifyFormData.modifyContent,
};
this.selectedDatas.forEach((item) => {
obj.declareIds.push(item.declareId);
});
console.log('datas==', obj)
bathDeclareDate(obj).then((res) => {
if (res.code === "200") {
this.msgSuccess('批量修改成功')
this.cancelModify(1)
} else {
this.alertWarningMsg(res.message);
}
})
.catch((err) => {
console.log(err);
this.alertWarningMsg(err.message);
this.cancelModify(1)
});
} else {
return false;
}
});
},
cancelModify(val){
this.batchModifyVisible = false
this.$emit('cancelBatchModify',val)
}
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
.modelItem {
width: 100%;
.modelItem-title {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
font-size: 14px;
font-weight: 600;
color: #333;
}
}
.revokeOperation{
margin-bottom:25px;
.revokeSubmitBtn{
margin-right: 30px;
}
}
</style>