退货单据,(还未完成)

ywj_dev
anthonywj 2 years ago
parent d2597578cb
commit 227428d87b

@ -0,0 +1,141 @@
import axios from "@/utils/request";
export function listOrder(query) {
return axios({
url: '/purchase/returned/list',
method: 'get',
params: query
})
}
export function auditListOrder(query) {
return axios({
url: '/purchase/returned/auditList',
method: 'get',
params: query
})
}
export function listOrderDetail(query) {
return axios({
url: '/purchase/returned/list/detail',
method: 'get',
params: query
})
}
export function getOrder(id) {
return axios({
url: '/purchase/returned/' + id,
method: 'get'
})
}
export function addOrder(data) {
return axios({
url: '/purchase/returned',
method: 'post',
data: data
})
}
export function auditOrder(data) {
return axios({
url: '/purchase/returned/auditOrder',
method: 'post',
data: data
})
}
// 修改pur
export function updateOrder(data) {
return axios({
url: '/purchase/returned',
method: 'put',
data: data
})
}
// 删除pur
export function delOrder(id) {
return axios({
url: '/purchase/returned/' + id,
method: 'delete'
})
}
export function inserThrOrderWeb(query) {
return axios({
url: "/purchase/returned/postOrder",
method: "post",
data: query
});
}
// 删除pur
export function delOrderDetail(id) {
return axios({
url: '/purchase/returned/detail/' + id,
method: 'delete'
})
}
// 添加puan
export function addOrderId() {
return axios({
url: "/purchase/returned/add",
method: 'post'
})
}
// 根据申购单添加详情表
export function addPlanDetailAndOrder(data) {
return axios({
url: "/purchase/returned/addPlanDetailAndOrder",
method: 'post',
data: data
})
}
// 添加详情表
export function addOrderDetail(data) {
return axios({
url: "/purchase/returned/addOrderDetail",
method: 'post',
data: data
})
}
// 查询详情表
export function selectOrderDetail(query) {
return axios({
url: "/purchase/returned/list/detail",
method: 'get',
params: query
})
}
//删除计划表和详情表
export function delOrderDetailAll(data) {
return axios({
url: "/purchase/returned/delOrderDetailAll",
method: 'post',
data: data
})
}
//更新pur
export function updateDetail(data) {
return axios({
url: "/purchase/returned/updateDetail",
method: 'post',
data: data
})
}

