<template>
  <el-form
    inline
    :model="form"
    ref="form"
    class="form-wrap"
    label-width="140px">
    <div class="dialog-info">
      <div class="block-title">基础信息</div>
      <el-form-item
        verify
        class="is-required"
        prop="ticketTypeId"
        label="票种">
        <el-select
          v-model="form.ticketTypeId"
          :disabled="dialogType === 'edit'"
          filterable
          @change="handleTicketTypeChange">
          <el-option
            v-for="item in ticketTypeList"
            :key="item.id"
            :label="getTicketTypeLabel(item)"
            :value="item.ticketTypeId"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item
        verify
        class="is-required"
        prop="otaSourceIds"
        label="分销商">
        <el-select
          v-model="form.otaSourceIds"
          multiple
          filterable
          :disabled="dialogType === 'edit'"
          @change="handleOtaSourceChange">
          <el-option
            v-for="item in otaList"
            :key="item.id"
            :label="item.otaSourceName"
            :value="item.otaSourceId"></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item
        verify
        class="is-required"
        label="市场价"
        prop="marketPrice">
        <el-input-number
          controls-position="right"
          v-model="form.marketPrice"
          :min="0"
          :precision="2"></el-input-number>
        <el-tooltip
          effect="dark"
          content="划线价"
          placement="top"
        >
          <i class="el-icon-info"></i>
        </el-tooltip>
      </el-form-item> -->
      <el-form-item
        verify
        class="is-required"
        label="结算价"
        prop="settlementPrice">
        <el-input-number
          controls-position="right"
          v-model="form.settlementPrice"
          :min="0"
          :precision="2"></el-input-number>
        <el-tooltip
          effect="dark"
          content="分销商和景区结算的价格"
          placement="top"
        >
          <i class="el-icon-info"></i>
        </el-tooltip>
      </el-form-item>
      <el-form-item
        verify
        class="is-required"
        label="售卖价"
        prop="salePrice">
        <el-input-number
          controls-position="right"
          v-model="form.salePrice"
          :min="0"
          :precision="2"></el-input-number>
        <el-tooltip
          effect="dark"
          content="分销商实际售卖价"
          placement="top"
        >
          <i class="el-icon-info"></i>
        </el-tooltip>
      </el-form-item>
      <el-form-item label="在售状态">
        <el-switch
          v-model="form.isSale"
          :inactive-value="0"
          :active-value="1">
        </el-switch>
        <span>{{ form.isSale ? '在售' : '禁售' }}</span>
      </el-form-item>
      <el-form-item
        label="库存"
        prop="totalStock">
        <el-input-number
          controls-position="right"
          v-model="form.totalStock"
          :min="-1"
          :precision="0"></el-input-number>
        <el-tooltip
          effect="dark"
          :content="stockContent"
          placement="top"
        >
          <i class="el-icon-info"></i>
        </el-tooltip>
      </el-form-item>
      <el-form-item
        verify
        class="is-required"
        label="是否实名制购票"
        prop="realNameType">
        <el-select v-model="form.realNameType">
          <el-option
            :value="0"
            label="不限"></el-option>
          <el-option
            :value="1"
            label="一证一人"></el-option>
          <el-option
            :value="2"
            label="一证多人"></el-option>
        </el-select>
      </el-form-item>
      <!-- <el-form-item
        v-if="hasXc"
        verify
        class="is-required"
        label="携程产品参数"
        prop="xcRealNameType">
        <el-select v-model="form.xcRealNameType">
          <el-option
            :value="1"
            label="一张一人需要证件"></el-option>
          <el-option
            :value="2"
            label="一张一人不需要证件"></el-option>
          <el-option
            :value="3"
            label="一单一人需要证件"></el-option>
          <el-option
            :value="4"
            label="一单一人不需要证件"></el-option>
        </el-select>
      </el-form-item> -->

      <div class="block-title">销售时间及使用时间</div>
      <div
        class="clearfix"
        style="width:100%"></div>
      <el-form-item
        verify
        class="is-required"
        prop="saleDateStart"
        label="售卖时间">
        <el-date-picker
          v-model="form.saleDateStart"
          type="date"
          :picker-options="dateOption"
          placeholder="选择日期时间"
          default-time="00:00:00">
        </el-date-picker>
      </el-form-item>
      <el-form-item
        verify
        prop="saleDateEnd"
        label-width="80"
        label="至">
        <el-date-picker
          v-model="form.saleDateEnd"
          type="date"
          :picker-options="dateOption"
          placeholder="选择日期时间"
          default-time="23:59:59">
        </el-date-picker>
      </el-form-item>
      <el-form-item
        verify
        class="is-required"
        label="使用日期"
        prop="useDateStart">
        <el-date-picker
          v-model="form.useDateStart"
          type="date"
          placeholder="开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item
        verify
        label="至"
        label-width="80"
        prop="useDateEnd">
        <el-date-picker
          v-model="form.useDateEnd"
          type="date"
          placeholder="结束时间">
        </el-date-picker>
      </el-form-item>

      <div class="block-title">
        添加分账子景点
      </div>
      <div>
        <div class="btn-wrap-left">
          <el-button
            plain
            class="add-btn"
            type="primary"
            @click="handleAddScenicSplit">
            添加
          </el-button>
        </div>
        <div class="table-box">
          <el-table
            border
            stripe
            :data="form.otaTicketTypeScenicSplitRequests">
            <el-table-column
              label="适用景点">
              <template slot-scope="scope">
                <el-select
                  v-model="scope.row.scenicId">
                  <el-option
                    v-for="item in scenicList"
                    :key="item.scenicId"
                    :label="item.name"
                    :value="item.scenicId"
                  >
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column
              label="应分金额"
              min-width="90">
              <template slot-scope="scope">
                <el-input-number
                  controls-position="right"
                  :min="0"
                  v-model="scope.row.price"
                ></el-input-number>
              </template>
            </el-table-column>
            <el-table-column
              width="90"
              class-name="align-item"
              label="操作">
              <template slot-scope="scope">
                <span
                  class="el-button el-button--primary el-button--small"
                  @click="delScenicSplit(scope.$index)">
                  <i class="el-icon-delete"></i>
                  删除
                </span>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>

      <!-- 美团场次票配置 -->
      <template v-if="showMtBatchConfig">
        <div class="block-title">
          美团场次票配置
          <el-tooltip
            effect="dark"
            content="当票种为场次票且分销商包含美团时，需要配置各场次的价格信息"
            placement="top">
            <i class="el-icon-info"></i>
          </el-tooltip>
        </div>
        <div>
          <div class="btn-wrap-left">
            <el-button
              plain
              class="add-btn"
              type="primary"
              @click="handleAddMtBatch">
              添加美团场次
            </el-button>
          </div>
          <div class="table-box">
            <el-table
              border
              stripe
              :data="form.mtProductLevelRequests">
              <el-table-column
                label="场次"
                min-width="150">
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.batchConfigId"
                    placeholder="请选择场次">
                    <el-option
                      v-for="item in currentBatchConfigList"
                      :key="item.batchConfigId"
                      :label="item.name"
                      :value="item.batchConfigId">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <!-- <el-table-column
                label="市场价"
                min-width="120">
                <template slot-scope="scope">
                  <el-input-number
                    controls-position="right"
                    :min="0"
                    :precision="2"
                    v-model="scope.row.marketPrice">
                  </el-input-number>
                </template>
              </el-table-column> -->
              <el-table-column
                label="美团价"
                min-width="120">
                <template slot-scope="scope">
                  <el-input-number
                    controls-position="right"
                    :min="0"
                    :precision="2"
                    v-model="scope.row.mtPrice">
                  </el-input-number>
                </template>
              </el-table-column>
              <el-table-column
                label="结算价"
                min-width="120">
                <template slot-scope="scope">
                  <el-input-number
                    controls-position="right"
                    :min="0"
                    :precision="2"
                    v-model="scope.row.settlementPrice">
                  </el-input-number>
                </template>
              </el-table-column>
              <el-table-column
                label="开始日期"
                min-width="150">
                <template slot-scope="scope">
                  <el-date-picker
                    v-model="scope.row.startDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="开始日期">
                  </el-date-picker>
                </template>
              </el-table-column>
              <el-table-column
                label="结束日期"
                min-width="150">
                <template slot-scope="scope">
                  <el-date-picker
                    v-model="scope.row.endDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="结束日期">
                  </el-date-picker>
                </template>
              </el-table-column>
              <el-table-column
                width="90"
                label="操作">
                <template slot-scope="scope">
                  <span
                    class="el-button el-button--primary el-button--small"
                    @click="delMtBatch(scope.$index)">
                    <i class="el-icon-delete"></i>
                    删除
                  </span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </template>

      <!-- 携程场次票配置 -->
      <template v-if="showXcBatchConfig">
        <div class="block-title">
          携程场次票配置
          <el-tooltip
            effect="dark"
            content="当票种为场次票且分销商包含携程时，需要配置各场次的资源信息"
            placement="top">
            <i class="el-icon-info"></i>
          </el-tooltip>
        </div>
        <div>
          <div class="btn-wrap-left">
            <el-button
              plain
              class="add-btn"
              type="primary"
              @click="handleAddXcBatch">
              添加携程场次
            </el-button>
          </div>
          <div class="table-box">
            <el-table
              border
              stripe
              :data="form.xcProductLevelRequests">
              <el-table-column
                label="场次"
                min-width="150">
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.batchConfigId"
                    placeholder="请选择场次">
                    <el-option
                      v-for="item in currentBatchConfigList"
                      :key="item.batchConfigId"
                      :label="item.name"
                      :value="item.batchConfigId">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                label="资源状态"
                min-width="120">
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.status"
                    placeholder="请选择">
                    <el-option
                      label="有效"
                      value="active">
                    </el-option>
                    <el-option
                      label="无效"
                      value="inactive">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                label="可售天数"
                min-width="120">
                <template slot-scope="scope">
                  <el-input-number
                    controls-position="right"
                    :min="0"
                    :precision="0"
                    v-model="scope.row.effectiveDays">
                  </el-input-number>
                </template>
              </el-table-column>
              <el-table-column
                label="提前预订"
                min-width="120">
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.requiredAdvanceBooking"
                    placeholder="请选择">
                    <el-option
                      label="无需提前"
                      :value="0">
                    </el-option>
                    <el-option
                      label="需要提前"
                      :value="1">
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                label="提前天数"
                min-width="100">
                <template slot-scope="scope">
                  <el-input-number
                    v-if="scope.row.requiredAdvanceBooking === 1"
                    controls-position="right"
                    :min="0"
                    :precision="0"
                    v-model="scope.row.advanceDays">
                  </el-input-number>
                  <span v-else>-</span>
                </template>
              </el-table-column>
              <el-table-column
                label="预订时间"
                min-width="120">
                <template slot-scope="scope">
                  <el-time-picker
                    v-if="scope.row.requiredAdvanceBooking === 1"
                    v-model="scope.row.advanceTime"
                    value-format="HH:mm"
                    format="HH:mm"
                    placeholder="选择时间">
                  </el-time-picker>
                  <span v-else>-</span>
                </template>
              </el-table-column>
              <el-table-column
                label="生效等待(分钟)"
                min-width="130">
                <template slot-scope="scope">
                  <el-input-number
                    v-if="scope.row.requiredAdvanceBooking === 1"
                    controls-position="right"
                    :min="0"
                    :precision="0"
                    v-model="scope.row.advanceMinutes">
                  </el-input-number>
                  <span v-else>-</span>
                </template>
              </el-table-column>
              <el-table-column
                width="90"
                label="操作">
                <template slot-scope="scope">
                  <span
                    class="el-button el-button--primary el-button--small"
                    @click="delXcBatch(scope.$index)">
                    <i class="el-icon-delete"></i>
                    删除
                  </span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </template>

    </div>
    <div class="dialog-btn-wrap">
      <el-button @click="reset">重置</el-button>
      <el-button
        @click="submit"
        type="primary">保存</el-button>
    </div>
  </el-form>
