|
@@ -3,8 +3,8 @@
|
|
|
<div>
|
|
|
<div class="common-card">
|
|
|
<el-form :model="listForm" ref="planForm" :inline="true">
|
|
|
- <el-form-item label="随货同行单号" prop="aa" :rules="rules.required">
|
|
|
- <el-input v-model="listForm.aa" placeholder="请输入随货同行单号"></el-input>
|
|
|
+ <el-form-item label="随货同行单号" prop="dyntNo">
|
|
|
+ <el-input v-model="listForm.dyntNo" placeholder="请输入随货同行单号"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="getDetails('search')"
|
|
@@ -27,45 +27,18 @@
|
|
|
<p>暂无数据</p>
|
|
|
</template>
|
|
|
<el-table-column fixed type="index" label="序号" width="60" />
|
|
|
+ <el-table-column label="采购单号" prop="purcOrdId" />
|
|
|
<el-table-column label="耗材编码" prop="materialId" />
|
|
|
- <el-table-column label="医保编码" prop="ybbm" />
|
|
|
- <el-table-column label="耗材名称" prop="materialName" />
|
|
|
- <el-table-column label="商品类别" prop="prodType" />
|
|
|
- <el-table-column label="商品分类" prop="drugListId" />
|
|
|
+ <el-table-column label="医保编码" prop="hiCode" />
|
|
|
+ <el-table-column label="耗材名称" width="300">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <mcs-info :info="scope.row"></mcs-info>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="规格" prop="spec" />
|
|
|
<el-table-column label="型号" prop="mol" />
|
|
|
<el-table-column label="材质" prop="matl" />
|
|
|
- <el-table-column label="生产来源" prop="source" />
|
|
|
- <el-table-column label="注册证号" prop="approveNo" />
|
|
|
- <el-table-column label="生产企业" prop="factory" />
|
|
|
<el-table-column label="单价" prop="purcPric" />
|
|
|
- <el-table-column label="需求数量" prop="purcCnt" />
|
|
|
- <el-table-column label="已出库数量" prop="delvCntYck" width="90px" />
|
|
|
- <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
|
|
|
- <el-table-column label="出库数量" prop="delvCnt" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- label-width="0"
|
|
|
- class="item"
|
|
|
- :prop="scope.$index + '.delvCnt'"
|
|
|
- :rules="[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- pattern: /^[0-9]\d*$/,
|
|
|
- message: '请输入正整数',
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
- ]"
|
|
|
- >
|
|
|
- <el-input-number
|
|
|
- v-model="scope.row.delvCnt"
|
|
|
- controls-position="right"
|
|
|
- @change="updateNum(scope.row, scope.$index)"
|
|
|
- :min="0"
|
|
|
- ></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column label="批号" prop="lotNum" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
@@ -132,6 +105,34 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="需求数量" prop="purcCnt" />
|
|
|
+ <!-- <el-table-column label="已出库数量" prop="delvCntYck" width="90px" /> -->
|
|
|
+ <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
|
|
|
+ <el-table-column label="出库数量" prop="delvCnt" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ label-width="0"
|
|
|
+ class="item"
|
|
|
+ :prop="scope.$index + '.delvCnt'"
|
|
|
+ :rules="[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ pattern: /^[0-9]\d*$/,
|
|
|
+ message: '请输入正整数',
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ v-model="scope.row.delvCnt"
|
|
|
+ controls-position="right"
|
|
|
+ @change="updateNum(scope.row, scope.$index)"
|
|
|
+ :min="0"
|
|
|
+ ></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column label="报关单" prop="invoFileId" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
<yl-upload
|
|
@@ -188,11 +189,8 @@
|
|
|
<el-dialog title="提取采购单" :visible.sync="dialog" width="70%">
|
|
|
<template>
|
|
|
<el-form :model="listQuery" ref="listQuery" :inline="true" label-width="90px">
|
|
|
- <el-form-item size="mini" label="采购单号" prop="id" class="long">
|
|
|
- <el-input v-model="listQuery.id" placeholder="请输入采购单号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item size="mini" label="采购员" prop="docmker" class="long">
|
|
|
- <el-input v-model="listQuery.docmker" placeholder="请输入采购员"></el-input>
|
|
|
+ <el-form-item size="mini" label="采购单号" prop="purcOrdId" class="long">
|
|
|
+ <el-input v-model="listQuery.purcOrdId" placeholder="请输入采购单号"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item size="mini" label="耗材名称" prop="prodName" class="long">
|
|
|
<el-input
|
|
@@ -206,7 +204,7 @@
|
|
|
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="getdialog('search')">查询</el-button>
|
|
|
- <el-button @click="resetdialog('consumableData')">重置</el-button>
|
|
|
+ <el-button @click="reset('consumable')">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-table
|
|
@@ -230,31 +228,30 @@
|
|
|
:reserve-selection="true"
|
|
|
width="55"
|
|
|
></el-table-column>
|
|
|
- <el-table-column prop="hiCode" label="医保编码"> </el-table-column>
|
|
|
- <el-table-column prop="prodName" label="耗材名称" width="180">
|
|
|
+ <el-table-column label="采购单号" prop="purcOrdId"> </el-table-column>
|
|
|
+ <el-table-column label="耗材编码" prop="materialId" />
|
|
|
+ <el-table-column label="医保编码" prop="hiCode" />
|
|
|
+ <el-table-column label="耗材名称" width="300">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <mcs-info :info="scope.row"></mcs-info>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="pubonlnPric" label="挂网价格"> </el-table-column>
|
|
|
- <el-table-column prop="isFas" label="是否集采">
|
|
|
+ <el-table-column label="规格" prop="spec" />
|
|
|
+ <el-table-column label="型号" prop="mol" />
|
|
|
+ <el-table-column label="材质" prop="matl" />
|
|
|
+ <el-table-column label="是否集采" prop="isFas">
|
|
|
<template #default="{ row }">
|
|
|
<span v-if="row.isFas == '1'">否</span>
|
|
|
<span v-if="row.isFas == '0'">是</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="fasBtch" label="集采批次"> </el-table-column>
|
|
|
- <el-table-column prop="spec" label="规格"> </el-table-column>
|
|
|
- <el-table-column prop="mol" label="型号"> </el-table-column>
|
|
|
- <el-table-column prop="matl" label="材质"> </el-table-column>
|
|
|
- <el-table-column prop="pacmatl" label="包装材质"> </el-table-column>
|
|
|
- <el-table-column prop="prodSouc" label="生产来源">
|
|
|
- <template #default="{ row }">
|
|
|
- <span v-if="row.prodSouc == '1'">国产</span>
|
|
|
- <span v-if="row.prodSouc == '0'">进口</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="regcertno" label="注册证号"> </el-table-column>
|
|
|
- <el-table-column prop="prodEntp" label="生产企业" width="120">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="agnt" label="代理企业" width="150"> </el-table-column>
|
|
|
+ <el-table-column label="计价单位" prop="prcUnt" />
|
|
|
+ <el-table-column label="采购单位" prop="purcUnt" />
|
|
|
+ <el-table-column label="包装内数量" prop="convrat" />
|
|
|
+ <el-table-column label="单价" prop="purcPric" />
|
|
|
+ <el-table-column label="需求数量" prop="purcCnt" />
|
|
|
+ <!-- <el-table-column label="已出库数量" prop="delvCntYck" width="90px" /> -->
|
|
|
+ <el-table-column label="剩余出库量" prop="toDelvCnt" width="90px" />
|
|
|
</el-table>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
|
@@ -273,13 +270,23 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import mcsInfo from "@/views/components/mcs-info.vue";
|
|
|
+import ylUpload from "@/components/yl-upload";
|
|
|
+import { countNumPrice, getTotalAmount } from "@/utils/utils";
|
|
|
import rules from "@/utils/rules";
|
|
|
+import { getMcsPurcOrdMx, submitMcsDelvOrd } from "@/api/orderManage-sup/index";
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ mcsInfo,
|
|
|
+ ylUpload,
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
rules,
|
|
|
listForm: {
|
|
|
- aa: "",
|
|
|
+ dyntNo: "",
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
},
|
|
|
planForm: {},
|
|
|
// 表格数据
|
|
@@ -290,32 +297,30 @@ export default {
|
|
|
listQuery: {
|
|
|
hiCode: "",
|
|
|
prodName: "",
|
|
|
- id: "",
|
|
|
- docmker: "",
|
|
|
+ purcOrdId: "",
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
},
|
|
|
consumableData: [],
|
|
|
selectData: [],
|
|
|
- dialogLoading:false,
|
|
|
- Loading:false,
|
|
|
+ dialogLoading: false,
|
|
|
+ Loading: false,
|
|
|
+ cellList: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
getDetails() {
|
|
|
- this.$refs["planForm"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.dialog = true;
|
|
|
- this.getdialog();
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.tidata.clearSelection();
|
|
|
- this.tableData.forEach((i) => {
|
|
|
- this.consumableData.forEach((row) => {
|
|
|
- if (i.id == row.id) {
|
|
|
- this.$refs.tidata.toggleRowSelection(row, true);
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
+ this.dialog = true;
|
|
|
+ this.getdialog();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
+ this.tableData.forEach((i) => {
|
|
|
+ this.consumableData.forEach((row) => {
|
|
|
+ if (i.id == row.id) {
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(row, true);
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
// 列表数据
|
|
@@ -330,13 +335,18 @@ export default {
|
|
|
this.Loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ // 重置
|
|
|
+ reset(){
|
|
|
+ this.$refs.listQuery.resetFields();
|
|
|
+ this.getdialog();
|
|
|
+ },
|
|
|
// 采购明细数据
|
|
|
- getdialog() {
|
|
|
+ getdialog(type) {
|
|
|
if (type == "search") {
|
|
|
this.listQuery.current = 1;
|
|
|
}
|
|
|
this.dialogLoading = true;
|
|
|
- getPurcOrdDrugList(this.listQuery)
|
|
|
+ getMcsPurcOrdMx(this.listQuery)
|
|
|
.then((res) => {
|
|
|
this.consumableData = res.data.records;
|
|
|
this.consumableData.forEach((i) => {
|
|
@@ -349,6 +359,29 @@ export default {
|
|
|
this.dialogLoading = false;
|
|
|
});
|
|
|
},
|
|
|
+ //删除
|
|
|
+ handleDelete(row, i) {
|
|
|
+ const index = this.tableData.findIndex(
|
|
|
+ (item) => item.materialId === row.materialId
|
|
|
+ );
|
|
|
+ if (index !== -1) {
|
|
|
+ let qwe = this.tableData.findIndex(function (item) {
|
|
|
+ return item.materialId == row.materialId;
|
|
|
+ });
|
|
|
+ this.tableData.splice(i, 1);
|
|
|
+ this.cellList.splice(i, 1);
|
|
|
+ this.cellList[qwe]--;
|
|
|
+ }
|
|
|
+ row.showDeleteButton = false;
|
|
|
+
|
|
|
+ this.shanchu3(row);
|
|
|
+ // if(this.number[index]){
|
|
|
+ // this.shanchu2(row,index);
|
|
|
+ // }else{
|
|
|
+ // this.shanchu(row);
|
|
|
+ // }
|
|
|
+ // this.number.splice(i,1);
|
|
|
+ },
|
|
|
// 合并列
|
|
|
handleSpan({ row, column, rowIndex, columnIndex }) {
|
|
|
if (
|
|
@@ -359,13 +392,7 @@ export default {
|
|
|
columnIndex === 5 ||
|
|
|
columnIndex === 6 ||
|
|
|
columnIndex === 7 ||
|
|
|
- columnIndex === 8 ||
|
|
|
- columnIndex === 9 ||
|
|
|
- columnIndex === 10 ||
|
|
|
- columnIndex === 11 ||
|
|
|
- columnIndex === 12 ||
|
|
|
- columnIndex === 13 ||
|
|
|
- columnIndex === 14
|
|
|
+ columnIndex === 8
|
|
|
) {
|
|
|
// console.log("单元格数组,若下一项为0,则代表合并上一项", this.cellList);
|
|
|
const rowCell = this.cellList[rowIndex];
|
|
@@ -385,104 +412,227 @@ export default {
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // if (columnIndex === 2 && rowIndex == 0) {
|
|
|
- // return {
|
|
|
- // rowspan: this.pos,
|
|
|
- // colspan: 1
|
|
|
- // };
|
|
|
- // }else{
|
|
|
- // for(let i=1;i<this.pos;i++){
|
|
|
- // if(rowIndex === this.pos-i && columnIndex == 2){
|
|
|
- // return {
|
|
|
- // rowspan: 0,
|
|
|
- // colspan: 0
|
|
|
- // };
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
},
|
|
|
//弹框选择
|
|
|
- handleSelectionChange() {
|
|
|
+ handleSelectionChange(e) {
|
|
|
this.selectData = e;
|
|
|
},
|
|
|
// 出库
|
|
|
handleDelivery() {
|
|
|
- if (this.tableData.length != 0) {
|
|
|
- this.$refs.tabledata.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- let data = this.tableData.map((i) => {
|
|
|
- return i.purcOrdId;
|
|
|
- });
|
|
|
- let data2 = data.slice(1);
|
|
|
- let qwe = data2.some((item) => {
|
|
|
- if (item != data[0]) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- });
|
|
|
- if (qwe == true) {
|
|
|
- this.$message.info("请勾选同一采购单明细");
|
|
|
- } else {
|
|
|
- this.$confirm("确认出库", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- }).then(() => {
|
|
|
- let data = this.tableData.map((i) => {
|
|
|
- return {
|
|
|
- drugListId: i.drugListId,
|
|
|
- delvCnt: i.delvCnt,
|
|
|
- lotNum: i.lotNum,
|
|
|
- manuDate: i.manuDate,
|
|
|
- prodExpy: i.prodExpy,
|
|
|
- invoFileId: i.invoFileId,
|
|
|
- dyntFileId: i.dyntFileId,
|
|
|
- delvPric: i.purcPric,
|
|
|
- };
|
|
|
- });
|
|
|
- let data2 = {
|
|
|
- delvOrdId: "",
|
|
|
- spdId: "",
|
|
|
- dyntNo: this.listForm.dyntNo,
|
|
|
- purcOrdId: this.tableData[0].purcOrdId,
|
|
|
- detlList: data,
|
|
|
- };
|
|
|
- this.confirmLoadLoad = true;
|
|
|
- submitDelvOrd(data2)
|
|
|
- .then((res) => {
|
|
|
- this.confirmLoadLoad = false;
|
|
|
- this.getTiData();
|
|
|
- this.tableData = [];
|
|
|
- this.selectData = [];
|
|
|
- this.$message({
|
|
|
- message: "出库成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- this.listForm.dyntNo = "";
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.confirmLoadLoad = false;
|
|
|
- });
|
|
|
- });
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
+ // console.log(item, "item");
|
|
|
+ if (item.delvCnt == "0") {
|
|
|
+ this.$message({
|
|
|
+ message: "本次出库数量必须大于0",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ throw new Error("本次出库数量必须大于0");
|
|
|
+ }
|
|
|
+ if (item.prodSouc == "进口" && !item.invoFileId) {
|
|
|
+ this.$message({
|
|
|
+ message: "请填写相应信息,并选择报关单",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ throw new Error("请填写相应信息,并选择报关单");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$refs.tabledata.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let data = this.tableData.map((i) => {
|
|
|
+ return i.purcOrdId;
|
|
|
+ });
|
|
|
+ let data2 = data.slice(1);
|
|
|
+ let qwe = data2.some((item) => {
|
|
|
+ if (item != data[0]) {
|
|
|
+ return true;
|
|
|
}
|
|
|
+ });
|
|
|
+ if (qwe == true) {
|
|
|
+ this.$message.info("请勾选同一采购单明细");
|
|
|
} else {
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "请填写必填项信息",
|
|
|
+ this.$confirm("确认出库", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ let data = this.tableData.map((i) => {
|
|
|
+ return {
|
|
|
+ materialId: i.prodCode,
|
|
|
+ memo: i.memo,
|
|
|
+ delvCnt: i.delvCnt,
|
|
|
+ hiCode: i.hiCode,
|
|
|
+ delvPric: i.purcPric,
|
|
|
+ lotNum: i.lotNum,
|
|
|
+ manuDate: i.manuDate,
|
|
|
+ prodExpy: i.prodExpy,
|
|
|
+ invoFileId: i.invoFileId,
|
|
|
+ dyntFileId: i.dyntFileId,
|
|
|
+ noRow: i.index,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let data2 = {
|
|
|
+ delvOrdId: "",
|
|
|
+ spdId: "",
|
|
|
+ purcOrdId: this.$route.query.id,
|
|
|
+ detlList: data,
|
|
|
+ dyntNo: this.listForm.dyntNo,
|
|
|
+ purcOrdId: this.tableData[0].purcOrdId,
|
|
|
+ };
|
|
|
+ submitMcsDelvOrd(data2)
|
|
|
+ .then((res) => {
|
|
|
+ this.getdialog();
|
|
|
+ this.tableData = [];
|
|
|
+ this.selectData = [];
|
|
|
+ this.$message({
|
|
|
+ message: '出库成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.listForm.dyntNo = "";
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
});
|
|
|
}
|
|
|
- });
|
|
|
- // }else{
|
|
|
- // this.$message({
|
|
|
- // type: "info",
|
|
|
- // message: "随货同行单号不能为空",
|
|
|
- // });
|
|
|
- // }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请填写必填项信息",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 添加批次
|
|
|
+ handleBatch(row, index) {
|
|
|
+ let list = {
|
|
|
+ purcOrdId: row.purcOrdId,
|
|
|
+ prodCode: row.prodCode,
|
|
|
+ regcertno: row.regcertno,
|
|
|
+ delvCnt: "",
|
|
|
+ delvCntYck: row.delvCntYck,
|
|
|
+ docmkDate: row.docmkDate,
|
|
|
+ docmker: row.docmker,
|
|
|
+ essdrugType: row.essdrugType,
|
|
|
+ prodEntp: row.prodEntp,
|
|
|
+ materialId: row.materialId,
|
|
|
+ id: row.id,
|
|
|
+ prodName: row.prodName,
|
|
|
+ hiCode: row.hiCode,
|
|
|
+ mol: row.mol,
|
|
|
+ matl: row.matl,
|
|
|
+ memo: row.memo,
|
|
|
+ mcsType: row.mcsType,
|
|
|
+ purcPric: row.purcPric,
|
|
|
+ purcAmt: row.purcAmt,
|
|
|
+ purcCnt: row.purcCnt,
|
|
|
+ prodSouc: row.prodSouc,
|
|
|
+ spec: row.spec,
|
|
|
+ toDelvCnt: row.toDelvCnt,
|
|
|
+ invoFileId: "",
|
|
|
+ lotNum: "",
|
|
|
+ manuDate: "",
|
|
|
+ prodExpy: "",
|
|
|
+ dyntFileId: "",
|
|
|
+ };
|
|
|
+ this.tableData.splice(index + 1, 0, list);
|
|
|
+ list.showDeleteButton = true;
|
|
|
+ this.computeCell(this.tableData);
|
|
|
+ console.log(this.tableData, "tableData");
|
|
|
+ // const aa = this.tableData.findIndex((item) => item.id === row.id);
|
|
|
+ // this.number.splice(aa+1,0,this.number[aa])
|
|
|
+ },
|
|
|
+ getUpload1(id, index) {
|
|
|
+ this.tableData[index].invoFileId = id;
|
|
|
+ if (id) {
|
|
|
+ this.$refs.tabledata.clearValidate("invoFileId");
|
|
|
} else {
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "出库数据不能为空",
|
|
|
- });
|
|
|
+ this.$refs.tabledata.validateField("invoFileId");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 筛选合并项
|
|
|
+ computeCell(tableData) {
|
|
|
+ this.cellList = [];
|
|
|
+ this.count = null;
|
|
|
+ for (let i = 0; i < tableData.length; i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ // 先设置第一项
|
|
|
+ this.cellList.push(1); // 初为1,若下一项和此项相同,就往cellList数组中追加0
|
|
|
+ this.count = 0;
|
|
|
+ console.log("索引", 0, this.count);
|
|
|
+ } else {
|
|
|
+ // 判断当前项与上项的设备类别是否相同,因为是合并这一列的单元格
|
|
|
+ if (tableData[i].id == tableData[i - 1].id) {
|
|
|
+ this.cellList[this.count] += 1; // 增加计数
|
|
|
+ this.cellList.push(0); // 相等就往cellList数组中追加0
|
|
|
+ console.log("索引", i, this.count);
|
|
|
+ } else {
|
|
|
+ this.cellList.push(1); // 不等就往cellList数组中追加1
|
|
|
+ this.count = i; // 将索引赋值为计数
|
|
|
+ console.log("索引", i, this.count);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取出库数量和
|
|
|
+ numAll(row) {
|
|
|
+ let num = 0;
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
+ if (item.materialId == row.materialId) {
|
|
|
+ num += item.delvCnt;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return num;
|
|
|
+ },
|
|
|
+ shanchu3(row) {
|
|
|
+ this.tableData.forEach(async (item) => {
|
|
|
+ await this.numAll(row);
|
|
|
+ console.log(this.numAll(row), "he");
|
|
|
+ if (item.materialId == row.materialId) {
|
|
|
+ if (this.numAll(row) > item.toDelvCnt) {
|
|
|
+ this.$message.warning("出库数量不能大于待出库数量");
|
|
|
+ row.delvCnt = 0;
|
|
|
+ row.price = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let choose = this.tableData;
|
|
|
+ this.tableData = choose;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ numOrPriceChange(index, row) {
|
|
|
+ this.$set(
|
|
|
+ this.tableData[index],
|
|
|
+ "price",
|
|
|
+ getTotalAmount(row.delvCnt, row.purcPric)
|
|
|
+ );
|
|
|
+ this.amount = countNumPrice(this.tableData);
|
|
|
+ },
|
|
|
+ // 出库数量变更
|
|
|
+ updateNum(row, index) {
|
|
|
+ // const aa = this.tableData.findIndex((item) => item.id === row.id);
|
|
|
+ // if(this.number[aa]){
|
|
|
+ // this.shanchu2(row,aa);
|
|
|
+ // }else{
|
|
|
+ // this.shanchu(row);
|
|
|
+ // }
|
|
|
+ this.shanchu3(row);
|
|
|
+ this.numOrPriceChange(index, row);
|
|
|
+ },
|
|
|
+ // 确认
|
|
|
+ handleConfirm() {
|
|
|
+ let data = this.selectData.map((i) => {
|
|
|
+ return i.purcOrdId;
|
|
|
+ });
|
|
|
+ let data2 = data.slice(1);
|
|
|
+ let qwe = data2.some((item) => {
|
|
|
+ if (item != data[0]) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (qwe == true) {
|
|
|
+ this.$message.info("请勾选同一采购单明细");
|
|
|
+ } else {
|
|
|
+ this.tableData = this.selectData;
|
|
|
+ this.computeCell(this.tableData);
|
|
|
+ this.dialog = false;
|
|
|
}
|
|
|
},
|
|
|
},
|