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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<template>
<div class="app-costForm shippingSea-dialog">
<el-form ref="costForm" :model="costObj" :rules="rules" label-width="120px">
<el-form-item :label="$t('操作步骤')" prop="opStepType">
<el-select
v-model="costObj.opStepType"
:placeholder="$t('请选择操作步骤')"
>
<el-option
v-for="type in getDictDatas(DICT_TYPE[this.process])"
:key="type.value"
:label="$l(type, 'label')"
:value="type.value"
></el-option>
</el-select>
<!--<el-select v-if="flag=='seaAir'" v-model="costObj.opStepType" :placeholder="$t('请选择操作步骤')">
<el-option v-for="type in this.getDictDatas(DICT_TYPE.BOX_SEA_AIR)" :key="type.value" :label="$l(type, 'label')" :value="type.value"></el-option>
</el-select>-->
</el-form-item>
<el-form-item :label="$t('费用类型')" prop="costType">
<el-select
v-model="costObj.costType"
:placeholder="$t('请选择费用类型')"
>
<el-option
v-for="type in this.getDictDatas(DICT_TYPE.FEE_TYPE)"
:key="type.value"
:label="$l(type, 'label')"
:value="type.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('供应商')" prop="supplierId">
<el-select
v-model="costObj.supplierId"
:placeholder="$t('请选择供应商')"
>
<el-option
v-for="supplier in allSupplier"
:key="supplier.id"
:label="$l(supplier, 'company')"
:value="supplier.id"
></el-option>
</el-select>
</el-form-item>
<!--lanbm 2024-05-17 添加字段-->
<el-form-item :label="$t('费用产生时间')" prop="freecsdate">
<el-date-picker
v-model="costObj.freecsdate"
style="width: 200px"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd"
type="datetime"
placeholder="费用产生时间"
/>
</el-form-item>
<el-row class="two-element-formItem">
<el-form-item :label="$t('金额')" prop="price">
<el-input-number
v-model="costObj.price"
controls-position="right"
:min="1"
></el-input-number>
</el-form-item>
<el-form-item label="" label-width="0px" prop="priceUnit">
<el-select
v-model="costObj.priceUnit"
:placeholder="$t('请选择单位')"
>
<el-option
v-for="type in this.currencyList"
:key="type.id"
:label="$l(type, 'title')"
:value="type.id"
></el-option>
</el-select>
</el-form-item>
</el-row>
<el-form-item :label="$t('备注')">
<el-input
v-model="costObj.remarks"
type="textarea"
rows="2"
:placeholder="$t('请输入备注')"
></el-input>
</el-form-item>
</el-form>
<div class="operate-button">
<el-button type="primary" @click="submit">{{ $t("确定") }}</el-button>
<el-button @click="$emit('closeDialog')">{{ $t("取消") }}</el-button>
</div>
</div>
</template>
<script>
import { getSupplierPage } from "@/api/ecw/supplier";
import { createCost } from "@/api/ecw/box";
import { serviceMsg } from "./shippingSea/utils";
import { getCurrencyList } from "@/api/ecw/currency";
import { getDictDatas } from "@/utils/dict";
export default {
name: "costForm",
inheritAttrs: false,
data() {
return {
// 费用登记对象
costObj: {},
// 供应商
allSupplier: [],
currencyList: [],
rules: {
opStepType: [
{
required: true,
message: this.$t("操作步骤不能为空"),
trigger: "change",
},
],
costType: [
{
required: true,
message: this.$t("费用类型不能为空"),
trigger: "change",
},
],
supplierId: [
{
required: true,
message: this.$t("供应商不能为空"),
trigger: "blur",
},
],
price: [
{ required: true, message: this.$t("金额不能为空"), trigger: "blur" },
],
priceUnit: [
{
required: true,
message: this.$t("金额单位不能为空"),
trigger: "blur",
},
],
freeCsDate: [
{
required: true,
message: this.$t("费用产生时间不能为空"),
trigger: "blur",
},
],
},
// flag: 'sea'
};
},
computed: {
flag() {
return this.$attrs.flag || "sea";
},
process() {
return {
air: "BOX_AIR_SHIPMENT_PROCESS",
sea: "BOX_SHIPPING_PROCESS",
seaAir: "BOX_SEA_AIR",
}[this.flag];
},
},
created() {
// 供应商
getSupplierPage({ pageNo: "1", pageSize: "10000" }).then((res) => {
const { data } = res;
this.allSupplier = data.list;
});
const { costDetail } = this.$attrs;
this.costObj = { ...costDetail };
//币种获取接口 lanbm 2024-05-16 添加注释
getCurrencyList().then((res) => {
this.currencyList = res.data ?? [];
});
/*if(this.$attrs.shipmentObj.bosType == 'seaAir'){
this.flag = 'seaAir';
}*/
},
methods: {
getDictDatas,
submit() {
this.$refs["costForm"].validate((valid) => {
if (valid) {
createCost({
shipmentId: this.$attrs.shipmentObj.id,
...this.costObj,
}).then((res) => {
serviceMsg(res, this).then(() => {
this.$emit("closeDialog", "cost");
});
});
}
});
},
},
};
</script>
<style lang="scss">
// 海运操作统一弹窗样式
.shippingSea-dialog {
// 页面内元素弹窗form控件宽度设置
.el-form-item__content {
> div:not(.el-input-number) {
width: 100%;
}
}
.operate-button {
text-align: center;
}
.two-element-formItem {
display: flex;
> :last-child {
width: 100%;
margin-left: 10px;
}
}
.two-element {
.el-form-item__content {
display: flex;
> :last-child {
margin-left: 10px;
}
}
}
}
</style>