<template>
  <div class="edit-add-detail">
    <div class="crumbs">
      <Breadcrumb
        :breadcrumbOpt="breadcrumbOpt"
        svg-name="#icon-wodeqingqiu"
        @breadcrumb-click="handleClose"
      />
    </div>
    <div class="form-content">
      <el-form
        ref="formInfo"
        :model="parameter"
        label-width="auto"
        label-position="right"
        :rules="rules"
        v-loading="loading"
      >
        <template>
          <div class="rows">
            <div class="rows-left">
              <div class="rows-hr"></div>
            </div>
            <div class="rows-title">
              <div class="text-overflow">基本信息</div>
            </div>
          </div>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="供应商名称" prop="supplierName">
                <el-input
                  v-model="parameter.supplierName"
                  disabled
                  placeholder=""
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="企业名称" prop="enterpriseName">
                <el-input
                  v-model="parameter.enterpriseName"
                  @focus="open('orgunits')"
                  placeholder="请选择企业"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" v-if="rulesData.length != 0">
            <el-col :span="24">
              <el-form-item label="准入规则编码" prop="admissionConfigCode">
                <el-input
                  v-model="parameter.admissionConfigCode"
                  @focus="openRule"
                  clearable
                  placeholder="请选择准入规则编码"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="24">
              <el-form-item label="供应业务" prop="categoryCode">
                <el-cascader
                  ref="cascader"
                  @change="cascaderChange"
                  @remove-tag="removeTag"
                  :options="matData"
                  disabled
                  v-model="parameter.categoryCode"
                  :props="{
                    value: 'code',
                    label: 'name',
                    checkStrictly: true,
                    emitPath: false,
                    multiple:true
                  }"
                  placeholder="请选择准入规则编码"
                  style="width: 100%"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24" v-for="(item, index) in list" :key="item.id">
            <el-form-item :label="item.name" v-if="rulesData.length != 0">
              <el-upload
                class="upload-demo"
                ref="upload"
                :headers="headers"
                :action="action"
                :file-list="item.qualificationLabelList"
                :multiple="false"
                accept=".png,.jpg,.jpeg,.xlsx,.xls,.pdf,.docx,.doc,.zip,.rar"
                :before-upload="
                  (res) => {
                    return beforeUpload(res, item, index)
                  }
                "
                :on-progress="updateFile"
                :show-file-list="false"
                :on-success="(res) => handleSuccess(res, item, index)"
              >
                <el-button slot="trigger" size="small" type="primary"
                  >上传文件</el-button
                >
              </el-upload>
            </el-form-item>
            <el-table
              class="down"
              v-if="rulesData.length != 0"
              :data="item.qualificationLabelList"
              border
              stripe
              style="width: 100%; margin-top: 20px"
            >
              <el-table-column prop="qualificationCode" label="资质编码">
                <template slot-scope="scope">
                  <el-input
                    clearable
                    v-model="scope.row.qualificationCode"
                    placeholder="资质编码"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column prop="qualificationName" label="资质名称">
                <template slot-scope="scope">
                  <el-input
                    clearable
                    v-model="scope.row.qualificationName"
                    placeholder="资质名称"
                  ></el-input>
                </template>
              </el-table-column>
              <el-table-column
                prop="qualificationAcquisitionDate"
                label="有效开始期"
              >
                <template slot-scope="scope">
                  <el-date-picker
                    clearable
                    style="width: 100%"
                    v-model="scope.row.qualificationAcquisitionDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="有效开始期"
                  >
                  </el-date-picker>
                </template>
              </el-table-column>
              <el-table-column prop="expiryDate" label="有效截止期">
                <template slot-scope="scope">
                  <el-select
                    style="width: 100%"
                    clearable
                    v-model="scope.row.expiryDate"
                    placeholder="选择有效截止期"
                  >
                    <el-option
                      v-for="item in expiryList"
                      :key="item.value"
                      :label="item.name"
                      :value="item.name"
                    >
                    </el-option>
                    <el-option style="height: 100%">
                      <template>
                        <el-date-picker
                          value-format="yyyy-MM-dd"
                          v-model="scope.row.expiryDate"
                          style="width: 100%; margin-top: 10px"
                          clearable
                          placeholder="请选择有效期至"
                        ></el-date-picker>
                      </template>
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>

              <el-table-column
                prop="name"
                show-overflow-tooltip
                label="文件名称"
              ></el-table-column>
              <el-table-column width="150px" label="操作">
                <template slot-scope="scope">
                  <el-button
                    size="small"
                    type="text"
                    v-if="
                      scope.row.accessoryList &&
                      scope.row.accessoryList.length != 0
                    "
                  >
                    <a
                      target="_blank"
                      @click="downloadFile(scope.row.name, scope.row.url)"
                      >下载</a
                    >
                  </el-button>
                  <el-button
                    size="small"
                    type="text"
                    v-if="
                      scope.row.accessoryList &&
                      scope.row.accessoryList.length != 0
                    "
                    @click="deleteHandle(scope.row, scope.$index)"
                    >删除</el-button
                  >
                  <el-button
                    type="primary"
                    size="small"
                    @click="handleRecording(scope.row)"
                    v-else
                    >查看附件</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </el-row>
        </template>
      </el-form>
    </div>
    <div slot="footer" class="footer">
      <el-button @click="handleClose">{{ $t('domestic.cancel') }}</el-button>
      <el-button @click="handleSave" :loading="saveing" type="primary"
        >保存</el-button
      >
    </div>
    <expertOrgUnits
      @addDetail="(list) => addDetail(list, 'enterpriseList')"
      :useOrgList="enterpriseList"
      :needReturnKey="['code']"
      :multiple="false"
      title="组织单位"
      ref="orgunits"
    />
    <classificationDialog
      @load="getClass"
      ref="class"
      :useOrgList="classList"
    ></classificationDialog>
    <el-dialog
      title="附件查看"
      :visible.sync="dialogVisible"
      width="50%"
      :before-close="dialogBeforeClose"
    >
      <div>
        <el-table
          class="down"
          :data="fileList"
          border
          stripe
          style="width: 100%; margin-top: 20px"
        >
          <el-table-column prop="name" label="文件名称"></el-table-column>
          <el-table-column prop="size" label="文件大小">
            <template slot-scope="scope">
              <span>{{ scope.row.fileSize }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="上传时间">
            <template slot-scope="scope">
              <div>
                {{ scope.row.createTime }}
              </div>
            </template>
          </el-table-column>
          <el-table-column width="150px" label="操作">
            <template slot-scope="scope">
              <el-button size="small" type="text">
                <a
                  target="_blank"
                  @click="downloadFile(scope.row.name, scope.row.url)"
                  >下载</a
                >
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <rule-dialog
      ref="rules"
      @ruleData="getRule"
      :useOrgList="rulesList"
    ></rule-dialog>
  </div>
</template>

<script>
import supplierManger from '@/api/supplierManger.js'
import dictUtils from '@/components/dict/DictSelectUtils.js'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
import utils from '@/utils.js'
import expertOrgUnits from './expertOrgUnits.vue'
import {mapState} from 'vuex'
import classificationDialog from './classificationDialog.vue'
import multipleInput from '../../blacklistSupplier/component/multipleInput.vue'
import ruleDialog from './ruleDialog.vue'

export default {
  name: 'domesticDialog',
  components: {
    Breadcrumb,
    expertOrgUnits,
    dictUtils,
    multipleInput,
    classificationDialog,
    ruleDialog,
  },
  props: {
    editData: Object,
  },
  data() {
    return {
      saveing: false,
      breadcrumbOpt: [{breadcrumbName: '供应商准入'}, {breadcrumbName: '新增'}],
      rules: {
        enterpriseName: [
          {
            required: true,
            message: '请选择企业名称',
            trigger: ['blur', 'change'],
          },
        ],
        supplierName: [
          {
            required: true,
            message: '请选择供应商名称',
            trigger: ['blur', 'change'],
          },
        ],
        categoryName: [
          {
            required: true,
            message: '请选择供应商分类',
            trigger: ['blur', 'change'],
          },
        ],
        admissionConfigCode: [
          {
            required: true,
            message: '请选择准入规则编码',
            trigger: ['blur', 'change'],
          },
        ],
        qualificationsCodeList: [
          {
            required: true,
            message: '请选择资质类型',
            trigger: ['blur', 'change'],
          },
        ],
      },
      parameter: {
        type: 1,
        categoryCode: '',
        reviewStatus: 0,
        needProvideQualifications: 1,
        qualificationsCodeList: [],
        suppliersQualificationList: [],
        supplierTypeId: '',
        categoryName: '',
        supplierName: '',
        qualificationLabelList: [],
        admissionConfigCode: '',
      },
      options: [],
      classList: [],
      rulesData: [],
      rulesList: [],
      form: {
        qualificationLabelList: [],
      },
      suppliersQualificationList: [],
      enterpriseList: [],
      list: [],
      accessoryList: [],
      supplierList: [],
      dialogVisible: false,
      loading: false,
      fileList: [],
      currentData: [],
      nodes:[],
      matData: [],
      expiryList: [{id: 1, name: '永久', value: 1}],
    }
  },
  created() {
    this.supplierList = []
    this.currentUser = JSON.parse(sessionStorage.getItem('currentUserDetail'))
    this.parameter.supplierId = this.currentUser.org[0].orgId
    this.parameter.supplierName = this.currentUser.org[0].orgName
    this.parameter.supplierCode = this.currentUser.org[0].orgCode
    this.supplierList = [
      {
        id: this.currentUser.org[0].orgId,
        name: this.currentUser.org[0].orgName,
        code: this.currentUser.org[0].orgCode,
      },
    ]
    this.addModifyBtn()
    this.getQualification()
    this.getQualificationData()
  },
  computed: {
    ...mapState({
      headers: (state) => {
        return {Authorization: `Bearer ${state.login.currentUser.token}`}
      },
      action: function () {
        return window.context.portal + '/biz/universal/v1/minioUpload'
      },
    }),
  },
  methods: {
    getCompanyRules() {
      this.loading = true
      this.rulesData = []
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
        querys: [],
      }
      params.querys.push({
        group: 'main',
        operation: 'EQUAL',
        parentGroup: '',
        property: 'enterpriseId',
        relation: 'AND',
        value: this.parameter.enterpriseId,
      })
      this.$http
        .post('${portal}/admissionConfig/v1/queryQuaCategory', params)
        .then((res) => {
          this.rulesData = res.data.rows
          this.loading = false
        })
    },
    handleInput() {
      this.$refs['class'].add()
    },
    open(type) {
      this.$refs[type].add()
    },
    deleteTags(index, key) {
      if (!index) {
        this[key] = []
      } else {
        this[key].splice(index, 1)
      }
      if (key === 'enterpriseList') {
        this.$set(this.parameter, 'enterpriseName', '')
        this.$set(this.parameter, 'enterpriseId', '')
        this.$set(this.parameter, 'enterpriseCode', '')
      }
    },
    addDetail(list, key) {
      console.log(list, key, 1111111111)
      this[key] = list
      if (key === 'enterpriseList') {
        this.$set(this.parameter, 'enterpriseName', list[0].name)
        this.$set(this.parameter, 'enterpriseId', list[0].id)
        this.$set(this.parameter, 'enterpriseCode', list[0].code)
        this.getMatClass()
        this.getCompanyRules()
        this.$forceUpdate()
      } else {
        let arr = []
        list.forEach((item) => {
          arr.push(item.name)
        })
        this.$set(this.parameter, 'supplierName', arr.join(','))
      }
    },
    getClass(list) {
      this.parameter.categoryCode = list[0].code
      this.parameter.categoryName = list[0].name
      this.parameter.supplierTypeId = list[0].id
    },
    getByIdData(id) {
      supplierManger.getByIdManage(id).then((res) => {
        console.log(res, 'ress')
        this.loading = false
        let data = res.data
        this.enterpriseList = [
          {
            id: data.enterpriseId,
            code: data.enterpriseCode,
            name: data.enterpriseName,
          },
        ]
        this.supplierList = [
          {
            id: data.supplierId,
            code: data.supplierCode,
            name: data.supplierName,
          },
        ]
        this.parameter = data
        this.getMatClass()
        this.getCompanyRules()
        this.getAdmission()
        this.parameter.categoryCode = this.parameter.categoryCode.split(',')
        this.rulesList = []
        let arr = this.parameter.admissionConfigId.split(',')
        arr.forEach(item=>{
          this.rulesList.push({
            id:item
          })
        })
        if (this.parameter.qualificationsCode) {
          this.parameter.qualificationsCodeList =
            this.parameter.qualificationsCode.split(',')
        }
      })
    },
    getTreeData(data) {
      for (let i = 0; i < data.length; i++) {
        if (data[i].children.length < 1) {
          // 最后一级没有数据将children变成undefined
          delete data[i].children
        } else {
          // children不为空时继续调用该方法
          this.getTreeData(data[i].children)
        }
      }
      return data
    },
    // 获取企业物料分类
    getMatClass() {
      this.matData = []
      this.$http
        .post(
          '${portal}/bizMaterialCategory/v1/getEnterpriseCategoryTreeByCode?companyCode=' +
            this.parameter.enterpriseCode
        )
        .then((res) => {
          if (res.data.state) {
            let data = this.getTreeData(res.data.value)
            if (this.parameter.enterpriseCode == '00001513') {
              data.forEach((item) => {
                if (
                  item.code == '01' ||
                  item.code == '02' ||
                  item.code == '03' ||
                  item.code == '04' ||
                  item.code == '07'
                ) {
                  this.matData.push(item)
                }
              })
            } else {
              data.forEach((item) => {
                if (
                  item.code != '01' &&
                  item.code != '02' &&
                  item.code != '03' &&
                  item.code != '04' &&
                  item.code != '07'
                ) {
                  this.matData.push(item)
                }
              })
            }
          }
        })
    },
    cascaderChange(val) {
        this.cascaderCheck = true
      this.nodes = this.$refs['cascader'].$refs.panel.getCheckedNodes()
      console.log(this.nodes, 111111)
      this.parameter.categoryCode = val.toString()
    },
    removeTag(val) {
      this.$nextTick(() => {
        let data = this.$refs['cascader'].$refs.panel.getCheckedNodes(false)
        this.nodes = data
      })
    },
    getQualification() {
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
      }
      this.$http
        .post('${portal}/bizQualificationCategory/v1/page', params)
        .then((res) => {
          if (res.data.state) {
            let data = res.data.value.rows
            this.options = data
          }
        })
    },
    changeCode(val) {
      console.log(val, 'val')
      let data = dictUtils.getDictItemsFromCache('gysfl')
      data.forEach((item) => {
        if (item.value == val) {
          this.parameter.categoryName = item.name
        }
      })
    },
    changeQua(val) {
      console.log(val)
      this.parameter.qualificationsCode = val.join(',')
      if (this.breadcrumbOpt[1].breadcrumbName === '编辑') {
        this.suppliersQualificationList = []
        this.options.forEach((item) => {
          val.forEach((v) => {
            if (item.code == v) {
              this.suppliersQualificationList.push({
                qualificationCategoryId: item.id,
                qualificationCategoryCode: item.code,
                qualificationCategoryName: item.name,
                fileSize: item.fileSize,
                fileNum: item.fileNum,
              })
            }
          })
        })
      } else {
        this.suppliersQualificationList = []
        this.options.forEach((item) => {
          val.forEach((v) => {
            if (item.code == v) {
              this.suppliersQualificationList.push({
                qualificationCategoryId: item.id,
                qualificationCategoryCode: item.code,
                qualificationCategoryName: item.name,
                fileSize: item.fileSize,
                fileNum: item.fileNum,
              })
            }
          })
        })
      }
      this.$forceUpdate()
    },
    // 文件状态改变时的钩子，添加文件、上传成功和上传失败时都会被调用,function(file, accessoryList)
    handleSuccess(res, item, index) {
      this.loading = false
      if (res.state) {
        this.loading = false
      } else {
        this.loading = false
      }
      this.accessoryList = []
      this.accessoryList.push(res.value)
      item.qualificationLabelList.push({
        qualificationMemberId: this.parameter.supplierId,
        qualificationMember: this.parameter.supplierName,
        qualificationCode: '',
        qualificationAcquisitionDate: '',
        expiryDate: '',
        qualificationName: '',
        accessoryList: this.accessoryList,
        name: res.value.name,
        createTime: res.value.createTime,
        qualificationTypeCode: item.qualificationTypeCode,
        qualificationTypeName: item.qualificationTypeName,
      })
      item.qualificationMemberId = this.parameter.supplierId
      item.qualificationMember = this.parameter.supplierName
      this.parameter.qualificationLabelList = this.list
      this.$forceUpdate()
    },
    beforeUpload(file, row, index) {
      const isLt = file.size / 1024 / 1024 < row.fileSize
      if (!isLt) {
        this.$message.error(`上传的文件大小不能超过${row.fileSize}MB！`)
      }
      return isLt
    },
    updateFile() {
      this.loading = true
    },
    getQualificationData() {
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
        querys: [],
      }
      params.querys.push({
        group: 'main',
        operation: 'EQUAL',
        parentGroup: '',
        property: 'qualificationMemberId',
        relation: 'AND',
        value: this.parameter.supplierId,
      })
      this.$http
        .post('${portal}/bizQualificationLabel/v1/page', params)
        .then((res) => {
          this.currentData = res.data.value.rows
        })
    },
    //下载按钮回调
    downloadFile(name, url) {
      console.log(name, 'name')
      var a = document.createElement('a')
      var event = new MouseEvent('click')
      a.download = name
      a.target = '_blank'
      a.href = url
      a.dispatchEvent(event)
    },
    // 删除
    deleteHandle(row, i) {
      this.$confirm('是否确认删除该附件', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        if (row.id) {
          this.$http
            .post('${portal}/biz/universal/v1/delete?ids=' + row.id)
            .then((res) => {
              if (res.data.state) {
                this.$message.success('删除成功')
                this.modifychoData(this.$route.query.editRows)
              }
            })
        } else {
          this.list.forEach((item) => {
            if (item.qualificationLabelList) {
              item.qualificationLabelList.forEach((val, index) => {
                if (
                  val.qualificationTypeCode == row.qualificationTypeCode &&
                  index == i
                ) {
                  item.qualificationLabelList.splice(index, 1)
                }
              })
            }
          })
        }
      })
    },
    getAdmission() {
      let params = {
        pageBean: {
          page: -1,
          pageSize: -1,
        },
        querys: [],
      }
      params.querys.push(
        {
          group: 'main',
          operation: 'EQUAL',
          parentGroup: '',
          property: 'b.ENTERPRISE_ID_',
          relation: 'AND',
          value: this.enterpriseList[0].id,
        },
        {
          group: 'main',
          operation: 'IN',
          parentGroup: '',
          property: 'b.MAT_CATEGORY_ID_',
          relation: 'AND',
          value: this.parameter.supplierTypeId.split(','),
        }
      )
      this.loading = true
      this.$http
        .post('${portal}/admissionConfigQualification/v1/queryByPage', params)
        .then((res) => {
          this.list = res.data.rows.filter((item, index, self) => {
            return (
              self.findIndex(
                (t) => JSON.stringify(t.code) === JSON.stringify(item.code)
              ) === index
            )
          })
          let code = this.list.map((val) => {
            return val.code
          })
          this.list.forEach((item) => {
            item['qualificationLabelList'] = []
            item.qualificationTypeCode = item.code
            item.qualificationTypeName = item.name
            delete item.id
          })
          let data = {
            pageBean: {
              page: -1,
              pageSize: -1,
            },
            querys: [],
          }
          data.querys.push(
            {
              group: 'main',
              operation: 'IN',
              parentGroup: '',
              property: 'qualificationTypeCode',
              relation: 'AND',
              value: code,
            },
            {
              group: 'main',
              operation: 'EQUAL',
              parentGroup: '',
              property: 'qualificationMemberId',
              relation: 'AND',
              value: this.currentUser.org[0].orgId,
            }
          )
          this.$http
            .post('${portal}/bizQualificationLabel/v1/page', data)
            .then((res) => {
              this.loading = false
              let arr = res.data.value.rows

              this.list.forEach((val) => {
                arr.forEach((item) => {
                  if (val.qualificationTypeCode == item.qualificationTypeCode) {
                    val.qualificationLabelList.push(item)
                  }
                })
              })
              this.suppliersQualificationList = this.list
            })
        })
    },
    openRule() {
      this.$refs.rules.add(this.parameter)
    },
    getRule(data) {
      this.rulesList = data
      this.parameter.qualificationsCodeList = []
      this.parameter.admissionConfigCode = data
        .map((item) => {
          return item.code
        })
        .join(',')
      this.parameter.admissionConfigId = data
        .map((item) => {
          return item.id
        })
        .join(',')
      this.parameter.categoryName = data
        .map((item) => {
          return item.matCategoryName
        })
        .join(',')
      let code = data
        .map((item) => {
          return item.matCategoryCode
        })
        .join(',')
      this.parameter.categoryCode = code.split(',')
      this.parameter.supplierTypeId = data
        .map((item) => {
          return item.matCategoryId
        })
        .join(',')
      let qualificationList = []
      data.forEach((item) => {
        if (item.qualificationCategoryList.length != 0) {
          item.qualificationCategoryList.forEach((val) => {
            qualificationList.push(val)
          })
        }
      })
      qualificationList.forEach((item) => {
        this.parameter.qualificationsCodeList.push(item.code)
      })
      this.parameter.qualificationsCodeList = Array.from(
        new Set(this.parameter.qualificationsCodeList)
      )
      this.getAdmission()
      this.$forceUpdate()
    },
    handleRecording(rows) {
      this.$http
        .post('${portal}/bizQualificationLabel/v1/getById?id=' + rows.id)
        .then((res) => {
          if (res.data.state) {
            this.fileList = res.data.value.accessoryList
          }
          this.dialogVisible = true
        })
    },
    dialogBeforeClose() {
      this.dialogVisible = false
    },
    changeLevel(val) {
      this.getAdmission()
    },
    //编辑
    addModifyBtn() {
      let {id} = this.$route.params
      if (id) {
        this.loading = true
        this.getByIdData(id)
        this.breadcrumbOpt[1].breadcrumbName = '编辑'
      } else {
        this.breadcrumbOpt[1].breadcrumbName = '新增'
      }
    },
    // 关闭//面包屑点击
    handleClose() {
      if (this.breadcrumbOpt[1].breadcrumbName === '编辑') {
        this.$router.push({
          name: 'onboardingSupplier',
          params: {
            pageBean: this.$route.query.pageBean,
          },
        })
      } else {
        this.$router.push({
          name: 'onboardingSupplier',
        })
      }
      this.active = 0
      this.parameter = {}
    },
    // 保存
    handleSave() {
      if(this.parameter.categoryCode&&this.parameter.categoryCode.length){
        this.parameter.categoryCode = this.parameter.categoryCode.toString()
      }
      this.$refs.formInfo.validate((valid) => {
        if (valid) {
          this.saveing = true
          if (this.suppliersQualificationList.length != 0) {
            this.parameter.suppliersQualificationList =
              this.suppliersQualificationList
          }
          let params = {
            ...this.parameter,
            supplierList: this.supplierList,
          }
          let arr = []
          this.list.forEach((item) => {
            item.qualificationLabelList.forEach((val) => {
              arr.push(val)
            })
          })
          params.qualificationLabelList = arr
          console.log(params, 'params')
          supplierManger.saveManage(params).then((res) => {
            this.saveing = false
            if (res.data.state) {
              this.$confirm('保存成功，是否返回列表页?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'success',
              }).then(() => {
                this.$router.push({
                  name: 'onboardingSupplier',
                })
              })
            }
          })
        }
      })
    },
  },
}
</script>

<style lang="scss"
  scoped>
/deep/ .el-row {
  padding: 0 240px;
}

// 步骤条
.theSteps {
  background-color: white;
  padding: 10px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  margin-top: 10px;

  /deep/.el-steps {
    width: 50%;
  }

  /deep/.el-steps--simple {
    background-color: rgba($color: #000000, $alpha: 0);
  }
}

.rows {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 16px;
  padding: 10px 0;

  .rows-left {
    margin-right: 10px;

    .rows-hr {
      width: 3px;
      height: 18px;
      background-color: #0e6eff;
      border-radius: 2px;
    }
  }

  .rows-title {
    .text-overflow {
      width: 100%;
      font-size: 16px;
    }
  }
}
</style>
