<!--
 * @Description : 重构 - 编辑SPU
 * @Author      : jinxin
 * @Date        : 2022-10-15 22:18:07
-->

<template>
  <el-main class="wrap_box bg_white">
    <el-row class="title_box head_box">
      <el-col :span="24">
        <!-- <el-button type="primary">暂存</el-button> -->
        <el-button type="primary" :disabled="data.isClick" @click="clickCom">保存</el-button>
      </el-col>
    </el-row>
    <div class="content">
      <SkuComponents v-model:editId="data.editSkuId" v-model:saveData="data.newData" v-model:notice="data.noticeSku"
        @transmitTableInfo="transmitTableInfo">
      </SkuComponents>
    </div>
    <!-- 语言选择 -->
    <!-- <LanguageSelect v-model:isShow="data.isLanguageShow" @getLanguageId="getLanguageId" ></LanguageSelect> -->
    <!-- 语言提示 -->
    <LanguageTiptool v-model:isShowLanguageTipTool="data.isLanguageShow" @noticeShowBatch="noticeShowBatch"
      @closeCurrentPage="closeCurrentPage"></LanguageTiptool>
    <!-- 移动弹窗 -->
    <DragDialog v-model:isShow="data.dragDialogShow" @getIfClose="getIfClose" @isSureClosePage="isSureClosePage"
      v-if="data.dragDialogShow"></DragDialog>
  </el-main>
</template>

