|
@@ -140,12 +140,34 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <!-- <previewTemp v-if="showPreview" :showPreview="showPreview" :option="option"></previewTemp> -->
|
|
|
+ <!-- <jjtOnlyOffice v-if="show" :option="option"></jjtOnlyOffice> -->
|
|
|
+ <!-- 查看模板的iframe -->
|
|
|
+ <el-dialog
|
|
|
+ v-model="showPreview"
|
|
|
+ title="模板预览"
|
|
|
+ :close-delay='200'
|
|
|
+ :before-close="closeHis"
|
|
|
+ :fullscreen='fullscreen'
|
|
|
+ >
|
|
|
+ <template #header="{ titleId, titleClass }">
|
|
|
+ <div class="my-header">
|
|
|
+ <span :id="titleId" :class="titleClass">模板预览</span>
|
|
|
+ <el-icon class="icon" @click="toFull" v-if="!fullscreen"><FullScreen /></el-icon>
|
|
|
+ <el-icon class="icon" @click="delFull" v-else><CopyDocument /></el-icon>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <iframe :src="preUrl" id="iframeHis" frameborder="0" width="1200px"
|
|
|
+ height="800px" class="iframeBox" ></iframe>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Template">
|
|
|
import { listTemplate, getTemplate, delTemplate, addTemplate, updateTemplate } from '@/api/biz/template'
|
|
|
import jjtOnlyOffice from '@/components/OnlyOffice/index.vue'
|
|
|
+import previewTemp from '@/components/previewTemp/previewTemp.vue'
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
const templateList = ref([])
|
|
@@ -157,6 +179,22 @@ const single = ref(true)
|
|
|
const multiple = ref(true)
|
|
|
const total = ref(0)
|
|
|
const title = ref('')
|
|
|
+const showPreview = ref(false)
|
|
|
+const fullscreen = ref(false)
|
|
|
+const preUrl = ref('')
|
|
|
+ let option = ref({
|
|
|
+ key: '',
|
|
|
+ url: '', //在线文档地址
|
|
|
+ isEdit: true, //是否允许编辑
|
|
|
+ fileType: '', //文件扩展名
|
|
|
+ title: '', //文件标题
|
|
|
+ user: {
|
|
|
+ id: null, //用户ID
|
|
|
+ name: '' //用户姓名
|
|
|
+ },
|
|
|
+ userdata: '',
|
|
|
+ editUrl: '' //回调地址
|
|
|
+ })
|
|
|
|
|
|
const data = reactive({
|
|
|
form: {},
|
|
@@ -246,19 +284,7 @@ function handleUpdate(row) {
|
|
|
|
|
|
function handleOpen(row) {
|
|
|
// console.log('isEdit',isEdit);
|
|
|
- let option = ref({
|
|
|
- key: '',
|
|
|
- url: '', //在线文档地址
|
|
|
- isEdit: props.onlyView, //是否允许编辑
|
|
|
- fileType: '', //文件扩展名
|
|
|
- title: '', //文件标题
|
|
|
- user: {
|
|
|
- id: null, //用户ID
|
|
|
- name: '' //用户姓名
|
|
|
- },
|
|
|
- userdata: '',
|
|
|
- editUrl: '' //回调地址
|
|
|
- })
|
|
|
+
|
|
|
|
|
|
option.value.isEdit = true
|
|
|
option.value.isCopy = true
|
|
@@ -285,7 +311,42 @@ function handleOpen(row) {
|
|
|
id: useUserStore().uid, //用户ID
|
|
|
name: useUserStore().uname //用户姓名
|
|
|
}
|
|
|
+ const str = JSON.stringify(option.value)
|
|
|
+ preUrl.value = `${window.location.origin}/tempPre?str=${str}`
|
|
|
+ showPreview.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ iframeSize()
|
|
|
+ }, 1000);
|
|
|
+ // console.log('option111',option.value);
|
|
|
}
|
|
|
+// 控制iframe大小
|
|
|
+ const iframeSize = () => {
|
|
|
+ // console.log('执行ifSize',par);
|
|
|
+ const outIframe = document.getElementById("iframeHis");
|
|
|
+ const inIframe =
|
|
|
+ outIframe.contentDocument.getElementsByTagName("iframe")[0];
|
|
|
+ if(inIframe==null){
|
|
|
+ // console.log('没有inF');
|
|
|
+ setTimeout(() => {
|
|
|
+ // console.log('==============');
|
|
|
+ iframeSize()
|
|
|
+ }, 200);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // console.log('outIframe', outIframe);
|
|
|
+ // console.error(outIframe.parentElement);
|
|
|
+ // inIframe.style.height = outIframe.style.height =
|
|
|
+ // 800 + "px";
|
|
|
+ // inIframe.style.width = outIframe.style.width =
|
|
|
+ // 1200 + "px";
|
|
|
+ inIframe.style.height = outIframe.style.height =
|
|
|
+ outIframe.parentElement.offsetHeight - 40 + "px";
|
|
|
+ inIframe.style.width = outIframe.style.width =
|
|
|
+ outIframe.parentElement.offsetWidth - 80+ "px";
|
|
|
+ }
|
|
|
+ const closeHis = ()=>{
|
|
|
+ showPreview.value = false
|
|
|
+ }
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
function submitForm() {
|
|
@@ -333,6 +394,27 @@ function handleExport() {
|
|
|
`template_${new Date().getTime()}.xlsx`
|
|
|
)
|
|
|
}
|
|
|
-
|
|
|
+const toFull = ()=>{
|
|
|
+ fullscreen.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ iframeSize()
|
|
|
+ }, 200);
|
|
|
+}
|
|
|
+const delFull = ()=>{
|
|
|
+ fullscreen.value = false
|
|
|
+ setTimeout(() => {
|
|
|
+ iframeSize()
|
|
|
+ }, 200);
|
|
|
+}
|
|
|
getList()
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.my-header{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+.icon{
|
|
|
+ margin-right: 16px;
|
|
|
+}
|
|
|
+</style>
|