From c7d6b1a520b00759c2023634b68027717212d0db Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 二月 2025 15:40:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
src/views/CNAS/process/method/standardMethodsChange/component/ViewDeviceDialog.vue | 138 +++++
src/views/CNAS/process/method/standardMethodsChange/component/ViewTestRecord.vue | 172 ++++++
src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue | 123 ++++
src/views/CNAS/process/method/standardMethodsChange/component/formDIaChange.vue | 456 +++++++++++++++++
src/views/CNAS/process/method/standardMethodsChange/index.vue | 201 +++++++
src/views/tool/file-preview.vue | 238 +++++++++
src/api/cnas/process/method/standardMethodsChange.js | 102 +++
src/views/CNAS/process/method/standardMethodsChange/component/viewWorkPermitDia.vue | 118 ++++
8 files changed, 1,548 insertions(+), 0 deletions(-)
diff --git a/src/api/cnas/process/method/standardMethodsChange.js b/src/api/cnas/process/method/standardMethodsChange.js
new file mode 100644
index 0000000..e4579aa
--- /dev/null
+++ b/src/api/cnas/process/method/standardMethodsChange.js
@@ -0,0 +1,102 @@
+// 瀹為獙瀹ょ殑妫�娴嬭兘鍔涙。妗堢浉鍏虫帴鍙�
+import request from "@/utils/request";
+
+//鏍囧噯鏂规硶鏇存柊楠岃瘉鍒楄〃
+export function pagesMethodVerify(query) {
+ return request({
+ url: "/processMethodVerify/pagesMethodVerify",
+ method: "get",
+ params: query,
+ });
+}
+
+//鑾峰彇鐢ㄦ埛鍒楄〃
+export function selectUserCondition(query) {
+ return request({
+ url: "/system/newUser/selectUserCondition",
+ method: "get",
+ params: query,
+ });
+}
+
+//鏌ヨ鏍囧噯鏂规硶楠岃瘉璇︽儏
+export function getMethodVerifyOne(query) {
+ return request({
+ url: "/processMethodVerify/getMethodVerifyOne",
+ method: "get",
+ params: query,
+ });
+}
+
+// 閫氳繃璁惧鍒嗙被鑾峰彇璁惧鍒楄〃
+export function deviceScopeSearch(query) {
+ return request({
+ url: '/deviceScope/search',
+ method: 'get',
+ params: query
+ })
+}
+
+// 鏂板鏍囧噯鏂规硶楠岃瘉
+export function addMethodVerify(data) {
+ return request({
+ url: "/processMethodVerify/addMethodVerify",
+ method: "post",
+ data: data,
+ });
+}
+
+// 淇敼鏍囧噯鏂规硶楠岃瘉
+export function updateMethodVerify(data) {
+ return request({
+ url: "/processMethodVerify/updateMethodVerify",
+ method: "post",
+ data: data,
+ });
+}
+
+// 瀵煎嚭鏍囧噯鏂规硶鏇存柊楠岃瘉
+export function exportMethodVerify(query) {
+ return request({
+ url: '/processMethodVerify/exportMethodVerify',
+ method: "get",
+ responseType: "blob",
+ params: query,
+ })
+}
+
+// 楠岃瘉纭
+export function methodVerifyAffirm(query) {
+ return request({
+ url: '/processMethodVerify/methodVerifyAffirm',
+ method: 'get',
+ params: query
+ })
+}
+
+// 鍒犻櫎鏍囧噯鏂规硶鏇存柊楠岃瘉
+export function delMethodVerify(query) {
+ return request({
+ url: '/processMethodVerify/delMethodVerify',
+ method: 'delete',
+ params: query
+ })
+}
+
+// 鍘熷璁板綍鍒楄〃
+export function getVerifyMethodFileList(query) {
+ return request({
+ url: '/processMethodVerify/getVerifyMethodFileList',
+ method: 'get',
+ params: query
+ })
+}
+
+// 鍒犻櫎楠岃瘉鍘熷璁板綍鍒楄〃
+export function delVerifyMethodFileList(query) {
+ return request({
+ url: '/processMethodVerify/delVerifyMethodFileList',
+ method: 'delete',
+ params: query
+ })
+}
diff --git a/src/views/CNAS/process/method/standardMethodsChange/component/ViewDeviceDialog.vue b/src/views/CNAS/process/method/standardMethodsChange/component/ViewDeviceDialog.vue
new file mode 100644
index 0000000..797a81c
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/component/ViewDeviceDialog.vue
@@ -0,0 +1,138 @@
+<template>
+ <div>
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="viewDeviceDialog" title="鏌ョ湅璁惧" width="80%" @close="closeDia">
+ <div style="text-align: right;margin-bottom: 10px">
+ <el-button size="small" type="primary" @click="addRow">娣诲姞</el-button>
+ <el-button size="small" type="danger" @click="clearTable">娓呯┖</el-button>
+ </div>
+ <div>
+ <el-table :data="machineAttachmentList" border height="500" style="width: 100%">
+ <el-table-column header-align="center" label="鍚嶇О" prop="machineName" width="200">
+ <template slot="header" slot-scope="scope">
+ <p>鍚嶇О</p>
+ </template>
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.machineName"
+ class="table_input"
+ clearable
+ filterable
+ placeholder="璁惧鍚嶇О"
+ size="small" @change="(val)=>changeMachineName(val, scope.$index)">
+ <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.value">
+ {{item.label + item.value}}
+ </el-option>
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column header-align="center" label="鍨嬪彿瑙勬牸" prop="machineSpecification" width="180">
+ <template slot="header" slot-scope="scope">
+ <p>鍨嬪彿瑙勬牸</p>
+ </template>
+ <template slot-scope="{row}">
+ <el-input v-model="row.machineSpecification" size="small"/>
+ </template>
+ </el-table-column>
+ <el-table-column header-align="center" label="娴嬮噺鑼冨洿" prop="machineMeasuringRange">
+ <template slot="header" slot-scope="scope">
+ <p>娴嬮噺鑼冨洿</p>
+ </template>
+ <template slot-scope="{row}">
+ <el-input v-model="row.machineMeasuringRange" size="small" type="textarea"/>
+ </template>
+ </el-table-column>
+ <el-table-column header-align="center" label="鈶犳墿灞曚笉纭畾搴︹憽鏈�澶у厑宸憿鍑嗙‘搴︾瓑绾�" prop="other">
+ <template slot="header" slot-scope="scope">
+ <p>鈶犳墿灞曚笉纭畾搴︹憽鏈�澶у厑宸憿鍑嗙‘搴︾瓑绾�</p>
+ </template>
+ <template slot-scope="{row}">
+ <el-input v-model="row.other" size="small" type="textarea"/>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="closeDia">鍙� 娑�</el-button>
+ <el-button type="primary" @click="handleDeviceInfo">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import { deviceScopeSearch } from '@/api/cnas/process/method/standardMethodsChange'
+
+export default {
+ name: 'ViewDeviceDialog',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: {},
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ viewDeviceDialog: false,
+ machineAttachmentList: [],
+ equipOptions: [],
+ };
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ openDia(info) {
+ this.viewDeviceDialog = true
+ this.machineAttachmentList = info.machineAttachmentList
+ this.getEquipOptions()
+ },
+ // 澧炲姞琛ㄦ牸琛屾暟鎹�
+ addRow () {
+ this.machineAttachmentList.push({
+ machineName: '',
+ machineSpecification: '',
+ machineMeasuringRange: '',
+ other: '',
+ })
+ },
+ // 娓呯┖琛ㄦ牸鏁版嵁
+ clearTable () {
+ this.machineAttachmentList = []
+ },
+ // 閫夋嫨璁惧鐨勫洖璋�
+ changeMachineName (val, index) {
+ const index1 = this.equipOptions.findIndex(item => item.value === val);
+ if (index1 !== -1) {
+ this.machineAttachmentList[index].deviceId = this.equipOptions[index1].id;
+ this.machineAttachmentList[index].machineName = this.equipOptions[index1].deviceName;
+ }
+ this.machineAttachmentList[index].machineSpecification = val
+ },
+ // 鎻愪氦璁惧淇℃伅
+ handleDeviceInfo () {
+ if (this.machineAttachmentList.length === 0) {
+ this.$message.warning('璇锋坊鍔犱俊鎭�')
+ return
+ }
+ this.viewDeviceDialog = false
+ this.$emit('handleDeviceInfo', this.machineAttachmentList)
+ },
+ closeDia () {
+ this.viewDeviceDialog = false
+ this.$emit('closDeviceDia')
+ },
+ // 鑾峰彇鎵�鏈夎澶�
+ getEquipOptions() {
+ this.equipOptions = []
+ deviceScopeSearch({status:'0'}).then(res => {
+ if (res.code === 200 && res.data) {
+ this.equipOptions = res.data.map(m => {
+ m.value = m.managementNumber
+ m.label = m.deviceName
+ return m
+ })
+ }
+ }).catch(error => {
+ console.error(error)
+ })
+ },
+ }
+};
+</script>
+
+<style scoped>
+</style>
diff --git a/src/views/CNAS/process/method/standardMethodsChange/component/ViewTestRecord.vue b/src/views/CNAS/process/method/standardMethodsChange/component/ViewTestRecord.vue
new file mode 100644
index 0000000..e8cd69d
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/component/ViewTestRecord.vue
@@ -0,0 +1,172 @@
+<template>
+ <div>
+ <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢涓婁紶" width="80%" @closed="closeFilesLook">
+ <div style="display: flex;justify-content: space-between;">
+ <el-upload ref='upload'
+ :action="fileAction"
+ :auto-upload="true"
+ :before-upload="fileBeforeUpload" :data="{methodVerifyId: info.methodVerifyId}"
+ :headers="uploadHeader"
+ :on-error="onError"
+ :on-success="handleSuccessUp"
+ :show-file-list="false"
+ accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;">
+ <el-button size="small" style="height: 38px" type="primary">闄勪欢涓婁紶</el-button>
+ </el-upload>
+ </div>
+ <div>
+ <lims-table
+ ref="yearTable"
+ :column="columnData"
+ :height="'calc(100vh - 47em)'"
+ :highlightCurrentRow="true"
+ :table-data="tableData"
+ :table-loading="tableLoading"
+ style="margin-top: 0.5em;">
+ </lims-table>
+ </div>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import limsTable from '@/components/Table/lims-table.vue'
+import file from "@/utils/file";
+import { delVerifyMethodFileList, getVerifyMethodFileList } from '@/api/cnas/process/method/standardMethodsChange'
+
+export default {
+ name: 'ViewTestRecord',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: { limsTable },
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ filesDialogVisible: false,
+ tableLoading: false,
+ filesLookInfo: {},
+ columnData: [
+ {
+ label: '鏂囦欢鍚嶇О',
+ prop: 'fileName',
+ minWidth: '150px'
+ },
+ {
+ dataType: 'action',
+ minWidth: '100',
+ label: '鎿嶄綔',
+ fixed: 'right',
+ operation: [
+ {
+ name: '涓嬭浇',
+ type: 'text',
+ clickFun: (row) => {
+ this.upload(row)
+ }
+ },
+ {
+ name: '鍒犻櫎',
+ type: 'text',
+ color: '#f56c6c',
+ clickFun: (row) => {
+ this.delete(row)
+ }
+ }
+ ]
+ }
+ ],
+ tableData: [],
+ info: {}
+ };
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ openDia(row) {
+ this.filesDialogVisible = true
+ this.info = row
+ if (this.info === undefined) {
+ this.info = {
+ methodVerifyId: ''
+ }
+ }
+ this.searchTableList()
+ },
+ // 鏌ヨ闄勪欢鍒楄〃
+ searchTableList () {
+ this.tableLoading = true
+ getVerifyMethodFileList({methodVerifyId:this.info.methodVerifyId}).then(res => {
+ this.tableLoading = false
+ if (res.code === 200){
+ this.tableData = res.data
+ }
+ }).catch(err => {
+ this.tableLoading = false
+ console.log('err---', err);
+ })
+ },
+ closeFilesLook () {
+ this.filesDialogVisible = false
+ },
+ // 涓嬭浇
+ upload (row) {
+ let url = '';
+ if(row.type==1){
+ url = this.javaApi+'/img/'+row.fileUrl
+ file.downloadIamge(url,row.fileName)
+ }else{
+ url = this.javaApi+'/word/'+row.fileUrl
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = row.fileName;
+ link.click();
+ }
+ },
+ // 鍒犻櫎
+ delete (row) {
+ this.tableLoading = true
+ delVerifyMethodFileList({methodFileId:row.methodFileId}).then(res => {
+ this.tableLoading = false
+ if (res.code === 200){
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.searchTableList()
+ }
+
+ }).catch(err => {
+ this.tableLoading = false
+ console.log('err---', err);
+ })
+ },
+ // 涓婁紶楠岃瘉
+ fileBeforeUpload(file) {
+ let flag = true
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
+ this.$refs.upload.clearFiles()
+ flag = false
+ }
+ if (!flag) {
+ return Promise.reject(flag); //姝g‘鐨勭粓姝�
+ }
+ },
+ onError(err, file, fileList,type) {
+ this.$message.error('涓婁紶澶辫触')
+ this.$refs.upload.clearFiles()
+ },
+ handleSuccessUp(response, ) {
+ this.upLoading = false;
+ if (response.code == 200) {
+ this.$message.success('涓婁紶鎴愬姛');
+ this.searchTableList()
+ }
+ },
+ },
+ computed: {
+ fileAction() {
+ return this.javaApi + '/processMethodVerify/uploadVerifyMethodFile'
+
+ }
+ },
+};
+</script>
+
+<style scoped>
+</style>
diff --git a/src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue b/src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue
new file mode 100644
index 0000000..0f43503
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/component/calibrationsFileDia.vue
@@ -0,0 +1,123 @@
+<template>
+ <div>
+ <el-dialog :visible.sync="filesDialogVisible" title="鏌ョ湅鏍″噯璇佷功" width="80%" @closed="closeFilesLook">
+ <div>
+ <limsTable
+ ref="yearTable"
+ :column="columnData"
+ :height="'calc(100vh - 47em)'"
+ :highlightCurrentRow="true"
+ :table-data="tableData"
+ :table-loading="tableLoading"
+ style="margin-top: 0.5em;">
+ </limsTable>
+ </div>
+ </el-dialog>
+ <el-dialog
+ :visible.sync="lookDialogVisible"
+ fullscreen
+ title="鏌ョ湅闄勪欢" top="5vh" width="800px">
+ <filePreview v-if="lookDialogVisible" :currentFile="{}"
+ :fileUrl="javaApi+'/img/'+currentInfo.fileUrl" style="max-height: 90vh;overflow-y: auto;"/>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import filePreview from '@/views/tool/file-preview.vue';
+import limsTable from '@/components/Table/lims-table.vue'
+import file from '@/utils/file';
+
+export default {
+ name: 'calibrationsFileDia',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: { limsTable, filePreview },
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ filesDialogVisible: false,
+ tableLoading: false,
+ filesLookInfo: {},
+ columnData: [
+ {
+ label: '鏂囦欢鍚嶇О',
+ prop: 'fileName',
+ minWidth: '150px'
+ },
+ {
+ label: '璁惧鍚嶇О',
+ prop: 'deviceName',
+ minWidth: '150px'
+ },
+ {
+ label: '璁惧缂栧彿',
+ prop: 'managementNumber',
+ minWidth: '150px'
+ },
+ {
+ dataType: 'action',
+ minWidth: '100',
+ label: '鎿嶄綔',
+ fixed: 'right',
+ operation: [
+ {
+ name: '棰勮',
+ type: 'text',
+ clickFun: (row) => {
+ this.handleLook(row)
+ }
+ },
+ {
+ name: '涓嬭浇',
+ type: 'text',
+ clickFun: (row) => {
+ this.upload(row)
+ }
+ },
+ ]
+ }
+ ],
+ tableData: [],
+ info: {},
+ currentInfo:{},
+ lookDialogVisible: false,
+ };
+ },
+ mounted() {
+
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ openDia(row) {
+ this.filesDialogVisible = true
+ this.info = row
+ this.tableData = this.info.calibrationsFileList
+ },
+ closeFilesLook () {
+ this.filesDialogVisible = false
+ },
+ // 鏌ョ湅鏂囦欢
+ handleLook(row){
+ this.currentInfo = row
+ this.lookDialogVisible = true
+ },
+ // 涓嬭浇
+ upload (row) {
+ let url = '';
+ if(row.type==1){
+ url = this.javaApi+'/img/'+row.fileUrl
+ file.downloadIamge(url,row.fileName)
+ }else{
+ url = this.javaApi+'/word/'+row.fileUrl
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = row.fileName;
+ link.click();
+ }
+ },
+ }
+};
+</script>
+
+<style scoped>
+</style>
diff --git a/src/views/CNAS/process/method/standardMethodsChange/component/formDIaChange.vue b/src/views/CNAS/process/method/standardMethodsChange/component/formDIaChange.vue
new file mode 100644
index 0000000..a63023a
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/component/formDIaChange.vue
@@ -0,0 +1,456 @@
+<template>
+ <div>
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
+ :title="operationType === 'edit' ? '缂栬緫' : '鏂板'"
+ :visible.sync="formDia"
+ width="90%" @close="closeDia">
+ <div v-if="operationType === 'edit'" style="text-align: right">
+ <el-button :disabled="form.confirmDate !== '' && form.confirmDate !== null && form.confirmDate !== undefined" size="medium" type="primary" @click="validation">楠岃瘉纭</el-button>
+ </div>
+ <table border="1" cellspacing="10" class="tables">
+ <tr>
+ <td>
+ <p>鏍囧噯鏂规硶</p>
+ </td>
+ <td>
+ <p>楠岃瘉鍘熷洜</p>
+ </td>
+ <td>
+ <p>涓昏鎶�鏈彉鍖�</p>
+ </td>
+ <td>
+ <p>娑夊強鏂归潰</p>
+ </td>
+ <td>
+ <p>鏍囧噯瑕佹眰</p>
+ </td>
+ <td>
+ <p>鍑嗗鎯呭喌</p>
+ </td>
+ <td>
+ <p>鏄惁婊¤冻</p>
+ </td>
+ <td>
+ <p>澶囨敞</p>
+ </td>
+ </tr>
+ <tr>
+ <td rowspan="9">
+ <el-input v-model="form.methodName" :rows="6"
+ placeholder="璇疯緭鍏ュ唴瀹�"
+ size="small"
+ type="textarea">
+ </el-input>
+ </td>
+ <td rowspan="9">
+ <el-input v-model="form.verifyReason" :rows="6"
+ placeholder="璇疯緭鍏ュ唴瀹�"
+ size="small"
+ type="textarea">
+ </el-input>
+ </td>
+ <td rowspan="9">
+ <el-input v-model="form.technologyChange" :rows="6"
+ placeholder="璇疯緭鍏ュ唴瀹�"
+ size="small"
+ type="textarea">
+ </el-input>
+ </td>
+ </tr>
+ <tr>
+ <td>浜猴細</td>
+ <td>
+ <el-input v-model="form.personRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.personReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.personIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-link type="primary" @click="viewWorkPermit">鏌ョ湅涓婂矖璇�</el-link>
+ </td>
+ </tr>
+ <tr>
+ <td>鏈猴細</td>
+ <td>
+ <el-input v-model="form.machineRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.machineReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.machineIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-link type="primary" @click="viewDevice">鏌ョ湅璁惧</el-link>
+ </td>
+ </tr>
+ <tr>
+ <td>鏂欙細</td>
+ <td>
+ <el-input v-model="form.materialRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.materialReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.materialIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-input v-model="form.materialRemark" size="small"></el-input>
+ </td>
+ </tr>
+ <tr>
+ <td>娉曪細</td>
+ <td>
+ <el-input v-model="form.methodRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.methodReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.methodIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-link type="primary" @click="viewTestRecord">鏌ョ湅妫�娴嬭褰�</el-link>
+ </td>
+ </tr>
+ <tr>
+ <td>鐜細</td>
+ <td>
+ <el-input v-model="form.environmentRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.environmentReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.environmentIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-input v-model="form.traceabilityRemark" size="small"></el-input>
+ </td>
+ </tr>
+ <tr>
+ <td>娴嬮噺婧簮鎬э細</td>
+ <td>
+ <el-input v-model="form.traceabilityRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.traceabilityReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.traceabilityIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-link type="primary" @click="viewCalibrationsFileDia">鏌ョ湅鏍″噯璇佷功</el-link>
+ </td>
+ </tr>
+ <tr>
+ <td>鏍峰搧绠$悊闇�姹傦細</td>
+ <td>
+ <el-input v-model="form.managementRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.managementReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.managementIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-input v-model="form.managementRemark" size="small"></el-input>
+ </td>
+ </tr>
+ <tr>
+ <td>鍏朵粬锛�</td>
+ <td>
+ <el-input v-model="form.otherRequirements" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-input v-model="form.otherReadiness" size="small" type="textarea"></el-input>
+ </td>
+ <td>
+ <el-radio-group v-model="form.otherIsSatisfied" v-removeAriaHidden>
+ <el-radio :label="0">鍚�</el-radio>
+ <el-radio :label="1">鏄�</el-radio>
+ </el-radio-group>
+ </td>
+ <td>
+ <el-input v-model="form.otherRemark" size="small"></el-input>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <p>鏄惁寮曠敤姝ゆ爣鍑嗗紑灞曟娴�:</p>
+ </td>
+ <td colspan="3">鍙互寮曠敤姝ゆ爣鍑嗗紑灞曟娴�</td>
+ <td>
+ <p>纭鏃堕棿:</p>
+ </td>
+ <td>{{form.confirmDate}}</td>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <p>鍙傚姞纭浜虹鍚�:</p>
+ </td>
+ <td colspan="5">
+ <el-select v-model="form.confirmUser" multiple placeholder="璇烽�夋嫨" size="small" style="width: 100%" :multiple-limit="5">
+ <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </td>
+ </tr>
+ </table>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="closeDia">鍙� 娑�</el-button>
+ <el-button :loading="editLoad" type="primary" @click="handleEdit">鎻� 浜�</el-button>
+ </span>
+ </el-dialog>
+ <ViewDeviceDialog v-if="viewDeviceDialog" ref="viewDeviceDialog" @closDeviceDia="closDeviceDia" @handleDeviceInfo="handleDeviceInfo"></ViewDeviceDialog>
+ <ViewTestRecord v-if="viewTestRecordDialog" ref="viewTestRecordDialog"></ViewTestRecord>
+ <ViewWorkPermitDia v-if="viewWorkPermitDia" ref="viewWorkPermitDia"></ViewWorkPermitDia>
+ <calibrations-file-dia v-if="calibrationsFileDia" ref="calibrationsFileDia"></calibrations-file-dia>
+ </div>
+</template>
+
+<script>
+import { dateFormat } from '@/utils/date'
+import ViewTestRecord from '../component/ViewTestRecord.vue';
+import ViewDeviceDialog from '../component/ViewDeviceDialog.vue';
+import ViewWorkPermitDia from '../component/viewWorkPermitDia.vue';
+import CalibrationsFileDia from '../component/calibrationsFileDia.vue';
+import {
+ addMethodVerify, deviceScopeSearch,
+ getMethodVerifyOne,
+ selectUserCondition,
+ updateMethodVerify
+} from '@/api/cnas/process/method/standardMethodsChange'
+
+export default {
+ name: 'formDIaChange',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: { CalibrationsFileDia, ViewWorkPermitDia, ViewDeviceDialog, ViewTestRecord },
+ props: {
+ operationType: {
+ type: String,
+ default: () => ''
+ }
+ },
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ formDia: false,
+ form: {
+ methodName: '',
+ verifyReason: '',
+ technologyChange: '',
+ personRequirements: '',
+ personReadiness: '',
+ personIsSatisfied: '',
+ personRemark: '',
+ machineRequirements: '',
+ machineReadiness: '',
+ machineIsSatisfied: '',
+ materialRequirements: '',
+ materialReadiness: '',
+ materialIsSatisfied: '',
+ materialRemark: '',
+ methodRequirements: '',
+ methodReadiness: '',
+ methodIsSatisfied: '',
+ environmentRequirements: '',
+ environmentReadiness: '',
+ environmentIsSatisfied: '',
+ traceabilityRequirements: '',
+ traceabilityReadiness: '',
+ traceabilityIsSatisfied: '',
+ traceabilityRemark: '',
+ managementRequirements: '',
+ managementReadiness: '',
+ managementIsSatisfied: '',
+ managementRemark: '',
+ otherRequirements: '',
+ otherReadiness: '',
+ otherIsSatisfied: '',
+ otherRemark: '',
+ machineAttachmentList: []
+ },
+ editLoad: false,
+ info: {
+ methodVerifyId: ''
+ },
+ userList: [],
+ viewDeviceDialog: false,
+ viewTestRecordDialog: false,
+ viewWorkPermitDia: false,
+ calibrationsFileDia: false,
+ };
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ openDia(row) {
+ this.formDia = true
+ this.info = row
+ this.getUserList()
+ if (this.operationType === 'edit') {
+ this.searchInfo(row)
+ }
+ },
+ // 鏌ヨ璇︽儏淇℃伅
+ searchInfo (row) {
+ getMethodVerifyOne({methodVerifyId:row.methodVerifyId}).then(res => {
+ if (res.code === 200) {
+ this.form = {...res.data}
+ if (this.form.confirmUser) {
+ this.form.confirmUser = this.form.confirmUser.split(',').map(Number)
+ }
+ }
+ }).catch(err => {
+ console.log('err---', err);
+ })
+ },
+ // 鎻愪氦
+ handleEdit() {
+ this.editLoad = true
+ const processMethodSearchNews = this.HaveJson(this.form)
+ processMethodSearchNews.confirmUser = processMethodSearchNews.confirmUser && processMethodSearchNews.confirmUser.join(',')
+ processMethodSearchNews.operationType = 0
+ if (this.operationType === 'edit') {
+ this.editInfo(processMethodSearchNews)
+ } else {
+ this.addInfo(processMethodSearchNews)
+ }
+ },
+ // 鏌ョ湅涓婂矖璇�
+ viewWorkPermit () {
+ this.viewWorkPermitDia = true
+ this.$nextTick(() => {
+ this.$refs.viewWorkPermitDia.openDia(this.form)
+ })
+ },
+ // 鏌ョ湅鏍″噯璇佷功
+ viewCalibrationsFileDia () {
+ this.calibrationsFileDia = true
+ this.$nextTick(() => {
+ this.$refs.calibrationsFileDia.openDia(this.form)
+ })
+ },
+ // 鏌ョ湅璁惧
+ viewDevice () {
+ this.viewDeviceDialog = true
+ this.$nextTick(() => {
+ this.$refs.viewDeviceDialog.openDia(this.form)
+ })
+ },
+ // 鍏抽棴璁惧寮规
+ closDeviceDia () {
+ this.viewDeviceDialog = false
+ },
+ // 鎻愪氦璁惧淇℃伅
+ handleDeviceInfo (machineAttachmentList) {
+ this.viewDeviceDialog = false
+ this.form.machineAttachmentList = machineAttachmentList
+ },
+ // 鏌ョ湅妫�娴嬭褰�
+ viewTestRecord () {
+ this.viewTestRecordDialog = true
+ this.$nextTick(() => {
+ this.$refs.viewTestRecordDialog.openDia(this.info)
+ })
+ },
+ // 鎻愪氦缂栬緫
+ editInfo (processMethodSearchNews) {
+ updateMethodVerify(processMethodSearchNews).then(res => {
+ this.editLoad = false
+ if (res.code === 200){
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.closeDia()
+ }
+ }).catch(err => {
+ console.log('err---', err);
+ this.editLoad = false
+ })
+ },
+ // 鎻愪氦鏂板
+ addInfo (processMethodSearchNews) {
+ addMethodVerify(processMethodSearchNews).then(res => {
+ this.editLoad = false
+ if (res.code === 200) {
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.closeDia()
+ }
+ }).catch(err => {
+ console.log('err---', err);
+ this.editLoad = false
+ })
+ },
+ // 楠岃瘉纭
+ validation () {
+ deviceScopeSearch({methodVerifyId:this.info.methodVerifyId}).then(res => {
+ if (res.code === 200){
+ this.form.confirmDate = dateFormat(new Date())
+ }
+ }).catch(err => {
+ console.log('err---', err);
+ })
+ },
+ // 鍏抽棴寮规
+ closeDia() {
+ this.formDia = false
+ this.$emit('closeDia');
+ },
+ getUserList(){
+ selectUserCondition().then(res => {
+ if (res.code === 200) {
+ this.userList = res.data
+ }
+ })
+ },
+ }
+};
+</script>
+
+<style scoped>
+>>>.el-dialog {
+ margin-top: 2vh !important;
+}
+>>>.el-dialog__body {
+ max-height: 720px;
+ overflow-y: auto;
+}
+.tables {
+ table-layout: fixed;
+ width: 100%;
+ margin-top: 10px;
+}
+.tables td {
+ height: 34px;
+ width: 100px;
+ text-align: center;
+ font-size: 14px;
+ word-wrap: break-word;
+ white-space: normal;
+ padding: 4px;
+}
+</style>
diff --git a/src/views/CNAS/process/method/standardMethodsChange/component/viewWorkPermitDia.vue b/src/views/CNAS/process/method/standardMethodsChange/component/viewWorkPermitDia.vue
new file mode 100644
index 0000000..0d8f468
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/component/viewWorkPermitDia.vue
@@ -0,0 +1,118 @@
+<template>
+ <div>
+ <el-dialog :visible.sync="filesDialogVisible" title="鏌ョ湅涓婂矖璇�" width="80%" @closed="closeFilesLook">
+ <div>
+ <limsTable
+ ref="yearTable"
+ :column="columnData"
+ :height="'calc(100vh - 400px)'"
+ :highlightCurrentRow="true"
+ :table-data="tableData"
+ :table-loading="tableLoading"
+ style="margin-top: 0.5em;">
+ </limsTable>
+ </div>
+ </el-dialog>
+ <el-dialog
+ :visible.sync="lookDialogVisible"
+ fullscreen
+ title="鏌ョ湅闄勪欢" top="5vh" width="800px">
+ <filePreview v-if="lookDialogVisible" :currentFile="{}"
+ :fileUrl="javaApi+'/img/'+currentInfo.fileUrl" style="max-height: 90vh;overflow-y: auto;"/>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import file from '@/utils/file';
+import filePreview from '@/views/tool/file-preview.vue';
+import limsTable from '@/components/Table/lims-table.vue'
+
+export default {
+ name: 'viewWorkPermitDia',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: { filePreview, limsTable },
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ filesDialogVisible: false,
+ tableLoading: false,
+ filesLookInfo: {},
+ columnData: [
+ {
+ label: '鏂囦欢鍚嶇О',
+ prop: 'fileName',
+ minWidth: '150px'
+ },
+ {
+ label: '鎸佹湁浜�',
+ prop: 'userName',
+ minWidth: '150px'
+ },
+ {
+ dataType: 'action',
+ minWidth: '100',
+ label: '鎿嶄綔',
+ fixed: 'right',
+ operation: [
+ {
+ name: '棰勮',
+ type: 'text',
+ clickFun: (row) => {
+ this.handleLook(row)
+ }
+ },
+ {
+ name: '涓嬭浇',
+ type: 'text',
+ clickFun: (row) => {
+ this.upload(row)
+ }
+ },
+ ]
+ }
+ ],
+ tableData: [],
+ info: {},
+ currentInfo:{},
+ lookDialogVisible: false,
+ };
+ },
+ mounted() {
+
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ openDia(row) {
+ this.filesDialogVisible = true
+ this.info = row
+ this.tableData = this.info.workFileList
+ },
+ closeFilesLook () {
+ this.filesDialogVisible = false
+ },
+ // 鏌ョ湅鏂囦欢
+ handleLook(row){
+ this.currentInfo = row
+ this.lookDialogVisible = true
+ },
+ // 涓嬭浇
+ upload (row) {
+ let url = '';
+ if(row.type==1){
+ url = this.javaApi+'/img/'+row.fileUrl
+ file.downloadIamge(url,row.fileName)
+ }else{
+ url = this.javaApi+'/word/'+row.fileUrl
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = row.fileName;
+ link.click();
+ }
+ },
+ },
+};
+</script>
+
+<style scoped>
+</style>
diff --git a/src/views/CNAS/process/method/standardMethodsChange/index.vue b/src/views/CNAS/process/method/standardMethodsChange/index.vue
new file mode 100644
index 0000000..9a4ac26
--- /dev/null
+++ b/src/views/CNAS/process/method/standardMethodsChange/index.vue
@@ -0,0 +1,201 @@
+<template>
+ <div class="capacity-scope">
+ <div class="search">
+ <div>
+ <el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
+ <el-form-item label="鏍囧噯鏂规硶" prop="methodName">
+ <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="searchForm.methodName"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="searchList">鏌� 璇�</el-button>
+ <el-button icon="el-icon-refresh" size="mini" @click="resetSearchForm">閲� 缃�</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div>
+ <el-button size="medium" type="primary" @click="openFormDia('add')">鏂� 澧�</el-button>
+ </div>
+ </div>
+ <div class="table">
+ <div>
+ <TableCard :showForm="false" :showTitle="false">
+ <template v-slot:table>
+ <lims-table :tableData="tableData" :column="tableColumn" :height="'calc(100vh - 250px)'" @pagination="pagination"
+ :page="page" :tableLoading="tableLoading"></lims-table>
+ </template>
+ </TableCard>
+ </div>
+ </div>
+ <formDIaChange v-if="formDIa" ref="formDIa" :operationType="operationType" @closeDia="closeDia"></formDIaChange>
+ </div>
+</template>
+
+<script>
+import TableCard from '@/views/CNAS/externalService/serviceAndSupplyPro/component/index.vue';
+import formDIaChange from './component/formDIaChange.vue';
+import limsTable from '@/components/Table/lims-table.vue'
+import {
+ delMethodVerify,
+ exportMethodVerify,
+ pagesMethodVerify
+} from '@/api/cnas/process/method/standardMethodsChange'
+
+export default {
+ name: 'a7-changes-standard-methods',
+ // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+ components: { limsTable, formDIaChange, TableCard },
+ data() {
+ // 杩欓噷瀛樻斁鏁版嵁
+ return {
+ searchForm: {
+ methodName: '',
+ operationType: 0,
+ },
+ options: [
+ { label: '涓婂崐骞�', value: '1' },
+ { label: '涓嬪崐骞�', value: '2' },
+ ],
+ tableColumn: [
+ {
+ label: '鏍囧噯鏂规硶',
+ prop: 'methodName',
+ minWidth: '100'
+ },
+ {
+ label: '楠岃瘉鍘熷洜',
+ prop: 'verifyReason',
+ minWidth: '100'
+ },
+ {
+ label: '涓昏鎶�鏈彉鍖�',
+ prop: 'technologyChange',
+ minWidth: '100'
+ },
+ {
+ dataType: 'action',
+ minWidth: '60',
+ label: '鎿嶄綔',
+ operation: [
+ {
+ name: '缂栬緫',
+ type: 'text',
+ clickFun: (row) => {
+ this.openFormDia('edit', row);
+ },
+ },
+ {
+ name: '瀵煎嚭',
+ type: 'text',
+ clickFun: (row) => {
+ this.downLoadPost(row);
+ },
+ },
+ {
+ name: '鍒犻櫎',
+ type: 'text',
+ color: '#f56c6c',
+ clickFun: (row) => {
+ this.deleteRow(row);
+ },
+ }
+
+ ]
+ }
+ ],
+ tableData: [],
+ tableLoading: false,
+ page: {
+ size: 10,
+ current: 1,
+ total: 0,
+ },
+ formDIa: false,
+ operationType: '',
+ };
+ },
+ mounted() {
+ this.searchList()
+ },
+ // 鏂规硶闆嗗悎
+ methods: {
+ // 鏌ヨ鍒楄〃
+ searchList() {
+ const entity = {
+ methodName: this.searchForm.methodName,
+ operationType: this.searchForm.operationType,
+ }
+ this.tableLoading = true
+ pagesMethodVerify({... this.page,...entity}).then(res => {
+ this.tableLoading = false
+ if (res.code === 200){
+ this.tableData = res.data.records
+ this.page.total = res.data.total
+ }
+ }).catch(err => {
+ console.log('err---', err);
+ this.tableLoading = false
+ })
+ },
+ // 鍒犻櫎
+ deleteRow (row) {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ this.tableLoading = true
+ delMethodVerify({methodVerifyId:row.methodVerifyId}).then(res => {
+ this.tableLoading = false
+ if (res.code === 200){
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.searchList()
+ }
+ }).catch(err => {
+ this.tableLoading = false
+ console.log('err---', err);
+ })
+ })
+ },
+ // 閲嶇疆鏌ヨ鏉′欢
+ resetSearchForm() {
+ this.searchForm.methodName = '';
+ this.searchList()
+ },
+ openFormDia (type, row) {
+ this.formDIa = true
+ this.operationType = type
+ this.$nextTick(() => {
+ this.$refs.formDIa.openDia(row)
+ })
+ },
+ // 鍏抽棴寮规
+ closeDia () {
+ this.formDIa = false
+ this.searchList()
+ },
+ // 瀵煎嚭
+ downLoadPost(row) {
+ this.outLoading = true
+ exportMethodVerify({methodVerifyId:row.methodVerifyId}).then(res => {
+ this.outLoading = false
+ const blob = new Blob([res],{ type: 'application/msword' });
+ this.$download.saveAs(blob, '鏍囧噯锛堟柟娉曪級纭璁板綍.docx')
+ this.$message.success('瀵煎嚭鎴愬姛')
+ })
+ },
+ // 鍒嗛〉鍒囨崲
+ pagination(page) {
+ this.page.size = page.limit
+ this.searchList();
+ },
+ }
+};
+</script>
+
+<style scoped>
+.search {
+ height: 46px;
+ display: flex;
+ justify-content: space-between;
+}
+</style>
diff --git a/src/views/tool/file-preview.vue b/src/views/tool/file-preview.vue
new file mode 100644
index 0000000..591aac2
--- /dev/null
+++ b/src/views/tool/file-preview.vue
@@ -0,0 +1,238 @@
+<template>
+ <div>
+ <div v-if="isImage">
+ <img :src="imgUrl" alt="Image Preview" />
+ </div>
+ <div v-if="isPdf">
+ <object :data="fileUrl" type="application/pdf" width="100%" height="750px">
+ <p>鎮ㄧ殑娴忚鍣ㄤ笉鏀寔 PDF 棰勮銆�<a :href="fileUrl">涓嬭浇 PDF 鏂囦欢</a></p>
+ </object>
+ </div>
+ <div v-if="isDoc">
+ <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
+ <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a>
+ <vue-office-docx v-else
+ :src="fileUrl"
+ style="height: 100vh;"
+ @rendered="renderedHandler"
+ @error="errorHandler"
+ />
+ </div>
+ <div v-if="isXls">
+ <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
+ <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a>
+ <vue-office-excel v-else
+ :src="fileUrl"
+ :options="options"
+ style="height: 100vh;"
+ @rendered="renderedHandler"
+ @error="errorHandler"
+ />
+ </div>
+ <div v-if="isZipOrRar">
+ <p>鍘嬬缉鏂囦欢鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
+ <a :href="fileUrl">涓嬭浇鏂囦欢</a>
+ </div>
+ <div v-if="isCsv">
+ <p v-if="csvList.length==0">CSV 鏂囦欢鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
+ <a :href="fileUrl" v-if="csvList.length==0">涓嬭浇鏂囦欢</a>
+ <el-tabs type="border-card" v-if="csvList.length>0" tab-position="bottom">
+ <el-tab-pane :label="item.sheetName" v-for="(item,index) in csvList" :key="index">
+ <el-table :data="item.tableData" height="75vh">
+ <el-table-column :label="m.label" :prop="m.prop" v-for="(m,i) in item.column" :key="i" min-width="120px" show-overflow-tooltip>
+ <template slot-scope="scope" slot="header">
+ <div>
+ <el-tooltip :content="m.label" placement="top">
+ <div class="oneLine">
+ <span>{{m.label}}</span>
+ </div>
+ </el-tooltip>
+ </div>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+ <div v-if="!isSupported">
+ <p>涓嶆敮鎸佺殑鏂囦欢鏍煎紡</p>
+ </div>
+ </div>
+</template>
+
+<script>
+import VueOfficeDocx from '@vue-office/docx'
+//寮曞叆鐩稿叧鏍峰紡
+import '@vue-office/docx/lib/index.css'
+import VueOfficeExcel from '@vue-office/excel'
+//寮曞叆鐩稿叧鏍峰紡
+import '@vue-office/excel/lib/index.css'
+export default {
+ components: {
+ VueOfficeDocx,
+ VueOfficeExcel,
+ },
+ props: {
+ fileUrl: {
+ type: String,
+ required: true
+ },
+ currentFile: {
+ type: Object,
+ required: true
+ },
+ },
+ data(){
+ return {
+ isDocShow:true,
+ options:{
+ xls: false, //棰勮xlsx鏂囦欢璁句负false锛涢瑙坸ls鏂囦欢璁句负true
+ minColLength: 0, // excel鏈�灏戞覆鏌撳灏戝垪锛屽鏋滄兂瀹炵幇xlsx鏂囦欢鍐呭鏈夊嚑鍒楋紝灏辨覆鏌撳嚑鍒楋紝鍙互灏嗘鍊艰缃负0.
+ minRowLength: 0, // excel鏈�灏戞覆鏌撳灏戣锛屽鏋滄兂瀹炵幇鏍规嵁xlsx瀹為檯鍑芥暟娓叉煋锛屽彲浠ュ皢姝ゅ�艰缃负0.
+ widthOffset: 10, //濡傛灉娓叉煋鍑烘潵鐨勭粨鏋滄劅瑙夊崟鍏冩牸瀹藉害涓嶅锛屽彲浠ュ湪榛樿娓叉煋鐨勫垪琛ㄥ搴︿笂鍐嶅姞 Npx瀹�
+ heightOffset: 10, //鍦ㄩ粯璁ゆ覆鏌撶殑鍒楄〃楂樺害涓婂啀鍔� Npx楂�
+ beforeTransformData: (workbookData) => {return workbookData}, //搴曞眰閫氳繃exceljs鑾峰彇excel鏂囦欢鍐呭锛岄�氳繃璇ラ挬瀛愬嚱鏁帮紝鍙互瀵硅幏鍙栫殑excel鏂囦欢鍐呭杩涜淇敼锛屾瘮濡傛煇涓崟鍏冩牸鐨勬暟鎹樉绀轰笉姝g‘锛屽彲浠ュ湪姝よ嚜琛屼慨鏀规瘡涓崟鍏冩牸鐨剉alue鍊笺��
+ transformData: (workbookData) => {return workbookData}, //灏嗚幏鍙栧埌鐨別xcel鏁版嵁杩涜澶勭悊涔嬪悗涓旀覆鏌撳埌椤甸潰涔嬪墠锛屽彲閫氳繃transformData瀵瑰嵆灏嗘覆鏌撶殑鏁版嵁鍙婃牱寮忚繘琛屼慨鏀癸紝姝ゆ椂姣忎釜鍗曞厓鏍肩殑text鍊煎氨鏄嵆灏嗘覆鏌撳埌椤甸潰涓婄殑鍐呭
+ },
+ csvList:[],//csv鏂囦欢鏁版嵁
+ imgUrl:''
+ }
+ },
+ computed: {
+ isImage() {
+ let state = /\.(jpg|jpeg|png|gif)$/i.test(this.fileUrl)
+ this.imgUrl = this.fileUrl
+ if(state){
+ this.imgUrl = this.fileUrl.replaceAll('word', 'img')
+ }
+ return state;
+ },
+ isPdf() {
+ return /\.pdf$/i.test(this.fileUrl);
+ },
+ isDoc() {
+ return /\.(doc|docx)$/i.test(this.fileUrl);
+ },
+ isXls(){
+ let state = /\.(xls|xlsx)$/i.test(this.fileUrl)
+ if(state){
+ if(/\.(xlsx)$/i.test(this.fileUrl)){
+ this.options.xls = false
+ }else{
+ this.options.xls = true
+ }
+ }
+ return state;
+ },
+ isZipOrRar() {
+ return /\.(zip|rar)$/i.test(this.fileUrl);
+ },
+ isCsv() {
+ let state = /\.csv$/i.test(this.fileUrl)
+ if(state){
+ this.loadCSVData();
+ // this.main()
+ }
+ return state;
+ },
+ isSupported() {
+ return this.isImage || this.isPdf || this.isDoc || this.isZipOrRar || this.isCsv||this.isXls;
+ }
+ },
+ methods:{
+ renderedHandler() {
+ console.log("娓叉煋瀹屾垚")
+ this.isDocShow = true
+ this.resetStyle()
+ },
+ errorHandler() {
+ console.log("娓叉煋澶辫触")
+ this.isDocShow = false
+ },
+ async loadCSVData() {
+ this.$axios.post(this.$api.insOrderPlan.preview, {
+ id: this.currentFile.id,
+ }).then( res => {
+ let arr = res.data
+ arr = arr.map(m=>{
+ let obj = {
+ sheetName:m.sheetName,
+ tableData:[],
+ column:[]
+ }
+ obj.tableData = this.formatCSVToTable(m.content.replaceAll('null',' '))
+ // .replaceAll('MIN','=MIN').replaceAll('MAX','=MAX').replaceAll('AVERAGE','=AVERAGE')
+ for (let item in obj.tableData[0]) {
+ obj.column.push({
+ label: item,
+ prop: item,
+ })
+ }
+ return obj
+ })
+ this.csvList = arr
+ }).catch( err => {
+ console.log(err)
+ })
+ },
+ formatCSVToTable(str){
+ const result = [];
+ const jsonObj = str.split("\n");
+ let arrHeader = [];
+ for (const i in jsonObj) {
+ if (typeof jsonObj[i] === 'string' && jsonObj[i].length > 0) {
+ const row = `${jsonObj[i]}`;
+ if (row.trim().length > 0) {
+ const kv = jsonObj[i].split(',');
+ if (i == 0) {
+ // 鑾峰彇column琛ㄥご
+ arrHeader = kv;
+ } else {
+ const obj = {};
+ for (let index = 0; index < arrHeader.length; index++) {
+ // 缁勮琛ㄦ牸鏁版嵁
+ const name = String(arrHeader[index]);
+ if (!arrHeader[index]) continue
+ if (!obj[name]) {
+ try {
+ if (kv[index]) {
+ obj[name] = String(kv[index]);
+ } else {
+ obj[name] = '';
+ }
+ } catch (err) {
+ obj[name] = '';
+ }
+ }
+ }
+ result.push(obj);
+ }
+ }
+ }
+ }
+ return result
+ },
+ resetStyle(){
+ const elements = document.querySelectorAll('[style*="pt"]');
+ for (const element of elements) {
+ const style = element.getAttribute('style');
+ if (!!style) {
+ element.setAttribute('style', style.replace(/pt/g, 'px'));
+ }
+ }
+ },
+ }
+}
+</script>
+
+<style scoped>
+img {
+ max-width: 100%;
+}
+
+.oneLine {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+</style>
--
Gitblit v1.9.3