<template>
    <div class="page">
        <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">

                    </LayoutTable>


        <drawer-show ref="drawerform" @ok="getData" />
    </div>
</template>

<script>
    /** 表单弹出框模式需引入 */
    import drawerShow from "./drawershow";
    import table from "@/assets/mixins/table";
    import session from "@/assets/utils/session";
    export default {
        name: "PjEvaluateStatList",
        components: {
            drawerShow
},
        mixins: [table],
      created() {
        const siteid = session.getSession("siteid");
        this.query["siteId"]=siteid?siteid:1;

        this.query.groupList=["year","month","day"]
      },
        methods: {
          afterRender(data) {

            console.log("data",data.data)
        if(data.data.length>0){
          var obj = data.data[0];
          console.log(obj)

          //遍历obj

          Object.entries(obj).forEach(function([key, value]) {
            // 使用 key 和 value

            console.log("key:"+key+" value:"+value)

          });


        }




            console.log("config",this.config)

          },

            /** 重写新增方法 */
            toAdd(row) {
                this.$refs.drawerform.add(row);
            },
            /** 重写编辑方法 */
            toEdit(row) {
                this.$refs.drawerform.edit(row);
            },
            /** 重写查看方法 */
            toView(row) {
                this.$refs.drawerform.view(row);
            },

        },
        data() {
            return {
              year:true,
              month:true,
              day:true,
              groupList:[],
                config: {
                    search: [
                      {
                        name: "sectionNameList",
                        type: "select",
                        multiple:true,
                        label: "部门",
                      },

                      {
                        name: "hallNameList",
                        type: "select",
                        multiple:true,
                        label: "所属大厅",
                      },
                      {
                        name: "windowFromnumList",
                        type: "select",
                        multiple:true,
                        label: "窗口编号",
                      },

                      {
                        name: "pjOptionList",
                        type: "select",
                        multiple:true,
                        label: "评价选项",
                      },

                      {
                        name: "year",
                        type: "year",
                        label: "年",
                      },
                      {
                        name: "month",
                        type: "month",
                      },
                      {
                        name: "day",
                        type: "day",
                      },

                      {
                        name: "groupList",
                        type: "groupList",
                        label: "分组",
                      },

                    ],
                    columns: [
                        {type: "index",label: "序号",width: 50},

                        {label: "站点编码", prop: "siteCode"},

                        {label: "站点名称", prop: "siteName"},

                        {label: "部门", prop: "sectionName"},

                        {label: "评价选项", prop: "pjOption"},

                        {label: "窗口编号", prop: "windowFromnum"},

                        {label: "评价数量", prop: "pjCount",formatter: this.formatter},

                        {label: "年", width: 80, prop: "year",formatter: this.formatter},

                        {label: "月", width: 60, prop: "month",formatter: this.formatter},

                        {label: "日", width: 60, prop: "day",formatter: this.formatter},

                    ]
                }
            };
        }
    };
</script>
