|
@@ -18,7 +18,7 @@
|
|
|
{
|
|
|
text: '出货',
|
|
|
disabled: selectData.length === 0,
|
|
|
- action: () => openModal(),
|
|
|
+ action: () => openModalOne(),
|
|
|
},
|
|
|
{
|
|
|
text: '产品装箱',
|
|
@@ -27,12 +27,24 @@
|
|
|
]"
|
|
|
@get-list="getList"
|
|
|
>
|
|
|
- <template #fileSlot="{ item }">
|
|
|
- <div
|
|
|
- style="cursor: pointer; color: #409eff"
|
|
|
- @click="handleClickFile(item)"
|
|
|
- >
|
|
|
- {{ item.fileName }}
|
|
|
+ <template #code="{ item }">
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in getData(item.codeAPName, 'code')"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ {{ item }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #productName="{ item }">
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in getData(item.codeAPName, 'productName')"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ {{ item }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</byTable>
|
|
@@ -76,6 +88,7 @@
|
|
|
@change="handleChangeContract"
|
|
|
filterable
|
|
|
style="width: 100%"
|
|
|
+ multiple
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in contractData"
|
|
@@ -175,10 +188,13 @@
|
|
|
:prop="'packDetailList.' + index + '.boxLong'"
|
|
|
:rules="rules.boxLong"
|
|
|
>
|
|
|
- <el-input
|
|
|
+ <el-input-number
|
|
|
v-model="item.boxLong"
|
|
|
placeholder="长"
|
|
|
- ></el-input>
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ ></el-input-number>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1" style="text-align: center"> * </el-col>
|
|
@@ -188,10 +204,13 @@
|
|
|
:prop="'packDetailList.' + index + '.boxWide'"
|
|
|
:rules="rules.boxWide"
|
|
|
>
|
|
|
- <el-input
|
|
|
+ <el-input-number
|
|
|
v-model="item.boxWide"
|
|
|
placeholder="宽"
|
|
|
- ></el-input>
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ ></el-input-number>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1" style="text-align: center"> * </el-col>
|
|
@@ -201,10 +220,13 @@
|
|
|
:prop="'packDetailList.' + index + '.boxHigh'"
|
|
|
:rules="rules.boxHigh"
|
|
|
>
|
|
|
- <el-input
|
|
|
+ <el-input-number
|
|
|
v-model="item.boxHigh"
|
|
|
placeholder="高"
|
|
|
- ></el-input>
|
|
|
+ :precision="2"
|
|
|
+ :controls="false"
|
|
|
+ :min="0"
|
|
|
+ ></el-input-number>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
@@ -219,8 +241,8 @@
|
|
|
v-for="(product, j) in item.packDetailProductList"
|
|
|
:key="j"
|
|
|
>
|
|
|
- <div>合同编码:{{ product.code }}</div>
|
|
|
- <div>产品名称:{{ product.name }}</div>
|
|
|
+ <div>合同编码:{{ product.contractCode }}</div>
|
|
|
+ <div>产品名称:{{ product.productName }}</div>
|
|
|
<div>每箱数量:{{ product.quantity }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -280,12 +302,7 @@
|
|
|
:rules="rules.unit"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
- <el-input-number
|
|
|
- v-model="row.unit"
|
|
|
- :precision="4"
|
|
|
- :controls="false"
|
|
|
- :min="0"
|
|
|
- />
|
|
|
+ <el-input v-model="row.unit" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -338,6 +355,34 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ title="合并出货"
|
|
|
+ v-model="dialogVisibleOne"
|
|
|
+ width="400"
|
|
|
+ v-loading="loadingOne"
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.dataOne"
|
|
|
+ :rules="rules"
|
|
|
+ ref="byform"
|
|
|
+ >
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisibleOne = false" size="large"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitFormOne()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -354,6 +399,8 @@ const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
|
|
|
const headers = ref({ Authorization: "Bearer " + getToken() });
|
|
|
const uploadData = ref({});
|
|
|
const loading = ref(false);
|
|
|
+const loadingOne = ref(false);
|
|
|
+
|
|
|
const submitLoading = ref(false);
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
@@ -365,6 +412,8 @@ const sourceList = ref({
|
|
|
},
|
|
|
});
|
|
|
let dialogVisible = ref(false);
|
|
|
+let dialogVisibleOne = ref(false);
|
|
|
+
|
|
|
let modalType = ref("add");
|
|
|
let fileList = ref([]);
|
|
|
let rules = ref({
|
|
@@ -378,7 +427,10 @@ let rules = ref({
|
|
|
quantityOne: [{ required: true, message: "请输入数量", trigger: "blur" }],
|
|
|
unit: [{ required: true, message: "请输入单位", trigger: "blur" }],
|
|
|
remark: [{ required: true, message: "请输入货物描述", trigger: "blur" }],
|
|
|
+
|
|
|
+ contractId: [{ required: true, message: "请选择主合同", trigger: "change" }],
|
|
|
});
|
|
|
+
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const selectConfig = reactive([
|
|
|
{
|
|
@@ -407,13 +459,15 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "合同号",
|
|
|
- prop: "subscribeCode",
|
|
|
+ prop: "codeAPName",
|
|
|
+ slot: "code",
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "产品名称",
|
|
|
- prop: "subscribeCode",
|
|
|
+ prop: "codeAPName",
|
|
|
+ slot: "productName",
|
|
|
},
|
|
|
},
|
|
|
|
|
@@ -428,18 +482,28 @@ const config = computed(() => {
|
|
|
label: "净重",
|
|
|
prop: "netWeight",
|
|
|
},
|
|
|
+ render(netWeight) {
|
|
|
+ return netWeight + "kg";
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "毛重",
|
|
|
prop: "roughWeight",
|
|
|
},
|
|
|
+
|
|
|
+ render(roughWeight) {
|
|
|
+ return roughWeight + "kg";
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "长",
|
|
|
prop: "boxLong",
|
|
|
},
|
|
|
+ render(boxLong) {
|
|
|
+ return boxLong + "cm";
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -447,27 +511,41 @@ const config = computed(() => {
|
|
|
label: "宽",
|
|
|
prop: "boxWide",
|
|
|
},
|
|
|
+ render(boxWide) {
|
|
|
+ return boxWide + "cm";
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "高",
|
|
|
prop: "boxHigh",
|
|
|
},
|
|
|
+ render(boxHigh) {
|
|
|
+ return boxHigh + "cm";
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "总体积",
|
|
|
prop: "bomVolume",
|
|
|
},
|
|
|
+ render(bomVolume) {
|
|
|
+ return bomVolume + "m³";
|
|
|
+ },
|
|
|
},
|
|
|
-
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "出货状态",
|
|
|
prop: "shipmentStatus",
|
|
|
},
|
|
|
render(status) {
|
|
|
- return status == 1 ? "出货" : "未出货";
|
|
|
+ return status == 1 ? "出货" : status == 0 ? "未出货" : "";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "出货时间",
|
|
|
+ prop: "shipmentTime",
|
|
|
},
|
|
|
},
|
|
|
|
|
@@ -534,7 +612,25 @@ const config = computed(() => {
|
|
|
const formDom = ref(null);
|
|
|
let formData = reactive({
|
|
|
data: {},
|
|
|
+ dataOne: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
});
|
|
|
+const byform = ref(null);
|
|
|
+const treeData = ref([]);
|
|
|
+const formConfig = reactive([
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "contractId",
|
|
|
+ label: "主合同",
|
|
|
+ required: true,
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+]);
|
|
|
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
@@ -543,10 +639,7 @@ const getList = async (req) => {
|
|
|
.post("/packDetail/page", sourceList.value.pagination)
|
|
|
.then((message) => {
|
|
|
console.log(message);
|
|
|
- sourceList.value.data = message.rows.map((x) => ({
|
|
|
- ...x,
|
|
|
- ...JSON.parse(x.victoriatouristJson),
|
|
|
- }));
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
sourceList.value.pagination.total = message.total;
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
@@ -555,40 +648,92 @@ const getList = async (req) => {
|
|
|
};
|
|
|
|
|
|
const openModal = () => {
|
|
|
+ modalType.value = "add";
|
|
|
formData.data = {
|
|
|
packDetailList: [],
|
|
|
+ contractIds: [],
|
|
|
};
|
|
|
dialogVisible.value = true;
|
|
|
- // handleChangeCustomer("");
|
|
|
+ handleChangeCustomer("");
|
|
|
};
|
|
|
|
|
|
-const submitForm = () => {
|
|
|
- console.log(formData.data, "qwdads");
|
|
|
+const openModalOne = () => {
|
|
|
+ formData.dataOne = {
|
|
|
+ ids: [],
|
|
|
+ contractId: "",
|
|
|
+ };
|
|
|
+ let ids = []; //合同id
|
|
|
+ let idsOne = []; //包装id
|
|
|
+ const list = selectData.value;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ ids = [...ids, ...e.contractIds.split(",")];
|
|
|
+ idsOne.push(e.id);
|
|
|
+ }
|
|
|
+ formData.dataOne.ids = idsOne;
|
|
|
+ proxy.post(`/contract/getByIds`, ids).then((res) => {
|
|
|
+ formConfig[0].data = res.map((x) => ({
|
|
|
+ label: x.code,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ dialogVisibleOne.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
+const submitForm = () => {
|
|
|
formDom.value.validate((vaild) => {
|
|
|
if (vaild) {
|
|
|
- console.log(formData.data, "qwdads");
|
|
|
submitLoading.value = true;
|
|
|
- proxy.post("/productionProcesses/" + modalType.value, formData.data).then(
|
|
|
+ loadingOne.value = true;
|
|
|
+ for (let i = 0; i < formData.data.packDetailList.length; i++) {
|
|
|
+ const e = formData.data.packDetailList[i];
|
|
|
+ e.bomVolume = (e.boxLong * e.boxWide * e.boxHigh) / 1000000;
|
|
|
+ }
|
|
|
+ formData.data.contractIds = formData.data.contractIds.join(",");
|
|
|
+ proxy.post("/pack/" + modalType.value, formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
type: "success",
|
|
|
});
|
|
|
- fileList.value = [];
|
|
|
dialogVisible.value = false;
|
|
|
submitLoading.value = false;
|
|
|
+ loadingOne.value = false;
|
|
|
getList();
|
|
|
},
|
|
|
(err) => {
|
|
|
- console.log(err, "aswwwww");
|
|
|
submitLoading.value = false;
|
|
|
+ loading.value = false;
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const submitFormOne = () => {
|
|
|
+ byform.value.handleSubmit((valid) => {
|
|
|
+ loading.value = true;
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/packDetail/shipment", formData.dataOne).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "出货成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisibleOne.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ loading.value = false;
|
|
|
+ getList();
|
|
|
+ selectData.value = [];
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ submitLoading.value = false;
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const selectData = ref([]);
|
|
|
const selectRow = (data) => {
|
|
|
selectData.value = data;
|
|
@@ -609,31 +754,55 @@ const handleClickPacking = () => {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ for (let j = 0; j < formData.data.contractProductData.length; j++) {
|
|
|
+ const jele = formData.data.contractProductData[j];
|
|
|
+ if (e.id === jele.id && e.quantity > Number(jele.waitQuantity)) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "装箱数量不可大于袋装箱数量",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
const packDetailProductList = list.map((x) => ({
|
|
|
- contractId: x.id,
|
|
|
- contractProductId: x.contractProductId,
|
|
|
+ contractCode: x.contractCode,
|
|
|
+ contractId: x.contractId,
|
|
|
+ contractProductId: x.id,
|
|
|
quantity: x.quantity,
|
|
|
- productId: x.contractProductId,
|
|
|
- productName: "",
|
|
|
- productModel: "",
|
|
|
- remark: "",
|
|
|
+ productId: x.productId,
|
|
|
+ productName: x.productName,
|
|
|
}));
|
|
|
+ const customerId = formData.data.customerId ? formData.data.customerId : "";
|
|
|
+ const contractIds = formData.data.contractIds
|
|
|
+ ? formData.data.contractIds.join(",")
|
|
|
+ : "";
|
|
|
formData.data.packDetailList.push({
|
|
|
- customerId: "",
|
|
|
- contractIds: "",
|
|
|
+ customerId: customerId,
|
|
|
+ contractIds: contractIds,
|
|
|
packQuantity: "",
|
|
|
netWeight: "",
|
|
|
roughWeight: "",
|
|
|
- boxLong: "",
|
|
|
- boxWide: "",
|
|
|
- boxHigh: "",
|
|
|
+ boxLong: undefined,
|
|
|
+ boxWide: undefined,
|
|
|
+ boxHigh: undefined,
|
|
|
bomVolume: "",
|
|
|
remark: "",
|
|
|
packDetailGoodsList: [],
|
|
|
packDetailProductList: packDetailProductList,
|
|
|
isShow: false,
|
|
|
});
|
|
|
- console.log(formData.data.packDetailList, "qsda");
|
|
|
+ // 减去待装箱数量
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ for (let j = 0; j < formData.data.contractProductData.length; j++) {
|
|
|
+ const jele = formData.data.contractProductData[j];
|
|
|
+ if (e.id === jele.id) {
|
|
|
+ formData.data.contractProductData[j].waitQuantity -= e.quantity;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
return ElMessage({
|
|
|
message: "请选择产品 !",
|
|
@@ -671,13 +840,14 @@ const handleChangeCustomer = (val) => {
|
|
|
.get(`/contract/getNoPackContractByCustomerId?customerId=${val}`)
|
|
|
.then((res) => {
|
|
|
contractData.value = res.data;
|
|
|
- formData.data.contractIds = "";
|
|
|
+ formData.data.contractIds = [];
|
|
|
});
|
|
|
};
|
|
|
const handleChangeContract = (val) => {
|
|
|
+ const customerId = formData.data.customerId ? formData.data.customerId : "";
|
|
|
proxy
|
|
|
.get(
|
|
|
- `/contractProduct/getNoPackContractProductById?customerId=${formData.data.customerId}&contractIds=${val}`
|
|
|
+ `/contractProduct/getNoPackContractProductById?customerId=${customerId}&contractIds=${val}`
|
|
|
)
|
|
|
.then((res) => {
|
|
|
formData.data.contractProductData = res.data.map((x) => ({
|
|
@@ -686,6 +856,24 @@ const handleChangeContract = (val) => {
|
|
|
}));
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const getData = (data, type) => {
|
|
|
+ if (!data) return [];
|
|
|
+ const arr = data.split(",");
|
|
|
+ if (arr && arr.length > 0) {
|
|
|
+ const arrOne = [];
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const e = arr[i];
|
|
|
+ if (type === "code") {
|
|
|
+ arrOne.push(e.split("_")[0]);
|
|
|
+ } else if (type === "productName") {
|
|
|
+ arrOne.push(e.split("_")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arrOne;
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+};
|
|
|
getSelectData();
|
|
|
getList();
|
|
|
</script>
|