
<template>
  <div>
    <basicLayout 
      ref="basicLayout" 
      :oldFormPath="{
        add:'HManagement/clueManage/clue_public/modules',
        edit:'HManagement/clueManage/clue_public/modules'
      }"
      tableName="cluePublicTable" 
      idName="sat_orderclueid" 
      :apiId="{query:20221101094402,del:20221101100502}" 
      :options="options"
      :detailPath="{path:'/clueDetail'}"
      @listCreate="list"
    >
    <div slot="custom" style="display:flex">

    </div>
      <div slot="titleRight" style="display:flex;margin-left:10px">
        <!-- <distribution class="inline-16" v-if="tool.checkAuth($route.name,'distribution')" @onSuccess="$refs.basicLayout.listData()"></distribution> -->
        <distributionSaler v-if="tool.checkAuth($route.name,'distributionSaler')" @onSuccess="$refs.basicLayout.listData()"></distributionSaler>
      </div>
      <template v-slot:tbList="scope">
        <div v-if="scope.data.column.columnname == 'status'">
          <span style="color:#cccccc" v-if="scope.data.column.data[[scope.data.column.columnname]] == '已过期'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#52C41A" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '跟进中'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#FA8C16" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '待跟进'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#F60909" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '已成交'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#BBBBBB" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '无效'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span v-else>{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
        </div>
        <div v-else-if="scope.data.column.columnname == 'province' && scope.data.column.data.province">
          {{scope.data.column.data.province}}-{{scope.data.column.data.city}}-{{scope.data.column.data.county}}
        </div>
        <div v-else-if="scope.data.column.columnname == 'totalinvestment'">
          <span>{{scope.data.column.data[[scope.data.column.columnname]] !== 0?tool.formatAmount(scope.data.column.data[[scope.data.column.columnname]],2):'--'}}</span>
        </div>
        <div v-else-if="scope.data.column.columnname == 'costofconstruction'">
          <span>{{scope.data.column.data[[scope.data.column.columnname]] !== 0?tool.formatAmount(scope.data.column.data[[scope.data.column.columnname]],2):'--'}}</span>
        </div>
        <div v-else>
          {{scope.data.column.data[[scope.data.column.columnname]] || '--'}}
        </div>
<!--        <span v-if="!scope.data.column.data[scope.data.column.columnname] ">&#45;&#45;</span>-->
      </template>
    </basicLayout>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'

import distribution from './modules/distribution.vue'
import distributionSaler from './modules/distribution_saler.vue'
export default {
  components:{
    distribution,
    distributionSaler,
  },
  ...mapGetters({
    sys_options:'sys_options'
  }),
  data () {
    return {
      options:[],
      search:{},
      area:'0',
      areaList2:[],
      statusList:[],
      status:'',
      arealist:[]
    }
  },
  methods:{
    statusChange () {
      this.$refs.basicLayout.param.content.where.status = this.search.status
      this.$refs.basicLayout.listData()
    }
  },
  provide() {
    return {
      arealist:() => this.arealist,
    }
  },
  async created () {
    const res = await this.$store.dispatch('optiontypeselect','dataarea')
    this.areaList2 = res.data

    const res2 = await this.$store.dispatch('optiontypeselect','cluepublic')
    this.statusList = res2.data

    this.query_arealist()
  },
  methods: {
    list (params) {
      params.content.nocache = true
    },
    async query_arealist() {
      const res = await this.$api.requested({
        "classname": "system.tools",
        "method": "query_arealist",
        "content": {
        }
      })
      
      this.arealist = this.tool.createMenu(res.data)
    },

  }
}

</script>
<style>
</style>