<template>
  <div class="app-container">
    <el-form class="secbox" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="项目编号" prop="xmbh">
            <el-input
			style="width: 160px;"
              v-model="queryParams.xmbh"
              placeholder="输入项目编号"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8">
          <el-form-item label="投资方" prop="tzf">
            <el-input
              v-model="queryParams.tzf"
              placeholder="输入投资方名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col> -->
        <!-- <el-col :span="8">
          <el-form-item label="属地政府" prop="sdzf">
            <el-input
              v-model="queryParams.sdzf"
              placeholder="输入属地政府名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col> -->
        <el-col :span="8">
          <el-form-item label="创建日期" prop="noticeTitle">
            <el-date-picker
                 v-model="queryParams.params.begintime"
                  type="date"
				  value-format="yyyy-MM-dd"
                  placeholder="年 / 月 / 日">
                </el-date-picker>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8">
          <el-form-item label="逾期程度" prop="createBy">
            <el-select v-model="value" 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-col> -->
        <el-col :span="4">
         <el-form-item>
           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
		   
         </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <!-- 列表 -->
    <!-- 标签页 -->
	
    <div class="tabs" style="padding: 10px; padding-top: 50px;">
		<div class="btns flexcc" style="right: 10px;">
		  <div style="width: 25px;"></div>
		  <el-button type="success"  class="cbbtn" size="small" @click="handleExport">导出</el-button>
		</div>
        <div class="boxlist" v-for="(item,index) in noticeList" :key="index" v-if='noticeList.length != 0'>
          <div class="ltop flex ">
              <!-- <div class="check"> -->
                <!-- <img src="@/assets/images/project/check.png"/> -->
                <!-- <img src="@/assets/images/project/ncheck.png"/> -->
              <!-- </div> -->
             <div style="display: flex;flex-wrap: wrap;align-items: center;">
               <div class="tit">{{item.xmmc == null?'暂无数据' : item.xmmc}}</div>
               <div class="txt">项目编号：<span>{{item.xmbh == null?'暂无数据' : item.xmbh}}</span></div>
               <div class="txt">投资方：{{item.tzf == null?'暂无数据' : item.tzf}}</div>
               <div class="txt">属地政府：{{item.sdzf == null?'暂无数据' : item.sdzf}}</div>
             </div>
              <div class="flex1"></div>
			  <div>
				   <el-button type="success"  @click="hunge(item)"  class="cbbtn" size="small" >查看</el-button>
			  </div>
          </div>
          <div class="lbox">
            <div class="lboxl">
              <div class="lbtab">
                <div class="tit">实际投资总额</div>
                <div class="txt">{{item.sjtzze == null?'暂无数据' : item.sjtzze}} 亿元</div>
              </div>
              <div class="lbtab">
                <div class="tit">固定资产投资额</div>
                <div class="txt">{{item.sjgdzctze == null?'暂无数据' : item.sjgdzctze}} 万元</div>
              </div>
			  <div class="lbtab ">
			    <div class="tit">投资回收周期</div>
			    <div class="txt ">{{item.tzhszq == null?'暂无数据' : item.tzhszq}} 年</div>
			  </div>
              <div class="lbtab isno">
                <div class="tit">项目进度</div>
                <div class="txt coa"><dict-tag :options="dict.type.project_schedule" :value="item.progress"/></div>
              </div>
              
            </div>
        
            <div class="rbox">
              <div class="tit">签约日期：{{item.qyrq == null?'暂无数据' : item.qyrq}}</div>
              <div class="tit">投资方法人：{{item.fddbr == null?'暂无数据' : item.fddbr}}</div>
              <div class="tit">联系方式：{{item.lxfs == null?'暂无数据' : item.lxfs}}</div>
              <div class="tit">供地面积：{{item.gdmj == null?'暂无数据' : item.gdmj}}亩</div>
              <div class="tit">租赁厂房面积：{{item.zlcf == null?'暂无数据' : item.zlcf}}平</div>
              <div class="tit">流转土地面积：{{item.lztd == null?'暂无数据' : item.lztd}}亩</div>
            </div>
          </div>
        </div>
		
		<div v-if='noticeList.length == 0'>
		  <el-empty :image-size="200"></el-empty>
		</div>
          <Pagination
            v-show="total>0"
            :total="total"
            background
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
          />
    </div>

  </div>
</template>