<script>
import { reactive, onMounted, defineComponent, provide, getCurrentInstance, watch, inject, ref, nextTick } from 'vue'
import SpuInfo from '../components/SetComponents/SpuInfo.vue'
import SkuComponents from '@/views/components/SetComponents/SkuComponents.vue'
import LanguageSelect from '@/views/components/LanguageSelect/LanguageSelect.vue'
import DragDialog from '@/views/components/SetComponents/DragDialog.vue'
import LanguageTiptool from '@/views/components/ProductListCom/LanguageTiptool.vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
export default defineComponent({
  name: "setSpu",
  components: {
    SpuInfo,
    SkuComponents,
    LanguageSelect,
    DragDialog,
    LanguageTiptool
  },
  setup () {
    // 生命周期
    const timer = ref(0)
    onMounted(() => {
      data.isLanguageShow = true
      data.noticeSku = data.noticeSku + 1
      data.editSkuId = route.currentRoute.value.query.id

      // 刷新页面
      if (!JSON.parse(sessionStorage.getItem('isResh'))) {
        reFreshPage()
        sessionStorage.setItem("isResh", true)
      }
    });
    // 获取实例
    const { proxy } = getCurrentInstance();
    let route = useRouter()
    let store = useStore()
    const reload = inject('reload')

    // 变量
    let data = reactive({
      isRefresh: false,
      isLanguageShow: false,
      dragDialogShow: false,
      editSkuId: '',
      getReqData: {},
      newData: {},
      spuInfo: {},
      isClick: false,
      transmitRquest: {},
      pushsku: {
        index: "",
        product_sku_id: null,
        sku: '',
        F_PAEZ_Combo2: '',
        fast: 0,
        is_war_for_price: 0,
        form_buy: null,
        supply_chain: '',
        FBARCODE: '',
        supplier: '',
        FUseOrgId: '',
        purchase_price: null,
        retail_special_offer: '',
        agent_special_offer: '',
        discount_begin_time: '',
        discount_end_time: '',
        customs_cn: '',
        customs_en: '',
        import_unit_price: '',
        customs_unit_price: '',
        customs_code: '',
        special_attr: null,
        // supplier_invoicing_unit: null,
        use_type: '',
        inland_delivered: ''
      },
      pushsku_params: {
        cover: '',
        product_sku_params_id: null,
        image: '',
        status: 0,
        attribute_id_1: '',
        attribute_id_2: '',
        attribute_id_3: '',
        attribute_id_4: '',
        attribute_id_5: '',
        attribute_id_6: '',
        attribute_id_7: '',
        attribute_id_8: '',
        attribute_id_9: '',
        attribute_id_10: '',
      },
      noticeSku: 1
    });
    // 获取语言
    const getLanguageId = (val) => {
      if (store.state.user.language.id !== val) {
        // 重新获取 表格数据 editSkuId
        store.state.user.language.id = val
        data.editSkuId = route.currentRoute.value.query.id + '|' + Math.random() * 30
        // console.log('不相同 store',store.state.user.language.id)
        // console.log('不相同 editSkuId',data.editSkuId)
      }
    }
    // 语言提示
    const noticeShowBatch = (val) => {
      if (val) {
        data.editSkuId = route.currentRoute.value.query.id + '|' + Math.random() * 30
      }
    }
    // 获取表格数据
    const transmitTableInfo = (val) => {
      //   console.log('get edit page table val',val)
      data.getReqData = val
    }
    // 刷新
    const reFreshPage = () => {
      reload()
    }
    // 保存
    const clickCom = async () => {
      let removequery = []
      // console.log('点击保存 进入验证')
      // console.log('源数据 data',data.getReqData)
      // console.log('源数据 data object',data.getReqData.originData.length == 0)
      if (data.getReqData.originData.length == 0) {
        proxy.$message.error('SKU列表不能为空')
      } else {
        // 1、行验证 - 去掉sku为空的数据 - 重新计算序号
        let removeSkuList = data.getReqData.originData.filter(it => it.sku == '')
        let newSkuList = data.getReqData.originData.filter(it => it.sku != '')
        if (removeSkuList.length > 0) {
          data.newData = {
            removeSkuList: removeSkuList,
            newSkuList: newSkuList
          }
          data.newData.newSkuList.forEach((el, ind) => {
            el.index = ind + 1
          })
          data.getReqData.originData = data.newData.newSkuList
        }
        // 2、sku 验证 - 去重
        let skustr = '';
        let skulist = [];
        let skumsglist = []
        for (let i = 0; i < data.getReqData.originData.length; i++) {
          let hasRead = false;
          for (let k = 0; k < skulist.length; k++) {
            if (skulist[k].sku == data.getReqData.originData[i].sku) {
              hasRead = true;
            }
          }
          if (!hasRead) {
            let _index = i + 1, haveSame = false;
            for (let j = i + 1; j < data.getReqData.originData.length; j++) {
              if (data.getReqData.originData[i].sku == data.getReqData.originData[j].sku) {
                _index += "," + (j + 1);
                haveSame = true;
              }
            }
            if (haveSame) {
              skulist.push(data.getReqData.originData[i].sku);
              skustr += "第" + _index + "行sku相同，内容为：" + data.getReqData.originData[i].sku + "|";
            }
            skumsglist = skustr.split('|')
          }
        }
        if (skulist.length > 0 && skulist[0] != '') {
          // 拼接 html
          skumsglist.forEach((el, ind) => {
            skumsglist[ind] = `<p>${el}</p>`
          });
          // 拼接 msg
          let str = ''
          skumsglist.forEach(el => {
            str += el
          })
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `${str}`
          })
          return
        }
        // 2.1 物料属性不能为空 自制、委外、外购不同情况判断
        let tempListBuy = []
        let tempListOrg = []
        let tempListSupplier = []
        let tempListPrice = []
        data.getReqData.originData.some(el => {
          if (!el.form_buy) {
            tempListBuy.push(el)
          }
          if (el.form_buy == 1) {
            if (!el.FUseOrgId) {
              tempListOrg.push(el)
            }
          } else {
            if (!el.supplier) {
              tempListSupplier.push(el)
            }
            if (!el.purchase_price) {
              tempListPrice.push(el)
            }
          }
        });
        if (tempListBuy.length > 0) {
          proxy.$message.error('物料属性为必填')
          return
        }
        // if (tempListOrg.length > 0) {
        //   proxy.$message.error('物料属性选择自制，默认供应组织为必填')
        //   return
        // }
        // if (tempListSupplier.length > 0) {
        //   proxy.$message.error('物料属性选择委外或外购，默认供应商为必填')
        //   return
        // }
        // if (tempListPrice.length > 0) {
        //   proxy.$message.error('物料属性选择委外或外购，采购价格为必填')
        //   return
        // }
        // 2.2 69验重 data.getReqData.originData
        let ljstr = '';
        let ljlist = [];
        let ljmsglist = []
        for (let i = 0; i < data.getReqData.originData.length; i++) {
          // if (i == 1) {
          //   data.getReqData.originData[i].index = 2
          // }
          let hasRead = false;
          for (let k = 0; k < ljlist.length; k++) {
            if (ljlist[k].FBARCODE == data.getReqData.originData[i].FBARCODE) {
              hasRead = true;
            }
          }
          if (!hasRead) {
            let _index = i + 1, haveSame = false;
            for (let j = i + 1; j < data.getReqData.originData.length; j++) {
              if (data.getReqData.originData[i].FBARCODE && data.getReqData.originData[i].FBARCODE == data.getReqData.originData[j].FBARCODE) {
                _index += "," + (j + 1);
                haveSame = true;
              }
            }
            if (haveSame) {
              ljlist.push(data.getReqData.originData[i].FBARCODE);
              ljstr += "第" + _index + "行69码相同，内容为：" + data.getReqData.originData[i].FBARCODE + "|";
            }
            ljmsglist = ljstr.split('|')
          }
        }
        if (ljlist.length > 0 && ljlist[0] != '') {
          // 拼接 html
          ljmsglist.forEach((el, ind) => {
            ljmsglist[ind] = `<p>${el}</p>`
          });
          // 拼接 msg
          let strlj = ''
          ljmsglist.forEach(el => {
            strlj += el
          })
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `${strlj}`
          })
          return
        }
        // 3、列验证
        let czlistvalue = data.getReqData.originData.filter(it => it.attribute_id_1 != '')
        let czlistnull = data.getReqData.originData.filter(it => it.attribute_id_1 == '')
        let xylistvalue = data.getReqData.originData.filter(it => it.attribute_id_2 != '')
        let xylistnull = data.getReqData.originData.filter(it => it.attribute_id_2 == '')
        let sllistvalue = data.getReqData.originData.filter(it => it.attribute_id_3 != '')
        let sllistnull = data.getReqData.originData.filter(it => it.attribute_id_3 == '')
        let bzlistvalue = data.getReqData.originData.filter(it => it.attribute_id_4 != '')
        let bzlistnull = data.getReqData.originData.filter(it => it.attribute_id_4 == '')
        let aglistvalue = data.getReqData.originData.filter(it => it.attribute_id_5 != '')
        let aglistnull = data.getReqData.originData.filter(it => it.attribute_id_5 == '')
        let jklistvalue = data.getReqData.originData.filter(it => it.attribute_id_6 != '')
        let jklistnull = data.getReqData.originData.filter(it => it.attribute_id_6 == '')
        let cclistvalue = data.getReqData.originData.filter(it => it.attribute_id_7 != '')
        let cclistnull = data.getReqData.originData.filter(it => it.attribute_id_7 == '')
        let yslistvalue = data.getReqData.originData.filter(it => it.attribute_id_8 != '')
        let yslistnull = data.getReqData.originData.filter(it => it.attribute_id_8 == '')
        let gnlistvalue = data.getReqData.originData.filter(it => it.attribute_id_9 != '')
        let gnlistnull = data.getReqData.originData.filter(it => it.attribute_id_9 == '')
        let sclistvalue = data.getReqData.originData.filter(it => it.attribute_id_10 != '')
        let sclistnull = data.getReqData.originData.filter(it => it.attribute_id_10 == '')
        let cztitle = ''
        let xytitle = ''
        let sltitle = ''
        let bztitle = ''
        let agtitle = ''
        let jktitle = ''
        let cctitle = ''
        let ystitle = ''
        let gntitle = ''
        let sctitle = ''
        if (czlistvalue.length > 0 && czlistnull.length > 0) {
          czlistnull.forEach(el => {
            cztitle = cztitle + el.index + '、'
          });
          cztitle = `第${cztitle.substr(0, cztitle.length - 1)}行，材质不能为空`
        }
        if (xylistvalue.length > 0 && xylistnull.length > 0) {
          xylistnull.forEach(el => {
            xytitle = xytitle + el.index + '、'
          });
          xytitle = `第${xytitle.substr(0, xytitle.length - 1)}行，协议不能为空`
        }
        if (sllistvalue.length > 0 && sllistnull.length > 0) {
          sllistnull.forEach(el => {
            sltitle = sltitle + el.index + '、'
          });
          sltitle = `第${sltitle.substr(0, sltitle.length - 1)}行，速率不能为空`
        }
        if (bzlistvalue.length > 0 && bzlistnull.length > 0) {
          bzlistnull.forEach(el => {
            bztitle = bztitle + el.index + '、'
          });
          bztitle = `第${bztitle.substr(0, bztitle.length - 1)}行，包装不能为空`
        }

        if (aglistvalue.length > 0 && aglistnull.length > 0) {
          aglistnull.forEach(el => {
            agtitle = agtitle + el.index + '、'
          });
          agtitle = `第${agtitle.substr(0, agtitle.length - 1)}行，安规不能为空`
        }

        if (jklistvalue.length > 0 && jklistnull.length > 0) {
          jklistnull.forEach(el => {
            jktitle = jktitle + el.index + '、'
          });
          jktitle = `第${jktitle.substr(0, jktitle.length - 1)}行，接口不能为空`
        }

        if (cclistvalue.length > 0 && cclistnull.length > 0) {
          cclistnull.forEach(el => {
            cctitle = cctitle + el.index + '、'
          });
          cctitle = `第${cctitle.substr(0, cctitle.length - 1)}行，尺寸不能为空`
        }
        if (yslistvalue.length > 0 && yslistnull.length > 0) {
          yslistnull.forEach(el => {
            ystitle = ystitle + el.index + '、'
          });
          ystitle = `第${ystitle.substr(0, ystitle.length - 1)}行，颜色不能为空`
        }

        if (gnlistvalue.length > 0 && gnlistnull.length > 0) {
          gnlistnull.forEach(el => {
            gntitle = gntitle + el.index + '、'
          });
          gntitle = `第${gntitle.substr(0, gntitle.length - 1)}行，功能/版本不能为空`
        }
        if (sclistvalue.length > 0 && sclistnull.length > 0) {
          sclistnull.forEach(el => {
            sctitle = sctitle + el.index + '、'
          });
          sctitle = `第${sctitle.substr(0, sctitle.length - 1)}行，输出接口不能为空`
        }
        if (cztitle || xytitle || sltitle || bztitle || agtitle || jktitle || cctitle || ystitle || gntitle || sctitle) {
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `
              <p>${cztitle}</p>
              <p>${xytitle}</p>
              <p>${sltitle}</p>
              <p>${bztitle}</p>
              <p>${agtitle}</p>
              <p>${jktitle}</p>
              <p>${ystitle}</p>
              <p>${cctitle}</p>
              <p>${gntitle}</p>
              <p>${sctitle}</p>
              `
          })
          return
        }
        // 4、行验证 去重 验证填了的属性是否存在一样的情况
        let strjoinlist = []
        data.getReqData.originData.forEach((el, ind) => {
          console.log('add el -->', el)
          removequery.push({ sku: el.sku, id: el.id ? el.id : 0 })
          let strjoinvalue = ''
          for (const key in el) {
            let strlist = ['attribute_id_1', 'attribute_id_2', 'attribute_id_3', 'attribute_id_4', 'attribute_id_5', 'attribute_id_6', 'attribute_id_7', 'attribute_id_8', 'attribute_id_9', 'attribute_id_10']
            if (strlist.indexOf(key) > -1) {
              // strjoinvalue = `${strjoinvalue}${key}=${el[key]}`
              strjoinvalue = strjoinvalue + el[key]
            }
          }
          strjoinlist.push(strjoinvalue)
        })

        let str = '';
        let list = [];
        let msglist = []
        for (let i = 0; i < strjoinlist.length; i++) {
          let hasRead = false;
          for (let k = 0; k < list.length; k++) {
            if (list[k] == strjoinlist[i]) {
              hasRead = true;
            }
          }
          if (!hasRead) {
            let _index = i + 1, haveSame = false;
            for (let j = i + 1; j < strjoinlist.length; j++) {
              if (strjoinlist[i] == strjoinlist[j]) {
                _index += "," + (j + 1);
                haveSame = true;
              }
            }
            if (haveSame) {
              list.push(strjoinlist[i]);
              str += "第" + _index + "行属性信息完全相同，请重新选择" + "|";
            }
            msglist = str.split('|')
          }
        }

        if (list.length > 0 && list[0] != '') {
          // 拼接 html
          msglist.forEach((el, ind) => {
            msglist[ind] = `<p>${el}</p>`
          });
          // 拼接 msg
          let str = ''
          msglist.forEach(el => {
            str += el
          })
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `${str}`
          })
          return
        }

        // 判断报关信息
        let bgstr = '';
        let bglist = [];
        let bgmsglist = [];
        let isBgtip = false;
        //1.8需求不需要判断报关信息是否必填，随便填不填
        // for (let i = 0; i < data.getReqData.originData.length; i++) {
        //   if (!data.getReqData.originData[i].customs_cn &&
        //     !data.getReqData.originData[i].customs_en &&
        //     !data.getReqData.originData[i].import_unit_price &&
        //     !data.getReqData.originData[i].customs_unit_price &&
        //     !data.getReqData.originData[i].customs_code &&
        //     !data.getReqData.originData[i].special_attr &&
        //     !data.getReqData.originData[i].supplier_invoicing_unit &&
        //     !data.getReqData.originData[i].use_type &&
        //     !data.getReqData.originData[i].inland_delivered) {
        //     isBgtip = true
        //     continue
        //   }
        //   if (!data.getReqData.originData[i].customs_cn) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，中文报关名不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].customs_en) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，英文报关名不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].import_unit_price) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，进口申报单价不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].customs_unit_price) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，出口报关单价不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].customs_code) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，海关H5编码不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].special_attr) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，特殊属性不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].supplier_invoicing_unit) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，报关/开票单位不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].use_type) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，用途不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   if (!data.getReqData.originData[i].inland_delivered) {
        //     bglist.push(i + "J");
        //     bgstr += "第" + (i + 1) + "行，境内货源地不能为空" + "|";
        //   } else {
        //     isBgtip = true
        //   }
        //   bgmsglist = bgstr.split('|')
        // }

        if (bglist.length > 0 && bglist[0] != '' && isBgtip) {
          // 拼接 html
          bgmsglist.forEach((el, ind) => {
            bgmsglist[ind] = `<p>${el}</p>`
          });
          // 拼接 msg
          let strlj = ''
          bgmsglist.forEach(el => {
            strlj += el
          })
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `${strlj}`
          })
          return
        }

        // 5、判断物料属性 - 自制 - 外购 - 委外
        // 物料属性 form_buy 1 自制 2 | 3 委外 外购
        // hasRead 自制
        // hasBuy 委外 | 外购

        let maljstr = '';
        let maljlist = [];
        let maljmsglist = []

        for (let i = 0; i < data.getReqData.originData.length; i++) {
          // 自制
          if (data.getReqData.originData[i].form_buy == 1) {
            if (data.getReqData.originData[i].FUseOrgId == '') {
              maljlist.push(i + "J");
              maljstr += "第" + (i + 1) + "行物料属性为：自制，默认供应组织不能为空" + "|";
            }
            maljmsglist = maljstr.split('|')
          }
          // 委外 | 外购
          if (data.getReqData.originData[i].form_buy == 2 || data.getReqData.originData[i].form_buy == 3) {
            console.log('data.getReqData.originData[i].purchase_price', data.getReqData.originData[i].purchase_price)
            if (data.getReqData.originData[i].supplier == '' || data.getReqData.originData[i].purchase_price == null || data.getReqData.originData[i].purchase_price == '' || data.getReqData.originData[i].FUseOrgId != '') {
              maljlist.push(i + "J");
              maljstr += "第" + (i + 1) + "行物料属性为：委外或外购，请填写供应商和采购价格并清空供应组织" + "|";
            }
            maljmsglist = maljstr.split('|')
          }
        }
        if (maljlist.length > 0 && maljlist[0] != '') {
          // 拼接 html
          maljmsglist.forEach((el, ind) => {
            maljmsglist[ind] = `<p>${el}</p>`
          });
          // 拼接 msg
          let strlj = ''
          maljmsglist.forEach(el => {
            strlj += el
          })
          proxy.$message.error({
            dangerouslyUseHTMLString: true,
            message: `${strlj}`
          })
          return
        }

        console.log('removequery', removequery)
        let isNext = true
        await proxy.$http.post('v1/product/do_sku_unique', removequery).then(res => {
          if (res.status != 200) {
            console.log('do_sku_unique res', res)
            isNext = false
          }
        })
        if (!isNext) {
          return
        }

        // 生成sku结构
        for (let index = 0; index < data.getReqData.originData.length - 1; index++) {
          data.getReqData.outData[0].sku.push(JSON.parse(JSON.stringify(data.pushsku)))
          data.getReqData.outData[0].sku_params.push(JSON.parse(JSON.stringify(data.pushsku_params)))
        }
        // 赋值数据
        data.getReqData.originData.forEach((el, ind) => {
          for (const key in el) {
            if (data.getReqData.outData[0].sku[ind].hasOwnProperty(key)) {
              data.getReqData.outData[0].sku[ind][key] = el[key]
            }
            if (data.getReqData.outData[0].sku_params[ind].hasOwnProperty(key)) {
              data.getReqData.outData[0].sku_params[ind][key] = el[key]
            }
          }
        });
        data.spuInfo.sku = data.getReqData.outData[0].sku
        data.spuInfo.sku_params = data.getReqData.outData[0].sku_params
        data.dragDialogShow = true
        data.isClick = true
        data.spuInfo.sku.forEach((el, idx) => {
          el.is_war_for_price = el.is_war_for_price ? 1 : 0
          el.fast = el.fast ? 1 : 0
          // 第一条数据要添加index为1
          if (!idx) {
            el.index = 1
          }
        })

        data.transmitRquest = data.spuInfo
      }
    }
    // 取消 关闭当前标签页、返回上一个页面
    const closeCurrentPage = () => {
      // 关闭页签
      let index = null
      store.state.topNavTag.tags.forEach((el, inde) => {
        el.fullPath == route.currentRoute.value.fullPath ? index = inde : false
      });
      store.dispatch('topNavTag/removeNavTag', index)
    }
    // 关闭当前标签跟页面
    const isSureClosePage = (isSure) => {
      // 关闭进度条
      data.isClick = false
      data.dragDialogShow = false
      // 关闭页签
      let index = null
      store.state.topNavTag.tags.forEach((el, inde) => {
        el.fullPath == route.currentRoute.value.fullPath ? index = inde : false
      });
      store.dispatch('topNavTag/removeNavTag', index)
    }
    // 注入
    provide('requestDataEdit', data)
    // 获取是否关闭drag dialog
    const getIfClose = () => {
      data.isClick = false
      data.dragDialogShow = false
      // console.log('click close type',data.type)
    }
    // 监听路由发生改变
    watch(() => route.currentRoute.value.path, (v1, v2) => {
      if (v1 == '/index/editSku' && v2 == '/index/productList') {
        let templist = store.state.topNavTag.tags.filter(it => it.name == 'EditSku')
        if (templist.length > 0 && templist[0].currType == 'editskucre') {
          data.isLanguageShow = true
          data.noticeSku = data.noticeSku + 1
          data.editSkuId = route.currentRoute.value.query.id + '|' + Math.random() * 30
          // console.log('watch route',route.currentRoute.value.query.id)
        }
      }
    })
    return {
      data,
      getLanguageId,
      transmitTableInfo,
      clickCom,
      getIfClose,
      reload,
      reFreshPage,
      isSureClosePage,
      noticeShowBatch,
      closeCurrentPage
    };
  }
})
</script>
<style scoped>
.content {
  margin: 24px 24px 0 24px;
}
.bg_white {
  background-color: #fff;
  height: 100%;
}
.input-w {
  width: 50%;
}
.table {
  width: 100% !important;
}
::v-deep(.vxe-table--render-default) {
  font-size: 12px !important;
}
::v-deep(.vxe-header--column) {
  padding: 5px 0 !important;
}
::v-deep(.vxe-body--column) {
  padding: 0 !important;
}
::v-deep(.vxe-header--column.col--ellipsis > .vxe-cell .vxe-cell--title) {
  white-space: normal;
  text-align: center;
}
::v-deep(
    .vxe-table--render-default
      .vxe-body--column.col--valid-error
      .vxe-cell--valid
  ) {
  width: 90%;
}
::v-deep(
    .vxe-table--render-default
      .vxe-body--column.col--valid-error
      .vxe-cell--valid
      .vxe-cell--valid-msg
  ) {
  text-align: left;
}
</style>