问题修改

master
zhangdi 1 month ago
parent 3227664032
commit e9aaf4e190
  1. 205
      src/views/firstOrder/outbound.vue
  2. 64
      src/views/secondOrder/components/outDialog.vue

@ -1,12 +1,25 @@
<template> <template>
<basic-container> <basic-container>
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page" <avue-crud
:permission="permissionList" @search-change="searchChange" @search-reset="searchReset" :option="option"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" :table-loading="loading"
@refresh-change="refreshChange" @on-load="onLoad" > :data="data"
ref="crud"
v-model="form"
:page.sync="page"
:permission="permissionList"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<!-- @row-click="rowSelect" --> <!-- @row-click="rowSelect" -->
<template slot-scope="scope" slot="menuLeft"> <template slot-scope="scope" slot="menuLeft">
<el-button size="small" type="primary" @click="handleDesign()">新增出库单 <el-button size="small" type="primary" @click="handleDesign()"
>新增出库单
</el-button> </el-button>
</template> </template>
<template slot-scope="scope" slot="demandEndInfo"> <template slot-scope="scope" slot="demandEndInfo">
@ -18,35 +31,54 @@
> >
<span v-else></span> <span v-else></span>
</template> </template>
<template slot-scope="scope" slot="outTypeInfo"> <!-- <template slot-scope="scope" slot="outTypeInfo">
<span v-if="scope.row.optionType=='YH'">发放单</span> <span v-if="scope.row.optionType=='YH'">发放单</span>
<span v-if="scope.row.optionType=='NY'">出库单</span> <span v-if="scope.row.optionType=='NY'">出库单</span>
</template> </template> -->
<template #menu="scope"> <template #menu="scope">
<el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button> <el-button type="text" @click.stop="handleDetails(scope.row)"
<el-button type="text" v-if="scope.row.status == 1" @click.stop="handleEdit(scope.row)">编辑</el-button> >详情</el-button
>
<el-button
type="text"
v-if="scope.row.status == 1"
@click.stop="handleEdit(scope.row)"
>编辑</el-button
>
</template> </template>
</avue-crud> </avue-crud>
<outDialog v-if="outDialogVisible" :repairVisible='outDialogVisible' :outDialogTiltle="outDialogTiltle" <outDialog
:outDialogType="outDialogType" @handleCloseDetail="handleCloseDetail" type="一级库" @submitSuccess="handleSubmitSuccess" v-if="outDialogVisible"
:id="id"> :repairVisible="outDialogVisible"
:outDialogTiltle="outDialogTiltle"
:outDialogType="outDialogType"
@handleCloseDetail="handleCloseDetail"
type="一级库"
@submitSuccess="handleSubmitSuccess"
:id="id"
>
</outDialog> </outDialog>
<!-- 需求单明细 --> <!-- 需求单明细 -->
<needDialog :showDialog="purchaseOpen" v-if="purchaseOpen" @closeDialog="closeDialog" <needDialog
:purchaseTitle="purchaseTitle" :id="id"> :showDialog="purchaseOpen"
v-if="purchaseOpen"
@closeDialog="closeDialog"
:purchaseTitle="purchaseTitle"
:id="id"
>
</needDialog> </needDialog>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { getList } from "@/api/firstOrder/outbound"; import { getList } from "@/api/firstOrder/outbound";
import outDialog from './components/outDialog.vue'; import outDialog from "./components/outDialog.vue";
import needDialog from './components/needDialog.vue'; import needDialog from "./components/needDialog.vue";
export default { export default {
components: { components: {
outDialog, outDialog,
needDialog needDialog,
}, },
data() { data() {
return { return {
@ -57,10 +89,10 @@ export default {
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
total: 0 total: 0,
}, },
option: { option: {
height: 'auto', height: "auto",
calcHeight: 30, calcHeight: 30,
tip: false, tip: false,
searchShow: true, searchShow: true,
@ -99,7 +131,7 @@ export default {
return "无"; return "无";
} }
return value; return value;
} },
}, },
{ {
label: "出库单号", label: "出库单号",
@ -114,6 +146,11 @@ export default {
width: 140, width: 140,
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
formatter: (row, column, cellValue) => {
if (row.optionType === "YH") return "发放单";
if (row.optionType === "NY") return "出库单";
return "";
},
}, },
{ {
label: "出库日期", label: "出库日期",
@ -121,10 +158,10 @@ export default {
search: true, search: true,
type: "datetime", type: "datetime",
searchRange: true, searchRange: true,
startPlaceholder: '开始时间', startPlaceholder: "开始时间",
endPlaceholder: "结束时间", endPlaceholder: "结束时间",
format: 'yyyy-MM-dd HH:mm:ss', format: "yyyy-MM-dd HH:mm:ss",
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: "yyyy-MM-dd HH:mm:ss",
width: 140, width: 140,
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
@ -140,17 +177,19 @@ export default {
label: "物资类型", label: "物资类型",
prop: "materialType", prop: "materialType",
search: false, search: false,
type: 'select', type: "select",
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
dicData: [{ dicData: [
label: '办公物资', {
value: '1' label: "办公物资",
}, value: "1",
{ },
label: '其他物资', {
value: '2' label: "其他物资",
}] value: "2",
},
],
}, },
// { // {
// label: "", // label: "",
@ -169,7 +208,7 @@ export default {
label: "出库人", label: "出库人",
prop: "shipperName", prop: "shipperName",
search: true, search: true,
searchParam: 'inOperator', searchParam: "inOperator",
align: "center", align: "center",
headerAlign: "center", headerAlign: "center",
}, },
@ -177,93 +216,89 @@ export default {
{ {
label: "状态", label: "状态",
prop: "status", prop: "status",
type: 'select', type: "select",
dicData: [ dicData: [
{ {
label: '暂存', label: "暂存",
value: 1 value: 1,
}, },
{ {
label: '待审批', label: "待审批",
value: 2 value: 2,
}, },
{ {
label: '已出库', label: "已出库",
value: 3 value: 3,
}, },
] ],
}, },
],
]
}, },
data: [], data: [],
outDialogVisible: false, outDialogVisible: false,
outDialogTiltle: '出库', outDialogTiltle: "出库",
outDialogType: '',// outDialogType: "", //
purchaseOpen: false, purchaseOpen: false,
purchaseTitle: '', purchaseTitle: "",
inTitle: '', inTitle: "",
}; };
}, },
computed: { computed: {},
},
methods: { methods: {
handleDesign() { handleDesign() {
this.outDialogVisible = true this.outDialogVisible = true;
this.outDialogType = 'add' this.outDialogType = "add";
this.outDialogTiltle = '新增出库' this.outDialogTiltle = "新增出库";
}, },
// //
handleDetails(row) { handleDetails(row) {
console.log(row, 'row详情') console.log(row, "row详情");
this.outDialogVisible = true this.outDialogVisible = true;
this.outDialogType = 'details' this.outDialogType = "details";
this.outDialogTiltle = '详情' this.outDialogTiltle = "详情";
this.id = row.id this.id = row.id;
console.log(this.id,'详情的id') console.log(this.id, "详情的id");
}, },
// //
handleEdit(row) { handleEdit(row) {
this.outDialogVisible = true this.outDialogVisible = true;
this.outDialogType = 'edit' this.outDialogType = "edit";
this.outDialogTiltle = '编辑' this.outDialogTiltle = "编辑";
this.id = row.id this.id = row.id;
}, },
// //
purchaseFn(row) { purchaseFn(row) {
console.log('xuqiudanchuku') console.log("xuqiudanchuku");
this.purchaseOpen = true this.purchaseOpen = true;
this.purchaseTitle = row.demandEndInfo + '需求单详情' this.purchaseTitle = row.demandEndInfo + "需求单详情";
this.id = row.id this.id = row.id;
console.log(this.id,'需求单的id') console.log(this.id, "需求单的id");
}, },
closeDialog() { closeDialog() {
this.purchaseOpen = false this.purchaseOpen = false;
}, },
handleCloseDetail() { handleCloseDetail() {
this.outDialogVisible = false this.outDialogVisible = false;
}, },
handleExport() { handleExport() {
this.$message({ this.$message({
type: "success", type: "success",
message: "出库单导出成功!" message: "出库单导出成功!",
}) });
}, },
// //
rowSelect() { rowSelect() {
this.outDialogVisible = true this.outDialogVisible = true;
this.outDialogType = 'outbound' this.outDialogType = "outbound";
this.outDialogTiltle = '出库' this.outDialogTiltle = "出库";
}, },
searchReset() { searchReset() {
this.query = {}; this.query = {};
this.form.outDate = [] this.form.outDate = [];
this.form.inOperatorName = '' this.form.inOperatorName = "";
this.form.inOperator = '' this.form.inOperator = "";
this.onLoad(this.page); this.onLoad(this.page);
}, },
searchChange(params, done) { searchChange(params, done) {
if (params && params.inOperatorName && !params.inOperator) { if (params && params.inOperatorName && !params.inOperator) {
@ -294,7 +329,7 @@ export default {
}, },
// //
handleSubmitSuccess() { handleSubmitSuccess() {
this.onLoad(this.page) this.onLoad(this.page);
}, },
// //
onLoad(page, params = {}) { onLoad(page, params = {}) {
@ -303,21 +338,21 @@ export default {
...params, ...params,
...this.query, ...this.query,
pageSize: page.pageSize, pageSize: page.pageSize,
pageNum: page.currentPage pageNum: page.currentPage,
}; };
if (queryParams.outDate && Array.isArray(queryParams.outDate)) { if (queryParams.outDate && Array.isArray(queryParams.outDate)) {
queryParams.startTime = queryParams.outDate[0]; queryParams.startTime = queryParams.outDate[0];
queryParams.endTime = queryParams.outDate[1]; queryParams.endTime = queryParams.outDate[1];
delete queryParams.outDate; delete queryParams.outDate;
} }
getList(page.currentPage, page.pageSize, queryParams).then(res => { getList(page.currentPage, page.pageSize, queryParams).then((res) => {
console.log('列表', res.data.result) console.log("列表", res.data.result);
this.data = res.data.result.list; this.data = res.data.result.list;
this.loading = false; this.loading = false;
this.page.total = res.data.result.total; this.page.total = res.data.result.total;
}); });
} },
} },
}; };
</script> </script>