<script>
// import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
import { listQyxx, getQyxx, delQyxx, addQyxx, updateQyxx } from "@/api/zhaoshang/qyxx"
export default {
  name: "Notice",
  dicts: ['sys_notice_status', 'sys_notice_type','project_schedule'], 
  components:{
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
	  ishsouetan:false,
      // 总条数
      total: 0,
      // 公告表格数据
      noticeList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
               pageSize: 10,
               xmId: null,
               xmbh: null,
               xmmc: null,
               beginTime: null,
               endTime: null,
               jgTime: null,
               rtTime: null,
			   params:{}
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        noticeTitle: [
          { required: true, message: "公告标题不能为空", trigger: "blur" }
        ],
        noticeType: [
          { required: true, message: "公告类型不能为空", trigger: "change" }
        ]
      },
	  tableMaxHeight:380,
    value:'',
    options: [{
              value: '选项1',
              label: '黄金糕'
            }, {
              value: '选项2',
              label: '双皮奶'
            }],
       activeName:'first',
       info:{},
    }
  },
  created() {
    this.getList()
  },
  computed: {
    dynamicStyle() {
      return {
        overflow:'auto',
        height:  this.tableMaxHeight + 'px',
      }
    }
    },
  methods: {
    /** 查询公告列表 */
    getList() {
      this.loading = true
	  this.queryParams.progress = 5
      listQyxx(this.queryParams).then(response => {
        this.noticeList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    handleClick(){

    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
              jsxxId: null,
              xmId: null,
              xmbh: null,
              xmmc: null,
              beginTime: null,
              endTime: null,
              jgTime: null,
              rtTime: null,
              createBy: null,
              createTime: null,
              updateBy: null,
              updateTime: null,
              remark: null
            }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.qyxxId)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
	hunge(row){
		console.log(row)
		this.$router.push({
		  path: '/zhaoshang/Information',
		  query: {
		  	'bh':row.xmbh,
			'id':row.xmId
		  }
		})
	},
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加公告"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const qyxxId = row.qyxxId || this.ids
      getJsxx(qyxxId).then(response => {
        this.form = response.data
        this.open = true
        this.title = "修改公告"
      })
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.qyxxId != undefined) {
            updateJsxx(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addJsxx(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const noticeIds = row.qyxxId || this.ids
	  delQyxx(noticeIds).then(response => {
	    this.$modal.msgSuccess("删除成功")
	    this.getList()
	  })
    },
	 handleExport() {
	      this.download('zhaoshangV3/qyxx/export', {
	        ...this.queryParams
	      }, `qyxx_${new Date().getTime()}.xlsx`)
	    }
  }
}
</script>
<style scoped lang="scss">
::v-deep{
  .secbox{
    .el-button{padding: 9px 15px;}
    .el-form-item__label{line-height: 40px;}
    // .el-input__inner{height: 40px;line-height: 40px;}
    // .el-form-item{min-width: 25%;}
  }
  .tabs{
    .el-tabs__item{padding-right: 0;color: #666666;line-height: 45px;height: 45px;padding-left: 0;}
    .is-active{color: #2777D0;font-weight: bold;}
  }
  .pagination-container{margin-top: 8px;}
}
.secbox{background: #FFFFFF;
border-radius: 4px;padding: 20px 16px 0;margin-bottom: 15px;}
.tabs{position: relative;background: #FFFFFF;padding-bottom: 25px;
  .tab{padding: 0 21px;}
  .tabimg{width: 14px;height: 14px;margin-right: 8px;}
  .tabcimg{width: 13px;height: 13px;margin-right: 9px;}
  .tabdimg{width: 14px;height: 15px;margin-right: 8px;}
  .btns{height: 45px;box-sizing: border-box;position: absolute;right: 0;top: 0;
    .btna{margin-left: 28px;font-weight: bold;
font-size: 14px;
    &.coa{color: #FE960E;}
    &.cob{color: #FF6969;}
      img{width: 12px;height: 14px;margin-right: 7px;}
    }
  }
  .cbbtn{padding: 0 12px;height: 32px;line-height: 32px;border-radius: 4px;font-weight: bold;
font-size: 14px;
color: #FFFFFF;}
.blist{padding: 10px 16px 0;}
}
</style>
<style lang="scss" scoped>
::v-deep {
 .el-popover{box-shadow: 0px 0px 10px 0px #D1D1D1;
 border-radius: 8px;border: none;}

}
 .boxlist{
   border-radius: 4px;margin-bottom: 17px;
   border: 1px solid #E6E6E6;
   .ltop{background: #F6FAFD;padding:13px 16px;display: flex;border-bottom: 1px solid #E6E6E6;align-items: flex-start;
      &.yqtop{background: #FFF4EF;}
      .check{width: 20px;height: 20px;margin-right: 13px;flex: 0 0 auto;
        img{width: 100%;height: 100%;}
      }
      .tit{font-weight: bold;font-size: 16px;color: #3D455B;margin-right: 53px;}
      .txt{font-size: 14px;color: #3d455b;margin-right: 49px;line-height: 20px;
        span{color:#1890ff ;}
      }
      .btna{margin-left: 28px;font-weight: bold;flex: 0 0 auto;
      font-size: 14px;line-height: 20px;
          &.coa{color: #FE960E;}
          &.cob{color: #FF6969;}
            img{width: 12px;height: 14px;margin-right: 7px;}
          }

   }
   .lbox{display: flex;align-items: center;
    .lboxl{width: 56%;flex: 0 0 auto;display: flex;align-items: center;flex-wrap: wrap;}
     .lbtab{display: flex;flex-direction: column;align-items: center;position: relative;padding: 0px 12px;box-sizing: border-box;flex: 1 0 auto;
      &::after{content: '';width: 1px;height: 44px;background: #E6E6E6;position: absolute;right: 0;top: 50%;margin-top: -22px;}
      &.isno::after{display: none;}
        .tit{font-size: 16px;color: #3D455B;margin-bottom: 6px;font-weight: bold;}
        .txt{font-size: 14px;color: #3D455B;
          &.coa{color: #1890ff;}
          &.cob{color: #00A854;}
          &.coc{color: #FF6969;}
          &.cod{color: #B4B4B4;}
          &.coe{color: #FE5A0E;}

        }
     }
     .rbox{background: #FAFAFA;min-height: 94px;flex: 1;display: flex;flex-wrap: wrap;align-items: center;padding: 15px 0;
      .tit{font-weight: 500;font-size: 12px;color: #666666;line-height: 32px;padding-left: 23px;min-width: 33.3%;box-sizing: border-box;}
      .rboxa{flex: 1;display: flex;flex-wrap: wrap;
        .tit{min-width: 50%;}
      }
      .rbtns{margin-right: 23px;background: #E9FFF4;
border-radius: 4px;
border: 1px solid #00A854;color: #00A854;padding: 0 12px;line-height: 30px;box-sizing: border-box;}
     }
   }

 }
 .tipbox{font-weight: 500;font-size: 14px;color: #FE960E;}
</style>
