<template>
|
<div class="page-list-container">
|
<!--数据Table-->
|
<yrt-data-list :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" :is-init-load="false">
|
<!-- 字段插槽 -->
|
<template slot="common-column-slot" slot-scope="{ row, col }">
|
<template v-if="col.prop == 'collectStatus'">
|
<el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
<!-- 连接字段 -->
|
<template v-else-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
|
</template>
|
<!--托盘号-->
|
<template v-else-if="col.prop == 'plateCode'">
|
{{ row[col.prop] }}
|
<el-button v-if="row['orderStatus']==='已组板'" type="text" @click="()=>{modifyPlateCode([row])}">改</el-button>
|
</template>
|
<template v-else-if="col.dropdown_Id>0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
<template slot="button-tool2-slot">
|
<el-checkbox v-model="dataOptions.isLoadHisotry" @change="$refs[dataListRef].reload()">查询历史</el-checkbox>
|
</template>
|
</yrt-data-list>
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :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">
|
</yrt-editor>
|
<el-dialog v-dialogDrag :visible.sync="dialogVisible" title="导入">
|
<el-form :model="form" label-width="120px">
|
<el-form-item label="货主名称:">
|
<el-select v-model="formData.consignor_Id" placeholder="请选择">
|
<el-option v-for="item in consignorNames" :key="item.consignor_Id" :label="item.consignorName" :value="item.consignor_Id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="选择仓库">
|
<el-select v-model="formData.storage_Id" placeholder="请选择">
|
<el-option v-for="item in storageNames" :key="item.storage_Id" :label="item.storageName" :value="item.storage_Id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="运单号:">
|
<el-input v-model="formData.wayBillCodes" type="textarea" placeholder="请输入内容,多条用逗号分隔或换行" class="w-500"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="save()">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
/* eslint-disable */
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "tms-way-bill-receive",
|
components: {},
|
mixins: [baseLayout],
|
data() {
|
return {
|
dialogVisible: false,
|
formData: {
|
consignor_Id: null,
|
wayBillCodes: null,
|
storage_Id: null
|
},
|
consignorNames: [],
|
form: {
|
voyageCode: "",
|
region: "",
|
date1: "",
|
date2: "",
|
delivery: false,
|
type: [],
|
resource: "",
|
desc: ""
|
},
|
storageNames: [],
|
// 状态值
|
statusValueList: [
|
{
|
status: "待揽收",
|
bgColor: "#ffffcc",
|
color: "black"
|
},
|
{
|
status: "已揽收",
|
bgColor: "#00ff99",
|
color: "black"
|
},
|
{
|
status: "已退货",
|
bgColor: "#ff9966",
|
color: "#fff"
|
}
|
]
|
};
|
},
|
mounted() {
|
this.consignors();
|
this.getStorageList();
|
},
|
methods: {
|
// 状态背景颜色
|
setStatusBgColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var bgColor = "#ffffff";
|
if (colorItem) bgColor = colorItem.bgColor;
|
|
return bgColor;
|
},
|
// 状态字体颜色
|
setStatusColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var color = "#888";
|
if (colorItem) color = colorItem.color;
|
|
return {
|
border: 0,
|
color: color
|
};
|
},
|
// 数据加载后
|
onEditLoadAfter(formData) {
|
this.editorOptions.config.disabled = true; // 整个对话框不可编辑
|
},
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "allImport":
|
this.import();
|
return true;
|
case "return":
|
this.return();
|
return true;
|
}
|
},
|
// 获取仓库
|
getStorageList() {
|
const url = "/api/basicInfo/base/storage/getList";
|
const params = {};
|
var callback = res => {
|
if (res.result) {
|
this.storageNames = res.data;
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
// 导入
|
import() {
|
this.dialogVisible = true;
|
},
|
// 获取货主名称
|
consignors() {
|
const url = "/api/basicInfo/base/consignor/getList";
|
const parments = {};
|
var conback = res => {
|
if (res.result) {
|
this.consignorNames = res.data;
|
}
|
};
|
this.common.ajax(url, parments, conback, true);
|
},
|
// 保存
|
save() {
|
var consignorNames = this.consignorNames;
|
var url = "/api/tms/wayBillReceive/wayBillSave";
|
var parments = {
|
wayBillCodes: this.formData.wayBillCodes,
|
consignor_Id: this.formData.consignor_Id,
|
storage_Id: this.formData.storage_Id
|
};
|
const ref = this.dataList;
|
var callback = res => {
|
if (res.result) {
|
this.common.showMsg(res);
|
this.formData.consignor_Id = null;
|
this.formData.wayBillCodes = null;
|
ref.loadData();
|
this.dialogVisible = false;
|
} else {
|
this.common.showMsg(res);
|
}
|
};
|
this.common.ajax(url, parments, callback, true);
|
},
|
// 退货
|
return() {
|
this.$confirm("确定要批量进行退货操作吗?", "批量退货", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
// 获得已选中的ID
|
const wayBillCodes = this.dataListSelections.map((item, index, Array) => {
|
return item.wayBillCode;
|
});
|
if (!wayBillCodes.length) {
|
this.$message({
|
message: "至少选中一行!",
|
type: "warning"
|
});
|
return;
|
}
|
const url = "/api/tms/wayBillReceive/return";
|
const params = {
|
wayBillCodes: wayBillCodes
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.dataList.loadData();
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
}
|
}
|
};
|
</script>
|