<template>
	<div class="content-main">
		<el-form :inline="true" :model="searchForm" class="search-bm-boder">
			<el-row>
				<el-form-item>
					<label slot="label">单位名称:</label>
					<el-input
						v-model="searchForm.dwmc"
						class="inputCompatible"
						clearable
					></el-input>
				</el-form-item>
				<el-form-item label="企业性质:">
					<el-input
						v-model="searchForm.qyxz"
						class="inputCompatible"
						clearable
					></el-input>
				</el-form-item>
				<el-form-item>
					<label slot="label">状态:</label>
					<el-select
						v-model="searchForm.ztbm"
						clearable
						placeholder="请选择"
						class="inputCompatible"
					>
						<el-option
							v-for="item in yearOptions"
							:key="item.value"
							:label="item.name"
							:value="item.value"
						></el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<div class="search-button">
						<span class="search-line"></span>
						<!-- <div class="search-select" @click="searchShowMoreBool=!searchShowMoreBool">更多条件 <i class="el-icon-arrow-up" v-show="searchShowMoreBool"></i><i class="el-icon-arrow-down" v-show="!searchShowMoreBool"></i></div> -->
						<el-button
							type="primary"
							@click="searchInfo"
							size="small"
							class="iconfont iconchaxun"
							>查询</el-button
						>
						<el-button
							type="primary"
							@click="chongzhi"
							size="small"
							class="iconfont iconzhongzhi"
							>重置</el-button
						>
					</div>
				</el-form-item>
			</el-row>
		</el-form>
		<el-row>
			<el-table
				:data="tableData"
				stripe
				v-loading="listLoading"
				border
				fit
				highlight-current-row
				style="width: 100%"
			>
				<el-table-column
					align="center"
					label="序号"
					width="60"
					type="index"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="dwmc"
					label="单位名称"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="jydz"
					label="经营地址"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="qyxz"
					label="企业性质"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="zyccywlx"
					label="主要仓储业务类型"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="kqgs"
					label="库区个数"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="zdmj"
					width="110"
					label="占地面积"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="zcr"
					label="总仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="whcr"
					label="完好仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="jycr"
					label="简易仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="zgr"
					label="总罐容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="yggs"
					label="油罐个数"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="储粮罩棚"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="hgss"
					label="烘干设施"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="hgnl"
					label="烘干能力"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="rcknl"
					label="日出库能力"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="应用环流熏蒸仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="应用粮情测控仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="应用机械通风仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="实现气调储粮仓容"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="保管员"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="clzp"
					label="质量检验员"
				></el-table-column>
				<el-table-column
					show-overflow-tooltip
					align="center"
					prop="ztmc"
					width="120"
					label="状态"
				></el-table-column>
				<el-table-column
					align="center"
					width="200"
					label="操作"
					fixed="right"
				>
					<template slot-scope="scope">
						<el-tooltip
							class="item"
							effect="light"
							content="查看"
							placement="top"
						>
							<el-button
								type="primary"
								@click="showInfo(scope.row)"
								class="operate_show_btn iconfont iconchakan2"
								size="small"
							></el-button>
						</el-tooltip>
						<el-tooltip
							class="item"
							effect="light"
							content="审核"
							placement="top"
						>
							<el-button
								type="primary"
								@click="editMe(scope.row)"
								v-show="scope.row.zt == '91000004'&& orgLength == 11"
								class="operate_edit_btn iconfont iconshenhe"
								size="small"
							></el-button>
						</el-tooltip>
							<el-tooltip
							class="item"
							effect="light"
							content="审核"
							placement="top"
						>
							<el-button
								type="primary"
								@click="editMe(scope.row)"
								v-show="scope.row.zt == '91000041'&& orgLength == 8"
								class="operate_edit_btn iconfont iconshenhe"
								size="small"
							></el-button>
						</el-tooltip>
							</el-tooltip>
							<el-tooltip
							class="item"
							effect="light"
							content="审核"
							placement="top"
						>
							<el-button
								type="primary"
								@click="editMe(scope.row)"
								v-show="scope.row.zt == '91000043'&& orgLength == 5"
								class="operate_edit_btn iconfont iconshenhe"
								size="small"
							></el-button>
						</el-tooltip>
						<!-- <el-tooltip class="item" effect="light" content="提交" placement="top">
							<el-button
								v-if="scope.row.zt != '1'"
								@click="tujiao(scope.row)"
								type="primary"
								class="operate_show_btn iconfont icontijiao"
								size="small"
							></el-button>
						</el-tooltip>-->
					</template>
				</el-table-column>
			</el-table>
		</el-row>
		<el-row>
			<el-pagination
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page.sync="pageForm.pageNum"
				:page-sizes="[10, 20, 30, 40]"
				:page-size="pageForm.pageSize"
				layout="total, sizes, prev, pager, next, jumper"
				:total="pageForm.total"
			></el-pagination>
		</el-row>
	</div>
