<template>
|
<div class="content-main">
|
<div class="top-bar">
|
<el-form ref="form" :inline="true" :model="searchData">
|
<el-form-item label="材料编码:" class="sermargin">
|
<el-input
|
v-model="searchData.code"
|
class="input-form"
|
placeholder="请输入"
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="材料名称:" class="sermargin">
|
<el-input
|
v-model="searchData.name"
|
class="input-form"
|
placeholder="请输入"
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="状态:" class="sermargin">
|
<el-select v-model="searchData.state" placeholder="全部">
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="来料日期:" style="margin-right: 20px;">
|
<el-input
|
v-model="searchData.date"
|
class="input-form"
|
placeholder="请输入"
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="search">查询</el-button>
|
<el-button type="primary" plain @click="reset">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="library-table">
|
<div class="table-header">
|
<div class="search-bar">
|
<el-radio-group v-model="radioValue" @change="radioclick">
|
<el-radio-button v-for="option in radioOptions" :key="option.value" :label="option.value">{{ option.label }}</el-radio-button>
|
</el-radio-group>
|
</div>
|
<div class="generateInsp">
|
<el-button type="primary" size="mini" icon="el-icon-document" style="background-color: rgb(1, 102, 226);">生成报检单</el-button>
|
</div>
|
</div>
|
<div class="table-box">
|
<el-table
|
ref="inspectionTable"
|
:max-height="800"
|
:cell-style="{textAlign: 'center'}"
|
:header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
|
:data="inspectionTable"
|
style="width: 100%"
|
>
|
<el-table-column
|
type="selection"
|
min-width="10%"
|
/>
|
<el-table-column
|
type="index"
|
label="序号"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="createTime"
|
label="来料日期"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="supplierName"
|
label="供应商名称"
|
min-width="12%"
|
/>
|
<el-table-column
|
prop="materialCoding"
|
label="材料编码"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="materialName"
|
label="材料名称"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="specificationsModels"
|
label="规格型号"
|
min-width="12%"
|
/>
|
<el-table-column
|
prop="unit"
|
label="单位"
|
min-width="5%"
|
/>
|
<el-table-column
|
prop="quantity"
|
label="数量"
|
min-width="5%"
|
/>
|
<el-table-column
|
prop="inspectionDate"
|
label="报检日期"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="surveyor"
|
label="检验人"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="dateSurvey"
|
label="检验日期"
|
min-width="8%"
|
/>
|
<el-table-column
|
prop="condition"
|
label="状态"
|
min-width="8%"
|
>
|
<template slot-scope="scope">
|
<span :style="{ color: scope.row.condition === 1 ? 'green' : 'red' }">
|
{{ scope.row.condition === 1 ? '已检测':'未检测' }}
|
</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 分页器 -->
|
<div>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="currentPage"
|
:page-sizes="[5, 10, 15, 20]"
|
:page-size="pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total">
|
</el-pagination>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import {getRawMaterialList } from '@/api/inspection/rawmaterial'
|
export default {
|
data() {
|
return {
|
form: [],
|
searchData: {
|
code: '',
|
name: '',
|
state: '',
|
date: ''
|
},
|
options: [{
|
value: 0,
|
label: '全部'
|
}, {
|
value: 1,
|
label: '已检验'
|
}, {
|
value: 2,
|
label: '未检验'
|
}],
|
radioOptions:[{
|
label: '全部',
|
value: 0
|
},{
|
value: 1,
|
label: '已检验'
|
},{
|
value: 2,
|
label: '待检验'
|
}],
|
radioValue: 0,
|
inspectionTable: [{
|
createTime: '2023-07-28',
|
supplier_name: '国网山东省电力有限公司',
|
materialCoding: 'BP214274',
|
materialName: '铝包钢绞线',
|
specificationsModels: 'JLHA/G1A-185/30-26/7',
|
unit: '吨',
|
quantity: 21,
|
dateSurvey: '2023-08-02',
|
surveyor: '黄小明',
|
inspectionDate: '2023-12-09',
|
condition: 1
|
}],
|
currentPage: 1,
|
pageSize: 5,
|
total:20,
|
data: ''
|
}
|
},
|
created(){
|
this.getRawMaterialList()
|
},
|
methods: {
|
// 获取分页列表数据
|
async getRawMaterialList(){
|
const res = await getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
|
// console.log(res)
|
this.inspectionTable = res.data.row
|
this.data = res.data.row
|
this.total = res.data.total
|
},
|
async search(){
|
this.radioValue = this.searchData.state
|
const res = await getRawMaterialList({condition: this.searchData.state,
|
createTime:this.searchData.date,
|
materialCoding:this.searchData.code,
|
materialName: this.searchData.name,
|
pageNo: this.currentPage,
|
pageSize: this.pageSize
|
})
|
// console.log(res)
|
this.inspectionTable = res.data.row
|
this.data = res.data.row
|
this.total = res.data.total
|
},
|
reset(){
|
this.searchData = {
|
code: '',
|
name: '',
|
state: '',
|
date: ''
|
}
|
this.getRawMaterialList()
|
},
|
radioclick(){
|
this.searchData.state = this.radioValue
|
// console.log(this.radioValue)
|
this.inspectionTable = this.data.filter((item)=>{
|
return item.condition === this.radioValue
|
})
|
if(this.radioValue === 0){
|
this.inspectionTable = this.data
|
}
|
this.total = this.inspectionTable.length
|
},
|
// 每页条数改变时触发 选择一页显示多少行
|
handleSizeChange(val) {
|
console.log(`每页 ${val} 条`)
|
this.pageSize = val
|
this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
|
},
|
// 当前页改变时触发 跳转其他页
|
handleCurrentChange(val) {
|
console.log(`当前页: ${val}`)
|
this.currentPage = val
|
this.getRawMaterialList({pageNo: this.currentPage,pageSize:this.pageSize})
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
.top-bar{
|
margin: -25px -15px;
|
background: #fff;
|
display: flex;
|
justify-content: space-between;
|
padding: 5px 24px 0px 24px;
|
.sermargin{
|
margin-right: 60px;
|
}
|
}
|
.rightBtn{
|
background-color: rgb(1, 102, 226);
|
}
|
.library-table{
|
background-color: #fff;
|
flex: 1;
|
margin: 0px -15px;
|
margin-top: 40px;
|
display: flex;
|
flex-direction: column;
|
.table-header{
|
padding: 20px;
|
display: flex;
|
justify-content: space-between;
|
.el-form-item{
|
margin-bottom: 30px !important;
|
}
|
}
|
.table-box{
|
padding: 0px 20px;
|
margin-top: 0px;
|
flex: 1;
|
background: #fff;
|
/* padding: 20px 20px 10px 20px; */
|
display: flex;
|
flex-direction: column;
|
.el-table {
|
flex: 1;
|
}
|
>div:nth-child(2){
|
display: flex;
|
justify-content: end;
|
margin: 10px 0;
|
}
|
}
|
}
|
.checked {
|
color: green;
|
}
|
|
.unchecked {
|
color: red;
|
}
|
|
</style>
|