<template>
  <div>
    <basicLayout
        ref="list"
        :oldFormPath="{add:'HManagement/notice/pate/modules'}"
        tableName="tablePate"
        idName="sat_notice_classid"
        :apiId="{query:20221101094603,del:20221101094703}"
        customTitle="通告板块"
    >
      <template v-slot:tbList="scope">
        <div v-if="scope.data.column.columnname === 'classname'">
          <el-input v-if="act_cus === scope.data.column.data.sat_notice_classid" size="mini" v-model="scope.data.column.data.classname" placeholder="输入版块名称"></el-input>
          <p v-else>{{ scope.data.column.data.classname }} <i class="el-icon-edit"></i></p>
        </div>
        <!-- <div v-else-if="scope.data.column.columnname === 'issecret'">
          <el-switch
              :disabled="act_cus !== scope.data.column.data.sat_notice_classid"
              v-model="scope.data.column.data.issecret"
              active-color="#ff4949"
              inactive-color="#ccc"
              :active-value="1"
              :inactive-value="0">
          </el-switch>
        </div> -->
        <div v-else>
          {{scope.data.column.data[[scope.data.column.columnname]]}}
        </div>
      </template>
      <template v-slot:tbOpreation="scope">
        <edit class="inline-16" :data="scope.data.data" @onSuccess="$refs.list.listData" @onEdit="onEdit"></edit>
      </template>
    </basicLayout>
<!--    <list ref="list">
      <add v-if="tool.checkAuth($route.name,'insert')" slot="add" @addClick="addClick"></add>
      <template v-if="tool.checkAuth($route.name,'delete')" v-slot:del="scope">
        <ondel :data="scope.data.data" @onSuccess="$refs.list.queryTypeList()"></ondel>
      </template>
      <template v-if="tool.checkAuth($route.name,'update')" v-slot:edit="scope">
        <edit class="inline-16" :data="scope.data.data" @onSuccess="$refs.list.queryTypeList()" @onEdit="onEdit"></edit>
      </template>
    </list>-->
  </div>
</template>

<script>
import list from './modules/list.vue'
import add from './modules/add.vue'
import edit from './modules/edit.vue'


export default {
  data(){
    return {
      act_cus:0,
      pateList:[],
      params:{
        "id": "20221101094603",
        "content": {
          "pageNumber": 1,
          "pageSize": 10,
          "where":{
            "condition":""
          }
        }
      },
    }
  },
  components:{
    list,
    add,
    edit,
  },
  methods: {
    addClick () {
      this.$refs.list.addPate()
    },
    onEdit (data) {
      this.cellClick(data)
    },
    cellClick (row) {
      this.act_cus = row.sat_notice_classid
    },
    // 新增或更新版块
    updatePate (row) {
      this.$api.requested({
        /*"classname": "webmanage.saletool.notice.noticeclass",
        "method": "insertormodify_noticeclass",*/
        "id":"20221101094503",
        "content": row
      }).then((res)=>{
        this.tool.showMessage(res)
        res.code === 1?this.act_cus = 0:''
        this.$refs.list.listData()
      })
    },
    // 插入新增行
    addPate () {
      this.act_cus = 0
      this.pateList.unshift({
        sat_notice_classid:0,
        classname:"",
        // issystem:0,
        // fisused:1,
        issecret:0,
        fcolor:'#ccc',
      })
    },

  }
}

</script>
<style>
</style>