</template>

<script>
import {
	getList,
	deletes
} from '@/api/grainCoManage/warehousingLogistics/recordAudit/index.js'

export default {
	name: 'index',
	data() {
		return {
			orgLength:"",
			listLoading: false,
			yearOptions: [
				{
					code: '91000001',
					value: '待提交'
				},
				{
					code: '91000004',
					value: '已提交'
				},
				{
					code: '91000013',
					value: '已通过'
				},
				{
					code: '91000041',
					value: '旗县已通过'
				},
				{
					code: '91000042',
					value: '旗县已驳回'
				},
				{
					code: '91000043',
					value: '盟市已通过'
				},
				{
					code: '91000044',
					value: '盟市已驳回'
				},
				{
					code: '91000046',
					value: '自治区已驳回'
				}
			],
			searchForm: {
				dwmc: null,
				qyxz: null,
				zt: null
			},
			pageForm: {
				pageNum: 1,
				pageSize: 10,
				total: 0
			},
			ssss: [],
			tableData: [{}]
		}
	},
	created() {
		var sss = sessionStorage.getItem('userRole')
		this.ssss = sss.split(',')
		this.getListInfo()
		if(sessionStorage.getItem("orgCode").length == 5){
			this.orgLength = 5
		}else if(sessionStorage.getItem("orgCode").length == 8){
			this.orgLength = 8
		}else if(sessionStorage.getItem("orgCode").length == 11){
			this.orgLength = 11
		}
	},
	methods: {
		chongzhi() {
			this.searchForm = {
				dwmc: null,
				qyxz: null,
				zt: null,
				roleCode: this.ssss
			}
		},
		getListInfo() {
			let data = {
				flag: true,
				roleCode: this.ssss,
				ssqydm: sessionStorage.getItem('ssqydm'),
				dwmc: this.searchForm.dwmc,
				qyxz: this.searchForm.qyxz,
				zt: this.searchForm.zt,
				pageNum: this.pageForm.pageNum,
				pageSize: this.pageForm.pageSize
			}
			getList(data).then((res) => {
				console.log(res, 'ssss')
				if (res.infoCode == '200') {
					this.tableData = res.data.items
					this.pageForm.total = Number(res.data.total)
				} else if (res.infoCode == '204') {
					this.tableData = []
				}
			})
		},
		searchInfo() {
			this.getListInfo()
		},
		showInfo(row) {
			console.log(row, 'sssssssssss2222')
			this.$router.push({
				path: '/grainCoManage/warehousingLogistics/recordAudit/details',
				query: {
					babm: row.babm,
					type: 'shows'
				}
			})
		},
		editMe(row) {
			this.$router.push({
				path: '/grainCoManage/warehousingLogistics/recordAudit/details',
				query: {
					babm: row.babm,
					taskId: row.rwmc,
					lcid: row.lcid,
					type: 'edits'
				}
			})
		},
		update() {
			this.$router.push({
				path:
					'/grainCoManage/warehousingLogistics/recordAudit/details?type=edit'
			})
		},
		addApply() {
			this.$router.push({
				path:
					'/grainCoManage/warehousingLogistics/recordAudit/details?type=add'
			})
		},
		delate() {
			this.$message({
				type: 'success',
				message: '删除成功'
			})
		},

		tujiao() {
			this.$message({
				type: 'success',
				message: '提交成功'
			})
		},
		handleSizeChange(val) {
			this.pageForm.pageSize = val
			this.getListInfo()
		},
		handleCurrentChange(val) {
			this.pageForm.pageNum = val
			this.getListInfo()
		}
	}
}
</script>

<style scoped>
.input-w-220 {
	width: 220px;
}
</style>
