1.添加单据复制,单据编辑功能及页面,修复部分bug

master
x_z 3 years ago
parent 58df53d6e7
commit a58a8335dc

@ -151,3 +151,12 @@ export function getThrsysDetail(params) {
params: params
});
}
//替换单据条码
export function replaceCodes(data) {
return axios({
url: "/warehouse/inout/replaceCodes",
method: "post",
data: data
})
}

@ -214,7 +214,7 @@ export function orderDetail(query) {
method: "get",
params: query
}
);
)
}
export function updateBind(query) {
@ -333,3 +333,27 @@ export function updateCodeBindSup(query) {
)
}
export function filterOrderForDelete(params) {
return axios({
url: "/udiwms/inout/order/filterOrderForDelete",
method: "get",
params: params
});
}
export function getOrderById(params) {
return axios({
url: "/udiwms/inout/order/getOrderById",
method: "get",
params: params
})
}
export function updateOrderInfo(data) {
return axios({
url: "/udiwms/inout/order/updateOrderInfo",
method: "post",
data: data
})
}

@ -255,3 +255,11 @@ export function updateReceiveStatus(params) {
data: params
})
}
export function stockOrderChange(query) {
return axios({
url: "/udiwms/stock/order/change",
method: "post",
data: query
});
}

@ -25,6 +25,7 @@ import userAccountManage from "@/views/userManage/userAccountManage";
//单据
import stockOrderDelSearch from "../views/warehouse/stockOrderDelSearch";
import stockOrderSearch from "../views/warehouse/stockOrderSearch";
import stockOrderDelete from "../views/warehouse/stockOrderDelete";
//往来单位字典
import UnitManage from "@/views/product/UnitManage";
@ -385,7 +386,15 @@ export const asyncRouterMap = [
meta: {
authRule: ["stock/stockOrderDelSearch"]
}
}
},
{
path: "stockOrderEdit",
component: stockOrderDelete,
name: "单据编辑",
meta: {
authRule: ["stock/stockOrderDelete"]
}
},
]
},

@ -327,7 +327,8 @@ export default {
supplementOrderType: row.supplementOrderType,
checkBalacne: row.checkBalacne,
secCheckBalacne: row.secCheckBalacne,
defaultUnit: row.defaultUnit
defaultUnit: row.defaultUnit,
prefix: row.prefix
};
this.modifyDialogVisible = true;
},

@ -100,20 +100,32 @@
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="20" class="el-col">
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>单据前缀&nbsp;</span>
</div>
<el-input
style="width: 40%"
size="small"
v-model="inputQuery.prefix"
></el-input>
</div>
</el-col>
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>备注&nbsp;</span>
</div>
<el-input
style="width: 80%"
style="width: 40%"
size="small"
splaceholder="请输入内容"
v-model="inputQuery.remark"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">

