zzw
2023-11-17 d6e4a1f930946ecaecaec3a3daa9d07dd370e9b1
web/src/views/modules/project/SoftwareTestOrder.vue
@@ -35,8 +35,10 @@
          <zt-table-column-dict prop="testStandard" min-width="420" label="测试标准" dict="test_standard"/>
          <zt-table-column-dict prop="articleNature" width="120px" label="物品性质" dict="article_nature"/>
          <zt-table-column-handle :table="table" width="150px" edit-perm="project:update" delete-perm="project::delete">
            <template slot-scope="scope">
              <zt-table-button @click="testOlderView()">预览</zt-table-button>
            <template v-slot="{ row }">
              <zt-table-button size="small" type="primary"
                               @click="preview(row)">预览
              </zt-table-button>
            </template>
          </zt-table-column-handle>
        </el-table>
@@ -46,28 +48,9 @@
                       @refreshDataList="table.query"
                       @setProjectInfo="openAddWin">
        </ProjectSelect>
      </zt-table-wraper>
      <div v-show="isOpenDocPreviewDialog" class="preview-dialog">
        <button @click="closePreviewDialog('doc')" class="close-button">关闭</button>
        <div id="SoftwareTestOrder-doc" style="overflow: auto; width: 100%; height: 90%;"></div>
        <div class="file-name">{{ docName }}</div>
      </div>
      <div v-show="isOpenPdfPreviewDialog" class="preview-dialog">
        <button @click="closePreviewDialog('pdf')" class="close-button">关闭</button>
        <iframe id="SoftwareTestOrder-pdf" src="" style="margin:0;padding:0;width:100%;height:90%;"></iframe>
        <div class="file-name">{{ pdfName }}</div>
      </div>
      <div v-show="isOpenImgPreviewDialog" class="preview-dialog">
        <button @click="closePreviewDialog('img')" class="close-button">关闭</button>
        <img id="SoftwareTestOrder-img" src="" style="margin:0;padding:0;width:100%;height:90%;">
        <div class="file-name">{{ imgName }}</div>
      </div>
      <div v-show="isOpenXlsPreviewDialog" class="preview-dialog">
        <button @click="closePreviewDialog('xls')" class="close-button">关闭</button>
        <div id="SoftwareTestOrder-xls" style="margin:0;padding:0;width:100%;height:90%;"></div>
        <div class="file-name">{{ xlsName }}</div>
      </div>
      <View ref="view22" :pageMarkerfun="SoftwareTestOrder">
      </View>
    </div>
  </el-card>
</template>
@@ -75,19 +58,11 @@
<script>
import AddOrUpdate from './SoftwareTestOrder-AddOrUpdate'
import ProjectSelect from "./Project-select.vue"
import {setAccessoryFormat2} from '@/commonJS/commonFile'
import View from '@/views/pages/view.vue'
export default {
  data() {
    return {
      isOpenDocPreviewDialog:false,
      isOpenPdfPreviewDialog:false,
      isOpenImgPreviewDialog:false,
      isOpenXlsPreviewDialog:false,
      docName:'',
      pdfName:'',
      imgName:'',
      xlsName:'',
      dataForm: {
        testBasis: '',
        testType: '',
@@ -98,7 +73,8 @@
  },
  components: {
    AddOrUpdate,
    ProjectSelect
    ProjectSelect,
    View
  },
  methods: {
    add() {
@@ -108,32 +84,11 @@
      console.log(row.id, 'row.id')
      this.$refs.addOrUpdate.$refs.dialog.init(null, {id: null, projectId: row.id})
    },
    testOlderView(row){
      return setAccessoryFormat2(row, 'SoftwareTestOrder', this)
    },
    closePreviewDialog(file) {
      if (file == 'doc') {
        this.docName = '';
        this.isOpenDocPreviewDialog = false; // 关闭弹窗
        const docElement = document.getElementById('SoftwareTestOrder-doc');
        docElement.innerHTML = '';
      } else if (file == 'pdf') {
        this.pdfName = '';
        this.isOpenPdfPreviewDialog = false;
        let iframe = document.getElementById('SoftwareTestOrder-pdf');
        iframe.src = '';
      } else if (file == 'img') {
        this.imgName = '';
        this.isOpenImgPreviewDialog = false;
        let img = document.getElementById('SoftwareTestOrder-img');
        img.src = '';
      } else if (file == 'xls') {
        this.xlsName = '';
        this.isOpenXlsPreviewDialog = false;
        let excelElement = document.getElementById('SoftwareTestOrder-xls');
        excelElement.innerHTML = '';
    preview(row){
      console.log(row,'preview(row)');
      this.$refs.view22.setAccessoryFormatSingle(row)
      }
    },
  }
}
</script>