From 5d61e3ea816a74f4491276e2d73cca2e42af3b10 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期一, 17 二月 2025 10:55:18 +0800 Subject: [PATCH] 文件档案第二次添加附件报错 --- src/components/do/a6-device/operation-instruction.vue | 868 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 602 insertions(+), 266 deletions(-) diff --git a/src/components/do/a6-device/operation-instruction.vue b/src/components/do/a6-device/operation-instruction.vue index 969c3b4..29757ae 100644 --- a/src/components/do/a6-device/operation-instruction.vue +++ b/src/components/do/a6-device/operation-instruction.vue @@ -7,46 +7,125 @@ <p style="line-height: 30px;">浣滀笟鎸囧涔�</p> </el-col> <el-col :span="12" style="text-align: right;"> - <el-button size="small" type="primary" @click="getList">鍒锋柊</el-button> - <el-button size="small" type="primary" @click="dialogVisible = true">鍙楁帶鐢宠</el-button> + <el-button size="small" type="primary" @click="getList" + >鍒锋柊</el-button + > + <el-button size="small" type="primary" @click="dialogVisible = true" + >鍙楁帶鐢宠</el-button + > </el-col> </el-row> </div> <el-table :data="tableData" border height="calc(100vh - 18em)"> <el-table-column type="index" label="搴忓彿" width="120"> <template v-slot="scope"> - <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> + <span>{{ + (search.current - 1) * search.size + scope.$index + 1 + }}</span> </template> </el-table-column> - <el-table-column label="鐢宠缂栧彿" min-width="150" prop="applicationNumber"></el-table-column> - <el-table-column label="璁惧鍚嶇О" min-width="150" prop="deviceName"></el-table-column> - <el-table-column label="璁惧缂栧彿" min-width="150" prop="deviceNumber"></el-table-column> - <el-table-column label="璁惧鍨嬪彿" min-width="150" prop="deviceModel"></el-table-column> - <el-table-column label="鏂囦欢缂栧彿" min-width="150" prop="documentNumber"></el-table-column> - <el-table-column label="鏂囦欢鍚嶅瓧" min-width="150" prop="fileName"></el-table-column> - <el-table-column label="鏂囨。璇存槑" min-width="150" prop="documentNote"></el-table-column> - <el-table-column label="涓婁紶浜�" min-width="150" prop="uploaderName"></el-table-column> - <el-table-column label="涓婁紶鏃堕棿" min-width="150" prop="updateTime"></el-table-column> - <el-table-column label="鐢熸晥鏃堕棿" min-width="150" prop="entryIntoForceTime"></el-table-column> - <el-table-column label="瀹℃壒浜�" min-width="150" prop="approverName"></el-table-column> + <el-table-column + label="鐢宠缂栧彿" + min-width="150" + prop="applicationNumber" + ></el-table-column> + <el-table-column + label="璁惧鍚嶇О" + min-width="150" + prop="deviceName" + ></el-table-column> + <el-table-column + label="璁惧缂栧彿" + min-width="150" + prop="deviceNumber" + ></el-table-column> + <el-table-column + label="璁惧鍨嬪彿" + min-width="150" + prop="deviceModel" + ></el-table-column> + <el-table-column + label="鏂囦欢缂栧彿" + min-width="150" + prop="documentNumber" + ></el-table-column> + <el-table-column + label="鏂囦欢鍚嶅瓧" + min-width="150" + prop="fileName" + ></el-table-column> + <el-table-column + label="鏂囨。璇存槑" + min-width="150" + prop="documentNote" + ></el-table-column> + <el-table-column + label="涓婁紶浜�" + min-width="150" + prop="uploaderName" + ></el-table-column> + <el-table-column + label="涓婁紶鏃堕棿" + min-width="150" + prop="updateTime" + ></el-table-column> + <el-table-column + label="鐢熸晥鏃堕棿" + min-width="150" + prop="entryIntoForceTime" + ></el-table-column> + <el-table-column + label="瀹℃壒浜�" + min-width="150" + prop="approverName" + ></el-table-column> <el-table-column label="瀹℃壒鐘舵��" min-width="150" prop="status"> <template v-slot="scope"> - {{scope.row.status === true ? '閫氳繃' : scope.row.status === false ? '涓嶉�氳繃' : '鏈鏍�'}} + {{ + scope.row.status === true + ? "閫氳繃" + : scope.row.status === false + ? "涓嶉�氳繃" + : "鏈鏍�" + }} </template> </el-table-column> <el-table-column label="鎿嶄綔" min-width="180" fixed="right" prop="name"> <template v-slot="scope"> - <el-button type="text" size="small" @click="downloadFile(scope.row.fileSystemName)">涓嬭浇</el-button> - <el-button type="text" size="small" style="color: red;" @click="deleteHomeworkGuidebook(scope.row)">鍒犻櫎</el-button> - <el-button type="text" size="small" @click="instructionEditFun(scope.row)">缂栬緫</el-button> - <el-button type="text" size="small" @click="approval(scope.row)">瀹℃壒</el-button> + <el-button + type="text" + size="small" + @click="downloadFile(scope.row.fileSystemName)" + >涓嬭浇</el-button + > + <el-button + type="text" + size="small" + style="color: red;" + @click="deleteHomeworkGuidebook(scope.row)" + >鍒犻櫎</el-button + > + <el-button + type="text" + size="small" + @click="instructionEditFun(scope.row)" + >缂栬緫</el-button + > + <el-button type="text" size="small" @click="approval(scope.row)" + >瀹℃壒</el-button + > </template> </el-table-column> </el-table> - <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1" - :page-sizes="[10, 20, 30, 50, 100]" :page-size="search.size" - layout="->,total, sizes, prev, pager, next, jumper" - :total="search.total"> + <el-pagination + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + :current-page="1" + :page-sizes="[10, 20, 30, 50, 100]" + :page-size="search.size" + layout="->,total, sizes, prev, pager, next, jumper" + :total="search.total" + > </el-pagination> <el-dialog :visible.sync="dialogVisible" title="鍙楁帶鐢宠" width="60%"> <div style="height: 60vh; overflow-y: auto; overflow-x: hidden;"> @@ -54,133 +133,317 @@ <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="鐢宠缂栧彿:"> - <el-input v-model="instructionForm.applicationNumber" disabled size="small" clearable></el-input> + <el-input + v-model="instructionForm.applicationNumber" + disabled + size="small" + clearable + ></el-input> </el-form-item> <el-form-item label="闄勪欢锛�" style="float: left;"> - <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList1" - :headers="headers" - :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove1" - :on-success="onSuccess1" - class="upload-demo" multiple> + <el-upload + ref="uploadFile" + :action="action" + :before-remove="beforeRemove" + :file-list="fileList1" + :headers="headers" + :limit="1" + :on-error="onError" + :on-exceed="handleExceed" + :on-remove="handleRemove1" + :on-success="onSuccess1" + class="upload-demo" + multiple + > <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> </el-upload> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="鐢宠閮ㄩ棬:"> - <el-input v-model="instructionForm.applicationDepartment" clearable size="small"></el-input> + <el-input + v-model="instructionForm.applicationDepartment" + clearable + size="small" + ></el-input> </el-form-item> <el-form-item label="璐d换浜�:"> - <el-input v-model="instructionForm.personLiable" clearable size="small"></el-input> + <el-input + v-model="instructionForm.personLiable" + clearable + size="small" + ></el-input> </el-form-item> </el-col> <el-col :span="24"> - <el-form-item label="鍙楁帶鐢宠璇存槑:" prop="controlledApplicationDescription" - :rules="[{required: true, message: '璇疯緭鍏ュ彈鎺х敵璇疯鏄�', trigger: 'blur'}]"> - <el-input v-model="instructionForm.controlledApplicationDescription" type="textarea" - clearable></el-input> + <el-form-item + label="鍙楁帶鐢宠璇存槑:" + prop="controlledApplicationDescription" + :rules="[ + { + required: true, + message: '璇疯緭鍏ュ彈鎺х敵璇疯鏄�', + trigger: 'blur' + } + ]" + > + <el-input + v-model="instructionForm.controlledApplicationDescription" + type="textarea" + clearable + ></el-input> </el-form-item> </el-col> </el-row> </el-form> <div style="text-align: right; margin-bottom: 10px"> - <el-button size="small" type="primary" @click="dialogVisible1 = true">娣诲姞鍙楁帶鏂囦欢</el-button> + <el-button size="small" type="primary" @click="openAddDia" + >娣诲姞鍙楁帶鏂囦欢</el-button + > <el-button size="small" @click="delFile">鍒犻櫎</el-button> </div> - <el-table :data="documentTableData" border style="width: 100%;" - tooltip-effect="dark" - :row-key="getRowKey" - @selection-change="handleSelectionChange" height="30em"> - <el-table-column type="selection" width="55%"> - </el-table-column> - <el-table-column label="搴忓彿" prop="id" type="index" width="60"></el-table-column> - <el-table-column label="璁惧鍚嶇О" prop="deviceName" show-overflow-tooltip min-width="125"></el-table-column> - <el-table-column label="璁惧缂栧彿" prop="deviceNumber" show-overflow-tooltip min-width="125"></el-table-column> - <el-table-column label="璁惧鍨嬪彿" prop="deviceModel" show-overflow-tooltip min-width="125"></el-table-column> - <el-table-column label="鏂囦欢缂栧彿" prop="documentNumber" show-overflow-tooltip - min-width="125"></el-table-column> - <el-table-column label="鏂囦欢鍚嶇О" prop="fileName" show-overflow-tooltip min-width="125"></el-table-column> - <el-table-column label="涓婁紶浜�" prop="author" show-overflow-tooltip min-width="125"></el-table-column> - <el-table-column label="涓婁紶鏃堕棿" prop="updateTime" show-overflow-tooltip min-width="125"></el-table-column> + <el-table + :data="documentTableData" + border + style="width: 100%;" + tooltip-effect="dark" + :row-key="getRowKey" + @selection-change="handleSelectionChange" + height="30em" + > + <el-table-column type="selection" width="55%"> </el-table-column> + <el-table-column + label="搴忓彿" + prop="id" + type="index" + width="60" + ></el-table-column> + <el-table-column + label="璁惧鍚嶇О" + prop="deviceName" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="璁惧缂栧彿" + prop="deviceNumber" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="璁惧鍨嬪彿" + prop="deviceModel" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="鏂囨。缂栧彿" + prop="documentNumber" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="鏂囦欢鍚嶇О" + prop="fileName" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="涓婁紶浜�" + prop="author" + show-overflow-tooltip + min-width="125" + ></el-table-column> + <el-table-column + label="涓婁紶鏃堕棿" + prop="updateTime" + show-overflow-tooltip + min-width="125" + ></el-table-column> <el-table-column min-width="100" label="鎿嶄綔" fixed="right"> - <template #default="{row, $index}"> - <el-button type="text" size="small" @click="downloadFile(row.fileSystemName)">涓嬭浇</el-button> - <el-button type="text" @click="editFun(row, $index)">缂栬緫</el-button> + <template v-slot="scope"> + <el-button + type="text" + size="small" + @click="downloadFile(scope.row.fileSystemName)" + >涓嬭浇</el-button + > + <el-button type="text" @click="editFun(scope.row, scope.$index)" + >缂栬緫</el-button + > </template> </el-table-column> </el-table> </div> <span slot="footer"> <el-button @click="dialogVisible = false" size="small">鍙� 娑�</el-button> - <el-button size="small" type="primary" @click="submitFun">鎻愪氦</el-button> + <el-button size="small" type="primary" @click="submitFun" + >鎻愪氦</el-button + > </span> </el-dialog> - <el-dialog :visible.sync="dialogVisible1" title="娣诲姞璁惧浣滀笟鎸囧涔�" width="40%"> + <el-dialog + :visible.sync="dialogVisible1" + title="娣诲姞璁惧浣滀笟鎸囧涔�" + width="40%" + > <div style="height: 50vh;"> <el-form ref="form" :model="form" label-width="90px"> <el-row :gutter="20"> <el-col :span="12"> - <el-form-item label="鏂囦欢绫诲瀷:" prop="documentType" - :rules="[{required: true, message: '璇疯緭鍏ユ枃浠剁被鍨�', trigger: 'blur'}]"> - <el-input v-model="form.documentType" clearable size="small" placeholder="璇疯緭鍏ユ枃浠剁被鍨�"></el-input> + <el-form-item + label="鏂囦欢绫诲瀷:" + prop="documentType" + :rules="[ + { required: true, message: '璇疯緭鍏ユ枃浠剁被鍨�', trigger: 'blur' } + ]" + > + <el-input + v-model="form.documentType" + clearable + size="small" + placeholder="璇疯緭鍏ユ枃浠剁被鍨�" + ></el-input> </el-form-item> - <el-form-item label="璁惧鍚嶇О:" prop="deviceName" - :rules="[{required: true, message: '璇烽�夋嫨璁惧', trigger: 'change'}]"> - <el-select v-model="form.deviceName" size="small" clearable style="width: 100%" - placeholder="璇烽�夋嫨璁惧鍚嶇О" - @change="onDeviceNameChange" filterable> - <el-option v-for="item in deviceNameOption" - :key="item.id" - :label="item.label" - :value="item.value"> + <el-form-item + label="璁惧鍚嶇О:" + prop="deviceName" + :rules="[ + { required: true, message: '璇烽�夋嫨璁惧', trigger: 'change' } + ]" + > + <el-select + v-model="form.deviceName" + size="small" + clearable + style="width: 100%" + placeholder="璇烽�夋嫨璁惧鍚嶇О" + @change="onDeviceNameChange" + filterable + > + <el-option + v-for="item in deviceNameOption" + :key="item.id" + :label="item.label" + :value="item.value" + > </el-option> </el-select> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鏂囨。缂栧彿:" prop="documentNumber" - :rules="[{required: true, message: '璇疯緭鍏ユ枃妗g紪鍙�', trigger: 'blur'}]"> - <el-input v-model="form.documentNumber" size="small" clearable placeholder="璇疯緭鍏ユ枃妗g紪鍙�"></el-input> + <el-form-item + label="鏂囨。缂栧彿:" + prop="documentNumber" + :rules="[ + { required: true, message: '璇疯緭鍏ユ枃妗g紪鍙�', trigger: 'blur' } + ]" + > + <el-input + v-model="form.documentNumber" + size="small" + clearable + placeholder="璇疯緭鍏ユ枃妗g紪鍙�" + ></el-input> </el-form-item> <el-form-item label="绠$悊缂栧彿:"> - <el-input v-model="form.deviceNumber" size="small" clearable disabled - placeholder="璇疯緭鍏ョ鐞嗙紪鍙�"></el-input> + <el-input + v-model="form.deviceNumber" + size="small" + clearable + disabled + placeholder="璇疯緭鍏ョ鐞嗙紪鍙�" + ></el-input> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鏂囦欢鐗堟湰:" prop="documentVersion" - :rules="[{required: true, message: '璇疯緭鍏ユ枃浠剁増鏈�', trigger: 'blur'}]"> - <el-input v-model="form.documentVersion" size="small" placeholder="璇疯緭鍏ユ枃浠剁増鏈�" clearable></el-input> + <el-form-item + label="鏂囦欢鐗堟湰:" + prop="documentVersion" + :rules="[ + { required: true, message: '璇疯緭鍏ユ枃浠剁増鏈�', trigger: 'blur' } + ]" + > + <el-input + v-model="form.documentVersion" + size="small" + placeholder="璇疯緭鍏ユ枃浠剁増鏈�" + clearable + ></el-input> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="浣滆��:" prop="author" - :rules="[{required: true, message: '璇疯緭鍏ヤ綔鑰�', trigger: 'blur'}]"> - <el-input v-model="form.author" size="small" clearable></el-input> + <el-form-item + label="浣滆��:" + prop="author" + :rules="[ + { required: true, message: '璇疯緭鍏ヤ綔鑰�', trigger: 'blur' } + ]" + > + <el-input + v-model="form.author" + size="small" + clearable + ></el-input> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鎻愪氦鏃ユ湡:" prop="submitDate" - :rules="[{required: true, message: '璇烽�夋嫨鎻愪氦鏃ユ湡', trigger: 'change'}]"> - <el-date-picker v-model="form.submitDate" format="yyyy-MM-dd" style="width: 100%" size="small" clearable - placeholder="閫夋嫨鏃ユ湡" - type="date" value-format="yyyy-MM-dd"> + <el-form-item + label="鎻愪氦鏃ユ湡:" + prop="submitDate" + :rules="[ + { + required: true, + message: '璇烽�夋嫨鎻愪氦鏃ユ湡', + trigger: 'change' + } + ]" + > + <el-date-picker + v-model="form.submitDate" + format="yyyy-MM-dd" + style="width: 100%" + size="small" + clearable + placeholder="閫夋嫨鏃ユ湡" + type="date" + value-format="yyyy-MM-dd" + > </el-date-picker> </el-form-item> </el-col> <el-col :span="24"> - <el-form-item label="鏂囨。璇存槑:" prop="documentNote" - :rules="[{required: true, message: '璇疯緭鍏ユ枃妗h鏄�', trigger: 'blur'}]"> - <el-input v-model="form.documentNote" placeholder="璇疯緭鍏ユ枃妗h鏄�" type="textarea" clearable></el-input> + <el-form-item + label="鏂囨。璇存槑:" + prop="documentNote" + :rules="[ + { required: true, message: '璇疯緭鍏ユ枃妗h鏄�', trigger: 'blur' } + ]" + > + <el-input + v-model="form.documentNote" + placeholder="璇疯緭鍏ユ枃妗h鏄�" + type="textarea" + clearable + ></el-input> </el-form-item> </el-col> <el-col :span="24"> <el-form-item label="闄勪欢锛�" style="float: left;"> - <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList" - :headers="headers" - :limit="1" :on-error="onError" :on-exceed="handleExceed" :on-remove="handleRemove" - :on-success="onSuccess" - class="upload-demo" multiple> + <el-upload + ref="uploadFile" + :action="action" + :before-remove="beforeRemove" + :file-list="fileList" + :headers="headers" + :limit="1" + :on-error="onError" + :on-exceed="handleExceed" + :on-remove="handleRemove" + :on-success="onSuccess" + class="upload-demo" + multiple + > <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> </el-upload> </el-form-item> @@ -189,8 +452,10 @@ </el-form> </div> <span slot="footer"> - <el-button @click="dialogVisible1 = false" size="small">鍙� 娑�</el-button> - <el-button type="primary" @click="addFile" size="small">纭� 瀹�</el-button> + <el-button @click="closeDia" size="small">鍙� 娑�</el-button> + <el-button type="primary" @click="addFile" size="small" + >纭� 瀹�</el-button + > </span> </el-dialog> </div> @@ -208,7 +473,7 @@ } } }, - name: '', + name: "", components: {}, data() { return { @@ -219,19 +484,20 @@ }, dialogVisible: false, dialogVisible1: false, - value: '', + value: "", selectRow: null, device: null, + tableDataIndex: "", form: { - documentType: '', - documentNumber: '', - deviceName: '', - deviceModel: '', - deviceNumber: '', - fileName: '', - fileSystemName: '', - submitDate: '', - documentNote: '', + documentType: "", + documentNumber: "", + deviceName: "", + deviceModel: "", + deviceNumber: "", + fileName: "", + fileSystemName: "", + submitDate: "", + documentNote: "" }, tableData: [], documentTableData: [], @@ -243,228 +509,279 @@ deviceNameOption: [], //璁惧鍚嶇О涓嬫媺妗嗘暟鎹� entity: { deviceName: null, - laboratoryName: '', - storagePoint: '' + laboratoryName: "", + storagePoint: "" }, selectedRow: [], instructionForm: { - applicationNumber: '', // 鐢宠缂栧彿 - applicationDepartment: '', // 鐢宠閮ㄩ棬 - personLiable: '', // 璐d换浜� - controlledApplicationDescription: '', // 鍙楁帶鐢宠璇存槑 + applicationNumber: "", // 鐢宠缂栧彿 + applicationDepartment: "", // 鐢宠閮ㄩ棬 + personLiable: "", // 璐d换浜� + controlledApplicationDescription: "" // 鍙楁帶鐢宠璇存槑 } - } + }; }, mounted() { this.getAllDevice(); - this.getList() + this.getList(); }, watch: { // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 clickNodeVal(newVal) { if (newVal) { - this.getList() - this.clickSidebar(newVal) - } - }, - dialogVisible1(newVal) { - this.form.deviceName = this.clickNodeVal.label - this.onDeviceNameChange() - if (newVal === false) { - this.$refs.form.resetFields() - // this.form = {} - this.fileList = [] + this.getList(); + this.clickSidebar(newVal); } }, dialogVisible(newVal) { if (newVal === false) { - this.instructionForm = {} - this.documentTableData = [] - this.fileList1 = [] + this.instructionForm = {}; + this.documentTableData = []; + this.fileList1 = []; } } }, methods: { approval(row) { - this.$confirm('鏄惁瀹℃壒閫氳繃锛�', '鎻愮ず', { - confirmButtonText: '閫氳繃', - cancelButtonText: '涓嶉�氳繃', - type: 'warning' - }).then(() => { - this.approvalFun(row.id, true) - }).catch(() => { - this.approvalFun(row.id, false) - }); + this.$confirm("鏄惁瀹℃壒閫氳繃锛�", "鎻愮ず", { + confirmButtonText: "閫氳繃", + cancelButtonText: "涓嶉�氳繃", + type: "warning" + }) + .then(() => { + this.approvalFun(row.id, true); + }) + .catch(() => { + this.approvalFun(row.id, false); + }); }, approvalFun(id, status) { - this.$axios.get(this.$api.deviceCheck.approvalOfHomeworkInstructionManual + "?id=" + id + "&status=" + status).then(res => { - this.getList() - }) + this.$axios + .get( + this.$api.deviceCheck.approvalOfHomeworkInstructionManual + + "?id=" + + id + + "&status=" + + status + ) + .then(res => { + this.getList(); + }); this.$message({ - type: 'success', - message: '鎿嶄綔鎴愬姛!' + type: "success", + message: "鎿嶄綔鎴愬姛!" }); }, - getRowKey (row) { - return row.index + getRowKey(row) { + return row.index; }, deleteHomeworkGuidebook(row) { - this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - this.$axios.get(this.$api.deviceCheck.homeworkGuidebook + "?id=" + row.id + "&instructionId=" + row.instructionId).then(res => { - this.$message.success('鍒犻櫎鎴愬姛锛�') - this.getList() + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$axios + .get( + this.$api.deviceCheck.homeworkGuidebook + + "?id=" + + row.id + + "&instructionId=" + + row.instructionId + ) + .then(res => { + this.$message.success("鍒犻櫎鎴愬姛锛�"); + this.getList(); + }); }) - }).catch(() => { - this.$message({ - type: 'info', - message: '宸插彇娑堝垹闄�' + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, downloadFile(fileName) { - let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName) + let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName); if (state) { - let url = this.javaApi + '/img/' + fileName; - fileDownload.downloadIamge(url, fileName) + let url = this.javaApi + "/img/" + fileName; + fileDownload.downloadIamge(url, fileName); } else { - const url = this.javaApi+'/word/'+ fileName - const link = document.createElement('a'); + const url = this.javaApi + "/word/" + fileName; + const link = document.createElement("a"); link.href = url; link.download = fileName; link.click(); - this.$message.success('涓嬭浇鎴愬姛') + this.$message.success("涓嬭浇鎴愬姛"); } }, instructionEditFun(row) { - this.dialogVisible = true - this.$axios.get(this.$api.deviceCheck.homeworkGuidebookEditor + "?instructionId=" + row.instructionId).then(res => { - if (res.code == 200) { - this.instructionForm = res.data.instruction; - if (this.instructionForm.fileSystemName) { - this.fileList1.push({name: this.instructionForm.fileName}) + this.dialogVisible = true; + this.$axios + .get( + this.$api.deviceCheck.homeworkGuidebookEditor + + "?instructionId=" + + row.instructionId + ) + .then(res => { + if (res.code == 200) { + this.instructionForm = res.data.instruction; + if (this.instructionForm.fileSystemName) { + this.fileList1.push({ name: this.instructionForm.fileName }); + } + this.documentTableData = res.data.list; + // 鍒犻櫎鐢� + this.documentTableData.forEach((v, k) => { + v.index = k; + }); } - this.documentTableData = res.data.list; - // 鍒犻櫎鐢� - this.documentTableData.forEach((v, k) => { - v.index = k - }) - } - }) + }); }, handleSizeChange(val) { - this.search.size = val - this.getList() + this.search.size = val; + this.getList(); }, handleCurrentChange(val) { - this.search.current = val - this.getList() + this.search.current = val; + this.getList(); }, submitFun() { - this.$refs.form1.validate((valid) => { + this.$refs.form1.validate(valid => { if (valid) { - this.instructionForm.feTempHumRecordList = this.documentTableData - this.$axios.post(this.$api.deviceCheck.newHomeworkGuidebookAdded, this.instructionForm, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { - if (res.code == 200) { - this.$message.success('鎿嶄綔鎴愬姛锛�') - this.dialogVisible = false - this.getList() - } - }) + this.instructionForm.feTempHumRecordList = this.documentTableData; + this.$axios + .post( + this.$api.deviceCheck.newHomeworkGuidebookAdded, + this.instructionForm, + { + headers: { + "Content-Type": "application/json" + } + } + ) + .then(res => { + if (res.code == 200) { + this.$message.success("鎿嶄綔鎴愬姛锛�"); + this.dialogVisible = false; + this.getList(); + } + }); } else { return false; } }); }, clickSidebar(clickNodeVal) { - this.laboratoryNameIsNull = false + this.laboratoryNameIsNull = false; // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾� if (!clickNodeVal.value) { this.list = []; - this.entity.laboratoryName = null - this.entity.storagePoint = null + this.entity.laboratoryName = null; + this.entity.storagePoint = null; // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂� - if (clickNodeVal.label === '鍏朵粬') { - this.laboratoryNameIsNull = true - this.getAllDevice() - return + if (clickNodeVal.label === "鍏朵粬") { + this.laboratoryNameIsNull = true; + this.getAllDevice(); + return; } if (clickNodeVal.level === 1) { - this.entity.laboratoryName = clickNodeVal.label + this.entity.laboratoryName = clickNodeVal.label; // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐� } else if (clickNodeVal.level === 2) { // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣 - if (clickNodeVal.parent.label === '鍏朵粬') { - this.laboratoryNameIsNull = true + if (clickNodeVal.parent.label === "鍏朵粬") { + this.laboratoryNameIsNull = true; } else { - this.entity.laboratoryName = clickNodeVal.parent.label + this.entity.laboratoryName = clickNodeVal.parent.label; } - this.entity.storagePoint = clickNodeVal.label + this.entity.storagePoint = clickNodeVal.label; } - this.getAllDevice() + this.getAllDevice(); } }, - //鏂板 + // 鏂板 addFile() { - this.$refs.form.validate((valid) => { + this.$refs.form.validate(valid => { if (valid) { - if (this.form.index !== undefined) { - this.$set(this.documentTableData, this.form.index, this.form) + if (this.tableDataIndex !== undefined) { + this.$set(this.documentTableData, this.tableDataIndex, this.form); this.dialogVisible1 = false; - this.$message.success('淇敼鎴愬姛'); + this.$message.success("淇敼鎴愬姛"); + console.log( + "this.documentTableData---edit", + this.documentTableData[this.tableDataIndex] + ); } else { this.documentTableData.push(this.form); - // 鍒犻櫎鐢� - this.documentTableData.forEach((v, k) => { - v.index = k - }) this.dialogVisible1 = false; - this.$message.success('娣诲姞鎴愬姛'); + this.$message.success("娣诲姞鎴愬姛"); } } else { return false; } }); }, + openAddDia() { + this.dialogVisible1 = true; + this.tableDataIndex = undefined; + this.form = { + documentType: "", + documentNumber: "", + deviceName: "", + deviceModel: "", + deviceNumber: "", + fileName: "", + fileSystemName: "", + submitDate: "", + documentNote: "" + }; + this.form.deviceName = this.clickNodeVal.label; + this.onDeviceNameChange(); + this.fileList = []; + }, editFun(row, index) { - this.form = {...row} - // 鏇存柊鐢� - this.form.index = index; + this.form = { ...row }; + this.tableDataIndex = index; + console.log("this.tableDataIndex", this.tableDataIndex); // 鍥炴樉鍒楄〃 if (this.form.fileSystemName) { - this.fileList.push({name: this.form.fileName}) + this.fileList.push({ name: this.form.fileName }); } - this.dialogVisible1 = true + this.dialogVisible1 = true; + }, + closeDia() { + this.dialogVisible1 = false; + this.$refs["form"].resetFields(); + this.fileList = []; }, handleSelectionChange(selected) { - this.selectedRow = selected + this.selectedRow = selected; }, async delFile() { if (this.selectedRow.length === 0) { - this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑閫夐」'); + this.$message.error("璇烽�夋嫨瑕佸垹闄ょ殑閫夐」"); return; } // 鍒犻櫎淇濆瓨濂界殑鏁版嵁 let ids = this.selectedRow - .filter(item => item.id!== undefined) - .map(item => item.id).join(','); + .filter(item => item.id !== undefined) + .map(item => item.id) + .join(","); //鏈夐敊璇� - const res = await this.$axios.get(this.$api.deviceCheck.deleteHomeworkGuidebook + '?ids=' + ids); + const res = await this.$axios.get( + this.$api.deviceCheck.deleteHomeworkGuidebook + "?ids=" + ids + ); if (res.code === 200) { // 鍒犻櫎瑙嗗浘鐨勬暟鎹� for (const resKey in this.selectedRow) { - this.documentTableData = this.documentTableData.filter(item => item.index === this.selectedRow[resKey].index) + this.documentTableData = this.documentTableData.filter( + item => item.index === this.selectedRow[resKey].index + ); } this.$message.success({ - message: '鍒犻櫎鎴愬姛', - type: 'success' + message: "鍒犻櫎鎴愬姛", + type: "success" }); } }, @@ -477,47 +794,65 @@ this.instructionForm.fileSystemName = response.data; }, onError(error, file, fileList) { - this.$message.error('涓婁紶澶辫触:', error, file, fileList); + this.$message.error("涓婁紶澶辫触:", error, file, fileList); }, handleRemove(file, fileList) { - this.form.fileName = '' - this.form.fileSystemName = '' + this.form.fileName = ""; + this.form.fileSystemName = ""; }, handleRemove1(file, fileList) { - this.form.fileName = '' - this.form.fileSystemName = '' + this.form.fileName = ""; + this.form.fileSystemName = ""; }, beforeRemove(file) { - return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋) + return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋); }, handleExceed(files, fileList) { - this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙); + this.$message.warning( + `褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙 + ); }, getList() { - this.$axios.get(this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions + "?size=" + this.search.size + "¤t=" + this.search.current).then(res => { - if (res.code == 200) { - this.tableData = res.data.records; - this.search.total = res.data.total - } - }) + this.$axios + .get( + this.$api.deviceCheck.pageByPageQueryOfHomeworkInstructions + + "?size=" + + this.search.size + + "¤t=" + + this.search.current + ) + .then(res => { + if (res.code == 200) { + this.tableData = res.data.records; + this.search.total = res.data.total; + } + }); }, getAllDevice() { - this.$axios.post(this.$api.deviceScope.selectDeviceParameter + "?laboratoryNameIsNull=" + this.laboratoryNameIsNull, { - page: { - current: 1, - size: -1 - }, - entity: this.entity - }, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { - if (res.code == 200) { - this.devices = res.data.body.records; - this.updateDeviceNameOptions(); - } - }) + this.$axios + .post( + this.$api.deviceScope.selectDeviceParameter + + "?laboratoryNameIsNull=" + + this.laboratoryNameIsNull, + { + page: { + current: 1, + size: -1 + }, + entity: this.entity + }, + { + headers: { + "Content-Type": "application/json" + } + } + ) + .then(res => { + if (res.code == 200) { + this.devices = res.data.body.records; + this.updateDeviceNameOptions(); + } + }); }, // 鏇存柊璁惧鍚嶇О涓嬫媺妗嗙殑閫夐」 updateDeviceNameOptions() { @@ -529,29 +864,30 @@ // 璁惧鍚嶇О鏀瑰彉鏃惰Е鍙� onDeviceNameChange() { // 鏍规嵁閫変腑鐨勮澶囧悕绉帮紝鏇存柊绠$悊缂栧彿涓嬫媺妗嗙殑閫夐」 - const selectedDevice = this.devices.find(device => device.deviceName === this.form.deviceName); + const selectedDevice = this.devices.find( + device => device.deviceName === this.form.deviceName + ); if (selectedDevice) { this.form.deviceNumber = selectedDevice.managementNumber; this.form.deviceModel = selectedDevice.specificationModel; - this.form.deviceId = selectedDevice.id + this.form.deviceId = selectedDevice.id; } - }, + } }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, action() { - return this.javaApi + this.$api.personnel.saveCNASFile + return this.javaApi + this.$api.personnel.saveCNASFile; } - }, -} + } +}; </script> <style scoped> - h4 { font-weight: 400; font-size: 16px; -- Gitblit v1.9.3