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/stockDeliveryOrder.vue

455 lines
16 KiB
Vue

<template>
<div>
<el-card class="el-card">
<el-form
:inline="true"
:model="query"
class="query-form"
size="mini"
>
<el-row>
<el-form-item class="query-form-item">
<el-input v-model="query.billNo" placeholder="单据号"></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-select v-model="query.status" placeholder="送货状态">
<el-option label="未提交" value="501"></el-option>
<el-option label="已提交" value="502"></el-option>
</el-select>
</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="addStockDeliveryOrder">新增</el-button>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table v-loading="loading"
:data="list"
style="width: 100%; height: 250px"
@row-click="getStockOrderDetailList" ref="multipleTable">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="单据号" prop="billNo" width="250"></el-table-column>
<el-table-column label="往来单位" prop="corpName" width="250"></el-table-column>
<el-table-column label="单据日期" prop="billdate" width="100"></el-table-column>
<el-table-column label="单据状态" width="100">
<template slot-scope="scope">
{{ scope.row.status | statusFilterName }}
</template>
</el-table-column>
<el-table-column label="业务类型" prop="billType">
<template slot-scope="scope">
<span>{{ getActionName(scope.row.billType) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="采购类型" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.type | typeFilterName }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" fixed="right" width="250">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native="submitStockDeliveryOrder(scope.row)"
>提交
</el-button
>
<el-button
type="text"
size="small"
@click.native="updateStockDeliveryOrder(scope.row)"
>编辑
</el-button
>
<el-button
type="text"
size="small"
@click.native="deleteStockOrder(scope.row)"
v-if="!haveDistributionVisible"
>删除
</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">
<el-table v-loading="detailLoading"
:data="detailList"
style="width: 100%">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column label="产品名称" prop="productName" width="200"></el-table-column>
<el-table-column label="包装规格" prop="spec" width="200"></el-table-column>
<el-table-column label="批次号" prop="batchNo" width="100"></el-table-column>
<el-table-column label="生产日期" prop="productDate" width="100"></el-table-column>
<el-table-column label="失效日期" prop="expireDate" width="100"></el-table-column>
<el-table-column label="配货数量" prop="count" width="100"></el-table-column>
<el-table-column label="实际数量" prop="reCount" width="100"></el-table-column>
<el-table-column label="扫码数量" prop="sweepCount" width="100"></el-table-column>
<el-table-column label="操作" fixed="right" width="250">
<template slot-scope="scope" v-if="!haveDistributionVisible">
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="detailQuery.limit"
@current-change="detailHandleCurrentChange"
layout="prev, pager, next"
:total="detailTotal"
>
</el-pagination>
</el-card>
<el-dialog
title="新增"
:visible.sync="deliveryAddVisible"
width="60%"
v-if="deliveryAddVisible"
@close='closeDialog'
>
<stockDeliveryAdd
:closeDialog="closeDialog"
:idQuery="idQuery"
></stockDeliveryAdd>
</el-dialog>
</div>
</template>
<script>
import {
stockOrderList, stockOrderDetail,
deleteStockOrderById, deleteStockOrderDetailById,
copyStockOrderDetail, submitStockOrder,
uploadStockOrderDetail, uploadStockOrderDetailCount,
generateStockOrderQRCodeText
} from "../../api/warehouse/stockOrder";
import {BASE_URL} from "../../config/app";
import stockDeliveryAdd from "./stockDeliveryAdd";
import draggable from "vuedraggable";
import codeDetail from "./errorCode";
import addOrder from "./addOrder";
import {getBussinessType} from "../../api/basic/bussinessType";
export default {
name: "stockOrder",
data() {
return {
query: {
billNo: "",
status: '501',
page: 1,
limit: 20
},
detailQuery: {
orderIdFk: "",
page: 1,
limit: 20
},
list: [],
detailList: [],
total: 0,
detailTotal: 0,
loading: false,
detailLoading: false,
idQuery: {
id: "",
},
deliveryAddVisible: false,
detailFormRules: {
batchNo: [
{required: true, message: "请输入批次号", trigger: "blur"}
],
productDate: [
{required: true, message: "请输入生产日期", trigger: "blur"}
],
expireDate: [
{required: true, message: "请输入失效日期", trigger: "blur"}
],
sweepCount: [
{required: true, message: "请输入扫码数量", trigger: "blur"}
]
},
detailFormVisible: false,
detailFormData: {},
detailFormLoading: false,
haveDistributionVisible: false,
busTypes: [],
}
},
methods: {
onReset() {
this.$router.push({
path: ""
});
this.query = {
billNo: "",
status: '501',
page: 1,
limit: 20
};
this.getList();
this.detailList = [];
this.haveDistributionVisible = false;
},
onSubmit() {
this.getList();
this.detailList = [];
if (this.query.status === "501") {
this.haveDistributionVisible = true;
} else {
this.haveDistributionVisible = false;
}
},
handleCurrentChange(val) {
this.query.page = val;
this.getList();
},
detailHandleCurrentChange(val) {
this.query.page = val;
this.getStockOrderDetailList();
},
// 刷新表单
resetForm() {
if (this.$refs["dataForm"]) {
// 清空验证信息表单
this.$refs["dataForm"].clearValidate();
// 刷新表单
this.$refs["dataForm"].resetFields();
this.getList();
}
},
getList() {
this.loading = true;
stockOrderList(this.query)
.then(response => {
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
distributionForm(index, row) {
this.idQuery.id = '';
if (this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.deliveryAddVisible = true;
}
},
closeDialog(type) {
this.deliveryAddVisible = false;
this.getList();
if (this.$isNotBlank(type)) {
this.detailList = [];
}
},
getStockOrderDetailList(row) {
if (this.$isNotBlank(row)) {
this.detailQuery.orderIdFk = row.id;
}
this.detailLoading = true;
stockOrderDetail(this.detailQuery)
.then((response) => {
console.log(response)
this.detailLoading = false;
this.detailList = response.data.list || [];
})
.catch(() => {
this.detailLoading = false;
this.detailList = [];
});
},
addStockDeliveryOrder(row) {
this.idQuery.id = '';
if (this.$isNotBlank(row.id)) {
this.idQuery.id = row.id;
this.idQuery.formData = row;
this.deliveryAddVisible = true;
}
},
submitStockDeliveryOrder(row) {
},
updateStockDeliveryOrder(row) {
},
deleteStockOrder(row) {
this.$confirm("此操作将永久删除该订单, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.loading = true;
deleteStockOrderById({ id: row.id })
.then(response => {
this.loading = false;
if (response.code === 20000) {
this.$message.success(response.data);
this.getList();
this.detailList = [];
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
})
}).catch(() => {
});
},
deleteStockOrderDetail(row) {
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.detailLoading = true;
deleteStockOrderDetailById({ id: row.id })
.then(response => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success(response.data);
this.getStockOrderDetailList();
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.detailLoading = false;
})
}).catch(() => {
});
},
// 显示表单
handleDetailForm(index, row) {
this.detailFormVisible = true;
this.detailFormData = {};
if (row !== null) {
this.detailFormData = Object.assign({}, row);
}
},
hideDetailForm() {
// 更改值
this.detailFormVisible = !this.detailFormVisible;
return true;
},
submitUploadDetail() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.detailLoading = true;
let tQuery = this.detailFormData;
uploadStockOrderDetail(tQuery).then((response) => {
this.detailLoading = false;
if (response.code === 20000) {
this.$message.success("修改完成");
this.hideDetailForm();
this.getStockOrderDetailList();
} else {
this.$alert(response.message, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: action => {
this.$refs.inputRef.focus();
}
});
}
});
}
});
},
getBusType() {
let query = {
enabled: true,
};
getBussinessType(query)
.then((response) => {
this.busTypes = response.data.list || [];
this.filterQuery.billAction = this.busTypes[0].action;
// this.getList();
})
.catch(() => {
});
},
getActionName(action) {
for (let i = 0; i < this.busTypes.length; i++) {
if (this.busTypes[i].action === action) {
return this.busTypes[i].name;
}
}
},
},
components: {
draggable,
stockDeliveryAdd,
},
filters: {
statusFilterType(status) {
const statusMap = {
0: "gray",
1: "success"
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
101: "未处理",
102: "已处理",
201: "未配货",
202: "已配货",
301: "已打印",
401: "异常",
501: "未提交",
502: "已提交",
};
return statusMap[status];
},
typeFilterName(type) {
const typeMap = {
1: "预入库",
2: "普通采购",
};
return typeMap[type];
}
},
created() {
this.getBusType();
this.getList();
}
}
</script>
<style scoped>
</style>