</template>

<script>
import { addOTATicketSale, updateOTATicketSale, getScenicList } from '@/api/otaTicketSale'
import moment from 'moment'
import { CategoryDict } from '@/const'

export default {
  props: {
    dialogType: {
      type: String,
      default: ''
    },
    currentItem: {
      type: Object,
      default: () => {}
    },
    otaList: {
      type: Array,
      default: () => []
    },
    ticketTypeList: {
      type: Array,
      default: () => []
    },
    batchConfigList: {
      type: Array,
      default: () => []
    },
    performList: {
      type: Array,
      default: () => []
    }
  },
  computed: {
    mtID () {
      const mtID = this.otaList.find(item => item.otaSourceName === '美团网酒旅')
      return mtID ? mtID.id : 9999
    },
    xcID () {
      const xcID = this.otaList.find(item => item.otaSourceName === '携程网')
      return xcID ? xcID.id : 9999
    },
    hasXc () {
      return this.form.otaSourceIds.some(id => !!this.otaList.find(item => item.otaSourceId === id && item.otaSourceCode === 'XC'))
    },
    hasMt () {
      return this.form.otaSourceIds.some(id => !!this.otaList.find(item => item.otaSourceId === id && item.otaSourceCode === 'MT'))
    },
    // 当前选中的票种
    currentTicketType () {
      return this.ticketTypeList.find(item => item.ticketTypeId === this.form.ticketTypeId) || {}
    },
    // 判断是否是场次票
    isBatchTicket () {
      return this.currentTicketType.category === 'batch' || this.currentTicketType.category === 'ticket'
    },
    // 当前票种的场次列表
    currentBatchConfigList () {
      return this.currentTicketType.batchConfigList || []
    },
    // 是否显示美团场次配置
    showMtBatchConfig () {
      return this.isBatchTicket && this.currentBatchConfigList.length > 0 && this.hasMt
    },
    // 是否显示携程场次配置
    showXcBatchConfig () {
      return this.isBatchTicket && this.currentBatchConfigList.length > 0 && this.hasXc
    }
  },
  data () {
    return {
      CategoryDict,
      visible: false,
      selectedBatch: {}, // 节目场次
      performBatchList: [], // 节目场次列表
      seatAreaList: [],
      seatAreas: [],
      batches: [],
      scenicList: [],
      projectName: localStorage.getItem('otaProject'),
      dateOption: {
        disabledDate (theTime) {
          let startTime = moment().format('YYYY-MM-DD') + ' 00:00:00'
          return moment(theTime).isBefore(startTime)
        }
      },
      form: {
        id: '',
        otaSourceIds: [],
        ticketTypeId: '',
        isSale: 1,
        salePrice: 0,
        marketPrice: 0,
        settlementPrice: 0,
        realNameType: 0,
        saleDateStart: moment().format('YYYY-MM-DD'),
        saleDateEnd: moment().add(20, 'years').endOf('year').format('YYYY-MM-DD'),
        useDateStart: moment().format('YYYY-MM-DD'),
        useDateEnd: moment().add(30, 'years').endOf('year').format('YYYY-MM-DD'),
        totalStock: -1, // -1代表不限库存
        xcRealNameType: '',
        otaTicketTypeScenicSplitRequests: [],
        mtProductLevelRequests: [],
        xcProductLevelRequests: []
      },
      showDeletedOption: false,
      deletedOption: {
        name: '',
        id: 0
      },
      stockContent: `1.-1代表无限库存
        2.已消耗库存数为用户历次下单门票张数之和，不包含退票
        3.修改库存数后，用户历史下单门票张数仍计算在内`
    }
  },
  watch: {
    visible (val) {
      this.reset()

      if (val) {
        this.getScenicList()
        this.showDeletedOption = false
        if (this.dialogType === 'edit' && this.currentItem) {
          this.form = Object.assign({}, this.form, this.currentItem)
          console.log('this.form', this.form)
          this.form.otaSourceIds = this.form.otaSourceId ? [this.form.otaSourceId] : []
          // 处理美团场次票数据回填
          if (this.currentItem.mtProductLevelList && this.currentItem.mtProductLevelList.length > 0) {
            this.form.mtProductLevelRequests = this.currentItem.mtProductLevelList.map(item => {
              // priceDate 格式可能是 "2026-03-29~2027-03-29" 或 "2026-03-29 - 2027-03-29"
              let startDate = ''
              let endDate = ''
              if (item.priceDate) {
                // 兼容 ~ 和 - 两种分隔符
                const separator = item.priceDate.includes('~') ? '~' : ' - '
                const dates = item.priceDate.split(separator)
                startDate = dates[0] ? dates[0].trim() : ''
                endDate = dates[1] ? dates[1].trim() : ''
              }
              return {
                batchConfigId: item.batchConfigId,
                marketPrice: item.marketPrice,
                mtPrice: item.mtPrice,
                settlementPrice: item.settlementPrice,
                startDate: startDate,
                endDate: endDate
              }
            })
          } else {
            this.form.mtProductLevelRequests = []
          }
          // 处理携程场次票数据回填
          if (this.currentItem.xcProductLevelList && this.currentItem.xcProductLevelList.length > 0) {
            this.form.xcProductLevelRequests = this.currentItem.xcProductLevelList.map(item => ({
              batchConfigId: item.batchConfigId,
              status: item.status || 'active',
              effectiveDays: item.effectiveDays || 0,
              requiredAdvanceBooking: item.requiredAdvanceBooking || 0,
              advanceDays: item.advanceDays || 0,
              advanceTime: item.advanceTime || '',
              advanceMinutes: item.advanceMinutes || 0
            }))
          } else {
            this.form.xcProductLevelRequests = []
          }
          // 处理分账子景点数据回填
          if (this.currentItem.otaTicketTypeScenicSplitList && this.currentItem.otaTicketTypeScenicSplitList.length > 0) {
            this.form.otaTicketTypeScenicSplitRequests = this.currentItem.otaTicketTypeScenicSplitList.map(item => ({
              scenicId: item.scenicId,
              price: item.price
            }))
          } else {
            this.form.otaTicketTypeScenicSplitRequests = []
          }
          // 有绑定场次的情况
          const batch = this.batchConfigList.find(v => v.id === this.form.batchConfigId)
          if (!batch && this.form.batchConfigId !== 0 && this.dialogType === 'edit') { // 有绑定场次 且该场次在不在现有可选范围中  ==》原来绑定的场次被删了 要保证正常显示 手动加这一项
            this.showDeletedOption = true
            this.deletedOption.name = this.form.batchConfigName
            this.deletedOption.id = this.form.batchConfigId
          } else {
            this.showDeletedOption = false
          }
        } else {
          this.form.batchConfigId = 0
          this.form.batchConfigIds = []
          this.form.mtProductLevelRequests = []
          this.form.xcProductLevelRequests = []
          this.form.otaTicketTypeScenicSplitRequests = []
        }
      }
    }
  },
  methods: {
    // 生成票种选项标签
    getTicketTypeLabel (item) {
      const category = this.CategoryDict[item.category] || ''
      let label = `${item.ticketTypeId}-${item.name}-${category}`
      // 只有场次票才显示场次信息
      if (item.category === 'batch') {
        const hasBatch = item.batchConfigList && item.batchConfigList.length > 0 ? '有场次' : '无场次'
        label += `--${hasBatch}`
      }
      return label
    },
    getScenicList () {
      getScenicList().then(res => {
        this.scenicList = res.data || []
      })
    },
    handleClose () {
      this.$parent.handleClose()
    },
    reset () {
      this.$refs.form.resetFields()
    },
    handleAddScenicSplit () {
      this.form.otaTicketTypeScenicSplitRequests.push({
        scenicId: '',
        price: 0
      })
    },
    delScenicSplit (index) {
      this.form.otaTicketTypeScenicSplitRequests.splice(index, 1)
    },
    // 添加美团场次配置
    handleAddMtBatch () {
      this.form.mtProductLevelRequests.push({
        batchConfigId: '',
        marketPrice: this.form.marketPrice || 0,
        mtPrice: this.form.salePrice || 0,
        settlementPrice: this.form.settlementPrice || 0,
        startDate: moment().format('YYYY-MM-DD'),
        endDate: moment().add(1, 'years').format('YYYY-MM-DD')
      })
    },
    // 删除美团场次配置
    delMtBatch (index) {
      this.form.mtProductLevelRequests.splice(index, 1)
    },
    // 添加携程场次配置
    handleAddXcBatch () {
      this.form.xcProductLevelRequests.push({
        batchConfigId: '',
        status: 'active',
        effectiveDays: 365,
        requiredAdvanceBooking: 0,
        advanceDays: 0,
        advanceTime: '',
        advanceMinutes: 0
      })
    },
    // 删除携程场次配置
    delXcBatch (index) {
      this.form.xcProductLevelRequests.splice(index, 1)
    },
    // 票种变更时清空场次配置
    handleTicketTypeChange () {
      this.form.mtProductLevelRequests = []
      this.form.xcProductLevelRequests = []
    },
    // 分销商变更时处理
    handleOtaSourceChange () {
      // 如果不再包含美团，清空美团配置
      if (!this.hasMt) {
        this.form.mtProductLevelRequests = []
      }
      // 如果不再包含携程，清空携程配置
      if (!this.hasXc) {
        this.form.xcProductLevelRequests = []
        this.form.xcRealNameType = ''
      }
    },
    submit () {
      this.$refs.form.validate((valid) => {
        if (valid) {
          switch (this.dialogType) {
            case 'add':
              this.addTicket()
              break
            case 'edit':
              this.updateTicket()
              break
          }
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    addTicket () {
      const params = Object.assign({}, this.form)
      delete params.id
      // 如果不是场次票或不包含美团，清空美团配置
      if (!this.showMtBatchConfig) {
        params.mtProductLevelRequests = []
      }
      // 如果不是场次票或不包含携程，清空携程配置
      if (!this.showXcBatchConfig) {
        params.xcProductLevelRequests = []
      }
      // 验证美团场次票配置
      if (this.showMtBatchConfig && params.mtProductLevelRequests.length > 0) {
        const hasEmptyBatch = params.mtProductLevelRequests.some(item => !item.batchConfigId)
        if (hasEmptyBatch) {
          this.$message.error('请选择美团场次票的场次')
          return
        }
      }
      // 验证携程场次票配置
      if (this.showXcBatchConfig && params.xcProductLevelRequests.length > 0) {
        const hasEmptyBatch = params.xcProductLevelRequests.some(item => !item.batchConfigId)
        if (hasEmptyBatch) {
          this.$message.error('请选择携程场次票的场次')
          return
        }
      }

      addOTATicketSale(params).then(res => {
        this.$message.success('添加成功')
        this.reset()
        this.handleClose()
        this.$emit('updateList')
      })
    },
    updateTicket () {
      const params = Object.assign({}, this.form)
      // 如果不是场次票或不包含美团，清空美团配置
      if (!this.showMtBatchConfig) {
        params.mtProductLevelRequests = []
      }
      // 如果不是场次票或不包含携程，清空携程配置
      if (!this.showXcBatchConfig) {
        params.xcProductLevelRequests = []
      }
      // 验证美团场次票配置
      if (this.showMtBatchConfig && params.mtProductLevelRequests.length > 0) {
        const hasEmptyBatch = params.mtProductLevelRequests.some(item => !item.batchConfigId)
        if (hasEmptyBatch) {
          this.$message.error('请选择美团场次票的场次')
          return
        }
      }
      // 验证携程场次票配置
      if (this.showXcBatchConfig && params.xcProductLevelRequests.length > 0) {
        const hasEmptyBatch = params.xcProductLevelRequests.some(item => !item.batchConfigId)
        if (hasEmptyBatch) {
          this.$message.error('请选择携程场次票的场次')
          return
        }
      }

      updateOTATicketSale(params).then(res => {
        this.$message.success('保存成功')
        this.reset()
        this.handleClose()
        this.$emit('updateList')
      })
    }
  }
}
</script>
<style lang="scss">
.manual-label {
  margin: 0;
  padding-right: 12px;
  box-sizing: border-box;
  text-align: right;
  display: inline-block;
  width: 140px;
}
.xs-input {
  width: 90px !important;
  .el-input, .el-input--small {
    width: 90px;
  }
}
.table-box {
  width: 100%;

  table {
    width: 100% !important;
  }
}
</style>
