
<template>
  <div>
    <basicLayout 
      ref="list" 
      :oldFormPath="{
        add:'HDrpManagement/serveBillMag/components'
      }"
      tableName="serveBillTable" 
      idName="sa_serviceorderid" 
      :apiId="{query:20230206091703,del:20230206091803}"
      :options="options"
      :detailPath="{
        path:'/serveBillDetail'
      }"
      @listData="list">
      <div slot="custom" style="display:flex">
        <div class="label_center">
          <label  class="search__label">状态:</label>
          <el-select class="inline-24" v-model="where.status" placeholder="请选择状态" @change="selectChange" size="small" clearable>
            <el-option label="待指派" value="待指派"></el-option>
            <el-option label="待处理" value="待处理"></el-option>
            <el-option label="进行中" value="进行中"></el-option>
            <el-option label="已完成" value="已完成"></el-option>
          </el-select>
        </div>
        <div class="label_center">
          <label class="search__label" >提交日期:</label>
          <el-date-picker
              style="margin-right: 24px !important;"
              size="small"
              @change="dateChange"
              value-format="yyyy-MM-dd"
              v-model="where.date"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              clearable>
          </el-date-picker>
        </div>
      </div>
      <template v-slot:tbList="scope">
        <div v-if="scope.data.column.columnname == 'status'">
          <span style="color:#52c41a" v-if="scope.data.column.data[[scope.data.column.columnname]] == '进行中'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#3874f6" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '待处理'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#333333" v-else-if="scope.data.column.data[[scope.data.column.columnname]] == '新建'">{{scope.data.column.data[[scope.data.column.columnname]]}}</span>
          <span style="color:#3874f6" 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:#fa8c16" 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.city}-${scope.data.column.data.county}` }}
        </div>
        <div v-else>
          {{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]]:'--'}}
        </div>
      </template>
      <template v-slot:tbOpreation="scope">
      </template>
    </basicLayout>
  </div>
</template>

<script>
export default {
  data () {
    return {
      options:[],
      where: {
        status:'',
        date: ''
      }
    }
  },
  methods:{
    list (data) {
      console.log(data)
    },
    selectChange () {
      this.$refs.list.param.content.where = this.where
      this.$refs.list.listData()
    },
    dateChange (date) {
      if (date) {
        this.where.startdate = date[0]
        this.where.enddate = date[1]
      } else {
        this.where.startdate = ''
        this.where.enddate = ''
      }     
      this.$refs.list.param.content.where = this.where
      this.$refs.list.listData()
    }
  }
}

</script>
<style>
</style>