@ -538,7 +538,6 @@ export default {
},
methods: {
onSubmit(formName) {
// this.formVisible = true;
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
@ -621,9 +620,15 @@ export default {
}, 1000);
},
handleChange(value) {
this.inputQuery.area =
CodeToText[value[0]] + CodeToText[value[1]] + CodeToText[value[2]];
console.log(value + "\n" + this.inputQuery.area);
this.inputQuery.area = CodeToText[value[0]];
if (CodeToText[value[1]] != null && CodeToText[value[1]] != ""
&& CodeToText[value[1]] != "undefined") {
this.inputQuery.area += CodeToText[value[1]];
}
if (CodeToText[value[2]] != null && CodeToText[value[2]] != ""
&& CodeToText[value[2]] != "undefined") {
this.inputQuery.area += CodeToText[value[2]];
}
this.inputQuery.areaCode = value.toString();
},
copy() {

@ -0,0 +1,446 @@
<template>
<div>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-button-group style="display: flex;margin: -40px 0 20px 80%; height: 35px">
<el-button
type="primary"
@click.native="submit('0')"
>生成单据
</el-button
>
</el-button-group>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>入库单号</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="corpOrderId">
<el-input v-model="formData.corpOrderId" auto-complete="off"
:disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>单据时间</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="actDate">
<el-date-picker
v-model="formData.actDate"
type="datetime"
placeholder="日期"
:disabled="true"
style="width: 100%; "
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>单据类型</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" prop="billType">
<el-select v-model="formData.action" placeholder="请选择单据类型"
@change="actionChange">
<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-col :span="3">
<div class="ao-text">
<span>当前仓库</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="locStorageCode">
<el-select v-model="formData.locStorageCode" placeholder="当前仓库信息" @change="locCHange">
<el-option
v-for="item in storageList"
: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-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>往来信息</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" prop="fromCorp"
v-if="curAction.corpType ==0 ">
<el-select
v-model="formData.fromCorp"
filterable
remote
clearable="true"
reserve-keyword
placeholder="请输入往来单位"
:remote-method="findMethod"
:loading="loading"
@change="unitChange"
>
<el-option
v-for="item in fromOptions"
:key="item.name"
:label="item.name"
:value="item"
>
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="query-form-item" prop="fromCorp"
v-if="curAction.corpType ==1">
<el-select
v-model="formData.fromCorp"
filterable
remote
clearable="true"
reserve-keyword
placeholder="请输入仓库信息"
:remote-method="findStorageMethod"
:loading="loading"
@change="storageChange"
>
<el-option
v-for="item in fromStorageOptions"
:key="item.value"
:label="item.code"
:value="item">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="query-form-item" prop="fromCorp"
v-if="curAction.corpType ==2">
<el-input v-model="formData.fromCorp" auto-complete="off"
clearable
placeholder="请输入病人住院号"
></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>当前分库</span>
</div>
</el-col>
</el-row>
</el-form>
<el-table v-loading="detailLoading"
:data="detailList"
@selection-change="changeFun"
style="width: 100%; margin-top: 20px;">
<el-table-column label="产品通用名" width="200" prop="productName"></el-table-column>
<el-table-column label="包装规格" width="200" prop="spec"></el-table-column>
<el-table-column label="批次号" width="100" prop="batchNo"></el-table-column>
<el-table-column label="生产日期" width="120" prop="productDate"></el-table-column>
<el-table-column label="失效日期" width="120" prop="expireDate"></el-table-column>
<el-table-column label="单据数量" width="100" prop="count"></el-table-column>
<el-table-column label="实际数量" width="100" prop="reCount"></el-table-column>
<el-table-column label="价格" width="120" prop="price"></el-table-column>
<el-table-column label="销售清单号(第二票)" width="180" prop="secSalesListNo"></el-table-column>
<el-table-column label="销售发票号(第一票)" width="180" prop="firstSalesInvNo"></el-table-column>
<el-table-column label="销售发票号(第二票)" width="180" prop="secSalesInvNo"></el-table-column>
<el-table-column label="发票日期" width="150" prop="invoiceDate"></el-table-column>
<el-table-column label="操作" width="100" prop="price" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="deleteOrderDetail(scope.$index, scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import {filterAllByLoc, filterAllByUser} from "@/api/basic/invWarehouse";
import {getBasicUnitMaintains} from "@/api/basic/basicUnitMaintain";
import {parseTime} from "@/filtres";
import {getLocalJoinByUser} from "@/api/basic/busLocalType";
import {stockOrderChange, stockOrderDetail} from "@/api/warehouse/stockOrder";
export default {
name: "DialogChangeNewOrder",
props: {
closeDialog: {
type: Function,
required: true,
},
curRow: {
type: Object,
required: true,
},
},
data() {
return {
formData: {
corpOrderId: "",
code: "",
actor: "",
fromCorpId: "",
fromCorp: null,
fromType: 2,
actDate: new Date(),
action: null,
locStorageCode: null,
mainAction: null
},
fromStorageOptions: [],
fromSubStorageOptions: [],
curAction: {
corpType: 0,
genUnit: false,
},
busTypes: [],
fromOptions: [],
loading: false,
detailList: [],
storageList: [],
detailLoading: false,
subInvList: [],
}
},
methods: {
submit() {
if (this.$isBlank(this.formData.action)) {
this.$message.warning("请选择单据类型!");
return;
}
if (this.$isBlank(this.formData.locStorageCode)) {
this.$message.error('当前仓库不能为空');
return;
}
if (this.$isBlank(this.formData.fromCorp)) {
this.$message.error('当前往来单位不能为空');
return;
}
if (this.detailList.length == 0) {
this.$message.error("产品列表不能为空");
return;
}
let products = [];
this.detailList.forEach(item => {
let product = {
relId: item.relId,
batchNo: item.batchNo
};
products.push(product);
});
this.busTypes.forEach(item => {
if (item.action === this.formData.action) {
this.formData.mainAction = item.mainAction;
}
})
let tQuery = {
stockOrderId: this.curRow.id,
locStorageCode: this.formData.locStorageCode,
action: this.formData.action,
mainAction: this.formData.mainAction,
fromCorp: this.formData.fromCorp,
fromCorpId: this.formData.fromCorpId,
products: products
};
stockOrderChange(tQuery)
.then((response) => {
if (response.code === 20000) {
this.$message.success("提交成功");
this.closeDialog();
} else {
this.$message.error(response.message);
}
this.loading = false;
});
},
locCHange() {
this.findStorageMethod();
},
findStorageMethod(query) {
if (this.formData.locStorageCode == null)
return;
this.fromStorageOptions = [];
let cQuery = {
locInvCode: this.formData.locStorageCode,
};
filterAllByLoc(cQuery)
.then((response) => {
this.fromStorageOptions = response.data || [];
})
.catch(() => {
});
},
findSubStorageMethod() {
let cQuery = {
pcode: this.formData.fromCorpId,
filter: 2,
};
filterSubByInv(cQuery)
.then((response) => {
this.fromSubStorageOptions = response.data || [];
})
.catch(() => {
});
},
findMethod(query) {
this.fromOptions = [];
let cQuery = {
key: query,
corpType: null,
outType: null,
};
if (this.curAction.corpType == 3) {//
cQuery.corpType = 4;
this.formData.fromCorpId = this.curAction.defaultUnit;
} else if (this.curAction.corpType == 2)//
{
cQuery.corpType = 4;
cQuery.outType = 2;
} else if (this.curAction.corpType == 0) {
cQuery.corpType = 2;
} else return;
getBasicUnitMaintains(cQuery)
.then((response) => {
this.loading = false;
this.fromOptions = response.data.page.list || [];
if (this.curAction.corpType == 3) {
for (let i = 0; i < this.fromOptions.length; i++) {
if (this.fromOptions[i].erpId == this.formData.fromCorpId) {
this.formData.fromCorp = this.fromOptions[i].name;
}
}
}
})
.catch(() => {
this.loading = false;
});
},
storageChange(row) {
this.formData.fromCorpId = row.code;
this.formData.fromCorp = row.name;
this.findSubStorageMethod();
},
unitChange(row) {
this.formData.fromCorpId = row.erpId;
this.formData.fromCorp = row.name;
},
actionChange(item) {
this.curAction = this.getActionItem(item);
this.findMethod();
},
getActionItem(action) {
for (let i = 0; i < this.busTypes.length; i++) {
if (this.busTypes[i].action === action) {
return this.busTypes[i];
}
}
},
getBusType() {
let query = {
enabled: true,
};
getLocalJoinByUser(query)
.then((response) => {
this.busTypes = response.data.list || [];
this.filterQuery.billAction = this.busTypes[0].action;
})
.catch(() => {
});
},
getStorage() {
this.storageList = [];
filterAllByUser()
.then((response) => {
this.storageList = response.data || [];
})
.catch(() => {
});
},
getStockOrderDetailList(orderId) {
let query = {
orderIdFk: orderId
}
stockOrderDetail(query)
.then((response) => {
this.detailLoading = false;
this.detailList = response.data.list || [];
})
.catch(() => {
this.detailLoading = false;
this.detailList = [];
});
},
deleteOrderDetail(index) {
for (let i = 0; i < this.detailList.length; i++) {
if (index === i) {
this.detailList.splice(index, 1);
break
}
}
}
},
created() {
if (this.$isBlank(this.formData.corpOrderId)) {
let date = new Date();
this.formData.corpOrderId = parseTime(date, '{y}{m}{d}{h}{i}{s}') + Math.ceil(Math.random() * 89 + 10);
}
this.getBusType();
this.getStorage();
this.getStockOrderDetailList(this.curRow.id);
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,411 @@
<template>
<div>
<el-form :inline="true" :model="query" class="query-form" size="mini">
<el-form-item class="query-form-item">
<el-input v-model="query.code" placeholder="条码查询"></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="search" @click="getCodeList"
>查询
</el-button
>
<el-button type="primary" icon="search" @click="editOrderTime"
>编辑
</el-button
>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="codeArry" style="width: 100%">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="条码"
prop="code"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="扫码数量"
prop="count"
width="180"
show-overflow-tooltip
></el-table-column>
<el-table-column label="创建时间" prop="actDate" width="220" show-overflow-tooltip>
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span>{{ scope.row.actDate }}</span>
</template>
</el-table-column>
<el-table-column label="操作员" prop="actor" width="180"></el-table-column>
<el-table-column label="操作" fixed="right" width="180">
<template slot-scope="scope">
<el-button
size="small"
type="text"
@click.native.stop="replaceCodes(scope.row)"
>
减一
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="query.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next,total"
:total="total"
>
</el-pagination>
<el-dialog
title="码替换"
:visible.sync="replaceVisible"
:append-to-body="true"
width="70%"
>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>条码:&nbsp;</span>
</div>
<el-input
style="width: 400px"
size="small"
splaceholder="请输入内容"
disabled="true"
v-model="codeDetail.code"
></el-input>
</div>
</el-col>
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>扫码数量:&nbsp;</span>
</div>
<el-input
style="width: 400px"
disabled="true"
size="small"
splaceholder="请输入内容"
v-model="codeDetail.count"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>替换条码:&nbsp;</span>
</div>
<el-input
style="width: 400px"
size="small"
splaceholder="请输入内容"
v-model="codeDetail.newCode"
></el-input>
</div>
</el-col>
<el-col :span="10" class="el-col">
<div class="text item">
<div class="itemTag">
<span>扫码数量:&nbsp;</span>
</div>
<el-input
style="width: 400px"
size="small"
splaceholder="请输入内容"
v-model="codeDetail.newCount"
></el-input>
</div>
</el-col>
</el-row>
<div style="text-align: center">
<el-button type="primary" size="small" icon="search" @click="replaceCodes"
>提交
</el-button
>
<el-button type="primary" size="small" icon="search" @click="cancelDialog"
>取消
</el-button
>
</div>
</el-dialog>
<el-dialog
title="修改时间"
:visible.sync="editOrderVisible"
width="35%"
append-to-body
v-if="editOrderVisible"
>
<el-row style="width: 100%">
<el-lable>创建时间</el-lable>
<el-date-picker
v-model="actDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
placeholder="选择日期时间">
</el-date-picker>
</el-row>
<el-row style="width: 100%; margin-top: 20px;">
<el-lable>审核时间</el-lable>
<el-date-picker
v-model="auditTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
placeholder="选择日期">
</el-date-picker>
</el-row>
<div style="text-align: right; margin-top: 10px;">
<el-button type="primary" size="small" icon="search" @click="updateOrderInfo"
>提交
</el-button
>
<el-button type="primary" size="small" icon="search" @click="cancelEdit"
>取消
</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import {codeList, updateOrderInfo, getOrderById} from "../../api/warehouse/order";
import draggable from "vuedraggable";
import {replaceCodes} from "@/api/basic/invWarehouse";
export default {
name: "idQuery",
props: {
idQuery: {
type: Object,
required: true,
},
},
data() {
return {
query: {
code: "",
corpOrderId: "",
page: 1,
limit: 20,
},
codeArry: [],
total: 0,
loading: true,
index: null,
formLoading: false,
formVisible: false,
replaceVisible: false,
deleteLoading: false,
orderNo: null,
busTypes: [],
codeDetail: {
code: null,
count: null,
newCode: null,
newCount: null,
orderId: null
},
actDate: null,
auditTime: null,
editOrderVisible: false
};
},
components: {
draggable,
},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.query = {
code: "",
corpOrderId: "",
page: 1,
limit: 20,
};
this.getCodeList();
},
onSubmit() {
this.$router.push({
path: "",
query: this.query,
});
this.getCodeList();
},
handleSizeChange(val) {
this.query.limit = val;
this.getCodeList();
},
handleCurrentChange(val) {
this.query.page = val;
this.getCodeList();
},
getCodeList() {
this.loading = true;
this.query.orderId = this.idQuery.id;
codeList(this.query) //
.then((response) => {
this.loading = false;
this.codeArry = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
intentBack() {
this.$router.go(-1);
},
showReplaceDialog(row) {
this.replaceVisible = true;
this.codeDetail = {
code: row.code,
count: row.count,
orderId: row.orderId
}
},
cancelDialog() {
this.replaceVisible = false;
this.codeDetail = {
code: null,
count: null,
newCode: null,
newCount: null
};
},
replaceCodes(row) {
this.$confirm("是否确认库存减一", "提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.codeDetail = {
code: row.code,
count: row.count,
orderId: row.orderId
};
replaceCodes(this.codeDetail).then((res) => {
if (res.code === 20000) {
this.$message.success("操作成功");
this.getCodeList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
});
});
},
editOrderTime() {
let getOrderDataParam = {
id: this.query.corpOrderId,
};
getOrderById(getOrderDataParam).then((res) => {
this.actDate = res.data.actDate;
this.auditTime = res.data.auditTime;
this.editOrderVisible = true;
}).catch((error) => {
});
},
updateOrderInfo() {
if (this.actDate === null || this.auditTime === null) {
this.$message.warning("创建时间和审核时间不能为空");
return;
} else if (this.actDate > this.auditTime) {
this.$message.warning("请检查创建时间和审核时间是否正确");
return;
}
let data = {
actDate: this.actDate,
auditTime: this.auditTime,
orderIds: [this.query.corpOrderId]
};
updateOrderInfo(data).then((res) => {
if (res.code === 20000) {
this.$message.success("修改成功");
}
}).catch((error) => {
});
this.actDate = null;
this.auditTime = null;
this.editOrderVisible = false;
},
cancelEdit() {
this.editOrderVisible = false;
this.actDate = null;
this.auditTime = null;
}
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
//
let query = this.$route.query;
this.orderNo = query.id;
this.query = Object.assign(this.query, query);
this.query.limit = parseInt(this.query.limit);
this.query.corpOrderId = query.id;
//
this.getCodeList();
},
};
</script>
<style scoped>
.itemTag {
float: left;
text-align: left;
margin-top: 10px;
width: 100px;
}
.text {
font-size: 13px;
font-family: "Microsoft YaHei";
}
.el-row {
display: flex;
flex-wrap: wrap;
margin-bottom: 20px;
}
.el-col {
border-radius: 4px;
flex-wrap: wrap;
}
</style>

@ -116,6 +116,13 @@
>提交
</el-button
>
<el-button
type="text"
size="small"
@click.native="generOrder(scope.row)"
>复制
</el-button
>
<el-button
v-if="scope.row.enableSupplementOrder"
type="text"
@ -283,6 +290,21 @@
></codeDetail>
</el-dialog>
<el-dialog
title="根据当前单据生成新单据"
:visible.sync="stockChangeVisible"
width="60%"
v-if="stockChangeVisible"
@close='closeDialog'
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<DialogChangeNewOrder
:closeDialog="closeDialog"
:curRow="curRow"
></DialogChangeNewOrder>
</el-dialog>
</div>
</template>
@ -304,6 +326,7 @@ import {filterAllByUser} from "@/api/basic/invWarehouse";
import StockOrderEdit from "@/views/warehouse/stockOrderEdit";
import {updateSpms} from "@/api/warehouse/order";
import codeDetail from "./code";
import DialogChangeNewOrder from "@/views/warehouse/DialogChangeNewOrder";
export default {
name: "stockOrderDelSearch",
@ -379,6 +402,8 @@ export default {
haveDistributionVisible: true,
qrcodeDetailVisible: false,
qrcodeExportVisible: false,
stockChangeVisible: false,
curRow: null,
actDateRange: [],
pickerOptions: {
shortcuts: [
@ -460,6 +485,10 @@ export default {
}
});
},
generOrder(row) {
this.stockChangeVisible = true;
this.curRow = row;
},
changeFun(row) {
let _this = this;
_this.multipId = []; //ID
@ -876,7 +905,8 @@ export default {
stockOrderDistribution,
stockOrderQRCodeDetail,
stockQRCodeExport,
StockOrderEdit
StockOrderEdit,
DialogChangeNewOrder
},
filters: {
statusFilterType(status) {

@ -0,0 +1,604 @@
<template>
<div>
<el-card class="el-card">
<el-form
:inline="true"
:model="query"
class="query-form"
size="mini"
>
<el-row style="width: 100%">
<el-form-item class="query-form-item">
<el-input style="width: 300px" v-model="query.orderId" placeholder="单据号"></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="search" @click="onSubmit"></el-button>
<el-button type="primary" icon="search" @click="deleteAllOrder"></el-button>
<el-button type="primary" icon="search" @click="editAllOrderTime"></el-button>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table
v-loading="loading"
:data="list"
style="width: 100%"
@row-click="getOrderDetailList"
highlight-current-row
@selection-change="handleSelectionChange"
:row-class-name="tableRowClassName"
>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="扫码单据类型" prop="action">
<template slot-scope="scope">
<span>{{ getActionName(scope.row.action) }}</span>
</template>
</el-table-column>
<el-table-column
label="单据号"
prop="orderId"
show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="来源" prop="fromType">
<template slot-scope="scope">
<span>{{ fromTypeMap[scope.row.fromType] }}</span>
</template>
</el-table-column>
<el-table-column label="往来单位" prop="fromCorp" width="250">
</el-table-column>
<el-table-column label="当前仓库" prop="locStorageCode" width="150">
<template slot-scope="scope">
<span>{{ getStorageName(scope.row.locStorageCode) }}</span>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="actDate"
width="150"
show-overflow-tooltip="true"
>
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span>{{ scope.row.actDate }}</span>
</template>
</el-table-column>
<el-table-column
label="审核时间"
prop="actDate"
width="150"
show-overflow-tooltip="true"
>
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span>{{ scope.row.auditTime }}</span>
</template>
</el-table-column>
<el-table-column label="校验状态" prop="contrastStatus" width="120">
<template slot-scope="scope">
<el-tag :type="(scope.row.contrastStatus === 1) | statusFilterType">
{{ erpCheckStatus[scope.row.contrastStatus] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="intentDetail(scope.row)"
>编辑
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="deleteOrder(scope.row)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="query.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next"
:total="total"
>
</el-pagination>
</el-card>
<el-card class="el-card" v-if="true">
<el-table
v-loading="loading"
:data="detailList"
style="width: 100%"
>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="产品通用名"
prop="coName"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="包装规格"
prop="packSpec"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="批次号"
prop="batchNo"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="生产日期"
prop="produceDate"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="失效日期"
prop="expireDate"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="单据数量"
prop="count"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="实际数量"
prop="reCount"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="扫码数量" prop="count"></el-table-column>
<el-table-column
label="供应商"
prop="supName"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="生产企业"
prop="productCompany"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="注册/备案凭证号"
prop="authCode"
:show-overflow-tooltip="true"
></el-table-column>
</el-table>
</el-card>
<el-dialog
title="详情"
:visible.sync="codeDetailVisible"
width="80%"
v-if="codeDetailVisible"
>
<codeReplace
:idQuery="idQuery"
v-on:closeDetailDialog="closeDetailDialog"
></codeReplace>
</el-dialog>
<el-dialog title="校验信息" :visible.sync="errDialogVisible" width="30%">
<span>{{ errorDetail }}</span>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="errDialogVisible = false"> </el-button>
</span>
</el-dialog>
<el-dialog
title="修改时间"
:visible.sync="editOrderVisible"
width="35%"
v-if="editOrderVisible"
>
<el-row style="width: 100%">
<el-lable>创建时间</el-lable>
<el-date-picker
v-model="actDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
placeholder="选择日期时间">
</el-date-picker>
</el-row>
<el-row style="width: 100%; margin-top: 20px;">
<el-lable>审核时间</el-lable>
<el-date-picker
v-model="auditTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
placeholder="选择日期">
</el-date-picker>
</el-row>
<div style="text-align: right; margin-top: 10px;">
<el-button type="primary" size="small" icon="search" @click="updateOrderInfo"
>提交
</el-button
>
<el-button type="primary" size="small" icon="search" @click="cancelEdit"
>取消
</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import {filterOrderForDelete, orderDetail, deleteByOrderId, updateOrderInfo} from "../../api/warehouse/order";
import store from "../../store";
import {getBussinessType} from "../../api/basic/bussinessType";
import {filterAllByUser} from "@/api/basic/invWarehouse";
import codeReplace from "./codeReplace";
export default {
name: "stockOrderDelete",
data() {
return {
query: {
orderId: "",
page: 1,
limit: 10
},
detailQuery: {
orderIdFk: "",
page: 1,
limit: 20
},
busTypes: [],
list: [],
detailList: [],
currentCheckIndex: -1,
multipId: [],
formLabelWidth: '150px',
total: 0,
detailTotal: 0,
storageList: [],
loading: false,
detailLoading: false,
idQuery: {
id: "",
},
sourceMap: {
"1": "web端新增单据",
"2": "第三方系统",
"3": "扫码单据转换",
},
fromTypeMap: {
"1": "UDIMS平台",
"2": "网页新增",
"3": "pda即时校验",
"4": "pda未校验",
"5": "pc端扫码精灵",
"6": "缺量补录单据",
"7": "UDI供应商平台",
"8": "平衡补录单据",
},
erpCheckStatus: {
1: "已完成",
0: "已完成",
2: "已完成",
},
isSp: store.getters.customerId,
detailFormData: {},
detailFormLoading: false,
actDateRange: [],
curRow: null,
codeDetailVisible: false,
editOrderVisible: false,
actDate: null, //
auditTime: null, //
orderIds: [],
pickerOptions: {
disabledDate: time => {
let endDate = new Date().getTime();
let nowDate = new Date(time).getTime();
return (nowDate > endDate);
}
}
}
},
methods: {
onReset() {
this.$router.push({
path: ""
});
this.query = {
orderId: ""
};
this.list = [];
this.detailList = [];
this.actDateRange = [];
},
onSubmit() {
this.getList();
},
handleCurrentChange(val) {
this.query.page = val;
this.getList();
},
changeFun(row) {
let _this = this;
_this.multipId = []; //ID
row.forEach((item) => {
_this.multipId.push(item.id);
})
},
detailHandleCurrentChange(val) {
this.query.page = val;
this.getOrderDetailList();
},
//
resetForm() {
if (this.$refs["dataForm"]) {
//
this.$refs["dataForm"].clearValidate();
//
this.$refs["dataForm"].resetFields();
this.getList();
}
},
getList() {
this.query.orderId = this.query.orderId.trim();
if (this.query.orderId === null || this.query.orderId === "") {
this.$message.warning("请输入需要查询的单号");
} else {
this.loading = true;
filterOrderForDelete(this.query)
.then(response => {
this.loading = false;
this.list = response.data || [];
this.detailList = [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
this.detailList = [];
});
}
},
getOrderDetailList(row) {
if (this.$isNotBlank(row)) {
this.detailQuery.orderId = row.orderId;
this.detailQuery.orderIdFk = row.orderId;
}
this.detailLoading = true;
orderDetail(this.detailQuery)
.then((response) => {
this.detailLoading = false;
this.detailList = response.data || [];
})
.catch(() => {
this.detailLoading = false;
this.detailList = [];
});
},
tableRowClassName({row, rowIndex}) {
if (rowIndex === 0) {
return 'highlight-row';
}
return '';
},
getActionName(action) {
for (let i = 0; i < this.busTypes.length; i++) {
if (this.busTypes[i].action === action) {
return this.busTypes[i].name;
}
}
},
getBusType() {
let query = {
enabled: true,
};
getBussinessType(query)
.then((response) => {
this.busTypes = response.data.list || [];
})
.catch(() => {
});
},
getStorageName(code) {
for (let i = 0; i < this.storageList.length; i++) {
if (this.storageList[i].code === code) {
return this.storageList[i].name;
}
}
},
getStorage() {
this.storageList = [];
filterAllByUser()
.then((response) => {
this.storageList = response.data || [];
})
.catch(() => {
});
},
deleteOrder(row) {
this.$confirm('是否确认删除单据及相关数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {
id: row.id
};
deleteByOrderId(params).then((res) => {
if (res.code === 20000) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
this.detailList = [];
}
}).catch((error) => {
this.$message.error("删除失败");
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
deleteAllOrder() {
if (this.query.orderId === null || this.query.orderId === "" || this.list.length === 0) {
return;
}
this.$confirm("是否确认删除此单据及所有关联单据?", "提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let ids = [];
this.list.forEach(item => {
ids.push(item.id);
});
let params = {
ids: ids
};
deleteByOrderId(params).then((res) => {
if (res.code === 20000) {
this.$message.success("删除成功");
this.list = [];
this.detailList = [];
}
}).catch((error) => {
this.$message.error("删除失败");
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
})
},
editAllOrderTime() {
if (this.query.orderId === null || this.query.orderId === "" || this.list.length === 0) {
return;
}
this.actDate = null;
this.auditTime = null;
this.editOrderVisible = true;
},
intentDetail(row) {
this.codeDetailVisible = true;
this.idQuery.id = row.orderId;
},
handleEdit(row) {
this.editOrderVisible = true;
let actDateSplit = row.actDate.split(" ");
this.actDate = actDateSplit[0];
this.actDate2 = actDateSplit[1];
let auditTimeSplit = row.auditTime.split(" ");
this.auditTime = auditTimeSplit[0];
this.auditTime2 = auditTimeSplit[1];
this.orderIds = [];
},
updateOrderInfo() {
if (this.actDate === null || this.actDate === '') {
this.$message.warning("创建时间不能为空");
return;
}
this.editOrderVisible = false;
this.list.forEach(item => {
this.orderIds.push(item.id);
});
let data = {
actDate: this.actDate,
auditTime: this.auditTime,
orderIds: this.orderIds
};
updateOrderInfo(data).then((res) => {
if (res.code === 20000) {
this.$message.success("修改成功");
this.getList();
}
}).catch((error) => {
this.$message.error(error.message);
});
},
cancelEdit() {
this.editOrderVisible = false;
}
},
components: {
codeReplace
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "gray",
1: "success"
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
"1": "草稿",
"2": "未配货",
"3": "待校验",
"4": "已校验",
"5": "已核对",
};
return statusMap[status];
},
typeFilterName(type) {
const typeMap = {
1: "预入库",
2: "普通采购",
};
return typeMap[type];
}
},
created() {
this.getBusType();
this.getStorage();
}
}
</script>
<style scoped>
.el-dialog {
display: flex;
flex-direction: column;
margin: 0 !important;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.el-dialog .el-dialog__body {
flex: 1;
overflow: auto;
}
.el-table /deep/ .highlight-row {
background: #cae3f9;
}
</style>
Loading…
Cancel
Save