Files
scrq-hd/.svn/pristine/47/476685fa2392decd2ea762f64b0e9fa2a8a757b6.svn-base
2025-07-03 10:34:04 +08:00

1633 lines
49 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- wms检验单 -->
<div class="app-container" ref="container">
<div class="main">
<query-params
ref="query"
:form="queryFormConfig"
@handleQuery="handleQuery"
@getTableData="getTableData"
@resetQuery="resetQuery"
>
</query-params>
<!-- 分割线 -->
<el-divider></el-divider>
<!-- 按钮区域 -->
<el-row :gutter="10" style="margin: 10px 0px" class="mb8">
<el-col :span="1.5" v-if="defaultExpandAll == false">
<el-button
type="primary"
icon="el-icon-arrow-down"
size="mini"
@click="changeDefaultExpandAll"
>展开</el-button
>
</el-col>
<el-col :span="1.5" v-if="defaultExpandAll == true">
<el-button
type="primary"
icon="el-icon-arrow-up"
size="mini"
@click="changeDefaultExpandAll"
>收起</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="single"
@click="createInputBill"
v-hasPermi="['inspectBill_warehousing']"
>办理入库
</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button type="warning" icon="el-icon-edit"
size="mini" :disabled="single">设置仓库
</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="buttonEnableD"
@click="deleteInspectBill"
v-hasPermi="['inspectBill_del']"
>删除
</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" icon="el-icon-printer"
size="mini" :disabled="single" @click="checkInputBill">查看入库单/打印
</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="updateSpotCheckQty"
v-hasPermi="['inspectBill_modify']"
>修改数量
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-folder-checked"
size="mini"
:disabled="single"
@click="checkDetail"
v-hasPermi="['inspectBill_detail']"
>查看检验明细
</el-button>
</el-col>
<!--<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus"
size="mini" :disabled="single">查看检验明细(行转列)
</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-document-checked"
size="mini"
:disabled="single"
@click="checkTmeplate"
v-hasPermi="['inspectBill_check']"
>检验
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-document-checked"
size="mini"
:disabled="single"
@click="importTmeplate"
v-hasPermi="['inspectBill_exportCheck']"
>导出检验项
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-printer"
size="mini"
:disabled="single"
@click="checkRecord"
v-hasPermi="['inspectBill_record']"
>抽检记录
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-printer"
size="mini"
:disabled="single"
@click="printBar"
v-hasPermi="['inspectBill_print']"
>打印不良品条码
</el-button>
</el-col>
<el-col
v-loading="handleExportLoading"
element-loading-spinner="el-icon-loading"
:span="1.5"
>
<el-button
type="warning"
size="mini"
:disabled="single"
@click="rejection"
v-hasPermi="['rejection']"
>
拒收
</el-button>
</el-col>
<el-col
v-loading="handleExportLoading"
element-loading-spinner="el-icon-loading"
:span="1.5"
>
<el-button
type="info"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['inspectBill_export']"
>
导出
</el-button>
</el-col>
<!-- 自定义列 -->
<el-popover
style="float: right"
placement="bottom-end"
title="自定义显示列"
width="250"
@show="initPopover"
trigger="hover"
>
<headConfig ref="test" @fathers="fathers" :propThis="propThis" />
<el-button
size="mini"
type="primary"
class="el-icon-caret-bottom"
slot="reference"
>
自定义列
</el-button>
</el-popover>
</el-row>
<!-- 排序条件 -->
<el-row
:gutter="10"
style="margin: 10px 0px"
class="mb8"
v-show="isSortShow"
>
<el-col>
<el-select
class="sortSeq"
ref="select"
@click.native="notSelect"
style="width: 100%"
v-model="seqence"
:multiple="true"
placeholder=""
>
<el-option
v-for="item in seqenceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-row>
<!-- 列表区域 -->
<div class="table">
<!-- 列表 -->
<el-table
v-if="indexShow"
v-loading="loading"
:data="tableData"
:height="tableHeight"
border
ref="list"
class="data-table"
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange"
@header-dragend="headerDragend"
@current-change="currentChange"
:cell-style="cellStyle"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
row-key="copyId"
:default-expand-all="defaultExpandAll"
:key="flash"
>
<el-table-column
type="index"
width="50"
align="center"
label="序号"
/>
<el-table-column type="selection" width="55" />
<el-table-column
v-for="(item, index) in realList"
:sortable="item.notSort == true ? false : `custom`"
:prop="item.tableProp"
:key="item.tableTitle + index"
:align="item.align"
header-align="center"
:min-width="item.width"
:label="item.tableTitle"
:show-overflow-tooltip="item.show_overflow_tooltip"
></el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
style="margin-top: 10px;height:20px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryParams.pageNo"
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
:page-size="queryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
></el-pagination>
</div>
</div>
<div id="printFlow" v-if="printInfo"></div>
<el-dialog title="选择删除方式" :visible.sync="dialogFormVisible">
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="deleteInspectBill(ev,0)">整单据删除</el-button>
<el-button type="primary" @click="deleteInspectBill(ev,1)">单个物料删除</el-button>
<el-button @click="dialogFormVisible = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import inspectBillUpdateSpotCheckQty from "./inspect-bill-update-spotCheckQty";
import inspectBillRejection from "./inspect-bill-rejection";
import inspectBillCheckDetail from "./inspect-bill-check-detail";
import inspectBillCheckInputBill from "./inspect-bill-check-inputBill";
import inspectBillCheckTemplateVue from "./inspect-bill-check-template.vue";
import inspectBillCheckTemplateImportVue from "./inspect-bill-check-template-import.vue";
import inspectBillCheckRecord from "./inspect-bill-check-record";
import inspectBillNgBarPrint from "./inspect-bill-ngBar-print";
import inspectBillCreateInputBill from "./inspect-bill-create-inputBill.vue";
export default {
name: "inspectBill",
components: {},
data() {
return {
ev:{},
dialogFormVisible:false,
printInfo: false,
handleExportLoading: false,
//单据状态集合
dictStatusList: [],
//查询表单
queryParams: {
inspectBillNumber: "",
arriveBillNumber: "",
createBy: "",
statusArr: undefined,
supplierName: "",
startCreatedDt: "",
endCreatedDt: "",
creater:"",
pageNo: 1,
pageSize: 20
},
//是否展示更多
showMore: false,
List: [],
//自定义列
realList: [],
propThis: this,
seqence: [],
seqenceOptions: [],
//列表
indexShow: false,
loading: false,
tableData: [],
tableHeight: 0,
//列表选择
single: true,
buttonEnableD: true,
rows: [],
multipleSelectionTable: [],
multipleSelectionChildTable:[],
//分页
total: 0,
domain: "com.cmeim.input.po.MmInspectBill",
model: "input",
isSortShow: false,
defaultExpandAll: false,
flash: true
};
},
mounted() {
this.$refs.query.init();
},
computed: {
queryFormConfig() {
return {
controlList: [
{
key: "inspectBillNumber",
label: "检验单号",
type: "input",
placeholder: "请输入",
prop: "inspectBillNumber",
class: "width_0180"
},
{
key: "arriveBillNumber",
label: "到货单号",
type: "input",
placeholder: "请输入",
prop: "arriveBillNumber",
class: "width_0180"
},
{
key: "materialCode",
label: "物料编码",
type: "input",
placeholder: "请输入",
prop: "materialCode",
class: "width_0180"
},
{
key: "materialName",
label: "物料名称",
type: "input",
placeholder: "请输入",
prop: "materialName",
class: "width_0180"
},
{
key: "materialSpec",
label: "规格型号",
type: "input",
placeholder: "请输入",
prop: "materialSpec",
class: "width_0180"
},
{
key: "dictStatus",
label: "状态",
type: "select",
placeholder: "请选择",
prop: "statusArr",
options: this.dictStatusList,
multiple: true,
optionLabel: "text",
optionValue: "key"
},
{
key: "warehouseCode",
label: "仓库",
type: "inputWidget",
placeholder: "请输入",
prop: "warehouseCode",
selectWidgetIndex: 3,
subProp: "warehouseCode"
},
{
key: "creater",
label: "创建人",
type: "input",
placeholder: "请输入",
prop: "creater",
selectWidgetIndex: 3,
subProp: "creater"
},
{
key: "completeTimeArray",
label: "检验时间",
type: "datetimerange",
startPlaceholder: "检验时间起始",
endPlaceholder: "检验时间截止",
prop: "completeTimeArray"
},
{
key: "supplierName",
label: "供应商",
type: "inputWidget",
placeholder: "请输入",
prop: "supplierName",
selectWidgetIndex: 4,
subProp: "supplierName"
},
{
key: "customerName",
label: "客户",
type: "inputWidget",
placeholder: "请输入",
prop: "customerName",
selectWidgetIndex: 5,
subProp: "customerName"
},
{
key: "dictInspectStatus",
label: "检验状态",
type: "select",
placeholder: "请选择",
prop: "inspectStatusArr",
options: this.dictInspectStatus,
multiple: true,
optionLabel: "text",
optionValue: "key"
},
{
key: "erpMaterialTypeCode",
label: "ERP存货类型代码",
type: "input",
placeholder: "请输入",
prop: "erpMaterialTypeCode",
class: "width_0180"
},
{
key: "erpMaterialTypeName",
label: "ERP存货类型名称",
type: "input",
placeholder: "请输入",
prop: "erpMaterialTypeName",
class: "width_0180"
},
],
config: {
hasAdvQuery: true,
propThis: this,
preFixWidthClass: "width_0100",
marginWidthClass: "width_0180",
storageMode:true,
storageKey:'inspectBillParams'
},
defaultList: ["inspectBillNumber", "arriveBillNumber", "materialCode"]
};
}
},
watch: {
seqence: function() {
this.getList();
var oldIsSortShow = this.isSortShow;
//判断是否显示排序条件
if (this.seqence.length > 0) {
this.isSortShow = true;
} else {
this.isSortShow = false;
}
//判断table高度
if (oldIsSortShow != this.isSortShow) {
if (this.isSortShow) {
this.tableHeight = this.tableHeight - 47;
} else {
this.tableHeight = this.tableHeight + 47;
}
}
}
},
created() {
this.dictStatusList = this.$dictType.getDictListByCode(
"mm_inspect_bill_status"
);
this.dictInspectStatus = this.$dictType.getDictListByCode(
"mm_inspect_bill_inspect_status"
);
document.documentElement.style.fontSize =
(((document.documentElement.clientWidth - 200) / 4 - 68) / 255) * 16 +
"px";
this.$nextTick(() => {
this.tableHeight =
window.innerHeight - this.$refs.query.offsetHeight - 220;
});
this.initData();
setTimeout(() => {
this.getList();
}, 500);
},
methods: {
// 导出
handleExport() {
/* this.handleExportLoading = true;
console.log(this.multipleSelectionTable,"导出所选数据")
if(this.multipleSelectionTable.length>0)
{
let inspectBillNumberArr=[];
for(let i=0;i<this.multipleSelectionTable.length;i++)
{
inspectBillNumberArr.push(this.multipleSelectionTable[i].inspectBillNumber)
}
this.queryParams.inspectBillNumberArr=inspectBillNumberArr;
}
let params = JSON.parse(JSON.stringify(this.queryParams));
this.$inspectBill.exportExcel(params).then(data => {
this.handleExportLoading = false;
this.download(data.data);
});*/
console.log(this.multipleSelectionTable,"导出所选数据")
console.log(this.multipleSelectionTable.length)
console.log(this.currentRow)
if (this.multipleSelectionTable.length === 0) {
this.$message.error("请至少选中一行数据");
return;
}
let ids = [];
if (this.multipleSelectionTable.length > 0) {
this.multipleSelectionTable.forEach(item => ids.push(item.id));
} else {
ids.push(this.currentRow.id);
}
// 去重
ids = [...new Set(ids)];
this.handleExportLoading = true;
console.log("导出:", ids);
this.$inspectBill.exportExcelSelected({ids}).then(data => {
this.handleExportLoading = false;
this.download(data.data);
});
},
// 下载导出文件
download(data) {
// 文件导出
let url = window.URL.createObjectURL(new Blob([data]));
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
let fileName = "检验单";
let time = new Date();
fileName +=
"_" +
time.getFullYear() +
(time.getMonth() < 11
? "0" + (time.getMonth() + 1)
: time.getMonth() + 1) +
(time.getDate() < 10 ? "0" + time.getDate() : time.getDate());
fileName += "_" + time.getHours() + time.getMinutes() + time.getSeconds();
fileName += ".xlsx";
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
link.remove();
},
//列表全部展开/收起
changeDefaultExpandAll() {
this.defaultExpandAll = !this.defaultExpandAll;
this.flash = !this.flash;
setTimeout(() => {
this.flash = !this.flash;
}, 100);
},
//初始化表格(根据tableName获取头部行的配置js)
async initData() {
let tempList = this.$headerConfig.getList("inspectBill");
this.seqenceOptions = [];
tempList.forEach((data, index) => {
if (data.notSort) return;
let temp = {
value: null,
label: null
};
temp.value = data.tableProp.replace("Show", "") + " ascending";
temp.label = data.tableTitle + " 升序";
this.seqenceOptions.push(temp);
let tempD = {
value: null,
label: null
};
tempD.value = data.tableProp.replace("Show", "") + " descending";
tempD.label = data.tableTitle + " 降序";
this.seqenceOptions.push(tempD);
});
const params = {
tableName: "inspectBill"
};
this.$headerConfig.getRealList(params).then(_data => {
let data = _data.config ? _data.data : _data;
if (data.data && data.data !== null) {
let temp = JSON.parse(data.data);
this.realList = temp.headerList;
if(temp.pageSize){this.queryParams.pageSize=temp.pageSize} //读取pageSize
this.List = temp.List;
} else {
this.List = this.$headerConfig.getList("inspectBill");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List
};
const params = {
tableName: "inspectBill",
configure: JSON.stringify(temp)
};
this.$headerConfig.updateRealList(params).then(value => {
console.log(value);
});
}
this.indexShow = true;
});
},
getQueryParams() {
let pageSize = this.queryParams.pageSize;
let pageNo = this.queryParams.pageNo;
this.queryParams = this.$refs.query.getQueryParams();
this.queryParams.pageSize = pageSize;
this.queryParams.pageNo = pageNo;
},
//查询table
async handleQuery() {
this.getQueryParams();
this.queryParams.pageNo = 1;
await this.getList();
this.single = true;
this.$forceUpdate();
},
//改变pageSize
handleSizeChange(val) {
this.queryParams.pageSize = val;
this.getList();
},
//改变页码
handleCurrentChange(val) {
this.queryParams.pageNo = val;
this.getList();
},
//获取table数据
async getList() {
this.loading = true;
this.single = true;
const orders = [];
this.seqence.map(val => {
orders.push(
val.replace("ascending", "asc").replace("descending", "desc")
);
});
this.queryParams.orders = orders;
let params = JSON.parse(JSON.stringify(this.queryParams));
if (
this.queryParams.completeTimeArray != null &&
this.queryParams.completeTimeArray != undefined
) {
params.startCreatedDt = this.g_method.dateFtt(
"yyyy-MM-dd hh:mm:ss",
this.queryParams.completeTimeArray[0]
);
params.endCreatedDt = this.g_method.dateFtt(
"yyyy-MM-dd hh:mm:ss",
this.queryParams.completeTimeArray[1]
);
}
if (
params.materialCode != null &&
params.materialCode.indexOf(" ") > -1
) {
params.materialCodeArr = params.materialCode.split(" ");
params.materialCode = null;
this.queryParams.materialCodeArr = params.materialCodeArr;
this.queryParams.materialCode = null;
}
if (
params.arriveBillNumber != null &&
params.arriveBillNumber.indexOf(" ") > -1
) {
params.arriveBillNumberArr = params.arriveBillNumber.split(" ");
params.arriveBillNumber = null;
this.queryParams.arriveBillNumberArr = params.arriveBillNumberArr;
this.queryParams.arriveBillNumber = null;
}
if (
params.inspectBillNumber != null &&
params.inspectBillNumber.indexOf(" ") > -1
) {
params.inspectBillNumberArr = params.inspectBillNumber.split(" ");
params.inspectBillNumber = null;
this.queryParams.inspectBillNumberArr = params.inspectBillNumberArr;
this.queryParams.inspectBillNumber = null;
}
console.log(params,"111");
this.$inspectBill.getInspectBillList(params).then(data => {
this.getTableData(data.data.data, true);
this.loading = false;
});
},
//展开更多查询条件
showMoreChange() {
if (!this.showMore) {
this.tableHeight = this.tableHeight - 94;
} else {
this.tableHeight = this.tableHeight + 94;
}
this.$nextTick(() => {
this.showMore = !this.showMore;
});
},
//重置查询条件
resetQuery() {
this.queryParams = {
inspectBillNumber: "",
arriveBillNumber: "",
createBy: "",
statusArr: undefined,
supplierName: "",
startCreatedDt: "",
endCreatedDt: "",
pageNo: 1,
pageSize: 20
};
this.handleQuery();
this.single = true;
this.buttonEnableD = true;
this.seqence = [];
},
//高级查询
getTableData(data, general) {
let val = data.data;
val.forEach(row=>{
row.items.sort(function (a, b) {
if(a.materialCode<b.materialCode){return -1}
if(a.materialCode>b.materialCode){return 1}
return 0
})
}) //items内按字母序排序
// 如果不是高级查询,则需要过滤
if (general) {
if (
this.queryParams.materialCodeArr != null &&
this.queryParams.materialCodeArr.length > 0
)
this.queryParams.materialCodeArr = this.queryParams.materialCodeArr.map(
code => code.toLowerCase()
);
val.map(
data =>
(data.items = data.items.filter(item => this.itemFilter(item)))
);
}
let tableData = [];
val.map(value => {
var master = {};
var children = [];
value.items.forEach((item, index) => {
item.dictStatusShow = this.$dictType.getDictNameByCodeAndKey(
"mm_inspect_bill_status",
item.dictStatus
);
item.dictInspectStatusShow = this.$dictType.getDictNameByCodeAndKey(
"mm_inspect_bill_inspect_status",
item.dictInspectStatus
);
let orderItem = {
id: value.id,
copyId: value.id,
detailId: item.id,
index:index
};
this.realList.map(columnData => {
if (index == 0) {
orderItem[columnData.tableProp] =
value[columnData.tableProp] || item[columnData.tableProp];
} else {
orderItem[columnData.tableProp] = columnData.isItem
? item[columnData.tableProp]
: orderItem[columnData.tableProp];
//复制列
orderItem.inspectBillDetailId = item.id;
orderItem.warehouseCode = value.warehouseCode;
orderItem.warehouseName = value.warehouseName;
orderItem.supplierCode = value.supplierCode;
orderItem.supplierName = value.supplierName;
orderItem.customerCode = value.customerCode;
orderItem.customerName = value.customerName;
}
orderItem.inspectBillDetailId = item.id;
orderItem.dictStatus = item.dictStatus;
orderItem.dictInspectStatus = item.dictInspectStatus;
orderItem.arriveBillNumberCopy = value.arriveBillNumber;
orderItem.inspectBillNumberCopy = value.inspectBillNumber;
});
//处理数据结构
if (index == 0) {
master = orderItem;
} else {
orderItem.copyId = Math.random();
orderItem.hasChildren = false;
children.push(orderItem);
}
});
master.children = children;
tableData.push(master);
});
this.tableData = tableData;
this.total = data.recordsTotal;
},
//自定义列清空
notSelect() {
this.$refs.select.blur();
},
//自定义列
initPopover() {
const params = {
tableName: "inspectBill"
};
this.$headerConfig.getRealList(params).then(_data => {
let data = _data.config ? _data.data : _data;
let temp = JSON.parse(data.data);
this.realList = temp.headerList;
this.$refs.test.init();
});
},
//自定义配置
fathers(data) {
this.List = data.configure.List;
data.configure.List.forEach(value => {
this.realList.forEach(real => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
data.configure.headerList.forEach(value => {
this.realList.forEach(real => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
if (data.configure.headerList.length <= 0) {
return;
}
data.configure.pageSize=this.queryParams.pageSize// 保存pageSize
const params = {
tableName: "inspectBill",
configure: JSON.stringify(data.configure)
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then(value => {});
},
//列表排序
sortChange({ column, prop, order }) {
prop = prop.replace("Show", "");
if (order == null) {
for (let i = 0; i < this.seqence.length; i++) {
let judgeSeqence = this.seqence[i].split(" ");
if (prop === judgeSeqence[0]) {
this.seqence.splice(i, 1);
break;
}
}
} else {
let value = prop + " " + order;
if (this.seqence.length === 0) {
this.seqence.push(value);
} else {
for (let i = 0; i < this.seqence.length; i++) {
let judgeSeqence = this.seqence[i].split(" ");
if (prop === judgeSeqence[0]) {
this.seqence.splice(i, 1, value);
break;
}
if (i + 1 === this.seqence.length) {
this.seqence.push(value);
}
}
}
}
},
//列表多选
handleSelectionChange(selection) {
console.log(selection)
this.multipleSelectionTable = selection;
this.single = selection.length != 1;
this.buttonEnableD = !selection.length;
},
//列表单选
currentChange(selection, lastVal) {
this.rows = [];
this.rows.push(selection);
this.currentRow = selection;
this.single = this.rows.length != 1;
this.buttonEnableD = this.rows.length > 1;
},
//列表列宽度拖动
headerDragend(newWidth, oldWidth, column, event) {
this.realList.forEach(value => {
if (column.property == value.tableProp) {
value.width = newWidth;
}
});
this.$refs.test.init();
setTimeout(() => {
this.$refs.test.show();
}, 1000);
},
//删除按钮
deleteInspectBill(ev,deleteType) {
this.dialogFormVisible=false;
var deleteList = [];
var numbers2 = "";
var numbers = "";
var list = [];
var list2 = [];
if (this.multipleSelectionTable.length > 0) {
deleteList = this.multipleSelectionTable;
} else {
deleteList = this.rows;
}
// 获取选中的主表id数组
deleteList.forEach(item => {
console.log(deleteType,item.index,item.children)
//为主表
if( deleteType==undefined && item.index==0 && item.children!=undefined && item.children.length>0){
this.dialogFormVisible=true;
//用异常终止本次程序
throw new Error("选择删除方式")
}
if(deleteType==undefined && item.index>0){
this.dialogFormVisible=true;
//用异常终止本次程序
throw new Error("选择删除方式")
}
numbers2 += "【" + item.materialName + "】";
list.push(item.id)
list2.push(item.detailId);
});
console.log("继续执行")
//为子表删除 id:inspectBillDetailId
if(deleteType==1){
this.$confirm("是否确认删除单据检验项明细" + numbers2 + "?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$inspectBill.deleteInspectBillDetail(list2).then(res => {
if (res.data.code == 200) {
this.$message.success("删除成功");
this.getList();
} else {
this.$message.error(res.data.message);
}
});
})
.catch(() => {});
return
}
//为主表 删除
// 去重
list = Array.from(new Set(list));
// 过滤掉没有到货单号的数据,并添加选中数据的到货单号
this.tableData
.filter(item => item.inspectBillNumber != null)
.forEach(item => {
if (list.indexOf(item.id) != -1) {
numbers += "【" + item.inspectBillNumber + "】";
}
});
this.$confirm("是否确认删除单据" + numbers + "?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$inspectBill.deleteInspectBill(list).then(res => {
if (res.data.code == 200) {
this.$message.success("删除成功");
this.getList();
} else {
this.$message.error(res.data.message);
}
});
})
.catch(() => {});
},
//修改数量按钮
updateSpotCheckQty() {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillUpdateSpotCheckQty,
parent: this,
data: {
row:
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0]
}
},
area: [this.g_const.dialogWidthBig, "220px"],
title: "修改数量"
});
},
//办理入库按钮
createInputBill() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
this.$inspectBill
.judgeCanInput({
inspectBillNumber: data.inspectBillNumber
})
.then(res => {
if (res.data.code == 200) {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCreateInputBill,
parent: this,
data: {
row: data
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "办理入库"
});
} else {
this.$message.error(res.data.msg);
}
});
// if (data.dictStatus == 10) {
// } else {
// this.$message.error("该单据尚未检验完毕");
// }
// var data =
// this.multipleSelectionTable.length > 0
// ? this.multipleSelectionTable[0]
// : this.rows[0];
// this.$confirm(
// "是否确认办理入库【" + data.inspectBillNumberCopy + "】?",
// "提示",
// {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// }
// )
// .then(() => {
// this.$inspectBill.addByInspect(data.id).then(res => {
// if (res.data.code == 200) {
// this.initData()
// this.$message.success("办理成功");
// this.getList();
// } else {
// this.$message.error(res.data.msg);
// }
// });
// })
// .catch(() => {});
},
//查看入库单按钮
checkInputBill() {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCheckInputBill,
parent: this,
data: {
row:
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0]
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "查看入库单"
});
},
//检验按钮
checkTmeplate() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
console.log("data", data);
console.log(this.tableData, "daaaaa");
var batch = "";
var inspectId = "";
var data1 = this.tableData.filter(
item =>
item.inspectBillNumber == data.inspectBillNumber ||
item.inspectBillNumber == data.inspectBillNumberCopy
);
console.log("data1", data1);
if (data1[0].materialCode == data.materialCode) {
if (batch == "") {
batch = data1[0].batchNo;
inspectId = data1[0].inspectBillDetailId;
} else {
batch = batch + "," + data1[0].batchNo;
inspectId = inspectId + "," + data1[0].inspectBillDetailId;
}
}
var data2 = [];
data2 = data1[0].children;
console.log("data2", data2);
data2.forEach(item => {
if (item.materialCode == data.materialCode) {
if (batch == "") {
batch = item.batchNo;
inspectId = item.inspectBillDetailId;
} else {
batch = batch + "," + item.batchNo;
inspectId = inspectId + "," + item.inspectBillDetailId;
}
}
});
data.batchNo = batch;
data.idArr = inspectId;
console.log("修改data", data);
if (data.spotCheckQty < data.spotCheckStandardQty) {
this.$message.error("抽检数量必须大于抽检标准数才能进行检验操作");
return;
}
// if (data.dictStatus == 1 || data.dictStatus == 5) {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCheckTemplateVue,
parent: this,
data: {
row: data
}
},
area: ["85vw", "100vh"],
title: "检验"
});
// } else if (data.dictStatus == 10) {
// this.$message.error("该物料已经检验");
// } else if (data.dictStatus == 15) {
// this.$message.error("该单据已入库");
// }
},
//导出检验
importTmeplate() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
console.log("data", data);
console.log(this.tableData, "daaaaa");
var batch = "";
var inspectId = "";
var data1 = this.tableData.filter(
item =>
item.inspectBillNumber == data.inspectBillNumber ||
item.inspectBillNumber == data.inspectBillNumberCopy
);
console.log("data1", data1);
if (data1[0].materialCode == data.materialCode) {
if (batch == "") {
batch = data1[0].batchNo;
inspectId = data1[0].inspectBillDetailId;
} else {
batch = batch + "," + data1[0].batchNo;
inspectId = inspectId + "," + data1[0].inspectBillDetailId;
}
}
var data2 = [];
data2 = data1[0].children;
console.log("data2", data2);
// this.$inspectBill.queryCheckRecord(this.data.inspectBillDetailId).then(res=>{
// console.log('dadsadasd',this.row)
// this.$router.push({ name: "formMakingInspect", params: { row:res} });
// });
data2.forEach(item => {
if (item.materialCode == data.materialCode) {
if (batch == "") {
batch = item.batchNo;
inspectId = item.inspectBillDetailId;
} else {
batch = batch + "," + item.batchNo;
inspectId = inspectId + "," + item.inspectBillDetailId;
}
}
});
data.batchNo = batch;
data.idArr = inspectId;
console.log("修改data", data);
if (data.spotCheckQty < data.spotCheckStandardQty) {
this.$message.error("抽检数量必须大于抽检标准数才能进行检验操作");
return;
}
if (data.dictStatus == 10 || data.dictStatus == 15) {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCheckTemplateImportVue,
parent: this,
data: {
row: data
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "检验"
});
} else {
this.$message.error("该物料未检验");
}
},
//检验记录按钮
checkRecord() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCheckRecord,
parent: this,
data: {
row: data
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "抽检记录"
});
},
//查看检验明细按钮
checkDetail() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
if (data.dictStatus == 10 || data.dictStatus == 15) {
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillCheckDetail,
parent: this,
data: {
row: data
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "检验明细"
});
} else {
this.$message.error("该物料尚未检验");
}
},
//打印不良品条码
printBar() {
var data =
this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillNgBarPrint,
parent: this,
data: {
row: data
}
},
area: [this.g_const.dialogWidthBig, "700px"],
title: "打印不良品条码"
});
// var data = this.multipleSelectionTable.length > 0
// ? this.multipleSelectionTable[0] : this.rows[0];
// let printData = [];
// this.printInfo = true;
// let router = "";
// 获取条码
// printData = []
// this.$nextTick(() => {
// printData.forEach((value, index) => {
// router =
// router +
// '<div class="a4" style="padding-top: 10px;" >' +
// '<table border="1" cellspacing="0" cellpadding="0" style="width:150px;table-layout:fixed;">' +
// "<tr>" +
// '<td align="center" style="font-size: 9px;height: 25px" width="70px">编码</td>' +
// '<td align="center" style="font-size: 9px;width: 160px;word-wrap:break-word;" >' +
// value.materialCode +
// "</td>" +
// '<td align="center" style="font-size: 18px;width: 120px" colspan="2" rowspan="3"><div style="padding-left: 20px" id="qrcode' +
// index +
// '"></div></td>' +
// "</tr>" +
// "<tr>" +
// '<td align="center" style="font-size: 9px;height:55px;" width="120px">名称</td>' +
// '<td align="center" style="font-size: 8px" colspan="1" width="120px"> ' +
// value.materialName +
// "</td>" +
// "</tr>" +
// "</tr>" +
// "<tr>" +
// '<td align="center" style="font-size: 9px;height:25px;" width="120px">条码</td>' +
// '<td align="center" style="font-size: 8px" colspan="1" width="120px"> ' +
// value.materialBar +
// "</td>" +
// "</tr>" +
// "<tr>" +
// '<td align="center" style="font-size: 9px;height: 25px" width="120px">批次</td>' +
// '<td align="center" style="font-size: 9px" >' +
// value.batchNo +
// "</td>" +
// '<td align="center" style="font-size: 9px;">数量</td>' +
// '<td align="center" style="font-size: 9px;" >' +
// value.materialQty +
// "</td>" +
// "</tr>" +
// "</table>" +
// " </div>";
// });
// let printerTable = document.getElementById("printFlow");
// printerTable.innerHTML = router;
// this.$nextTick(() => {
// printData.forEach((value, idx) => {
// let qrcode = new QRCode("qrcode" + idx, {
// width: 90, //图像宽度
// height: 90, //图像高度
// colorDark: "#000000", //前景色
// colorLight: "#ffffff", //背景色
// typeNumber: 4,
// correctLevel: QRCode.CorrectLevel.H //容错级别 容错级别有1QRCode.CorrectLevel.L 2QRCode.CorrectLevel.M 3QRCode.CorrectLevel.Q 4QRCode.CorrectLevel.H
// });
// console.log(value.materialBar);
// qrcode.makeCode(value.materialBar);
// });
// this.$nextTick(() => {
// window.setTimeout(() => {
// this.loading = false;
// this.printInfo = false;
// let tableToPrint = document.getElementById("printFlow"); //将要被打印的表格
// let newWin = window.open(""); //新打开一个空窗口
// newWin.document.write(
// "<html><head><title>物料条码打印</title></head><style>@page{margin:0px 10px;size: auto} td{text-align: center; border: solid 1px #000000; height: 20px;}.a4{page-break-before: auto;" +
// ' page-break-after: always;}</style><body style="padding: 0px;margin: 0px">'
// );
// newWin.document.write(tableToPrint.outerHTML); //将表格添加进新的窗口
// newWin.document.write("</body></html>");
// newWin.focus(); //在IE浏览器中使用必须添加这一句
// newWin.print(); //打印
// newWin.close(); //关闭窗口
// }, 1000);
// });
// });
// });
},
cellStyle({ row, column, rowIndex, columnIndex }) {
if (row.dictStatusShow == "待检验" && column.property == "dictStatusShow") {
return "";
} else if (row.dictStatusShow == "检验中" && column.property == "dictStatusShow") {
return "color: red;font-weight:bold;";
} else if (row.dictStatusShow == "已检验" && column.property == "dictStatusShow") {
return "color: green;font-weight:bold;";
} else if (row.dictStatusShow == "已生成入库单" && column.property == "dictStatusShow") {
return "color: blue;font-weight:bold;";
} else if (row.dictInspectStatusShow == "全部接收" && column.property == "dictInspectStatusShow") {
return "color: green; font-weight:bold;";
} else if (row.dictInspectStatusShow == "让步接收" && column.property == "dictInspectStatusShow") {
return "color: #f47920; font-weight:bold;";
} else if (row.dictInspectStatusShow == "拒收" && column.property == "dictInspectStatusShow") {
return "color: red; font-weight:bold;";
}
},
// 子项过滤
itemFilter(item) {
// 物料编码过滤
if (this.queryParams.materialCode != null) {
if (
item.materialCode
.toLowerCase()
.indexOf(this.queryParams.materialCode.toLowerCase()) == -1
)
return false;
}
// 物料编码批量过滤
if (
this.queryParams.materialCodeArr != null &&
this.queryParams.materialCodeArr.length > 0
) {
if (
this.queryParams.materialCodeArr.indexOf(
item.materialCode.toLowerCase()
) == -1
)
return false;
}
// 物料名称过滤
if (this.queryParams.materialName != null) {
if (
item.materialName
.toLowerCase()
.indexOf(this.queryParams.materialName.toLowerCase()) == -1
)
return false;
}
// 物料规格过滤
if (this.queryParams.materialSpec != null) {
if (
item.materialSpec
.toLowerCase()
.indexOf(this.queryParams.materialSpec.toLowerCase()) == -1
)
return false;
}
// 状态过滤
if (
this.queryParams.statusArr != null &&
this.queryParams.statusArr.length != 0
) {
if (
!this.queryParams.statusArr.some(status => status == item.dictStatus)
)
return false;
}
return true;
},
// 拒收
rejection() {
let row = this.multipleSelectionTable.length > 0
? this.multipleSelectionTable[0]
: this.rows[0];
if (row.dictStatusShow=="已生成入库单") {
this.$message.error("此条数据已生成入库单,不能进行拒收操作");
return;
}
this.$layer.iframe({
resize: true,
shadeClose: false,
content: {
content: inspectBillRejection,
parent: this,
data: {
row: row
}
},
area: [this.g_const.dialogWidthBig, "220px"],
title: "拒收"
});
}
}
};
</script>
<style lang="scss" scoped>
/*.app-container{*/
/* overflow-y: hidden!important;*/
/*}*/
// .app-container {
// padding: 10px;
// }
>>> .el-pager {
height: 50px;
}
>>> .el-table th.gutter {
display: table-cell !important;
}
>>> .el-form-item {
padding: 0px;
margin: 0px;
}
.el-divider {
margin: 1px;
}
>>> .el-table__body tr.current-row > td {
background-color: #8ac1ff !important;
cursor: pointer;
}
.el-table >>> tbody tr:hover > td {
background-color: #8ac1ff !important;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
padding-right: 35px;
}
.sortSeq >>> .el-input__suffix-inner {
display: none;
}
>>> .el-form-item {
margin-bottom: 10px;
}
.el-divider {
margin-top: 0px;
margin-bottom: 5px;
}
>>> .el-table .el-table__header-wrapper th {
padding: 5px 0;
}
>>> .vue-treeselect__control {
height: 30px !important;
line-height: 30px !important;
}
>>> .vue-treeselect--single .vue-treeselect__input-container {
height: 30px !important;
line-height: 30px !important;
}
// >>> .el-input-group__append{
// padding: 5px;
// }
>>> .el-input-group__append .el-select,
.el-input-group__append .el-button,
.el-input-group__prepend .el-select,
.el-input-group__prepend .el-button {
margin-left: -28px !important;
margin-right: -33px !important;
}
// .query >>> .el-button--mini{
// padding-bottom:0px;
// }
.el-button + .el-button {
margin-left: 4px;
}
>>> .el-table td {
padding: 5px 0 !important;
}
</style>