You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-vue/src/views/warehouse/stockDeliveryAdd.vue

381 lines
13 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-form :model="formData" :rules="formRules" ref="dataForm">
<el-button-group style="display: flex">
<el-button
type="primary"
@click.native="submit('0')"
style="margin: -50px 60px 10px auto; height: 35px"
:loading="loading"
>提交
</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="7">
<el-form-item prop="billNo">
<el-input v-model="formData.billNo" 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="7">
<el-form-item prop="corpName">
<el-input v-model="formData.corpName" auto-complete="off" :disabled="true"></el-input>
</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="7">
<el-form-item prop="billdate">
<el-input v-model="formData.billdate" 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="7">
<el-form-item prop="status">
<el-input v-model="statusMap[formData.status]" auto-complete="off" :disabled="true"></el-input>
</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="7">
<el-form-item prop="billType">
<el-select v-model="formData.billType" placeholder="请选择业务类型" clearable="true" disabled="true">
<el-option
v-for="item in busTypes"
:key="item.localName"
:label="item.localName"
:value="item.localAction">
<span style="float: left">{{ item.localName }}</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="7">-->
<!-- <el-form-item prop="type">-->
<!-- <el-input v-model="typeMap[formData.type]" auto-complete="off" :disabled="true"></el-input>-->
<!-- </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="15">
<el-form-item prop="code">
<el-input
@focus="getInputFocus($event)"
@keypress.enter.native="addCode()"
v-model="code"
auto-complete="off"
ref='inputRef'
></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button
type="primary"
size="small"
@click.native.stop="addCode()"
style="height: 31px; margin-left: 10px"
>添加
</el-button
>
</el-col>
<!-- <div class="text item" style="margin-left: 30px"> 已扫码条码:{{ total }} </div>-->
</el-row>
<el-table v-loading="loading" :data="codeArray" style="width: 100%;" max-height="350" height="350" ref="multipleTable">
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55">-->
<!-- </el-table-column>-->
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column
label="产品名称"
prop="productName"
show-overflow-tooltip
width="200"
></el-table-column>
<el-table-column
label="包装规格"
prop="spec"
show-overflow-tooltip
width="200"
></el-table-column>
<el-table-column
label="批次号"
prop="batchNo"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="生产日期"
prop="productDate"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="失效日期"
prop="expireDate"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="扫码数量"
prop="sweepCount"
show-overflow-tooltip
></el-table-column>
</el-table>
<div class="block">
<el-pagination
@current-change="handleCurrentChange"
layout="prev, pager, next"
:page-size="query.limit"
:total="total">
</el-pagination>
</div>
</el-form>
</div>
</template>
<script>
import {stockOrderDetail, submitStockOrder, submitStockOrderError, uploadStockOrderDetailCount} from "../../api/warehouse/stockOrder";
import draggable from "vuedraggable";
import {saveAs} from "file-saver";
import {parseTime} from "../../filtres/index";
import store from "../../store";
import {getLocalJoinBusType} from "../../api/basic/busLocalType";
export default {
name: "idQuery",
props: {
closeDialog: {
type: Function,
required: true,
},
idQuery: {
type: Object,
required: true,
},
},
data() {
return {
code: "",
query: {
orderIdFk: "",
page: 1,
limit: 10,
},
formData: {},
formRules: {
temp: [
{required: true, message: "请输入条码", trigger: "blur"}
],
},
codeArray: [],
total: 0,
loading: false,
index: null,
formLoading: false,
formVisible: false,
deleteLoading: false,
orderNo: null,
statusMap: {
101: "未处理",
102: "已处理",
201: "未配货",
202: "已配货",
301: "已打印",
401: "异常",
501: "未提交",
502: "已提交",
},
busTypes: [],
typeMap: {
1: "预入库",
2: "普通采购",
}
};
},
components: {
draggable,
},
methods: {
submit(formName) {
if (this.total < 1) {
this.$message.error('未配货');
return;
}
this.$confirm("是否提交?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let tQuery = {
id: this.idQuery.id
}
this.loading = true;
submitStockOrder(tQuery)
.then((response) => {
this.loading = false;
if (response.code === 20000) {
this.$message.success("提交成功");
this.closeDialog(true);
} else {
this.$message.error(response.message);
}
});
}).catch(() => {
this.loading = false;
});
},
// 刷新表单
resetForm() {
if (this.$refs["dataForm"]) {
// 清空验证信息表单
this.$refs["dataForm"].clearValidate();
// 刷新表单
this.$refs["dataForm"].resetFields();
this.getList();
}
},
addCode() {
this.code = this.code.trim();
if (this.$isBlank(this.code)) return;
this.loading = true;
let tQuery = {
orderId: this.idQuery.id,
code: this.code,
};
uploadStockOrderDetailCount(tQuery).then((response) => {
this.loading = false;
if (response.code === 20000) {
this.idQuery.id = response.data;
this.getStockOrderDetailList();
} else {
this.$alert(response.message, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: action => {
this.$refs.inputRef.focus();
}
});
}
});
},
getInputFocus(event) {
event.currentTarget.select();
},
tableSelection() {
this.$refs.multipleTable.clearSelection();
this.$refs.multipleTable.toggleAllSelection();
},
handleSizeChange(val) {
this.query.limit = val;
this.getStockOrderDetailList();
},
handleCurrentChange(val) {
this.query.page = val;
this.getStockOrderDetailList();
},
getStockOrderDetailList() {
this.loading = true;
stockOrderDetail(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;
});
},
intentBack() {
this.$router.go(-1);
},
getBusType() {
let query = {
enabled: true,
};
getLocalJoinBusType(query)
.then((response) => {
this.busTypes = response.data.list || [];
})
.catch(() => {
});
},
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.getBusType();
this.formData = {};
this.codeArray = [];
if (this.$isNotBlank(this.idQuery.id)) {
this.query.orderIdFk = this.idQuery.id;
this.formData = this.idQuery.formData;
this.getStockOrderDetailList();
}
},
};
</script>
<style>
.ao-text {
width: 100%;
font-size: 13px;
font-family: "Microsoft YaHei";
float: right;
text-align: right;
margin-top: 10px;
}
</style>