<script>
import QuoteSearch from "./primary/quoteSearch.vue";
import QuoteTable from "./primary/quoteTable.vue";
import {queryQuotePage, queryQuoteRoleUser, removeQuote, saveQuote, updateQuote} from "../../../api/quote/quote";
import {getSiteAndBuByUserName} from "../../../api/eam/eam";
import CustomerTable from "../../../components/selector/table/customerTable.vue";
import BuSelect from "../../../components/selector/select/BuSelect.vue";
import ProjectTable from "../../../components/selector/table/projectTable.vue";
import {queryCustomerList} from "../../../api/customer/customer";
import {queryProjectList} from "../../../api/project/project";
import QuoteDetail from "./detail/quoteDetail.vue";
import ChooseListEam from "../common/Chooselist_eam.vue";

export default {
  name: "quote",
  components: {ChooseListEam,QuoteDetail, ProjectTable, BuSelect, CustomerTable, QuoteTable, QuoteSearch},
  menuId:5011,
  data(){
    return{
      total: 0,
      no:1,
      size: 20,
      quote:{
        id: null,
        site:"",
        quoteNo: "",
        customerInquiryNo: "",
        insideInquiryNo: "",
        buNo: "",
        buId: null,
        versionNo: "",
        status:'',
        quoteVersionNo: "",
        customerNo: "",
        customerDesc: "",
        projectNo: "",
        projectDesc: "",
        currency: "",
        quoteDate: "",
        quoter: "",
        purchase: "",
        remark: "",
        createBy: "",
        createDate: "",
        updateBy: "",
        updateDate: "",
      },
      quoteForm:{
      },
      saveQuote:{
      },
      dataList:[],
      columns: [
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1BuDesc',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'buDesc',
          headerAlign: 'center',
          align: 'center',
          columnLabel: 'BU',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1QuoteVersionNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'quoteVersionNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '单据号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 180
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1QuoteNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'quoteNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '报价单号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1QuoteDate',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'quoteDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '报价日期',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 100
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1CustomerNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'customerNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '客户编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1CustomerDesc',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'customerDesc',
          headerAlign: 'center',
          align: 'left',
          columnLabel: '客户名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1ProjectNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'projectNo',
          headerAlign: 'center',
          align: 'left',
          columnLabel: '项目编码',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200
        }, {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1ProjectDesc',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'projectDesc',
          headerAlign: 'center',
          align: 'left',
          columnLabel: '项目名称',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 200
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1QuoterName',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'quoterName',
          headerAlign: 'center',
          align: 'left',
          columnLabel: '报价专员',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1PurchaseName',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'purchaseName',
          headerAlign: 'center',
          align: 'left',
          columnLabel: '采购专员',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1Currency',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'currency',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '货币',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1Status',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'status',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '状态',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1CustomerInquiryNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'customerInquiryNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '客户报价单号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1InsideInquiryNo',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'insideInquiryNo',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '内部询价单号',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1CreateBy',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'createBy',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '创建人',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1CreateDate',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'createDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '创建时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1UpdateBy',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'updateBy',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '更新人',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5011,
          serialNumber: '5011Table1UpdateDate',
          tableId: '5011Table1',
          tableName: '报价信息表',
          columnProp: 'updateDate',
          headerAlign: 'center',
          align: 'center',
          columnLabel: '更新时间',
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: '',
          columnWidth: 120
        },
      ],
      searchLoading: false,
      saveVisible: false,
      saveLoading: false,
      activeName:'detail',
      userBuList: [],
      saveRules: {
        buId:[{required: true, message: '请选择BU', trigger: ['blur','change']}],
        customerNo:[{required: true, message: '请输入客户编码', trigger: ['blur','change']}],
        customerDesc:[{required: true, message: '请输入客户名称', trigger: ['blur','change']}],
        projectNo:[{required: true, message: '请输入项目编码', trigger: ['blur','change']}],
        projectDesc:[{required: true, message: '请输入项目名称', trigger: ['blur','change']}],
        currency:[{required: true, message: '请输入币种', trigger: ['blur','change']}],
        quoteDate:[{required: true, message: '请选择报价日期', trigger: ['blur','change']}],
        quoter:[{required: true, message: '请输入报价专员', trigger: ['blur','change']}],
        purchase:[{required: true, message: '请输入询价专员', trigger: ['blur','change']}],
      },
      customerVisible:false,
      projectVisible:false,
      quoterVisible:false,
      purchaseVisible:false,
      currentQuote:{

      },
      userVisible:false,
      userTitle:'人员信息',
      user:{
        username:'',
        userDisplay:'',
        active:'',
        buId:null,
        roleNo:'',
      },
      userDataList:[],
      tagNo:undefined,
    }
  },
  methods:{
    handleSearch(){
      let params = {
        ...this.quoteForm,
        no: this.no,
        size: this.size,
      }
      this.searchLoading = true
      queryQuotePage(params).then(({data})=>{
        if (data && data.code === 0){
          this.dataList = data.rows
          this.total = data.total
          if (this.total > 0){
            this.currentQuote = {...this.dataList[0]}
          }else {
            this.currentQuote = {}
          }
        }else {
          this.$message.error(data.msg)
        }
        this.searchLoading = false
      }).catch(error=>{
        this.$message.error(error)
        this.searchLoading = false
      })
    },
    handleSave(row){
      this.$nextTick(()=>{
        if (this.$refs.saveForm){
          this.$refs.saveForm.clearValidate();
        }
      })
      if (row){
        this.saveQuote = {
          ...row
        }
      }else {
        this.saveQuote = {
          ...this.quote,
        }
        this.$nextTick(()=>{
          this.saveQuote.buId = this.userBuList.length > 0? this.userBuList[0].id:null;
        })
      }
      this.saveVisible = true
    },
    handleSizeChange(size){
      this.size = size
      this.handleSearch();
    },
    handlePageChange(no) {
      this.no = no
      this.handleSearch();
    },
    handleQueryBu(){
      let params = {
        username: this.$store.state.user.name,
      }
      getSiteAndBuByUserName(params).then(({data}) => {
        if (data && data.code === 0) {
          this.userBuList = data.rows
        }else {
          this.$message.warning(data.msg)
        }
      }).catch((error)=>{
        this.$message.error(error)
      })
    },
    handleSaveOrUpdateQuote(){
      this.$refs.saveForm.validate((valid,obj) => {
        if (valid){
          if (this.saveQuote.id){
            this.handleUpdateQuote();
          }else {
            this.handleSaveQuote();
          }
        }else {
          let i = 1;
          for (let key in obj){
            this.$message.warning(obj[key][0].message)
            if (i === 1){
              return
            }
            i++;
          }
        }
      })
    },
    handleSaveQuote(){
      let params = {
        ...this.saveQuote,
        status: '草稿',
        action: 'Y',
        createBy: this.$store.state.user.name,
      }
      this.saveLoading = true
      saveQuote(params).then(({data})=>{
        if (data && data.code === 0){
          this.saveVisible = false
          this.$message.success(data.msg)
        }else {
          this.$message.warning(data.msg)
        }
        this.handleSearch();
        this.saveLoading = false
      }).catch((error)=>{
        this.$message.error(error)
        this.saveLoading = false
      })
    },
    handleUpdateQuote(){
      let params = {
        ...this.saveQuote,
        updateBy: this.$store.state.user.name,
      }
      this.saveLoading = true
      updateQuote(params).then(({data})=>{
        if (data && data.code === 0){
          this.saveVisible = false
          this.$message.success(data.msg)
        }else {
          this.$message.warning(data.msg)
        }
        this.handleSearch();
        this.saveLoading = false
      }).catch((error)=>{
        this.$message.error(error)
        this.saveLoading = false
      })
    },
    customerDblClick(row){
      this.saveQuote.customerNo = row.customerNo
      this.saveQuote.customerDesc = row.customerDesc
      this.customerVisible = false
    },
    projectDblClick(row){
      this.saveQuote.projectNo = row.projectNo
      this.saveQuote.projectDesc = row.projectDesc
      this.projectVisible = false
    },
    handleRemove(row){
      console.log(row)
      this.$alert('确认删除该报价信息吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.handleRemoveQuote(row)
      }).catch(() => {

      })
    },
    handleRemoveQuote(row){
      let params = {
        id: row.id,
      }
      removeQuote(params).then(({data})=>{
        if (data && data.code === 0){
          this.$message.success(data.msg)
          this.handleSearch();
        }else {
          this.$message.warning(data.msg)
        }
      }).catch((error)=>{
        this.$message.error(error)
      })
    },
    customerNoBlur(){
      let params = {
        customerNo: this.saveQuote.customerNo,
        createBy: this.$store.state.user.name,
      }
      queryCustomerList(params).then(({data}) => {
        if (data && data.code === 0) {
          if (data.rows.length === 1){
            this.saveQuote.customerDesc = data.rows[0].customerDesc
          }else {
            this.saveQuote.projectNo = ''
            this.saveQuote.projectDesc = ''
            this.saveQuote.customerDesc = ''
          }
        }else {
          this.$message.warning(data.message)
        }
      }).catch((error) => {
        this.$message.error(error)
      })
    },
    projectNoBlur(){
      let params = {
        projectNo: this.saveQuote.projectNo,
        customerNo: this.saveQuote.customerNo,
        createBy: this.$store.state.user.name,
        buId: this.saveQuote.buId,
      }
      queryProjectList(params).then(({data})=>{
        if (data && data.code === 0) {
          if (data.rows.length === 1) {
            this.saveQuote.projectDesc = data.rows[0].projectDesc
          }else {
            this.saveQuote.projectDesc = ''
          }
        }else {
          this.$message.warning(data.msg)
        }
      }).catch((error)=>{
        this.$message.error(error)
      })
    },
    handleRowClick(row){
      this.currentQuote = {...row}
    },
    userDblClick(row){
      if (this.quoterVisible){
        this.saveQuote.quoter = row.username
        this.quoterVisible = false
      }else if (this.purchaseVisible){
        this.saveQuote.purchase = row.username
        this.purchaseVisible = false
      }
      this.userVisible = false
    },
    handleQuoterClick(){
      this.userTitle = '报价专员'
      this.user.username = this.saveQuote.quoter
      this.user.userDisplay = ''
      this.user.active = ''
      this.user.buId = this.saveQuote.buId
      this.user.roleNo = 'QUOTER'
      this.quoterVisible = true
      this.handleQueryQuoteRoleUser();
      this.userVisible = true
    },
    handlePurchaseClick(){
      this.userTitle = '采购专员'
      this.user.username = this.saveQuote.purchase
      this.user.userDisplay = ''
      this.user.active = ''
      this.user.buId = this.saveQuote.buId
      this.user.roleNo = 'PURCHASE'
      this.purchaseVisible = true
      this.handleQueryQuoteRoleUser();
      this.userVisible = true
    },
    handleQueryQuoteRoleUser(){
      let params = {
        ...this.user,
      }
      this.userDataList = []
      queryQuoteRoleUser(params).then(({data})=>{
        if (data && data.code === 0){
          this.userDataList = data.rows
        }else {
          this.$message.warning(data.msg)
        }
      }).catch((error)=>{
        this.$message.error(error)
      })
    },
    getBaseList(val){
      this.tagNo = val
      this.$nextTick(()=>{
        let strVal = ''
        if (val === 512){
          strVal = this.saveQuote.currency;
          this.$refs.baseList.init(val,strVal)
        }
      })
    },
    getBaseData(val){
      if (this.tagNo === 512){
        this.saveQuote.currency = val.Currency
      }
    }
  },
  created() {
    this.quoteForm = {
      ...this.quote,
      createBy: this.$store.state.user.name,
    }
    this.handleQueryBu();// 查询 BU
    this.handleSearch();// 查询报价信息
  },
  watch:{
    'quoteForm.customerNo'(newVal, oldVal){
      this.quoteForm.customerNo = newVal.toUpperCase()
    },
    'quoteForm.projectNo'(newVal, oldVal){
      this.quoteForm.projectNo = newVal.toUpperCase()
    },
    'quoteForm.quoteNo'(newVal, oldVal){
      this.quoteForm.quoteNo = newVal.toUpperCase()
    },
    'saveQuote.customerNo'(newVal, oldVal){
      this.saveQuote.customerNo = newVal.toUpperCase()
    },
    'saveQuote.projectNo'(newVal, oldVal){
      // this.saveQuote.projectNo = newVal.toUpperCase()
    },
  }
}
</script>

