|
|
<template>
|
|
|
<div>
|
|
|
<el-card class="el-card">
|
|
|
<el-form :inline="true" :model="filterQuery"
|
|
|
class="query-form" size="mini">
|
|
|
<el-row>
|
|
|
<el-form-item class="query-form-item">
|
|
|
<el-input
|
|
|
v-model="filterQuery.billNo"
|
|
|
placeholder="单据号"
|
|
|
clearable
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="query-form-item">
|
|
|
<el-input
|
|
|
v-model="filterQuery.corpName"
|
|
|
placeholder="往来单位"
|
|
|
clearable
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="query-form-item">
|
|
|
<el-select v-model="filterQuery.billAction" placeholder="请选择业务类型">
|
|
|
<el-option
|
|
|
v-for="item in busTypes"
|
|
|
:key="item.name"
|
|
|
:label="item.name"
|
|
|
:value="item.action">
|
|
|
<span style="float: left">{{ item.name }}</span>
|
|
|
<!--<span style="float: right; color: #8492a6; font-size: 13px">{{ item.action }}</span>-->
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="query-form-item">
|
|
|
<span style="color: #000; margin-left: 10px; margin-right: 6px">单据日期:</span>
|
|
|
<el-date-picker
|
|
|
:picker-options="pickerOptions"
|
|
|
v-model="actDateRange"
|
|
|
type="daterange"
|
|
|
format="yyyy 年 MM 月 dd 日"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<!--<el-form-item class="query-form-item">-->
|
|
|
<!--<el-select v-model="filterQuery.thirdSysFk" placeholder="请选择第三方系统">-->
|
|
|
<!--<el-option-->
|
|
|
<!--v-for="item in thirdSys"-->
|
|
|
<!--:key="item.value"-->
|
|
|
<!--:label="item.thirdName"-->
|
|
|
<!--:value="item.thirdId">-->
|
|
|
<!--<span style="float: left">{{ item.thirdName }}</span>-->
|
|
|
<!--<span style="float: right; color: #8492a6; font-size: 13px">{{ item.thirdId }}</span>-->
|
|
|
<!--</el-option>-->
|
|
|
<!--</el-select>-->
|
|
|
<!--</el-form-item>-->
|
|
|
<el-form-item>
|
|
|
<el-button-group style="display:flex;">
|
|
|
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
|
|
|
<el-button type="primary" icon="search" @click="getList">查询</el-button>
|
|
|
<el-button type="primary" icon="search" @click="selectExport" v-if="selectType==0"
|
|
|
>选中导出
|
|
|
</el-button>
|
|
|
<el-button type="primary" icon="search" @click="allExport" v-if="selectType==0"
|
|
|
>结果全部导出
|
|
|
</el-button>
|
|
|
<el-button type="primary" icon="search" @click="uploadSMP"
|
|
|
v-if="selectType==1"
|
|
|
>选中上传
|
|
|
</el-button>
|
|
|
<el-button type="primary" icon="search" @click="allUploadSMP"
|
|
|
v-if="selectType==1"
|
|
|
>一键上传
|
|
|
</el-button>
|
|
|
<el-button type="primary" icon="search" @click="downloadErp" v-if="selectType==3"
|
|
|
>选中下载
|
|
|
</el-button>
|
|
|
<el-button type="primary" icon="search" @click="downloadAllErp" v-if="selectType==3"
|
|
|
>结果全部下载
|
|
|
</el-button>
|
|
|
</el-button-group>
|
|
|
</el-form-item>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row="true"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
@current-change="handleDetail">
|
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
|
<el-table-column label="序号" type="index" width="60"></el-table-column>
|
|
|
<el-table-column label="单据号" prop="billNo"></el-table-column>
|
|
|
<el-table-column label="往来单位ID" prop="corpId" width="100"></el-table-column>
|
|
|
<el-table-column label="往来单位" prop="corpName" width="300"
|
|
|
show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column label="扫码单据类型" prop="billType">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ geActionName(scope.row.billType) }}</span>
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
<el-table-column label="单据状态" prop="billFlag" width="80"></el-table-column>
|
|
|
<el-table-column label="单据日期" prop="billdate"></el-table-column>
|
|
|
<el-table-column label="单据类型" prop="originType"></el-table-column>
|
|
|
<el-table-column label="操作" fixed="right" v-if="thirdSysDetail.fromType!=0">
|
|
|
<template slot-scope="scope" >
|
|
|
<el-button type="text" size="small" @click.native.stop="deleteDialog(scope.row)"
|
|
|
>删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination
|
|
|
:page-size="filterQuery.limit"
|
|
|
@current-change="handleCurrentChange"
|
|
|
layout="prev, pager, next"
|
|
|
:total="total"
|
|
|
></el-pagination>
|
|
|
</el-card>
|
|
|
<el-card class="el-card">
|
|
|
<el-table v-loading="loading" :data="detailList" style="width: 100%">
|
|
|
<el-table-column label="序号" type="index" width="120"></el-table-column>
|
|
|
<el-table-column label="产品编码" prop="productId"></el-table-column>
|
|
|
<el-table-column label="产品名称" prop="productName" show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column label="规格型号" prop="spec" show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column label="批次号" prop="batchNo"></el-table-column>
|
|
|
<el-table-column label="生产日期" prop="productDate"></el-table-column>
|
|
|
<el-table-column label="失效日期" prop="expireDate"></el-table-column>
|
|
|
<el-table-column label="单据数量" prop="reCount"></el-table-column>
|
|
|
<el-table-column label="实际数量" prop="count"></el-table-column>
|
|
|
</el-table>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import {
|
|
|
delThrOrders, delAll, downloadAll, orderDownload
|
|
|
} from "../../api/thrsys/thrOrder";
|
|
|
import {getBussinessType} from "../../api/basic/bussinessType";
|
|
|
import {getBasicThirdSys, filterDetailByKey} from "../../api/basic/basicThirdSys";
|
|
|
import {selectIp} from "../../api/param/systemParamConfig";
|
|
|
import {getCloudErp} from "../../api/inout/erpOrder";
|
|
|
import {exportExcel} from "../../api/thrsys/thrOrderExport"
|
|
|
import {orderUpload} from "../../api/thrsys/smp"
|
|
|
|
|
|
export default {
|
|
|
name: "ThrOrderSelect",
|
|
|
props: {
|
|
|
selectType: {
|
|
|
type: Object,
|
|
|
required: true,
|
|
|
},
|
|
|
isDownThrSys: {
|
|
|
type: Object,
|
|
|
required: true,
|
|
|
},
|
|
|
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
filterQuery: {
|
|
|
erpOrderResponses: [],
|
|
|
billNo: "",
|
|
|
thirdSysFk: "",
|
|
|
billFlag: null,
|
|
|
billAction: "PurchaseWareHouseIn",
|
|
|
startDate: null,
|
|
|
endDate: null,
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
isDownThrSys: null,
|
|
|
},
|
|
|
total: 0,
|
|
|
thirdSys: [],
|
|
|
thirdSysDetail: null,
|
|
|
busTypes: [],
|
|
|
list: [],
|
|
|
detailList: [],
|
|
|
uploadFileUrl: null,
|
|
|
fileList: [],
|
|
|
uploadData: {
|
|
|
thirdSys: "thirdId",
|
|
|
},
|
|
|
loading: false,
|
|
|
multipleSelection: [],
|
|
|
actDateRange: [],
|
|
|
pickerOptions: {
|
|
|
shortcuts: [
|
|
|
{
|
|
|
text: "最近一周",
|
|
|
onClick(picker) {
|
|
|
const end = new Date();
|
|
|
const start = new Date();
|
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
picker.$emit("pick", [start, end]);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
text: "最近一个月",
|
|
|
onClick(picker) {
|
|
|
const end = new Date();
|
|
|
const start = new Date();
|
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
picker.$emit("pick", [start, end]);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
text: "最近三个月",
|
|
|
onClick(picker) {
|
|
|
const end = new Date();
|
|
|
const start = new Date();
|
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
|
|
picker.$emit("pick", [start, end]);
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
onReset() {
|
|
|
this.$router.push({
|
|
|
path: "",
|
|
|
});
|
|
|
this.filterQuery = {
|
|
|
erpOrderResponses: [],
|
|
|
billNo: "",
|
|
|
thirdSysFk: "",
|
|
|
billFlag: null,
|
|
|
billAction: "PurchaseWareHouseIn",
|
|
|
startDate: null,
|
|
|
endDate: null,
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
isDownThrSys: null,
|
|
|
};
|
|
|
this.actDateRange = [];
|
|
|
this.getList();
|
|
|
},
|
|
|
|
|
|
getList() {
|
|
|
if (this.filterQuery.thirdSysFk == null) {
|
|
|
this.$message.warning("请先选择第三方系统!")
|
|
|
return;
|
|
|
}
|
|
|
if (this.actDateRange != null) {
|
|
|
this.filterQuery.startDate = this.actDateRange[0];
|
|
|
this.filterQuery.endDate = this.actDateRange[1];
|
|
|
} else {
|
|
|
this.filterQuery.startDate = null;
|
|
|
this.filterQuery.endDate = null;
|
|
|
}
|
|
|
|
|
|
this.loading = true;
|
|
|
this.filterQuery.isDownThrSys = this.isDownThrSys;
|
|
|
getCloudErp(this.filterQuery)
|
|
|
.then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.list = response.data.list || [];
|
|
|
this.total = response.data.total || 0;
|
|
|
} else {
|
|
|
this.$message.error(response.message);
|
|
|
}
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
this.list = [];
|
|
|
this.total = 0;
|
|
|
});
|
|
|
},
|
|
|
handleDetail(row) {
|
|
|
this.detailList = row.subErpOrders;
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
|
},
|
|
|
selectExport() {
|
|
|
var selectData = this.multipleSelection;
|
|
|
selectData.forEach((obj) => {
|
|
|
this.filterQuery.erpOrderResponses.push(obj);
|
|
|
});
|
|
|
this.allExport();
|
|
|
},
|
|
|
allExport() {
|
|
|
exportExcel(this.filterQuery)
|
|
|
.then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: "导出成功,后台正在生成Excel文件,请稍后刷新查看!",
|
|
|
});
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "error",
|
|
|
message: response.message,
|
|
|
});
|
|
|
}
|
|
|
this.$emit("cancelDialog", true);
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$message({
|
|
|
type: "error",
|
|
|
message: "上传失败",
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
|
|
|
uploadSMP() {
|
|
|
var selectData = this.multipleSelection;
|
|
|
selectData.forEach((obj) => {
|
|
|
this.filterQuery.erpOrderResponses.push(obj);
|
|
|
});
|
|
|
this.allUploadSMP();
|
|
|
},
|
|
|
|
|
|
allUploadSMP() {
|
|
|
orderUpload(this.filterQuery)
|
|
|
.then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.$message.success("提交成功,后台正在上传!")
|
|
|
} else {
|
|
|
this.$message.error(response.message)
|
|
|
}
|
|
|
this.$emit("cancelDialog", true);
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$message.error("上传失败!");
|
|
|
});
|
|
|
},
|
|
|
|
|
|
|
|
|
downloadErp() {
|
|
|
var selectData = this.multipleSelection;
|
|
|
selectData.forEach((obj) => {
|
|
|
this.filterQuery.erpOrderResponses.push(obj);
|
|
|
});
|
|
|
this.downloadAllErp();
|
|
|
},
|
|
|
|
|
|
downloadAllErp() {
|
|
|
orderDownload(this.filterQuery)
|
|
|
.then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.$message.success("提交成功,后台正在下载!")
|
|
|
|
|
|
} else {
|
|
|
this.$message.error(response.message)
|
|
|
}
|
|
|
this.$emit("cancelDialog", true);
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$message.error("下载失败!");
|
|
|
});
|
|
|
},
|
|
|
|
|
|
deleteDialog(row) {
|
|
|
this.$confirm("此操作将永久删除该单据, 是否继续?", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
|
let dQuery = {
|
|
|
id: row.id,
|
|
|
};
|
|
|
delThrOrders(dQuery)
|
|
|
.then((response) => {
|
|
|
this.loading = false;
|
|
|
if (response.code == 20000) {
|
|
|
this.$message.success("删除成功");
|
|
|
this.getList();
|
|
|
} else {
|
|
|
this.$message.error(response.message);
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
|
|
|
})
|
|
|
.catch(() => {
|
|
|
});
|
|
|
},
|
|
|
clearAll() {
|
|
|
this.$confirm("此操作将清空所有单据, 是否继续?", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
|
delAll()
|
|
|
.then((response) => {
|
|
|
this.loading = false;
|
|
|
if (response.code == 20000) {
|
|
|
this.$message.success("删除成功");
|
|
|
this.getList();
|
|
|
} else {
|
|
|
this.$message.success(response.message);
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
|
|
|
})
|
|
|
.catch(() => {
|
|
|
});
|
|
|
},
|
|
|
getBasicThirdSys() {
|
|
|
let query = {
|
|
|
enabled: true,
|
|
|
};
|
|
|
getBasicThirdSys(query)
|
|
|
.then((response) => {
|
|
|
this.thirdSys = response.data.list || [];
|
|
|
this.filterQuery.thirdSysFk = this.thirdSys[0].thirdId;
|
|
|
this.uploadData.thirdSys = this.filterQuery.thirdSysFk;
|
|
|
this.selectSysParam();
|
|
|
this.getThirdSysDetail();
|
|
|
this.getBusType();
|
|
|
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
this.list = [];
|
|
|
});
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
this.filterQuery.page = val;
|
|
|
this.getList();
|
|
|
},
|
|
|
handleChange(response, files, fileList) {
|
|
|
console.log(response);
|
|
|
if (response.code != 20000) {
|
|
|
this.$message.error(response.message);
|
|
|
} else {
|
|
|
console.log(files[0] + "\n" + this.fileList[0] + "\n" + fileList[0]);
|
|
|
this.$message.success("文件上传成功,请稍后刷新查看!");
|
|
|
}
|
|
|
},
|
|
|
selectSysParam() {
|
|
|
let query = {
|
|
|
key: "thirdIpUrl",
|
|
|
thirdSysFk: this.filterQuery.thirdSysFk
|
|
|
};
|
|
|
selectIp(query).then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.uploadFileUrl = response.data.thridUrl + "/udiwms/erp/pi/upload";
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
thirdSysChange() {
|
|
|
this.uploadData.thirdSys = this.filterQuery.thirdSysFk;
|
|
|
this.getThirdSysDetail();
|
|
|
},
|
|
|
getThirdSysDetail() {
|
|
|
let query = {
|
|
|
thirdSysFk: this.filterQuery.thirdSysFk,
|
|
|
key: "orderQueryUrl",
|
|
|
};
|
|
|
filterDetailByKey(query)
|
|
|
.then((response) => {
|
|
|
this.thirdSysDetail = response.data;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
this.list = [];
|
|
|
});
|
|
|
|
|
|
},
|
|
|
downloadDatas() {
|
|
|
let query = {
|
|
|
billAction: this.filterQuery.billAction
|
|
|
};
|
|
|
downloadAll(query).then((response) => {
|
|
|
if (response.code == 20000) {
|
|
|
this.$message.success(response.data);
|
|
|
} else {
|
|
|
this.$message.error(response.message);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
},
|
|
|
getBusType() {
|
|
|
let query = {
|
|
|
enabled: true,
|
|
|
};
|
|
|
getBussinessType(query)
|
|
|
.then((response) => {
|
|
|
this.busTypes = response.data.list || [];
|
|
|
this.filterQuery.billAction = this.busTypes[0].action;
|
|
|
this.getList();
|
|
|
})
|
|
|
.catch(() => {
|
|
|
});
|
|
|
},
|
|
|
geActionName(action){
|
|
|
for (let i = 0; i < this.busTypes.length; i++) {
|
|
|
if (this.busTypes[i].action === action) {
|
|
|
return this.busTypes[i].name;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
},
|
|
|
components: {},
|
|
|
mounted() {
|
|
|
},
|
|
|
created() {
|
|
|
let end = new Date();
|
|
|
let start = new Date();
|
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
this.actDateRange = [start, end];
|
|
|
this.getBasicThirdSys();
|
|
|
|
|
|
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
.itemTag {
|
|
|
float: left;
|
|
|
text-align: left;
|
|
|
margin-top: 10px;
|
|
|
width: 25%;
|
|
|
}
|
|
|
|
|
|
.text {
|
|
|
font-size: 13px;
|
|
|
font-family: "Microsoft YaHei";
|
|
|
}
|
|
|
.query-form {
|
|
|
margin-top: 10px;
|
|
|
display: flex;
|
|
|
}
|
|
|
.query-form-item {
|
|
|
display: block !important;
|
|
|
margin-right: 10px;
|
|
|
margin-bottom: 5px;
|
|
|
}
|
|
|
|
|
|
.el-row {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
}
|
|
|
|
|
|
.el-col {
|
|
|
border-radius: 4px;
|
|
|
flex-wrap: wrap;
|
|
|
}
|
|
|
</style>
|