@ -0,0 +1,419 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" label-width="100px" v-show="showSearch">
<el-row>
<el-col :span="6">
<el-form-item label="单据号:">
<el-input v-model="filterQuery.billNo" style="width: 90%" placeholder="单据号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="单据日期:">
<el-date-picker
:picker-options="pickerOptions"
v-model="actDateRange"
type="daterange"
style="width: 90%"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmitFind"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="newDistributionForm()" :loading="loading">新增退货单据
</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" border highlight-current-row
@current-change="handleDetail">
<el-table-column label="序号" type="index" width="60"></el-table-column>
<el-table-column label="单据号" prop="billNo"></el-table-column>
<el-table-column label="单据日期" prop="billDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.billDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="createUser"></el-table-column>
<el-table-column label="部门" prop="deptName"></el-table-column>
<el-table-column label="仓库" prop="invName"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="状态" prop="status">
<template slot-scope="scope">
<el-tag :type="(scope.row.status) | statusFilterType">
{{ statusMap[scope.row.status] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native="newDistributionForm(scope.$index, scope.row)">编辑
</el-button>
<el-button type="text" size="small" @click.native.stop="deleteDialog(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="filterQuery.page"
:limit.sync="filterQuery.limit"
@pagination="handleCurrentChange"
></pagination>
</el-card>
<el-card class="el-card">
<el-table v-loading="loading" :data="detailList" style="width: 100%" border highlight-current-row>
<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="count"></el-table-column>
<el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="生产企业" prop="manufactory" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="医疗器械注册人" prop="ylqxzcrbarmc" show-overflow-tooltip="true"></el-table-column>
</el-table>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="newSpDistributionVisible"
width="80%"
v-if="newSpDistributionVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="handleClose"
>
<purDeliveryEdit
:isChang="isChang"
:closeDialog="closeDialog"
v-on:cancelDialog="getId"
:idQuery="idQuery"
></purDeliveryEdit>
</el-dialog>
</div>
</template>
<script>
import purDeliveryEdit from "./purReturnedEditDialog";
import {inserThrOrderWeb, listOrderDetail, delOrderDetailAll, listOrder} from "@/api/purchase/purReturned";
export default {
data() {
name: "purReturned"
return {
showSearch: true,
pId: null,
isChang: false,
filterQuery: {
billAction: null,
billNo: "",
originType: null,
thirdSysFk: "",
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
},
formName: null,
formMap: {
add: "新增送货单",
update: "编辑送货单",
},
statusMap: {
1: "草稿",
2: "未审核",
3: "已审核",
4: "已拒绝"
},
idQuery: {},
total: 0,
thirdSys: [],
thirdSysDetail: null,
busTypes: [],
originTypes: [],
list: [],
detailList: [],
loading: false,
actDateRange: [],
newSpDistributionVisible: false,
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 = {
billNo: "",
thirdSysFk: "",
billFlag: null,
billAction: null,
startDate: null,
endDate: null,
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
};
this.actDateRange = [];
this.getList();
},
handleClose() {
if (this.formName == 'add' && this.pId != null) {
this.isChang = !this.isChang
} else {
this.newSpDistributionVisible = false
}
},
getId(id) {
if (this.formName == 'add' && id != null) {
var data = {
id: id
}
this.pId = id;
//
delOrderDetailAll(data).then((response) => {
if (response.code == 20000) {
this.newSpDistributionVisible = false
}
});
}
},
onSubmitFind() {
this.filterQuery.page = 1;
this.getList();
},
hideSearch() {
this.showSearch = !this.showSearch;
},
getList() {
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;
listOrder(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) {
let query = {orderIdFk: row.id};
this.loading = true;
listOrderDetail(query) //
.then((response) => {
this.detailList = response.data.list || [];
this.loading = false;
})
.catch(() => {
this.loading = false;
this.detailList = [];
this.total = 0;
});
},
submitOrder(row) {
this.$confirm("是否确定提交审核?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true;
let tQuery = {
editStatus: 2,
purPlanEntity: row,
}
inserThrOrderWeb(tQuery)
.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(() => {
});
},
deleteDialog(row) {
this.$confirm("此操作将永久删除该单据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delOrderDetailAll({id: row.id})
.then((response) => {
this.loading = false;
if (response.code == 20000) {
this.$message.success("删除成功");
this.getList();
this.detailList = null;
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {
});
},
handleCurrentChange(val) {
this.filterQuery.page = val.page;
this.getList();
},
closeDialog() {
this.newSpDistributionVisible = false;
this.getList();
this.detailList = [];
},
newDistributionForm(index, row) {
this.idQuery.id = '';
if (this.$isNotBlank(row) && this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.formName = "update";
} else
this.formName = "add";
this.newSpDistributionVisible = true;
},
}
,
components: {
purDeliveryEdit,
}
,
filters: {
statusFilterType(status) {
const statusMap = {
1: "warning",
2: "success",
};
return statusMap[status];
}
,
}
,
mounted() {
}
,
created() {
let end = new Date();
let start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.actDateRange = [start, end];
this.getList();
}
,
}
;
</script>
<style scoped>
.itemTag {
float: left;
text-align: left;
margin-top: 10px;
width: 25%;
}
.text {
font-size: 13px;
font-family: "Microsoft YaHei";
}
.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>

@ -0,0 +1,417 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" label-width="100px" v-show="showSearch">
<el-row>
<el-col :span="6">
<el-form-item label="单据号:">
<el-input v-model="filterQuery.billNo" style="width: 90%" placeholder="单据号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="单据日期:">
<el-date-picker
:picker-options="pickerOptions"
v-model="actDateRange"
type="daterange"
style="width: 90%"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmitFind"></el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" border highlight-current-row
@current-change="handleDetail">
<el-table-column label="序号" type="index" width="60"></el-table-column>
<el-table-column label="单据号" prop="billNo"></el-table-column>
<el-table-column label="单据日期" prop="billDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.billDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="createUser"></el-table-column>
<el-table-column label="退货部门" prop="deptName"></el-table-column>
<el-table-column label="退货仓库" prop="invName"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="状态" prop="status">
<template slot-scope="scope">
<el-tag :type="(scope.row.status) | statusFilterType">
{{ statusMap[scope.row.status] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native="newDistributionForm(scope.$index, scope.row)">编辑
</el-button>
<el-button type="text" size="small" @click.native.stop="deleteDialog(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="filterQuery.page"
:limit.sync="filterQuery.limit"
@pagination="handleCurrentChange"
></pagination>
</el-card>
<el-card class="el-card">
<el-table v-loading="loading" :data="detailList" style="width: 100%" border highlight-current-row>
<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="count"></el-table-column>
<el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="生产企业" prop="manufactory" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="医疗器械注册人" prop="ylqxzcrbarmc" show-overflow-tooltip="true"></el-table-column>
</el-table>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="newSpDistributionVisible"
width="80%"
v-if="newSpDistributionVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="handleClose"
>
<purDeliveryEdit
:isChang="isChang"
:closeDialog="closeDialog"
v-on:cancelDialog="getId"
:idQuery="idQuery"
></purDeliveryEdit>
</el-dialog>
</div>
</template>
<script>
import purDeliveryEdit from "./purReturnedEditDialog";
import {inserThrOrderWeb, listOrderDetail, delOrderDetailAll, listOrder} from "@/api/purchase/purReturned";
export default {
data() {
name: "purDelivery"
return {
showSearch: true,
pId: null,
isChang: false,
filterQuery: {
billAction: null,
billNo: "",
originType: null,
thirdSysFk: "",
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
},
formName: null,
formMap: {
add: "新增退货单",
update: "编辑退货单",
},
statusMap: {
1: "草稿",
2: "未审核",
3: "已审核",
4: "已拒绝"
},
idQuery: {},
total: 0,
thirdSys: [],
thirdSysDetail: null,
busTypes: [],
originTypes: [],
list: [],
detailList: [],
loading: false,
actDateRange: [],
newSpDistributionVisible: false,
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 = {
billNo: "",
thirdSysFk: "",
billFlag: null,
billAction: null,
startDate: null,
endDate: null,
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
};
this.actDateRange = [];
this.getList();
},
handleClose() {
if (this.formName == 'add' && this.pId != null) {
this.isChang = !this.isChang
} else {
this.newSpDistributionVisible = false
}
},
getId(id) {
if (this.formName == 'add' && id != null) {
var data = {
id: id
}
this.pId = id;
//
delOrderDetailAll(data).then((response) => {
if (response.code == 20000) {
this.newSpDistributionVisible = false
}
});
}
},
onSubmitFind() {
this.filterQuery.page = 1;
this.getList();
},
hideSearch() {
this.showSearch = !this.showSearch;
},
getList() {
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;
listOrder(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) {
let query = {orderIdFk: row.id};
this.loading = true;
listOrderDetail(query) //
.then((response) => {
this.detailList = response.data.list || [];
this.loading = false;
})
.catch(() => {
this.loading = false;
this.detailList = [];
this.total = 0;
});
},
submitOrder(row) {
this.$confirm("是否确定提交审核?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true;
let tQuery = {
editStatus: 2,
purPlanEntity: row,
}
inserThrOrderWeb(tQuery)
.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(() => {
});
},
deleteDialog(row) {
this.$confirm("此操作将永久删除该单据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delOrderDetailAll({id: row.id})
.then((response) => {
this.loading = false;
if (response.code == 20000) {
this.$message.success("删除成功");
this.getList();
this.detailList = null;
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {
});
},
handleCurrentChange(val) {
this.filterQuery.page = val.page;
this.getList();
},
closeDialog() {
this.newSpDistributionVisible = false;
this.getList();
this.detailList = [];
},
newDistributionForm(index, row) {
this.idQuery.id = '';
if (this.$isNotBlank(row) && this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.formName = "update";
} else
this.formName = "add";
this.newSpDistributionVisible = true;
},
}
,
components: {
purDeliveryEdit,
}
,
filters: {
statusFilterType(status) {
const statusMap = {
1: "warning",
2: "success",
};
return statusMap[status];
}
,
}
,
mounted() {
}
,
created() {
let end = new Date();
let start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.actDateRange = [start, end];
this.getList();
}
,
}
;
</script>
<style scoped>
.itemTag {
float: left;
text-align: left;
margin-top: 10px;
width: 25%;
}
.text {
font-size: 13px;
font-family: "Microsoft YaHei";
}
.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>

@ -0,0 +1,475 @@
<template>
<div>
<el-form :model="formData" :rules="formRules" ref="dataForm" label-width="120px">
<el-row type="flex" justify="end" v-if="editType == 1">
<el-button-group style="display: flex;margin-bottom: 15px; margin-right: 50px">
<el-button type="primary" @click.native="saveOrder('3')" :loading="loading">审核通过</el-button>
<el-button type="primary" @click.native="saveOrder('4')" :loading="loading">拒绝申请</el-button>
</el-button-group>
</el-row>
<el-card style="margin-top: -5px;">
<el-row>
<el-col :span="11">
<el-form-item label="单据号:" prop="billNo">
<el-input v-model="formData.billNo" style="width: 90%" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="单据日期:" prop="billdate">
<el-date-picker
v-model="formData.billDate"
type="datetime"
placeholder="选择日期" :disabled="true"
style="width: 90%"
:clearable="false"
value-format="yyyy-MM-dd HH:mm:ss"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="采购仓库:" prop="locStorageCode">
<el-select v-model="formData.invName" placeholder="采购仓库信息" style="width: 90%"
:disabled="true" clearable>
<el-option
v-for="item in subInvList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="审核说明:" prop="billNo">
<el-input v-model="formData.auditRemark" style="width: 90%" auto-complete="off" type="textarea" autosize></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="采购说明:" prop="billNo">
<el-input v-model="formData.remark" style="width: 90%":disabled="true" auto-complete="off" type="textarea" autosize></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item>
<el-checkbox v-model="formData.autoPurchase"></el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row v-show="formData.autoPurchase">
<el-col :span="11">
<el-form-item label="入库仓库:" prop="locStorageCode">
<el-select v-model="formData.targetSubInv" placeholder="入库仓库信息" style="width: 90%" @change="targetInvChange" clearable>
<el-option
v-for="item in tarSubList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="入库单据类型:" class="query-form-item" prop="targetBillAction">
<el-select v-model="formData.targetBillAction" placeholder="请选择单据类型" style="width: 90%">
<el-option
v-for="item in busTypes"
:key="item.name"
:label="item.name"
:value="item.action">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="codeArray" style="width: 100%;" :row-class-name="tableRowClassName" border highlight-current-row max-height="300" height="300" ref="multipleTable">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="产品通用名" prop="productName" show-overflow-tooltip></el-table-column>
<el-table-column label="规格型号" prop="spec" show-overflow-tooltip></el-table-column>
<el-table-column label="计量单位" prop="measname" show-overflow-tooltip></el-table-column>
<el-table-column label="生产厂家" prop="manufactory" show-overflow-tooltip></el-table-column>
<el-table-column width="150" label="单据数量">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.count"
placeholder="请输入数量" style="width: 80%"
type='number'
@change="tableCountChange(scope.row)"
:disabled="scope.row.index !== selectedIndex"
oninput="value=value.replace(/[^\d]/g,'')"></el-input>
</template>
</el-table-column>
</el-table>
</el-card>
</el-form>
<el-dialog
title="产品录入"
:visible.sync="selectProductVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="80%"
v-if="selectProductVisible"
:append-to-body='true'
>
<purPlanProducts
:closeDialog="closeDialogC2"
:data="thisData"
:purType="1"
></purPlanProducts>
</el-dialog>
</div>
</template>
<script>
import draggable from "vuedraggable";
import purPlanProducts from "@/views/purchase/purPlan/purOrderSelectProduct";
import {auditOrder, delOrderDetail, listOrderDetail} from "@/api/purchase/purOrder";
import {filterAllByUser,selectByCode} from "@/api/system/invWarehouse";
import {filterSubByInv} from "@/api/system/invSubWarehouse";
import {getLocalJoinByUser} from "@/api/basic/busType";
export default {
name: "idQuery",
props: {
closeDialog: {
type: Function,
required: true,
},
idQuery: {
type: Object,
required: true,
},
editType: {
type: Object,
required: true,
},
},
data() {
return {
code: "",
query: {
orderIdFk: "",
page: 1,
limit: 10,
},
formData: {
id: null,
billNo: null,
billDate: "",
remark: "",
deptCode: null,
locStorageCode: null,
invWarehouseCode: null,
auditRemark: null,
autoPurchase: false,
targetInv: 1000,
targetSubInv: null,
targetBillAction: null,
},
formRules: {},
codeArray: [],
total: 0,
loading: false,
index: null,
formLoading: false,
formVisible: false,
deleteLoading: false,
orderNo: null,
statusMap: {
1: "草稿",
2: "未审核",
3: "已审核",
},
typeMap: {
1: "预入库",
2: "普通采购",
},
orderEditor: true,
sOptions: [],
sValue: [],
sList: [],
sLoading: false,
busTypes: [],
currentRow: {},
selectedIndex: "",
selectProductVisible: false,
thisData: {},
subInvList: [],
tarSubList: [],
invQueryData: {},
};
},
components: {
draggable,
purPlanProducts,
},
methods: {
saveOrder(status) {
let tip = "";
if (status == "3") {
tip = "是否确定通过该采购计划?";
} else {
tip = "是否确定拒绝该采购计划?";
}
this.$confirm(tip, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.submitFunction(status);
}).catch(() => {
this.loading = false;
});
},
submitFunction(status) {
let tMessage = status === '1' ? '保存' : '提交';
this.loading = true;
let tQuery = {
autoPurchase:this.formData.autoPurchase,
targetSubInv:this.formData.targetSubInv,
targetDeptCode:this.formData.targetDeptCode,
targetBillAction:this.formData.targetBillAction,
editStatus: status,
purOrderEntity: this.formData,
subErpOrders: this.codeArray,
}
auditOrder(tQuery)
.then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success(tMessage + "成功");
this.closeDialog(true);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
})
},
selectProductFunction() {
this.selectProductVisible = true;
},
closeDialogC2(rData) {
this.selectProductVisible = false;
this.thisData = {};
if (this.$isNotBlank(rData)) {
this.codeArray = [];
rData.forEach((obj, index) => {
this.codeArray.unshift(obj);
});
this.$refs.multipleTable.setCurrentRow(this.codeArray[0]);
this.currentRow = this.codeArray[0];
this.selectedIndex = 0;
}
},
rowChange(val) {
this.currentRow = val;
this.selectedIndex = val.index;
},
tableCountChange(row) {
if (this.$isNotBlank(row)) {
// row.count = row.reCount;
}
},
tableRowClassName({row, rowIndex}) {
row.index = rowIndex;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
deleteCodeArray(index, row) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.$refs.multipleTable.setCurrentRow();
this.currentRow = {};
this.selectedIndex = "";
if (this.orderEditor) {
this.detailLoading = true;
if (this.$isNotBlank(row.id)) {
delOrderDetail(row.id)
.then(response => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success(response.data);
// this.getStockOrderDetailList();
this.codeArray.splice(index, 1);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.detailLoading = false;
})
} else {
this.$message.success('删除成功');
this.codeArray.splice(index, 1);
}
} else {
this.$message.success('删除成功');
this.codeArray.splice(index, 1);
}
}).catch(() => {
});
},
getStockOrderDetailList() {
this.loading = true;
listOrderDetail(this.query) //
.then((response) => {
console.log(response)
this.codeArray = response.data.list || [];
this.total = response.data.total || 0;
this.loading = false;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
findSubInvs() {
this.subInvList = [];
let query = {
pcode: this.formData.locStorageCode
};
filterSubByInv(query)
.then((response) => {
this.subInvList = response.data || [];
if (this.subInvList != null && this.subInvList.length == 1) {
this.formData.invWarehouseCode = this.subInvList[0].code;
}
})
.catch(() => {
});
},
findTargetSubInvs() {
if(this.formData.targetSubInv!=null && this.tarSubList.length>0){
this.formData.targetDeptCode= this.subInvList.find(item => item.code == this.formData.targetSubInv).parentId
}
this.tarSubList = [];
let query = {
pcode: 1000
};
filterSubByInv(query)
.then((response) => {
this.tarSubList = response.data || [];
if (this.tarSubList != null && this.tarSubList.length == 1) {
this.formData.targetSubInv = this.tarSubList[0].code;
this.formData.targetDeptCode=this.tarSubList[0].parentId;
this.targetInvChange();
}
})
.catch(() => {
});
},
targetInvChange() {
let query = {
code: this.formData.targetSubInv,
enabled: true,
spUse: true,
};
getLocalJoinByUser(query)
.then((response) => {
this.busTypes = response.data.list || [];
// this.formData.targetBillAction = this.busTypes[0].localAction;
})
.catch(() => {
});
let query1 = {
code: this.formData.targetSubInv,
};
selectByCode(query1)
.then((res) => {
if (res.code === 20000) {
this.formData.targetDeptCode=res.data
}
})
},
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
if (this.$isNotBlank(this.idQuery.id)) {
this.query.limit = 100;
this.query.orderIdFk = this.idQuery.id;
this.formData = this.idQuery.formData;
this.formData.targetInv = 1000;
this.orderEditor = true;
this.sValue = this.formData.corpName;
this.getStockOrderDetailList();
} else {
this.formData = {
id: null,
billNo: null,
billDate: "",
remark: "",
deptCode: null,
locStorageCode: null,
invWarehouseCode: null,
auditRemark: null,
autoPurchase: false,
targetInv: 1000,
targetSubInv: null,
targetBillAction: null,
};
this.orderEditor = false;
}
this.findTargetSubInvs();
this.codeArray = [];
},
};
</script>
<style>
.ao-text {
width: 100%;
font-size: 13px;
font-family: "Microsoft YaHei";
float: right;
text-align: right;
margin-top: 10px;
}
</style>

@ -0,0 +1,488 @@
<template>
<div>
<el-form :model="formData" :rules="formRules" ref="dataForm" label-width="120px">
<el-row type="flex" justify="end">
<el-button-group style="display: flex;margin-bottom: 15px; margin-right: 50px">
<el-button type="primary" @click.native="saveOrder('1')" :loading="loading">草稿保存</el-button>
<el-button type="primary" @click.native="saveOrder('2')" :loading="loading">提交单据</el-button>
</el-button-group>
</el-row>
<el-card style="margin-top: -5px;">
<el-row>
<el-col :span="11">
<el-form-item label="单据号:" prop="billNo">
<el-input v-model="formData.billNo" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="单据时间:" prop="billdate">
<el-date-picker
v-model="formData.billDate"
type="datetime"
placeholder="选择日期"
style="width: 100%"
:clearable="false"
value-format="yyyy-MM-dd HH:mm:ss"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="当前仓库:" prop="invCode">
<el-select v-model="formData.invCode" @change="setDeptCode" placeholder="当前仓库信息" style="width: 100%"
clearable>
<el-option
v-for="item in invCodeList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.warehouseName }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="备注说明:" prop="billNo">
<el-input v-model="formData.remark" auto-complete="off" type="textarea" autosize></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11" v-show="formData.status==4">
<el-form-item label="拒绝原因:">
<el-input v-model="formData.auditRemark" auto-complete="off" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-card>
<el-row type="flex" justify="end">
<el-button-group style="display: flex">
<el-button-group style="display: flex;margin-bottom: 15px; margin-right: 50px">
<el-button type="primary" @click.native.stop="selectProductFunction()" :loading="loading">产品录入</el-button>
</el-button-group>
</el-button-group>
</el-row>
<el-table v-loading="loading" :data="codeArray" style="width: 100%;" :row-class-name="tableRowClassName" border
highlight-current-row max-height="300" height="300" ref="multipleTable">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="产品通用名" prop="productName" show-overflow-tooltip></el-table-column>
<el-table-column label="规格型号" prop="spec" show-overflow-tooltip></el-table-column>
<el-table-column width="150" label="退货数量">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.count"
placeholder="请输入数量" style="width: 80%"
type='number'
@change="tableCountChange(scope.row)"
:disabled="scope.row.index !== selectedIndex"
oninput="value=value.replace(/[^\d]/g,'')"></el-input>
</template>
</el-table-column>
<el-table-column label="供应商" prop="supName" show-overflow-tooltip></el-table-column>
<el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh" show-overflow-tooltip></el-table-column>
<el-table-column label="生产厂家" prop="manufactory" show-overflow-tooltip></el-table-column>
<el-table-column label="医疗器械注册人" prop="ylqxzcrbarmc" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" :disabled="scope.row.index === selectedIndex" @click.stop="true"
@click.native="rowChange(scope.row)">编辑
</el-button>
<el-button type="text" size="small" @click.stop="true"
@click.native="deleteCodeArray(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-form>
<el-dialog
title="产品录入"
:visible.sync="selectProductVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="80%"
v-if="selectProductVisible"
:append-to-body='true'
>
<purOrderProducts
:closeDialog="closeDialogC2"
:purType="1"
:pId="pId"
:data="thisData"
></purOrderProducts>
</el-dialog>
<el-dialog
title="采购订单选入"
:visible.sync="selectApplyVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="80%"
append-to-body
v-if="selectApplyVisible"
>
<select-plan-list-dialog
:data="thisData"
:pId="pId"
:closeDialog="closeDialogC2"
></select-plan-list-dialog>
</el-dialog>
</div>
</template>
<script>
import purOrderProducts from "@/views/purchase/purDelivery/purDeliverySelectProduct";
import {
inserThrOrderWeb,
delOrderDetail,
listOrderDetail,
addOrderId,
selectOrderDetail,
updateDetail
} from "@/api/purchase/purDelivery";
import {filterSubByInv} from "@/api/system/invSubWarehouse";
import SelectPlanListDialog from "@/views/purchase/purPlan/selectPlanListDialog";
export default {
name: "idQuery",
props: {
closeDialog: {
type: Function,
required: true,
},
idQuery: {
type: Object,
required: true,
},
isChang: {
type: Boolean,
required: true,
},
},
data() {
return {
code: "",
query: {
orderIdFk: "",
page: 1,
limit: 10,
},
formData: {
id: null,
billNo: null,
billDate: "",
remark: "",
deptCode: null,
locStorageCode: null,
invWarehouseCode: null,
},
pId: null,
formRules: {},
codeArray: [],
total: 0,
loading: false,
index: null,
formLoading: false,
formVisible: false,
deleteLoading: false,
orderNo: null,
statusMap: {
1: "草稿",
2: "未审核",
3: "已审核",
},
typeMap: {
1: "预入库",
2: "普通采购",
},
orderEditor: true,
sOptions: [],
sValue: [],
sList: [],
sLoading: false,
busTypes: [],
currentRow: {},
selectedIndex: "",
selectProductVisible: false,
thisData: {},
storageList: [],
invCodeList: [],
invQueryData: {},
selectApplyVisible: false
};
},
watch: {
isChang: function () {
this.$emit("cancelDialog", this.pId);
},
},
components: {
purOrderProducts,
SelectPlanListDialog
},
methods: {
saveOrder(status) {
this.$refs["dataForm"].validate(valid => {
if (valid) {
if (this.codeArray.length < 1) {
this.$message.warning('未添加产品');
return;
}
if (status === '2') {
if (this.formData.billDate == "" || this.formData.billDate == null) {
return this.$message.error("单据日期不能为空!");
}
if (this.formData.invCode == "" || this.formData.invCode == null) {
return this.$message.error("采购仓库不能为空!");
}
for (let i = 0; i < this.codeArray.length; i++) {
if (this.$isBlank(this.codeArray[i].count) || this.codeArray[i].count == "0") {
return this.$message.error('单据数量不能为0');
}
}
}
if (status == "1") {
this.submitFunction(status);
} else {
let tip = "是否确定提交订单?";
this.$confirm(tip, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.submitFunction(status);
}).catch(() => {
this.loading = false;
});
}
}
});
},
submitFunction(status) {
let tMessage = status === '1' ? '保存' : '提交';
this.loading = true;
this.formData.id = this.pId;
let tQuery = {
editStatus: status,
purDeliveryEntity: this.formData,
subErpOrders: this.codeArray,
type: 1,
}
inserThrOrderWeb(tQuery)
.then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success(tMessage + "成功");
this.closeDialog(true);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
})
},
selectProductFunction() {
this.selectProductVisible = true;
//idid
if (this.pId == null) {
addOrderId().then(response => {
if (response.code === 20000) {
this.pId = response.data
}
}).catch(() => {
this.loading = false;
})
}
this.thisData.stockOrderLists = this.codeArray;
},
setDeptCode(obj) {
this.formData.deptCode = this.invCodeList.find(item => item.code == obj).parentId;
},
closeDialogC2() {
this.selectProductVisible = false;
this.selectApplyVisible = false;
this.query = {
orderIdFk: this.pId
}
selectOrderDetail(this.query) //
.then((response) => {
console.log(response)
this.codeArray = response.data.list || [];
this.total = response.data.total || 0;
this.loading = false;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
rowChange(val) {
this.currentRow = val;
this.selectedIndex = val.index;
},
tableCountChange(row) {
if (this.$isNotBlank(row)) {
updateDetail(this.currentRow);
}
},
tableRowClassName({row, rowIndex}) {
row.index = rowIndex;
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
deleteCodeArray(index, row) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.$refs.multipleTable.setCurrentRow();
this.currentRow = {};
this.selectedIndex = "";
if (this.orderEditor) {
this.detailLoading = true;
if (this.$isNotBlank(row.id)) {
let delIds = [];
delIds.push(row.id)
delOrderDetail(delIds)
.then(response => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success(response.data);
// this.getStockOrderDetailList();
this.codeArray.splice(index, 1);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.detailLoading = false;
})
} else {
this.$message.success('删除成功');
this.codeArray.splice(index, 1);
}
} else {
this.$message.success('删除成功');
this.codeArray.splice(index, 1);
}
}).catch(() => {
});
},
getStockOrderDetailList() {
this.loading = true;
listOrderDetail(this.query) //
.then((response) => {
console.log(response)
this.codeArray = response.data.list || [];
this.total = response.data.total || 0;
this.loading = false;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
findSubInvs() {
this.invCodeList = [];
let query = {
filter: 3
};
filterSubByInv(query)
.then((response) => {
this.invCodeList = response.data || [];
if (this.invCodeList != null && this.invCodeList.length == 1) {
this.formData.invCode = this.invCodeList[0].code;
}
})
.catch(() => {
});
},
selectApply() {
this.selectApplyVisible = true;
//idid
if (this.pId == null) {
addOrderId().then(response => {
if (response.code === 20000) {
this.pId = response.data
}
}).catch(() => {
this.loading = false;
})
}
},
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
if (this.$isNotBlank(this.idQuery.id)) {
this.query.limit = 100;
this.pId = this.idQuery.id;
this.query.orderIdFk = this.idQuery.id;
this.formData = this.idQuery.formData;
this.orderEditor = true;
this.sValue = this.formData.corpName;
this.getStockOrderDetailList();
} else {
this.formData = {
id: null,
billNo: null,
billDate: "",
remark: "",
deptCode: null,
incCode: null,
};
this.orderEditor = false;
}
this.findSubInvs();
this.codeArray = [];
},
};
</script>
<style>
.ao-text {
width: 100%;
font-size: 13px;
font-family: "Microsoft YaHei";
float: right;
text-align: right;
margin-top: 10px;
}
</style>

@ -0,0 +1,417 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" label-width="100px" v-show="showSearch">
<el-row>
<el-col :span="6">
<el-form-item label="单据号:">
<el-input v-model="filterQuery.billNo" style="width: 90%" placeholder="单据号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="单据日期:">
<el-date-picker
:picker-options="pickerOptions"
v-model="actDateRange"
type="daterange"
style="width: 90%"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmitFind"></el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" border highlight-current-row
@current-change="handleDetail">
<el-table-column label="序号" type="index" width="60"></el-table-column>
<el-table-column label="单据号" prop="billNo"></el-table-column>
<el-table-column label="单据日期" prop="billDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.billDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="供应商" prop="createUser"></el-table-column>
<el-table-column label="退货部门" prop="deptName"></el-table-column>
<el-table-column label="退货仓库" prop="invName"></el-table-column>
<el-table-column label="备注" prop="remark"></el-table-column>
<el-table-column label="状态" prop="status">
<template slot-scope="scope">
<el-tag :type="(scope.row.status) | statusFilterType">
{{ statusMap[scope.row.status] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" @click.native="newDistributionForm(scope.$index, scope.row)">编辑
</el-button>
<el-button type="text" size="small" @click.native.stop="deleteDialog(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="filterQuery.page"
:limit.sync="filterQuery.limit"
@pagination="handleCurrentChange"
></pagination>
</el-card>
<el-card class="el-card">
<el-table v-loading="loading" :data="detailList" style="width: 100%" border highlight-current-row>
<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="count"></el-table-column>
<el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="生产企业" prop="manufactory" show-overflow-tooltip="true"></el-table-column>
<el-table-column label="医疗器械注册人" prop="ylqxzcrbarmc" show-overflow-tooltip="true"></el-table-column>
</el-table>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="newSpDistributionVisible"
width="80%"
v-if="newSpDistributionVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="handleClose"
>
<purDeliveryEdit
:isChang="isChang"
:closeDialog="closeDialog"
v-on:cancelDialog="getId"
:idQuery="idQuery"
></purDeliveryEdit>
</el-dialog>
</div>
</template>
<script>
import purDeliveryEdit from "./purReturnedDetailDialog";
import {inserThrOrderWeb, listOrderDetail, delOrderDetailAll, listOrder} from "@/api/purchase/purReturned";
export default {
data() {
name: "purReturned"
return {
showSearch: true,
pId: null,
isChang: false,
filterQuery: {
billAction: null,
billNo: "",
originType: null,
thirdSysFk: "",
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
},
formName: null,
formMap: {
add: "新增退货单",
update: "编辑退货单",
},
statusMap: {
1: "草稿",
2: "未审核",
3: "已审核",
4: "已拒绝"
},
idQuery: {},
total: 0,
thirdSys: [],
thirdSysDetail: null,
busTypes: [],
originTypes: [],
list: [],
detailList: [],
loading: false,
actDateRange: [],
newSpDistributionVisible: false,
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 = {
billNo: "",
thirdSysFk: "",
billFlag: null,
billAction: null,
startDate: null,
endDate: null,
page: 1,
limit: 10,
corpName: null,
type: 1,
editStatus: 1,
};
this.actDateRange = [];
this.getList();
},
handleClose() {
if (this.formName == 'add' && this.pId != null) {
this.isChang = !this.isChang
} else {
this.newSpDistributionVisible = false
}
},
getId(id) {
if (this.formName == 'add' && id != null) {
var data = {
id: id
}
this.pId = id;
//
delOrderDetailAll(data).then((response) => {
if (response.code == 20000) {
this.newSpDistributionVisible = false
}
});
}
},
onSubmitFind() {
this.filterQuery.page = 1;
this.getList();
},
hideSearch() {
this.showSearch = !this.showSearch;
},
getList() {
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;
listOrder(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) {
let query = {orderIdFk: row.id};
this.loading = true;
listOrderDetail(query) //
.then((response) => {
this.detailList = response.data.list || [];
this.loading = false;
})
.catch(() => {
this.loading = false;
this.detailList = [];
this.total = 0;
});
},
submitOrder(row) {
this.$confirm("是否确定提交审核?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true;
let tQuery = {
editStatus: 2,
purPlanEntity: row,
}
inserThrOrderWeb(tQuery)
.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(() => {
});
},
deleteDialog(row) {
this.$confirm("此操作将永久删除该单据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delOrderDetailAll({id: row.id})
.then((response) => {
this.loading = false;
if (response.code == 20000) {
this.$message.success("删除成功");
this.getList();
this.detailList = null;
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {
});
},
handleCurrentChange(val) {
this.filterQuery.page = val.page;
this.getList();
},
closeDialog() {
this.newSpDistributionVisible = false;
this.getList();
this.detailList = [];
},
newDistributionForm(index, row) {
this.idQuery.id = '';
if (this.$isNotBlank(row) && this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.formName = "update";
} else
this.formName = "add";
this.newSpDistributionVisible = true;
},
}
,
components: {
purDeliveryEdit,
}
,
filters: {
statusFilterType(status) {
const statusMap = {
1: "warning",
2: "success",
};
return statusMap[status];
}
,
}
,
mounted() {
}
,
created() {
let end = new Date();
let start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.actDateRange = [start, end];
this.getList();
}
,
}
;
</script>
<style scoped>
.itemTag {
float: left;
text-align: left;
margin-top: 10px;
width: 25%;
}
.text {
font-size: 13px;
font-family: "Microsoft YaHei";
}
.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>
Loading…
Cancel
Save