<template>
  <div>
    <quote-search v-model:quote="quoteForm" @search="handleSearch" @save="handleSave"></quote-search>
    <quote-table v-loading="searchLoading" :current-row="currentQuote" :columns="columns" style="margin-top: 5px"
                 @save="handleSave" @remove="handleRemove" @rowClick="handleRowClick"
                 :data-list="dataList" :height="'35vh'">

    </quote-table>
    <el-pagination @size-change="handleSizeChange"
                   @current-change="handlePageChange"
                   :current-page="no"
                   :page-sizes="[20, 50, 100, 200, 500]"
                   :page-size="size"
                   :total="total"
                   layout="total,sizes, prev, pager, next, jumper">
    </el-pagination>
    <el-tabs v-model="activeName" >
      <el-tab-pane label="报价明细" name="detail">
        <quote-detail :quote="currentQuote" :height="'33vh'"></quote-detail>
      </el-tab-pane>
    </el-tabs>

    <el-dialog :title="saveQuote.id? '报价信息:'+ saveQuote.quoteVersionNo : '报价信息'" v-drag :close-on-click-modal="false" :visible.sync="saveVisible" width="500px" >
      <el-form ref="saveForm" :model="saveQuote" :rules="saveRules" label-position="top" label-width="100px">
        <el-row :gutter="10">
          <el-col :span="16">
            <el-form-item label="BU" prop="buId" :show-message="false">
              <bu-select v-model="saveQuote.buId" :disabled="saveQuote.id > 0"></bu-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="客户询价单号" prop="customerInquiryNo" :show-message="false">
              <el-input v-model="saveQuote.customerInquiryNo"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="内部询价单号" prop="insideInquiryNo" :show-message="false">
              <el-input v-model="saveQuote.insideInquiryNo"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="客户编码" prop="customerNo" :show-message="false">
              <span slot="label">
                <a @click="customerVisible = true">客户编码</a>
              </span>
              <el-input v-model="saveQuote.customerNo" @blur="customerNoBlur"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="客户描述" prop="customerDesc" :show-message="false">
              <el-input v-model="saveQuote.customerDesc" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="项目编码" prop="projectNo" :show-message="false">
              <span slot="label" v-if="saveQuote.customerNo && saveQuote.customerDesc">
                <a @click="projectVisible = true" >项目编码</a>
              </span>
              <el-input v-model="saveQuote.projectNo" @blur="projectNoBlur"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="16">
            <el-form-item label="项目描述" prop="projectDesc" :show-message="false">
              <el-input v-model="saveQuote.projectDesc" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="币种" prop="currency" :show-message="false">
              <span slot="label">
                <a @click="getBaseList(512)">币种</a>
              </span>
              <el-input v-model="saveQuote.currency"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="报价日期" prop="quoteDate" :show-message="false">
              <el-date-picker style="width: 100%" v-model="saveQuote.quoteDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd'></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="10">
          <el-col :span="8">
            <el-form-item label="报价专员" prop="quoter" :show-message="false">
              <span slot="label">
                <a @click="handleQuoterClick" >报价专员</a>
              </span>
              <el-input v-model="saveQuote.quoter"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="采购专员" prop="purchase" :show-message="false">
              <span slot="label">
                <a @click="handlePurchaseClick" >采购专员</a>
              </span>
              <el-input v-model="saveQuote.purchase"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark" class="auto" :show-message="false">
              <el-input v-model="saveQuote.remark" :rows="3" type="textarea"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleSaveOrUpdateQuote">确 定</el-button>
        <el-button @click="saveVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="userTitle" v-drag :visible.sync="userVisible" width="500px" modal-append-to-body :close-on-click-modal="false">
      <el-form :model="user" label-position="top">
        <el-row :gutter="10">
          <el-col :span="6">
            <el-form-item label="用户账号" prop="name">
              <el-input v-model="user.username"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="用户名" prop="name">
              <el-input v-model="user.userDisplay"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="是否在用">
              <el-select filterable v-model="user.active" style="width: 100%">
                <el-option label="全部" value=""></el-option>
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label=" " >
              <el-button type="primary" @click="handleQueryQuoteRoleUser">查询</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table
        :height="300"
        :data="userDataList"
        border
        @row-dblclick="userDblClick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="status"
          header-align="center"
          align="center"
          label="是否在用">
          <template slot-scope="scope">
            <span v-if="scope.row.status === 1">是</span>
            <span v-if="scope.row.status === 0">否</span>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <customer-table ref="customerTable" v-if="saveVisible" v-model="customerVisible" :height="300" @dblclick="customerDblClick" :customer-no="saveQuote.customerNo"></customer-table>
    <project-table  ref="projectTable"  v-if="saveVisible" v-model="projectVisible"  :height="300" @dblclick="projectDblClick"  :customer-no="saveQuote.customerNo" :project-no="saveQuote.projectNo" :bu-id="saveQuote.buId"></project-table>
    <choose-list-eam ref="baseList" @getBaseData="getBaseData"></choose-list-eam>
  </div>
</template>

<style scoped>
.auto /deep/ .el-form-item__content{
  height: auto;
  line-height: 1.5;
}

.el-table /deep/ .cell{
  height: auto;
  line-height: 1.5;
}
</style>
