From 4c3fd93d87daace1de00b129e642193fe863f4a2 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 11 三月 2025 09:23:29 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/center-lims-before-ruoyi into dev
---
src/views/CNAS/resourceDemand/device/component/operationInstruction.vue | 536 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 536 insertions(+), 0 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
new file mode 100644
index 0000000..436b01f
--- /dev/null
+++ b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
@@ -0,0 +1,536 @@
+<!-- 浣滀笟鎸囧涔� -->
+<template>
+ <div>
+ <div style="margin: 10px 0;text-align: right">
+<!-- <el-button size="small" type="primary" @click="getList">鍒锋柊</el-button>-->
+ <el-button size="small" type="primary" @click="dialogVisible = true">鍙楁帶鐢宠</el-button>
+ </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>
+ </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="status">
+ <template v-slot="scope">
+ {{ 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>
+ </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>
+ <el-dialog :visible.sync="dialogVisible" title="鍙楁帶鐢宠" width="60%">
+ <div style="height: 60vh; overflow-y: auto; overflow-x: hidden;">
+ <el-form ref="form1" label-width="110px" :model="instructionForm">
+ <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-form-item>
+ <el-form-item label="闄勪欢锛�" style="float: left;">
+ <el-upload ref="uploadFile" :action="action" :before-remove="beforeRemove" :file-list="fileList1"
+ :headers="uploadHeader" :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-form-item>
+ <el-form-item label="璐d换浜�:">
+ <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>
+ </el-col>
+ </el-row>
+ </el-form>
+ <div style="text-align: right; margin-bottom: 10px">
+ <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="29em">
+ <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 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>
+ </span>
+ </el-dialog>
+ <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>
+ <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>
+ <el-form-item label="绠$悊缂栧彿:">
+ <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>
+ </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>
+ </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-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>
+ </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="uploadHeader" :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>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ <span slot="footer">
+ <el-button @click="closeDia" size="small">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addFile" size="small">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import fileDownload from "@/utils/file";
+import {
+ approvalOfHomeworkInstructionManual,
+ homeworkGuidebook,
+ homeworkGuidebookEditor,
+ newHomeworkGuidebookAdded,
+ deleteHomeworkGuidebook,
+ pageByPageQueryOfHomeworkInstructions,
+ selectDeviceParameter,
+} from '@/api/cnas/resourceDemand/device.js'
+export default {
+ props: {
+ clickNodeVal: {
+ type: Object,
+ default: () => {
+ return {};
+ }
+ }
+ },
+ name: '',
+ components: {},
+ data() {
+ return {
+ search: {
+ size: 20,
+ current: 1,
+ total: 0
+ },
+ dialogVisible: false,
+ dialogVisible1: false,
+ value: '',
+ selectRow: null,
+ device: null,
+ tableDataIndex: '',
+ form: {
+ documentType: '',
+ documentNumber: '',
+ deviceName: '',
+ deviceModel: '',
+ deviceNumber: '',
+ fileName: '',
+ fileSystemName: '',
+ submitDate: '',
+ documentNote: '',
+ },
+ tableData: [],
+ documentTableData: [],
+ formData: {},
+ fileList: [],
+ fileList1: [],
+ laboratoryNameIsNull: false,
+ devices: [], //璁惧鍒楄〃鏁版嵁
+ deviceNameOption: [], //璁惧鍚嶇О涓嬫媺妗嗘暟鎹�
+ entity: {
+ deviceName: null,
+ laboratoryName: '',
+ storagePoint: ''
+ },
+ selectedRow: [],
+ instructionForm: {
+ applicationNumber: '', // 鐢宠缂栧彿
+ applicationDepartment: '', // 鐢宠閮ㄩ棬
+ personLiable: '', // 璐d换浜�
+ controlledApplicationDescription: '', // 鍙楁帶鐢宠璇存槑
+ }
+ }
+ },
+ mounted() {
+ this.getAllDevice();
+ this.getList()
+ },
+ watch: {
+ // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
+ clickNodeVal(newVal) {
+ if (newVal) {
+ this.getList()
+ this.clickSidebar(newVal)
+ }
+ },
+ dialogVisible(newVal) {
+ if (newVal === false) {
+ 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)
+ });
+ },
+ approvalFun(id, status) {
+ approvalOfHomeworkInstructionManual({ id, status }).then(res => {
+ this.getList()
+ this.$message({
+ type: 'success',
+ message: '鎿嶄綔鎴愬姛!'
+ });
+ })
+
+ },
+ getRowKey(row) {
+ return row.index
+ },
+ deleteHomeworkGuidebook(row) {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ homeworkGuidebook({
+ id: row.id,
+ instructionId: row.instructionId
+ }).then(res => {
+ this.$message.success('鍒犻櫎鎴愬姛锛�')
+ this.getList()
+ })
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ });
+ });
+ },
+ downloadFile(fileName) {
+ let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName)
+ if (state) {
+ let url = this.javaApi + '/img/' + fileName;
+ fileDownload.downloadIamge(url, fileName)
+ } else {
+ const url = this.javaApi + '/word/' + fileName
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = fileName;
+ link.click();
+ this.$message.success('涓嬭浇鎴愬姛')
+ }
+ },
+ instructionEditFun(row) {
+ this.dialogVisible = true
+ 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
+ })
+ }
+ })
+ },
+ handleSizeChange(val) {
+ this.search.size = val
+ this.getList()
+ },
+ handleCurrentChange(val) {
+ this.search.current = val
+ this.getList()
+ },
+ submitFun() {
+ this.$refs.form1.validate((valid) => {
+ if (valid) {
+ this.instructionForm.feTempHumRecordList = this.documentTableData
+ newHomeworkGuidebookAdded(this.instructionForm).then(res => {
+ if (res.code == 200) {
+ this.$message.success('鎿嶄綔鎴愬姛锛�')
+ this.dialogVisible = false
+ this.getList()
+ }
+ })
+ } else {
+ return false;
+ }
+ });
+ },
+ clickSidebar(clickNodeVal) {
+ this.laboratoryNameIsNull = false
+ // 鏄惁瀛樺湪value锛屽瓨鍦╲alue浠h〃涓轰笁绾�
+ if (!clickNodeVal.value) {
+ this.list = [];
+ this.entity.laboratoryName = null
+ this.entity.storagePoint = null
+ // 绛変簬1浠h〃涓烘爲鐨勪竴绾э紝label涓洪儴闂�
+ if (clickNodeVal.label === '鍏朵粬') {
+ this.laboratoryNameIsNull = true
+ this.getAllDevice()
+ return
+ }
+ if (clickNodeVal.level === 1) {
+ this.entity.laboratoryName = clickNodeVal.label
+ // 绛変簬浜岀骇銆俵abel涓哄瓨鍌ㄥ湴鐐�
+ } else if (clickNodeVal.level === 2) {
+ // 鍏朵粬琛ㄧず娌℃湁閰嶇疆瀹為獙瀹わ紝鍙厤缃簡鍦扮偣
+ if (clickNodeVal.parent.label === '鍏朵粬') {
+ this.laboratoryNameIsNull = true
+ } else {
+ this.entity.laboratoryName = clickNodeVal.parent.label
+ }
+ this.entity.storagePoint = clickNodeVal.label
+ }
+ this.getAllDevice()
+ }
+ },
+ // 鏂板
+ addFile() {
+ this.$refs.form.validate((valid) => {
+ if (valid) {
+ if (this.tableDataIndex !== undefined) {
+ this.$set(this.documentTableData, this.tableDataIndex, this.form)
+ this.dialogVisible1 = false;
+ this.$message.success('淇敼鎴愬姛');
+ console.log('this.documentTableData---edit', this.documentTableData[this.tableDataIndex])
+ } else {
+ this.documentTableData.push(this.form);
+ this.dialogVisible1 = false;
+ this.$message.success('娣诲姞鎴愬姛');
+ }
+ } else {
+ return false;
+ }
+ });
+ },
+ openAddDia() {
+ this.dialogVisible1 = true
+ this.tableDataIndex = undefined;
+ this.form = {}
+ this.form.deviceName = this.clickNodeVal.label
+ this.onDeviceNameChange()
+ this.fileList = []
+
+ },
+ editFun(row, 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.dialogVisible1 = true
+ },
+ closeDia() {
+ this.dialogVisible1 = false
+ this.$refs['form'].resetFields()
+ this.fileList = []
+ },
+ handleSelectionChange(selected) {
+ this.selectedRow = selected
+ },
+ async delFile() {
+ if (this.selectedRow.length === 0) {
+ this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑閫夐」');
+ return;
+ }
+ // 鍒犻櫎淇濆瓨濂界殑鏁版嵁
+ let ids = this.selectedRow
+ .filter(item => item.id !== undefined)
+ .map(item => item.id).join(',');
+ //鏈夐敊璇�
+ const res = await deleteHomeworkGuidebook({ ids });
+ if (res.code === 200) {
+ // 鍒犻櫎瑙嗗浘鐨勬暟鎹�
+ for (const resKey in this.selectedRow) {
+ this.documentTableData = this.documentTableData.filter(item => item.index === this.selectedRow[resKey].index)
+ }
+ this.$message.success({
+ message: '鍒犻櫎鎴愬姛',
+ type: 'success'
+ });
+ }
+ },
+ onSuccess(response, file, fileList) {
+ this.form.fileName = file.name;
+ this.form.fileSystemName = response.data;
+ },
+ onSuccess1(response, file, fileList) {
+ this.instructionForm.fileName = file.name;
+ this.instructionForm.fileSystemName = response.data;
+ },
+ onError(error, file, fileList) {
+ this.$message.error('涓婁紶澶辫触:', error, file, fileList);
+ },
+ handleRemove(file, fileList) {
+ this.form.fileName = ''
+ this.form.fileSystemName = ''
+ },
+ handleRemove1(file, fileList) {
+ this.form.fileName = ''
+ this.form.fileSystemName = ''
+ },
+ beforeRemove(file) {
+ return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋)
+ },
+ handleExceed(files, fileList) {
+ this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙);
+ },
+ getList() {
+ pageByPageQueryOfHomeworkInstructions({ ...this.search }).then(res => {
+ if (res.code == 200) {
+ this.tableData = res.data.records;
+ this.search.total = res.data.total
+ }
+ })
+ },
+ getAllDevice() {
+ selectDeviceParameter({ laboratoryNameIsNull: this.laboratoryNameIsNull }).then(res => {
+ if (res.code == 200) {
+ this.devices = res.data.records;
+ this.updateDeviceNameOptions();
+ }
+ })
+ },
+ // 鏇存柊璁惧鍚嶇О涓嬫媺妗嗙殑閫夐」
+ updateDeviceNameOptions() {
+ this.deviceNameOption = this.devices.map(device => ({
+ value: device.deviceName,
+ label: device.deviceName
+ }));
+ },
+ // 璁惧鍚嶇О鏀瑰彉鏃惰Е鍙�
+ onDeviceNameChange() {
+ // 鏍规嵁閫変腑鐨勮澶囧悕绉帮紝鏇存柊绠$悊缂栧彿涓嬫媺妗嗙殑閫夐」
+ 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
+ }
+ },
+ },
+ computed: {
+ action() {
+ return this.javaApi + '/personBasicInfo/saveCNASFile'
+ }
+ },
+}
+</script>
+
+<style scoped>
+h4 {
+ font-weight: 400;
+ font-size: 16px;
+ display: flex;
+ justify-content: flex-end;
+ margin: 10px 0;
+}
+</style>
--
Gitblit v1.9.3