<template>
  <div>
    <el-button size="mini" type="text" @click="contactBtn">联 系 人</el-button>
    <el-dialog title="新 建" :visible.sync="dialogFormVisible" width="80%">
      <div slot="title" style="font-size: 15px">
        关联缔约企业
      </div>
      <basicLayout 
        ref="basicLayout" 
        formPath="projectChange/andEnterprise/contacat" 
        tableName="endEnterpriseConcatTable" 
        idName="sa_project_partiesid" 
        :apiId="{query:20221027184902,del:20221027185002}" 
        :options="options"
        @listCreate="list">
        <div slot="custom"></div>
        <template v-slot:tbList="scope">
          <div v-if="scope.data.column.columnname == 'province'">
          {{`${scope.data.column.data['province']}、${scope.data.column.data['city']}、${scope.data.column.data['county']}`}}
        </div>
          <div v-else>
            {{scope.data.column.data[[scope.data.column.columnname]]}}
          </div>
        </template>
        <template v-slot:tbOpreation="scope">
          <delete-btn v-if="tool.checkAuth($route.name,'delete')" :id="scope.data.data.sa_project_parties_contactsid" @deleteSuccess="$refs.basicLayout.listData()" nameId="20221027185002" nameKey="sa_project_parties_contactsids"/>
        </template>
      </basicLayout>
    </el-dialog>
    
  </div>
</template>

<script>
export default {
  props:['rowData'],
  components:{},
  name: "index",
  data() {
    return {
      options:[],
      dialogFormVisible: false,
      contactList:'',
    }
  },
  provide () {
    return {
      rowData:() => this.rowData,
      contactList:() => this.contactList
    }
  },
  methods: {
    contactBtn () {
      this.dialogFormVisible = true
      this.getContact()
    },
    list (param) {
      param.content.sa_project_partiesid = this.rowData.sa_project_partiesid
    },
        /* 获取联系人列表 */
    async getContact () {
      let res = await this.$api.requested({
        "id": "20221022165503",
        "content": {
            "nocache":true,
            "sys_enterpriseid": this.rowData.sys_enterpriseid,
            "where": {
                "condition": "",
                "workaddress":1
            }
        }
      })
      this.contactList = res.data
      console.log(this.contactList);
    },
  }
}
</script>

<style scoped>

</style>