@ -517,9 +517,10 @@ export default {
// materialName materialId // materialName materialId
return ( return (
(row.materialName && (row.materialName &&
row.materialName.trim() !== "" && row.materialName.trim() !== "" &&
row.materialId != null && row.materialId != null &&
row.materialId !== "")||(rowinventory<row.num) row.materialId !== "") ||
rowinventory < row.num
); );
}, },
// //
@ -563,6 +564,7 @@ export default {
if (group.twoInventoryVOList.length > 0) { if (group.twoInventoryVOList.length > 0) {
group.twoInventoryVOList.forEach((element) => { group.twoInventoryVOList.forEach((element) => {
element.applyNum = group.applyNum; element.applyNum = group.applyNum;
element.goodsCode = group.applyNum;
if (element.type === "NY") { if (element.type === "NY") {
element.num = 1; element.num = 1;
} else { } else {
@ -751,8 +753,8 @@ export default {
this.sizeForm.ldTwoOutStorage.departmentInfo = this.sizeForm.ldTwoOutStorage.departmentInfo =
departmentArr.length > 0 ? departmentArr[0] : {}; departmentArr.length > 0 ? departmentArr[0] : {};
if(this.sizeForm.groupName!='自由出库'){ if (this.sizeForm.groupName != "自由出库") {
this.groupTableData = res.data.result.ldTwoOutStorageDetailList this.groupTableData = res.data.result.ldTwoOutStorageDetailList;
} }
// this.sizeForm.ldTwoOutStorage.proposerInfo={} // this.sizeForm.ldTwoOutStorage.proposerInfo={}
}); });
@ -776,6 +778,58 @@ export default {
console.log("form", this.sizeForm); console.log("form", this.sizeForm);
this.$refs.dynamicValidateForm.validate((valid) => { this.$refs.dynamicValidateForm.validate((valid) => {
if (valid) { if (valid) {
// ===== =====
if (this.sizeForm.ldTwoOutStorage.groupName !== "自由出库") {
let hasError = false;
for (const group of this.groupTableData) {
const key = group.materialId || group.materialCode || group.id;
if (!key) continue;
//
const selectedItems = this.selectedGroupMap[key] || [];
//
if (selectedItems.length === 0) {
this.$message.error(`分组【${group.materialName || group.materialCode}】未选择任何物资`);
hasError = true;
break;
}
// num
const totalSelectedNum = selectedItems.reduce((sum, item) => {
return sum + (Number(item.num) || 0);
}, 0);
const applyNum = Number(group.applyNum) || 0;
if (totalSelectedNum !== applyNum) {
this.$message.error(
`分组【${group.materialName || group.materialCode}】:已选物资出库数量总和(${totalSelectedNum})与申请数量(${applyNum})不一致`
);
hasError = true;
break;
}
}
if (hasError) {
return; //
}
}
// ===== =====
if (this.sizeForm.ldTwoOutStorage.groupName === "自由出库") {
if (
!this.sizeForm.ldTwoOutStorageDetailList ||
this.sizeForm.ldTwoOutStorageDetailList.length === 0
) {
this.$message.error("请至少选择一项物资");
return;
}
}
submit(this.sizeForm).then((res) => { submit(this.sizeForm).then((res) => {
this.$message({ this.$message({
type: "success", type: "success",

Loading…
Cancel
Save