<!-- 打开新界面编辑使用方法 -->
<template>
  <a-button style="margin-right: 8px;" @click="getModelData">获取ModelData</a-button>
  <a-button style="margin-right: 8px;" @click="setModelData1">设置ModelData1</a-button>
  <a-button style="margin-right: 8px;" @click="setModelData2">设置ModelData2</a-button>
  <a-button style="margin-right: 8px;" @click="refresh">刷新ModelData</a-button>
</template>

<script setup>

const getModelData = () => {
  const modelDatas = window.opener.viewEditDatas;
  console.log(modelDatas, window.opener, '获取到modelData');
};

// isViewEdit为true才允许改变curd的modelData
const setModelData1 = () => {
  const modelDatas = window.opener.viewEditDatas;
  if (modelDatas.isViewEdit) {
    modelDatas.data['description']['displayValue'][0] = 'test1';
    window.opener.editModelDataChanged(modelDatas);
  }
};
const setModelData2 = () => {
  const modelDatas = window.opener.viewEditDatas;
  modelDatas.data['description']['displayValue'][0] = 'test2';
  window.opener.editModelDataChanged(modelDatas);
};
const refresh = () => {
  window.opener.refreshCurdDatas();
};
</script>

<style scoped></style>