You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
6.7 KiB

<template>
<!-- (原为图纸计划查询) -->
<el-container>
<el-header style="width: 100%">
<el-row>
<el-col :span="18">
<el-col :span="4">
<el-select v-model="request.dcCh" placeholder="船号" clearable>
<el-option
v-for="item in ShipNoList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :span="6" style="text-align: right">
<el-button type="primary" @click="initList()">查询</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="18">
<el-col :span="4">
<el-select v-model="request.zt" placeholder="状态" clearable>
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-col>
<el-col :span="6" style="text-align: right">
<!-- <el-button type="success" @click="toolbarButtonClickEvent('insert')"-->
<!-- >审核</el-button-->
<!-- >-->
</el-col>
</el-row>
</el-header>
<el-container style="padding-top: 10px">
<el-container>
<el-main>
<div class="mytable">
<vxe-grid
id="id"
ref="tableRef"
border
resizable
keep-source
:height="height"
:auto-resize="true"
:columns="tableColumn"
:data="list"
:custom-config="{ storage: true }"
highlight-hover-row
:checkbox-config="{checkMethod: CheckboxkMethod}"
@checkbox-all="selectAllEvent"
@checkbox-change="selectChangeEvent"
>
</vxe-grid>
</div>
</el-main>
</el-container>
</el-container>
</el-container>
</template>
<script>
import { getList, sh } from "@/api/jhzx/tzCX";
export default {
name: "TzxqCX",
data() {
return {
request: {
dcCh: "",
Zt: "",
},
list: [],
height: "500px",
tableColumn: [
{ type: "checkbox", width: 50 },
{ type: "seq", width: 60, title: "序号" },
{ field: "dcPl", title: "批量", editRender: { name: "input" } },
{ field: "dcFd", title: "图名", editRender: { name: "input" } },
{
field: "dcCh",
title: "船名",
editRender: {
name: "$select",
options: [],
props: { clearable: true },
},
},
{ field: "xfqTlt", title: "套料图下发", editRender: { name: "input" } },
{ field: "jsqTlt", title: "套料图接收", editRender: { name: "input" } },
{
field: "xfqLqb",
title: "板材领取表下发",
editRender: { name: "input" },
},
{
field: "jsqLqb",
title: "板材领取表接收",
editRender: { name: "input" },
},
{
field: "xfqPtb",
title: "零件配套表下发",
editRender: { name: "input" },
},
{
field: "jsqPtb",
title: "零件配套表接收",
editRender: { name: "input" },
},
{
field: "zt",
title: "状态",
editRender: {
name: "$select",
options: [],
props: { clearable: true },
},
},
],
statusOptions: [
{
value: "0",
label: "未审核",
},
{
value: "1",
label: "已审核",
},
],
ShipNoList: [],
checkedList: [],
};
},
created() {
window.addEventListener("resize", this.getHeight);
this.getHeight();
this.statusList();
this.initList();
},
methods: {
statusList() {
this.$nextTick(() => {
const tableRef = this.$refs.tableRef;
const statusText = tableRef.getColumnByField("zt");
statusText.editRender.options = this.statusOptions;
});
},
// 获取列表接口(船号)
initList() {
let params = {
Zt: this.request.Zt,
dcCh: "",
};
if (this.ShipNoList.length > 0 && this.request.dcCh) {
params.dcCh = this.ShipNoList[this.request.dcCh - 1].label;
} else {
params.dcCh = "";
}
getList(params).then((res) => {
this.list = res.data;
this.checkedList = [];
var arrList = [];
if (this.list.length > 0) {
this.list.forEach((item, index) => {
arrList.push(item.dcCh);
this.ShipNoList = [];
Array.from(new Set(arrList)).forEach((em, eindex) => {
this.ShipNoList.push({
label: em,
value: eindex + 1,
});
});
});
}
});
},
// 全选
selectAllEvent() {
const records = this.$refs.tableRef.getCheckboxRecords();
this.checkedList = records;
},
// 单选
selectChangeEvent() {
const records = this.$refs.tableRef.getCheckboxRecords();
this.checkedList = records;
},
// 是否可选中
CheckboxkMethod({ row }){
return row.zt !== '1'
},
// 操作
async toolbarButtonClickEvent(code) {
switch (code) {
case "insert":
if (this.checkedList.length > 0) {
sh(this.checkedList).then((res) => {
if (res.success) {
const xTable = this.$refs.tableRef;
xTable.loadData(this.initList());
this.$message.success("审核成功!");
}
});
} else {
this.$message.warning("请选择数据!");
}
break;
default:
break;
}
},
getHeight() {
this.height = window.innerHeight - 160;
},
},
};
</script>
<style lang="scss" scoped>
.el-header {
margin: 0;
padding: 5px 0;
height: auto;
}
.el-container {
padding: 0;
margin: 0;
}
.el-main {
padding: 0;
}
.el-col {
padding: 0;
}
.el-aside {
background: #fff;
padding: 0;
}
.el-container {
padding: 0;
}
.el-row {
margin-bottom: 5px;
}
.el-row:last-child {
margin-bottom: 0;
}
.tableStyles {
background: #0a76a4;
}
.my-dropdown {
width: 450px;
height: 250px;
background-color: #fff;
border: 1px solid #dcdfe6;
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
font-size: 12px;
}
::v-deep .mytable .vxe-input {
display: flex !important;
}
</style>