<template>
|
<div class="page-list-container">
|
<!-- 数据Table -->
|
<yrt-data-list :fixed-where="fixedwhere" :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
|
<template slot="common-column-slot" slot-scope="{ row, col }">
|
<!-- 状态 颜色 -->
|
<template v-if="col.prop=='orderStatus'">
|
<template>
|
<el-tag v-if="row[col.prop]=='新建'" color="#ffff33" style="color:black;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]=='未揽收'" color="#ffff33" style="color:black;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]=='提货中'" color="#00cc00" style="color:white;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
</template>
|
|
<!--审核字段-->
|
<template v-else-if="col.prop=='auditing'">
|
<template>
|
<el-tag v-if="row[col.prop]==0" color="#ffff33" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==1" color="#ff0033" style="color:white;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==2" color="#33cc33" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<span v-else>
|
{{ row[col.prop] }}
|
</span>
|
</template>
|
</template>
|
</template>
|
</yrt-data-list>
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :edit-button-click="editButtonClick" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" :before-close="beforeClose" @on-edit-load-after="onEditLoadAfter" @on-change="onChange">
|
</yrt-editor>
|
<!--新建页面-->
|
<create-pick-dialog ref="childData" :visible.sync="createDistConfig.isShowDialog" :config="createDistConfig" @generate-bills="generatebill">
|
</create-pick-dialog>
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
import CreatePickDialog from "./components/create-pick-dialog";
|
export default {
|
name: "tms-way-bill",
|
components: { CreatePickDialog },
|
mixins: [baseLayout],
|
data() {
|
return {
|
fixedwhere: { take: 1, orderStatus: ["新建", "未揽收"] },
|
createDistConfig: {
|
// 显示新建页面对话框
|
isShowDialog: false,
|
title: "生成提货派车单"
|
}
|
};
|
},
|
methods: {
|
// 主表按钮点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "pickupbill":
|
this.pickupbill();
|
return false;
|
}
|
},
|
pickupbill() {
|
const ids = this.dataList.dataListSelections.map(item => item.wayBill_Id);
|
if (!ids.length) {
|
this.$message.error("至少选择一行!");
|
return;
|
}
|
const Total = this.dataList.dataListSelections;
|
// 合计件数
|
let totalQuantity = 0;
|
// 合计数量
|
let totalNumber = 0;
|
// 合计重量
|
let totalWeight = 0.0;
|
// 合计体积
|
let totalVolume = 0.0;
|
// 合计体积
|
Total.forEach(item => {
|
totalQuantity += item.totalQuantity;
|
totalNumber += item.totalQuantityOrder;
|
totalWeight += item.totalWeight;
|
totalVolume += item.totalVolume;
|
});
|
// 传入到子组件
|
const total = { totalQuantity, totalNumber, totalWeight, totalVolume };
|
this.$refs.childData.childTotal(total);
|
// 获取司机和车辆信息
|
const url = "/api/tms/wayBillPickup/distributionbill";
|
const params = {};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 获取司机信息集合
|
const driverDataList = res.data.driverDataList;
|
// 传递到子组件 driver
|
this.$refs.childData.driver(driverDataList);
|
// 获取车辆信息集合
|
const vehicleDataList = res.data.vehicleDataList;
|
// 传递到子组件 vehicle
|
this.$refs.childData.vehicle(vehicleDataList);
|
}
|
};
|
this.common.ajax(url, params, callback);
|
// 打开窗体
|
this.createDistConfig.isShowDialog = true;
|
},
|
// 生成配送单
|
generatebill(formData) {
|
this.$confirm("生成配送单, 是否继续?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
// formData 获取当前输入的派车单信息
|
const ids = this.dataList.dataListSelections.map(item => item.wayBill_Id);
|
const url = "/api/tms/wayBillPickup/generateBill"; // 服务地址
|
const params = {
|
wayBill_Ids: ids,
|
formData: formData
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.createDistConfig.isShowDialog = false;
|
// 触发子组件事件清空表单
|
this.$refs.childData.clear();
|
this.dataList.reload();
|
}
|
};
|
this.common.ajax(url, params, callback);
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 明细按钮点击事件
|
editButtonClick(authNode) {},
|
// 改变后事件
|
onChange(ref, val, field, formData) {},
|
// 编辑页面加载前
|
onEditLoadAfter(formData) {
|
this.editorOptions.config.disabled = true; // 整个对话框不可编辑
|
},
|
beforeClose() {
|
this.editorOptions.config.visible = false;
|
}
|
}
|
};
|
</script>
|