From e3686634452289d43e750a44f30f72b0e7754866 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 07 十一月 2026 00:26:56 +0800
Subject: [PATCH] 修复人员管理模块各标签页问题并完善设备、文件受控页面
---
src/views/CNAS/personnel/personnelInfo/index.vue | 97 +-
src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue | 81 +
src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue | 110 ++
src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue | 50 +
src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue | 174 +++-
src/views/CNAS/personnel/personnelInfo/tabs/mandate.vue | 92 +
src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue | 3
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue | 39 +
src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue | 3
index.html | 1
src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue | 3
public/import-templates/文件受控申请导入模板.xlsx | 0
src/views/CNAS/personnel/personnelInfo/tabs/personnel-capacity.vue | 182 ++++-
src/views/CNAS/personnel/personnelInfo/tabs/personnelTraining.vue | 212 ++++-
src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue | 3
src/views/CNAS/personnel/personnelInfo/components/Edit.vue | 150 ++-
src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue | 48
src/views/CNAS/personnel/personnelInfo/tabs/personnel-information.vue | 338 +++++++--
src/components/UpPdfStamp/index.vue | 59 +
src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue | 97 ++
src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue | 3
src/views/CNAS/resourceDemand/device/component/record.vue | 60
src/api/cnas/personal/personJobResponsibilities.js | 2
src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue | 173 +++-
src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue | 3
25 files changed, 1,383 insertions(+), 600 deletions(-)
diff --git a/index.html b/index.html
index c14411b..63fef54 100644
--- a/index.html
+++ b/index.html
@@ -218,7 +218,6 @@
<!-- Luckysheet 蹇呴』鍏堜簬鑷姩娉ㄥ叆鐨� Vue 搴旂敤鑴氭湰鍔犺浇锛坈lassic script 鍏堜簬 type=module 鎵ц锛� -->
<script src="/luckysheet/plugins/js/plugin.js"></script>
<script src="/luckysheet/luckysheet.umd.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js"></script>
<script type="module" src="/src/main.js"></script>
</body>
diff --git "a/public/import-templates/\346\226\207\344\273\266\345\217\227\346\216\247\347\224\263\350\257\267\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/public/import-templates/\346\226\207\344\273\266\345\217\227\346\216\247\347\224\263\350\257\267\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
new file mode 100644
index 0000000..c291c48
--- /dev/null
+++ "b/public/import-templates/\346\226\207\344\273\266\345\217\227\346\216\247\347\224\263\350\257\267\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
diff --git a/src/api/cnas/personal/personJobResponsibilities.js b/src/api/cnas/personal/personJobResponsibilities.js
index 0c2673b..79abe7e 100644
--- a/src/api/cnas/personal/personJobResponsibilities.js
+++ b/src/api/cnas/personal/personJobResponsibilities.js
@@ -29,7 +29,7 @@
export function personJobResponsibilitiesDelete(query) {
return request({
url: "/personJobResponsibilities/personJobResponsibilitiesDelete",
- method: "delete ",
+ method: "delete",
params: query
});
}
diff --git a/src/components/UpPdfStamp/index.vue b/src/components/UpPdfStamp/index.vue
index fd92a4e..b4277ee 100644
--- a/src/components/UpPdfStamp/index.vue
+++ b/src/components/UpPdfStamp/index.vue
@@ -20,6 +20,7 @@
<script>
import jsPDF from 'jspdf'
+import workerUrl from 'pdfjs-dist/build/pdf.worker.min.mjs?worker&url'
// 鍘熷疄鐜扮敤 require("@/assets/stamps/" + name + ".png")锛孷ite 閲屾病鏈� require锛�
// 鐢� import.meta.glob 鎶婂嵃绔犲浘鎵撴垚涓�寮� 鍚嶅瓧鈫扷RL 鐨勮〃锛屾晥鏋滅瓑浠枫��
@@ -97,10 +98,22 @@
this.$message.error('璇烽�夋嫨 PDF 鏂囦欢')
}
},
- loadPDF(typedArray) {
- pdfjsLib.getDocument(typedArray).promise.then(pdfDoc_ => {
- this.pdfDoc = pdfDoc_
- this.canvasNumPages = this.pdfDoc._pdfInfo.numPages
+ async loadPDF(typedArray) {
+ try {
+ // 鐢ㄦ湰鍦版墦鍖呯殑 pdf.js锛屼笉鍐嶄緷璧栧叕缃� CDN锛涘唴缃戝姞杞戒笉鍒颁細閫犳垚棰勮鍖哄彧鍓╃┖鐧界敾甯�
+ const pdfjsLib = await import('pdfjs-dist/build/pdf.mjs')
+ pdfjsLib.GlobalWorkerOptions.workerSrc = workerUrl
+ const loadingTask = pdfjsLib.getDocument({
+ data: typedArray,
+ useWasm: false,
+ useSystemFonts: true,
+ isEvalSupported: false
+ })
+ const pdfDoc_ = await loadingTask.promise
+ // pdf.js 5 鐨勭被鍐呴儴鐢ㄤ簡 # 绉佹湁瀛楁锛岃 Vue3 鍝嶅簲寮忓寘鎴� Proxy 鍚� getPage 浼氭姏
+ // "Cannot read private member ... from an object whose class did not declare it"锛屽繀椤� markRaw
+ this.pdfDoc = markRaw(pdfDoc_)
+ this.canvasNumPages = pdfDoc_.numPages
this.stamps = []
this.contextList = []
for (let i = 1; i <= this.canvasNumPages; i++) {
@@ -109,11 +122,20 @@
})
this.stamps.push([])
}
- })
+ } catch (e) {
+ console.error('[UpPdfStamp] PDF 鍔犺浇澶辫触', e)
+ this.pdfDoc = null
+ this.canvasNumPages = 0
+ this.stamps = []
+ this.contextList = []
+ this.$message.error('鏂囦欢棰勮澶辫触锛岃妫�鏌ユ枃浠舵槸鍚︽崯鍧忔垨绋嶅悗閲嶈瘯')
+ this.$emit('uploadPDFErr')
+ }
},
// 娓叉煋鎸囧畾椤甸潰
- renderPage(pageNum) {
- this.pdfDoc.getPage(pageNum).then(page => {
+ async renderPage(pageNum) {
+ try {
+ const page = await this.pdfDoc.getPage(pageNum)
const canvas = this.canvasEls[pageNum - 1]
if (!canvas) return
// 鍘熷疄鐜版槸 push锛屼綅缃彇鍐充簬鍚勯〉 getPage 鐨� Promise 瀹屾垚椤哄簭锛�
@@ -124,17 +146,18 @@
canvas.width = viewport.width
canvas.height = viewport.height
- page
- .render({
- canvasContext: this.contextList[pageNum - 1],
- viewport: viewport
- })
- .promise.then(() => {
- this.stamps[pageNum - 1].forEach(m => {
- this.drawStamps(m.x, m.y, pageNum - 1)
- })
- })
- })
+ await page.render({
+ canvasContext: this.contextList[pageNum - 1],
+ viewport: viewport
+ }).promise
+ this.stamps[pageNum - 1].forEach(m => {
+ this.drawStamps(m.x, m.y, pageNum - 1)
+ })
+ } catch (e) {
+ console.error('[UpPdfStamp] PDF 椤甸潰娓叉煋澶辫触', e)
+ this.$message.error('鏂囦欢棰勮娓叉煋澶辫触锛岃绋嶅悗閲嶈瘯')
+ this.$emit('uploadPDFErr')
+ }
},
// 鍗曞嚮--娣诲姞绔�
handleCanvasClick(event, i) {
diff --git a/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue b/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
index 1b2291b..dcdda3e 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
@@ -1,19 +1,20 @@
<template>
<div>
- <el-dialog v-model="addTrainingPlanDia" title="鏂板鍩硅璁″垝" width="50%" @close="closeAdd">
+ <el-dialog v-model="addTrainingPlanDia" :title="operationType === 'edit' ? '缂栬緫鍩硅璁″垝' : '鏂板鍩硅璁″垝'" width="50%" @close="closeAdd">
<div class="body">
<el-form ref="trainingPlanForm" :model="trainingPlan" label-position="right" label-width="90px" :rules="trainingPlanRules">
<el-row>
<el-col :span="12">
<el-form-item label="鍩硅鏃ユ湡:" prop="trainingDate">
- <el-date-picker v-model="trainingPlan.trainingDate" format="YYYY-MM"
- placeholder="閫夋嫨鏃ユ湡" size="small" value-format="YYYY-MM"
- type="month" style="width: 100%"></el-date-picker>
+ <el-date-picker v-model="trainingPlan.trainingDate" format="YYYY-MM-DD"
+ placeholder="閫夋嫨鏃ユ湡" size="small" value-format="YYYY-MM-DD"
+ type="date" style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="璇炬椂:" prop="classHour">
- <el-input type="number" v-model="trainingPlan.classHour" label="鎻忚堪鏂囧瓧" size="small"></el-input>
+ <el-input-number v-model="trainingPlan.classHour" :min="0" :max="9999" :precision="0"
+ controls-position="right" size="small" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -101,11 +102,11 @@
planId: '',
id: '',
trainingDate: '',
- classHour: '',
+ classHour: null,
trainingObjectives: '',
participants: '',
trainingContent: '',
- trainingLecturerId: '',
+ trainingLecturerId: null,
trainingLecturerName: '',
trainingMode: '',
holdingDepartment: '',
@@ -126,17 +127,22 @@
this.operationType = type
if (this.operationType === 'edit') {
this.trainingPlan = this.HaveJson(row)
+ // 鍘嗗彶鏁版嵁鍙兘鍙瓨浜嗗勾鏈堬紝琛ラ綈鍒板綋鏈�1鏃ワ紝閬垮厤鏃ユ湡鎺т欢鏃犳硶鍥炴樉
+ if (this.trainingPlan.trainingDate && /^\d{4}-\d{2}$/.test(this.trainingPlan.trainingDate)) {
+ this.trainingPlan.trainingDate += '-01'
+ }
this.lecturerType = row.trainingLecturerId ? 'internal' : (row.trainingLecturerName ? 'external' : 'internal')
} else {
this.lecturerType = 'internal'
this.trainingPlan = {
id: '',
trainingDate: '',
- classHour: '',
+ classHour: null,
trainingObjectives: '',
participants: '',
trainingContent: '',
- trainingLecturerId: '',
+ trainingLecturerId: null,
+ trainingLecturerName: '',
trainingMode: '',
holdingDepartment: '',
remarks: '',
@@ -144,6 +150,9 @@
}
this.trainingPlan.planId = id
this.getUserList()
+ this.$nextTick(() => {
+ this.$refs.trainingPlanForm && this.$refs.trainingPlanForm.clearValidate()
+ })
},
handleLecturerTypeChange(type) {
if (type === 'internal') {
@@ -172,15 +181,20 @@
this.trainingPlan.trainingLecturerName = null
}
this.submitAddLoading = true
- this.trainingPlan.planId = this.currentChangeRow.id
+ if (!this.trainingPlan.planId) {
+ this.trainingPlan.planId = this.currentChangeRow.id
+ }
const personTrainingDetailed = this.trainingPlan
addOrUpdatePersonTrainingDetailed(personTrainingDetailed).then(res => {
- this.submitAddLoading = false
if (res.code == 200) {
this.$message.success('鎻愪氦鎴愬姛');
this.closeAdd();
+ } else {
+ this.$message.error(res.msg || '鎻愪氦澶辫触')
}
}).catch(() => {
+ this.$message.error('鎻愪氦澶辫触')
+ }).finally(() => {
this.submitAddLoading = false
})
}
@@ -188,16 +202,22 @@
},
// 鍏抽棴寮规
closeAdd() {
- this.$refs['trainingPlanForm'].resetFields();
+ if (this.$refs['trainingPlanForm']) {
+ this.$refs['trainingPlanForm'].resetFields();
+ }
this.$emit('search')
this.addTrainingPlanDia = false;
},
- // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+ // 鑾峰彇璁插笀鍊欓�変汉锛堝叏绯荤粺浜哄憳锛屼笉闄愭湰閮ㄩ棬锛�
getUserList() {
- selectUserCondition({type: 2}).then(res => {
+ selectUserCondition({ isCustom: 0 }).then(res => {
if (res.code == 200) {
- this.responsibleOptions = res.data
+ this.responsibleOptions = Array.isArray(res.data) ? res.data : []
+ } else {
+ this.responsibleOptions = []
}
+ }).catch(() => {
+ this.responsibleOptions = []
})
},
},
diff --git a/src/views/CNAS/personnel/personnelInfo/components/Edit.vue b/src/views/CNAS/personnel/personnelInfo/components/Edit.vue
index 95d521d..99a3ddd 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/Edit.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/Edit.vue
@@ -3,7 +3,7 @@
<div class="page-header">
<h4><span class="line"></span><span>鍩硅涓庤�冩牳璁板綍</span></h4>
<div class="btns">
- <el-button size="small" type="primary" @click="submitForm(3)" v-if="currentRow.state !== 1">鎾ら攢</el-button>
+ <el-button size="small" type="primary" @click="submitForm(3)" v-if="currentRow.state === 2">鎾ら攢</el-button>
<el-button size="small" type="primary" @click="submitForm(0)" v-if="currentRow.state !== 1">鎻愪氦</el-button>
<el-button size="small" @click="$emit('goBack')">杩斿洖</el-button>
</div>
@@ -226,8 +226,7 @@
current:1
},
addUserTableInfo: {
- name: null,
- type: 2
+ name: null
},
multipleSelection: [],
userList: [],
@@ -240,39 +239,56 @@
this.trainingForm = this.currentRow
this.getInfo()
this.getUserList()
- this.isDisabled = this.trainingForm.assessmentUserId !== this.userId
+ this.isDisabled = this.trainingForm.assessmentUserId != this.userId
},
// 鏂规硶闆嗗悎
methods: {
// 鑾峰彇褰撳墠鏁版嵁
- async getInfo() {
+ getInfo() {
this.trainingLoading = true
- await trainingAndAssessmentRecordsPage({
+ trainingAndAssessmentRecordsPage({
trainingDetailedId: this.currentRow.id,
userName: this.userName
}).then(res => {
if (res.code === 200) {
- this.trainingTableData = res.data
+ this.trainingTableData = res.data || []
+ } else {
+ this.trainingTableData = []
+ this.$message.error(res.msg || '鑰冩牳浜哄憳鍔犺浇澶辫触')
}
+ }).catch(() => {
+ this.trainingTableData = []
+ }).finally(() => {
this.trainingLoading = false
})
},
updatePersonResult(row) {
outOfFocusPreservation(row).then(res => {
- this.$message.success("鎿嶄綔鎴愬姛锛�")
+ if (res.code == 200) {
+ this.$message.success("鎿嶄綔鎴愬姛锛�")
+ } else {
+ this.$message.error(res.msg || '鑰冩牳缁撴灉淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鑰冩牳缁撴灉淇濆瓨澶辫触')
})
},
addPerson() {
- this.isSelectedList = this.trainingTableData.map(item => item.userId)
+ if (this.currentRow.state === 1) {
+ this.$message.warning('鍩硅宸插畬鎴愶紝涓嶈兘鏂板浜哄憳')
+ return
+ }
this.selectUserDia = true;
+ this.multipleSelection = []
this.selectUserList()
},
- selectUserList () {
+ selectUserList() {
this.tableLoading1 = true
- selectUserCondition({...this.addUserTableInfo}).then(res => {
- this.tableLoading1 = false
- this.tableData1 = res.data
- }).catch(err => {
+ selectUserCondition({ name: this.addUserTableInfo.name || '', isCustom: 0 }).then(res => {
+ // 宸插湪鍚嶅崟涓殑浜哄憳涓嶅啀閲嶅灞曠ず锛岄伩鍏嶉噸澶嶆坊鍔�
+ const existed = new Set(this.trainingTableData.map(item => String(item.userId)))
+ this.tableData1 = (res.data || []).filter(item => !existed.has(String(item.id)))
+ }).catch(() => {}).finally(() => {
this.tableLoading1 = false
})
},
@@ -281,7 +297,7 @@
this.multipleSelection = val
},
selectUser() {
- let selects = this.multipleSelection;
+ let selects = this.multipleSelection || [];
if (selects.length == 0) {
this.$message.error('鏈�夋嫨鏁版嵁');
return;
@@ -296,9 +312,16 @@
list.push(obj)
});
newPersonnelAddedToTrainingRecords(list).then(res => {
- this.isSelectedList = []
- this.selectUserDia = false;
- this.getInfo()
+ if (res.code == 200) {
+ this.$message.success('娣诲姞鎴愬姛')
+ this.multipleSelection = []
+ this.selectUserDia = false;
+ this.getInfo()
+ } else {
+ this.$message.error(res.msg || '娣诲姞澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('娣诲姞澶辫触')
})
},
// 鎵归噺鍒犻櫎
@@ -307,7 +330,11 @@
},
batchDelete() {
if (this.multipleSelection.length > 0) {
- let ids = this.multipleSelection.map(item => item.trainingRecordId).join(',')
+ let ids = this.multipleSelection.map(item => item.trainingRecordId).filter(id => id != null).join(',')
+ if (!ids) {
+ this.$message.warning('鎵�閫変汉鍛樼己灏戝煿璁褰昳d锛屾棤娉曞垹闄�')
+ return
+ }
this.$confirm('鏄惁纭鍒犻櫎鎵�閫夋嫨鐨勬暟鎹�?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
@@ -316,37 +343,54 @@
deleteTrainingAndAssessmentRecords({ids: ids}).then(res => {
if (res.code == 200) {
this.$message.success('鍒犻櫎鎴愬姛');
+ this.multipleSelection = []
this.getInfo()
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
});
- }).catch(() => {
- this.$message.warning('鍙栨秷鍒犻櫎');
- });
+ }).catch(() => {});
} else {
this.$message.warning('璇烽�夋嫨闇�瑕佸垹闄ょ殑鏁版嵁')
}
},
- handleSizeChange(val) {
- this.search.size = val;
- this.getInfo();
- },
- handleCurrentChange(val) {
- this.search.current = val;
- this.getInfo();
- },
/**
- * @desc 鎻愪氦琛ㄥ崟
+ * @desc 鎻愪氦琛ㄥ崟 status=3 涓烘挙閿�锛屽叾浠栦负鎻愪氦
*/
async submitForm(status) {
+ if (!this.trainingForm.id) {
+ this.$message.warning('鍩硅璁板綍涓嶅瓨鍦紝璇疯繑鍥炲悗閲嶆柊鎵撳紑')
+ return
+ }
let state = this.currentRow.state
- if (this.trainingForm.assessmentUserId) {
- state = 2
- }
- if (this.trainingForm.comprehensiveAssessment) {
- state = 1
- }
if (status === 3) {
+ if (this.trainingForm.assessmentUserId != this.userId) {
+ this.$message.warning('鎮ㄤ笉鏄湰娆″煿璁殑璇勪环浜猴紝鏃犳硶鎾ら攢')
+ return
+ }
state = 3
+ } else if (state === 3) {
+ if (!this.trainingForm.assessmentUserId) {
+ this.$message.warning('璇峰厛閫夋嫨璇勪环浜�')
+ return
+ }
+ state = 2
+ } else if (state === 2) {
+ if (this.trainingForm.assessmentUserId != this.userId) {
+ this.$message.warning('鎮ㄤ笉鏄湰娆″煿璁殑璇勪环浜猴紝鏃犳硶鎻愪氦璇勪环')
+ return
+ }
+ if (!this.trainingForm.comprehensiveAssessment) {
+ this.$message.warning('璇峰~鍐欐湰娆″煿璁患鍚堣瘎浠�')
+ return
+ }
+ if (!this.trainingForm.assessmentDate) {
+ this.$message.warning('璇烽�夋嫨璇勪环鏃堕棿')
+ return
+ }
+ state = 1
}
let data = {
assessmentMethod: this.trainingForm.assessmentMethod,
@@ -358,22 +402,28 @@
assessmentDate: this.trainingForm.assessmentDate,
state: state
}
- let code = {}
- if (state === 2) {
- code = await trainingAndAssessmentRecordsAdded(data)
- } else {
- code = await trainingAndAssessmentRecordsEvaluate(data)
- }
- this.isDisabled = this.trainingForm.assessmentUserId !== this.userId
- if(code.code === 200) {
- this.currentRow.state = state
- this.$message.success("鎿嶄綔鎴愬姛")
+ try {
+ const res = state === 2
+ ? await trainingAndAssessmentRecordsAdded(data)
+ : await trainingAndAssessmentRecordsEvaluate(data)
+ if (res.code === 200) {
+ this.trainingForm.state = state
+ this.currentRow.state = state
+ this.isDisabled = this.trainingForm.assessmentUserId != this.userId
+ this.$message.success("鎿嶄綔鎴愬姛")
+ } else {
+ this.$message.error(res.msg || '鎿嶄綔澶辫触')
+ }
+ } catch (e) {
+ // 閿欒鎻愮ず鐢辫姹傛嫤鎴櫒缁熶竴澶勭悊
}
},
getUserList(){
- selectUserCondition({ type: 2 }).then((res) => {
- this.userList = res.data;
- })
+ selectUserCondition({ isCustom: 0 }).then((res) => {
+ if (res.code == 200) {
+ this.userList = res.data || []
+ }
+ }).catch(() => {})
},
}
};
diff --git a/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue b/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue
index 80af54d..c09b517 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/ViewRecord.vue
@@ -99,13 +99,17 @@
},
// 鏌ヨ闄勪欢鍒楄〃
searchTableList () {
+ if (!this.info || !this.info.id) {
+ this.tableData = []
+ return
+ }
this.tableLoading = true
getTrainingDetailedFileList({trainingDetailedId: this.info.id}).then(res => {
+ this.tableData = res.data || []
+ }).catch(() => {
+ this.tableData = []
+ }).finally(() => {
this.tableLoading = false
- this.tableData = res.data
- }).catch(err => {
- this.tableLoading = false
- console.log('err---', err);
})
},
closeFilesLook () {
@@ -124,37 +128,43 @@
}).then(() => {
this.tableLoading = true
delTrainingDetailedFileList({detailedFileId: row.detailedFileId}).then(res => {
+ if (res.code == 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.searchTableList()
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
+ }).finally(() => {
this.tableLoading = false
- this.$message.success('鍒犻櫎鎴愬姛')
- this.searchTableList()
- }).catch(err => {
- this.tableLoading = false
- console.log('err---', err);
})
}).catch(() => {})
},
// 涓婁紶楠岃瘉
fileBeforeUpload(file) {
- let flag = true
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
this.$refs.upload.clearFiles()
- flag = false
+ return Promise.reject()
}
- if (!flag) {
- return Promise.reject(flag); //姝g‘鐨勭粓姝�
+ if (!/\.(jpg|jpeg|png|gif|doc|docx|xls|xlsx|ppt|pptx|pdf|zip|rar)$/i.test(file.name || '')) {
+ this.$message.error('涓嶆敮鎸佺殑鏂囦欢鏍煎紡')
+ this.$refs.upload.clearFiles()
+ return Promise.reject()
}
},
onError(err, file, fileList,type) {
this.$message.error('涓婁紶澶辫触')
- this.$refs.upload.clearFiles()
+ this.$refs.upload && this.$refs.upload.clearFiles()
},
- handleSuccessUp(response, ) {
- this.upLoading = false;
- if (response.code == 200) {
- this.$message.success('涓婁紶鎴愬姛');
- this.searchTableList()
+ handleSuccessUp(response) {
+ if (!response || response.code != 200) {
+ this.$message.error((response && (response.msg || response.message)) || '涓婁紶澶辫触')
+ return
}
+ this.$message.success('涓婁紶鎴愬姛');
+ this.searchTableList()
},
// 鏌ョ湅鏂囦欢
handleLook(row){
diff --git a/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue b/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
index fa0d0d0..087af91 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/mandateAdd.vue
@@ -1,7 +1,7 @@
<template>
<div class="add">
<el-dialog
- :title="isEdit ?'缂栬緫闄勪欢璧勬枡':'鏂板闄勪欢璧勬枡'"
+ :title="isEdit ? '缂栬緫浠昏亴鎺堟潈璁板綍' : '鏂板浠昏亴鎺堟潈璁板綍'"
v-model="dialogVisible"
width="50%"
>
@@ -51,6 +51,8 @@
<el-upload ref="upload" style="float: left; margin: 0 12px 0 20px;" :action="action"
:headers="uploadHeader"
:show-file-list="false"
+ accept=".doc,.docx,.pdf,.jpg,.jpeg,.png"
+ :before-upload="beforeUpload"
:on-success="onSuccess">
<template #trigger><el-button class="uploadFile" size="small" type="primary">涓婁紶</el-button></template>
</el-upload>
@@ -93,8 +95,8 @@
rules: {
certificateNumber: [{ required: true, message: '璇疯緭鍏ヨ瘉涔︾紪鍙�', trigger: 'blur' }],
userId: [{ required: true, message: '璇烽�夋嫨琚换鑱屼汉鍛�', trigger: 'change' }],
- post: [{ required: true, message: '浠昏亴宀椾綅', trigger: 'blur' }],
- operationType: [{ required: true, message: '鎿嶄綔绫诲瀷', trigger: 'blur' }],
+ post: [{ required: true, message: '璇疯緭鍏ヤ换鑱屽矖浣�', trigger: 'blur' }],
+ operationType: [{ required: true, message: '璇疯緭鍏ユ搷浣滅被鍨�', trigger: 'blur' }],
},
loading: false,
userList: []
@@ -107,19 +109,61 @@
},
methods: {
onSuccess(response, file, fileList) {
- this.form["systemFileName"] = response.data
+ if (response && response.code === 200 && response.data) {
+ this.form.systemFileName = response.data
+ this.form.fileName = file.name
+ this.$message.success('涓婁紶鎴愬姛')
+ } else {
+ this.$refs.upload && this.$refs.upload.clearFiles()
+ this.$message.error((response && response.msg) || '涓婁紶澶辫触')
+ }
},
deleteFile(fileName) {
- deleteCNASFile({fileName: fileName}).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛锛�')
- this.form["systemFileName"] = null
+ if (!fileName) {
+ this.form.systemFileName = ''
+ return
+ }
+ this.$confirm('鏄惁鍒犻櫎宸蹭笂浼犵殑涓婂矖璇佷功鏂囦欢?', '璀﹀憡', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ deleteCNASFile({fileName: fileName}).then(res => {
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛锛�')
+ this.form.systemFileName = ''
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
+ })
+ }).catch(() => {})
+ },
+ resetData() {
+ this.form = {
+ id: undefined,
+ certificateNumber: undefined,
+ userId: undefined,
+ post: undefined,
+ operationType: undefined,
+ fileList: [],
+ fileName: undefined,
+ systemFileName: undefined,
+ remarks: undefined,
+ num2: undefined,
+ num1: undefined
+ }
+ this.$nextTick(() => {
+ if (this.$refs.ruleForm) this.$refs.ruleForm.clearValidate()
+ if (this.$refs.upload) this.$refs.upload.clearFiles()
})
},
async openDialog(row, type) {
await this.getUserList()
- this.dialogVisible = true
- if(type) {
- this.isEdit = true
+ this.isEdit = !!type
+ this.resetData()
+ if (type) {
this.form.id = row.id
this.form.certificateNumber = row.certificateNumber
this.form.userId = Number(row.userId)
@@ -129,12 +173,10 @@
this.form.remarks = row.remarks
this.form.num1 = row.num1
this.form.num2 = row.num2
- } else {
- this.resetForm('ruleForm')
}
+ this.dialogVisible = true
},
closeDialog() {
- this.resetForm('ruleForm')
this.dialogVisible = false
},
/**
@@ -142,7 +184,7 @@
*/
async getUserList() {
try {
- const res = await selectUserCondition()
+ const res = await selectUserCondition({ isCustom: 0 })
if (res.code !== 200) throw new Error('浜哄憳鍒楄〃鎺ュ彛杩斿洖澶辫触')
this.userList = Array.isArray(res.data) ? res.data : []
} catch (error) {
@@ -169,10 +211,16 @@
}
this.loading = true
addOrUpdatePersonPostAuthorizationRecord(params).then(res => {
- this.loading = false
- this.closeDialog()
- this.$emit('refresh')
- }).catch(err => {
+ if (res.code === 200) {
+ this.$message.success(this.isEdit ? '淇敼鎴愬姛' : '鏂板鎴愬姛')
+ this.closeDialog()
+ this.$emit('refresh')
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('淇濆瓨澶辫触')
+ }).finally(() => {
this.loading = false
})
}
@@ -184,13 +232,16 @@
beforeUpload(file) {
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
- this.$refs.upload.clearFiles()
return false;
- } else {
- this.form.fileList = [file]
- this.form.fileName = file.name
- return true;
}
+ const ext = (file.name.split('.').pop() || '').toLowerCase()
+ if (!['doc', 'docx', 'pdf', 'jpg', 'jpeg', 'png'].includes(ext)) {
+ this.$message.error('浠呮敮鎸佷笂浼� doc銆乨ocx銆乸df銆乯pg銆乸ng 鏍煎紡鐨勬枃浠�');
+ return false;
+ }
+ this.form.fileList = [file]
+ this.form.fileName = file.name
+ return true;
},
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/index.vue b/src/views/CNAS/personnel/personnelInfo/index.vue
index f373685..736261f 100644
--- a/src/views/CNAS/personnel/personnelInfo/index.vue
+++ b/src/views/CNAS/personnel/personnelInfo/index.vue
@@ -22,7 +22,7 @@
<el-tree
ref="tree"
:data="list"
- :default-expanded-keys="[22]"
+ :default-expanded-keys="expandedKeys"
:expand-on-click-node="false"
:filter-node-method="filterNode"
:props="{ children: 'children', label: 'name' }"
@@ -38,7 +38,7 @@
class="node_i" :name="data.children != undefined&&data.children.length>0 ? 'el-icon-folder-opened' : 'el-icon-tickets'"></lims-icon>
{{ data.name }}</span>
</el-col>
- <el-col v-if="node.level>1 && data.id !== null" :span="2" style="text-align: right;">
+ <el-col v-if="node.level>1 && data.id != null" :span="2" style="text-align: right;">
<el-button size="small" link type="primary" @click.stop="remove(node, data)">
<lims-icon name="el-icon-delete"></lims-icon>
</el-button>
@@ -53,7 +53,8 @@
<PersonnelList v-if="activeName === '浜哄憳鍩烘湰淇℃伅' && isShowAll" ref="personnelList" :currentCompaniesList="currentCompaniesList"
:departId="departId" @refreshTree="refreshTree"
@updatePerson="updatePerson"></PersonnelList>
- <personnelInformation v-if="activeName === '浜哄憳鍩烘湰淇℃伅' && !isShowAll" :clickNodeVal="clickNodeVal"></personnelInformation>
+ <personnelInformation v-if="activeName === '浜哄憳鍩烘湰淇℃伅' && !isShowAll" :clickNodeVal="clickNodeVal"
+ @refreshTree="refreshTree"></personnelInformation>
</el-tab-pane>
<el-tab-pane label="鍩硅璁″垝" name="鍩硅璁″垝">
<PersonnelTraining v-if="activeName === '鍩硅璁″垝'" ref="personnelTraining"
@@ -75,6 +76,7 @@
<el-tab-pane label="浜哄憳鑳藉姏" name="浜哄憳鑳藉姏">
<personnel-capacity v-if="activeName === '浜哄憳鑳藉姏'" ref="personnelCapacity"
:departId="departId"
+ :personName="isDepartment ? '' : (clickNodeVal.name || '')"
:isDepartment="isDepartment"></personnel-capacity>
</el-tab-pane>
</el-tabs>
@@ -118,6 +120,7 @@
activeName: '浜哄憳鍩烘湰淇℃伅',
departId: 1,
list: [],
+ expandedKeys: [],
addDia: false,
addOb: {
name: '',
@@ -147,28 +150,38 @@
},
methods: {
remove(node, data) {
- this.$confirm("鏄惁鍒犻櫎璇ュ眰绾�", "鎻愮ず", {
- type: "error"
+ this.$confirm(`纭畾鍒犻櫎鏋舵瀯鈥�${data.name}鈥濆悧锛�<br/>璇ユ灦鏋勪笅涓嶈兘瀛樺湪涓嬬骇鏋舵瀯鎴栦汉鍛橈紝鍚﹀垯鏃犳硶鍒犻櫎銆俙, "鎻愮ず", {
+ type: "warning",
+ dangerouslyUseHTMLString: true
}).then(() => {
delDepartmentLims({
id: data.id
}).then(res => {
- this.$message.success('宸插垹闄�')
- this.geList();
+ if (res.code == 200) {
+ this.$message.success('宸插垹闄�')
+ if (this.addOb.fatherId === data.id) {
+ this.addOb.fatherId = ''
+ }
+ this.geList();
+ }
})
}).catch(e => {})
},
addStandardTree() {
- if (this.addOb.name == null || this.addOb.factory == '') {
- this.$message.error('鏋勬灦鍚嶇О鏄繀濉」')
+ if (!this.addOb.name || String(this.addOb.name).trim() === '') {
+ this.$message.error('鏋舵瀯鍚嶇О鏄繀濉」')
return
}
- addDepartmentLims(this.addOb).then(res => {
- this.$message.success('娣诲姞鎴愬姛')
- this.addDia = false
- this.geList();
- this.addOb.name = ''
- this.addOb.fatherId = ''
+ addDepartmentLims({
+ name: String(this.addOb.name).trim(),
+ fatherId: this.addOb.fatherId
+ }).then(res => {
+ if (res.code == 200) {
+ this.$message.success('娣诲姞鎴愬姛')
+ this.addDia = false
+ this.addOb.name = ''
+ this.geList();
+ }
})
},
handleAdd() {
@@ -180,24 +193,24 @@
},
// 浜哄憳鍒楄〃缂栬緫
updatePerson(row) {
- const node = this.findNodeById(this.list, row.name);
+ const node = this.findNodeByUserId(this.list, row.userId);
if (node) {
this.handleNodeClick(node);
} else {
- this.$message.warning('鏈壘鍒拌浜哄憳');
+ this.$message.warning('鏈壘鍒拌浜哄憳锛岃鍒锋柊宸︿晶浜哄憳鏍戝悗閲嶈瘯');
}
},
- // 鏂板缓浜哄憳鍚庡埛鏂版爲
+ // 鏂板缓/缂栬緫浜哄憳鍚庡埛鏂版爲
refreshTree () {
this.geList()
},
- findNodeById(treeData, name) {
+ findNodeByUserId(treeData, userId) {
for (let i = 0; i < treeData.length; i++) {
- if (treeData[i].name === name) {
+ if (treeData[i].userId !== undefined && treeData[i].userId !== null && treeData[i].userId == userId) {
return treeData[i]; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
}
if (treeData[i].children && treeData[i].children.length > 0) {
- const foundNode = this.findNodeById(treeData[i].children, name);
+ const foundNode = this.findNodeByUserId(treeData[i].children, userId);
if (foundNode) {
return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
}
@@ -211,10 +224,14 @@
// 鑾峰彇鏍�
geList() {
selectCNSAPersonTree().then(res => {
- this.list = res.data;
- if(this.list.length > 0) {
+ this.list = res.data || [];
+ // 鍒锋柊鏍戞椂涓嶈鎶婁汉瑙嗚寮鸿鍒囧洖閮ㄩ棬瑙嗚锛屽惁鍒欏叾浠栨爣绛鹃〉浼氭嬁浜哄憳id褰撻儴闂╥d鏌ヨ
+ if (this.list.length > 0 && !(this.clickNodeVal && this.clickNodeVal.userId != null)) {
this.isDepartment = true;
}
+ this.expandedKeys = this.list.filter(item => item.id != null).map(item => item.id);
+ }).catch(() => {
+ this.list = []
});
},
filterNode(value, data) {
@@ -230,24 +247,32 @@
this.clickNodeVal.level = node.level;
this.clickNodeVal.parent = node.parent.data;
}
- this.entity.departLimsId = val.id;
- this.addOb.fatherId = val.id;
- // 鏄惁鏄剧ず璁惧璇︽儏
- this.isShowAll = val.id !== null;
- if (val.id) { // 濡傛灉鏄疄楠屽
- this.departId = val.id;
- this.isDepartment = true;
- }
- if (val.userId) { // 鏄汉鍛�
+ if (val.userId !== undefined && val.userId !== null) {
+ // 鏄汉鍛橈紝灞曠ず浜哄憳璇︽儏
+ this.isShowAll = false;
this.departId = val.userId;
- this.isDepartment = false
+ this.isDepartment = false;
+ this.addOb.fatherId = '';
+ } else {
+ // 鏄疄楠屽/閮ㄩ棬
+ this.isShowAll = true;
+ this.addOb.fatherId = val.id;
+ if (val.id) {
+ this.departId = val.id;
+ this.isDepartment = true;
+ }
}
},
getNodeParent(val) {
- if (val.parent != null) {
+ this.currentCompaniesList = [];
+ this.buildNodeParent(val);
+ },
+ buildNodeParent(val) {
+ if (val.parent != null && val.data && val.data.id != null) {
this.currentCompaniesList[val.level - 1] = val.data.id;
- this.selectTree += ' - ' + val.label;
- this.getNodeParent(val.parent);
+ }
+ if (val.parent != null) {
+ this.buildNodeParent(val.parent);
}
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue b/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue
index b5efdbf..4a0ab9a 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue
@@ -26,6 +26,12 @@
<el-table-column label="鎵�灞為儴闂�" min-width="180" prop="departLimsName"></el-table-column>
<el-table-column label="宸ヤ綔鐩爣" min-width="180" prop="jobObjective"></el-table-column>
<el-table-column label="宀椾綅鑱岃矗" min-width="180" prop="jobResponsibilities"></el-table-column>
+ <el-table-column label="褰撳墠鐘舵��" min-width="120" prop="currentState">
+ <template v-slot="scope">
+ <el-tag v-if="scope.row.currentState" :type="stateTagType(scope.row.currentState)">{{ scope.row.currentState }}</el-tag>
+ <span v-else>-</span>
+ </template>
+ </el-table-column>
<el-table-column label="浠昏亴浜�" min-width="180" prop="incumbentName"></el-table-column>
<el-table-column label="浠昏亴浜哄鏍告棩鏈�" min-width="180" prop="incumbentDate"></el-table-column>
<el-table-column label="涓荤" min-width="180" prop="supervisorName"></el-table-column>
@@ -35,7 +41,8 @@
<el-button v-if="!isDepartment || scope.row.currentState === '鍏抽棴'" size="small" link type="primary"
@click="handleViewClick(scope.row, 'view')">鏌ョ湅
</el-button>
- <el-button v-if="isDepartment && scope.row.currentState !== '鍏抽棴'" size="small" link type="primary"
+ <el-button v-if="scope.row.currentState !== '鍏抽棴' && (isDepartment || scope.row.incumbentId == departId)"
+ size="small" link type="primary"
@click="handleViewClick(scope.row, 'edit')">缂栬緫
</el-button>
<el-button size="small" link type="primary" @click="downLoadPost(scope.row)">瀵煎嚭</el-button>
@@ -44,13 +51,15 @@
</template>
</el-table-column>
</el-table>
- <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
- :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" background style="margin-top: 10px"
+ <el-pagination v-model:current-page="search.current" v-model:page-size="search.size"
+ :page-sizes="[10, 20, 30, 50, 100]" :total="search.total"
+ layout="->,total, sizes, prev, pager, next, jumper" background style="margin-top: 10px"
@size-change="handleSizeChange" @current-change="handleCurrentChange">
</el-pagination>
</div>
<!-- 鏂板宀椾綅鑱岃矗 -->
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible" title="鏂板宀椾綅鑱岃矗"
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible"
+ :title="operationType === 'view' ? '鏌ョ湅宀椾綅鑱岃矗' : (operationType === 'edit' ? '缂栬緫宀椾綅鑱岃矗' : '鏂板宀椾綅鑱岃矗')"
width="50%" @close="resetForm">
<el-steps :active="currentStep" align-center finish-status="success">
<el-step v-for="(v, i) in steps" :key="i" :title="v" style="cursor:pointer"
@@ -82,7 +91,7 @@
<el-col v-if="currentStep === 0 || operationType === 'view'" :span="12">
<el-form-item :rules="[{ required: currentStep === 0, message: '璇烽�夋嫨浠昏亴浜�', trigger: 'change' }]"
label="浠昏亴浜猴細" prop="incumbentId">
- <el-select v-model="form.incumbentId" :disabled="operationType === 'view'" clearable filterable
+ <el-select v-model="form.incumbentId" :disabled="operationType === 'view' || !isDepartment" clearable filterable
placeholder="璇烽�夋嫨浠昏亴浜�" size="small" style="width: 100%;">
<el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
@@ -112,11 +121,13 @@
</div>
</el-form>
<template #footer><span class="dialog-footer">
- <el-button v-if="currentStep !== 0 && currentStep !== 3" @click="submitForm('3reject')">椹冲洖</el-button>
- <el-button v-if="currentStep === 0" @click="submitForm('2save')">淇濆瓨</el-button>
- <el-button v-if="currentStep !== 3" type="primary" @click="submitForm('1submit')">{{ currentStep === 0 ? '鎻愪氦' :
- '閫氳繃'
- }}</el-button>
+ <el-button v-if="operationType !== 'view' && currentStep !== 0 && currentStep !== 3"
+ :loading="submitLoading" @click="submitForm('3reject')">椹冲洖</el-button>
+ <el-button v-if="operationType !== 'view' && currentStep === 0" :loading="submitLoading"
+ @click="submitForm('2save')">淇濆瓨</el-button>
+ <el-button v-if="operationType !== 'view' && currentStep !== 3" type="primary" :loading="submitLoading"
+ @click="submitForm('1submit')">{{ currentStep === 0 ? '鎻愪氦' : '閫氳繃' }}</el-button>
+ <el-button @click="dialogVisible = false">鍏� 闂�</el-button>
</span></template>
</el-dialog>
</div>
@@ -131,6 +142,7 @@
} from "@/api/cnas/personal/personJobResponsibilities";
import { selectUserCondition } from "@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment";
import { mapGetters } from "@/utils/store-compat";
+import { blobValidate } from "@/utils/ruoyi";
export default {
data() {
@@ -145,6 +157,8 @@
total: 0
},
dialogVisible: false,
+ submitLoading: false,
+ downLoading: false,
currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳
currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖�
operationType: '',
@@ -183,12 +197,16 @@
},
methods: {
addPost() {
- this.dialogVisible = true;
+ if (!this.isDepartment && !this.departId) {
+ this.$message.warning('璇峰厛鍦ㄥ乏渚ч�夋嫨浜哄憳鎴栭儴闂�')
+ return
+ }
+ this.operationType = '';
this.form = {
postName: '', // 宀椾綅鍚嶇О
jobObjective: '', // 宸ヤ綔鐩爣
jobResponsibilities: '', // 宀椾綅鑱岃矗
- incumbentId: '', // 浠昏亴浜�
+ incumbentId: this.isDepartment ? '' : this.departId, // 浜哄憳瑙嗚榛樿灏辨槸褰撳墠浜哄憳
supervisorId: '', // 鎿嶄綔浜�
submitPerson: '', // 涓荤
submitDate: '', // 鏃ユ湡
@@ -196,6 +214,7 @@
};
this.currentStep = 0;
this.getUserList();
+ this.dialogVisible = true;
},
// 鏌ヨ鍒楄〃淇℃伅
getPostList(userId) {
@@ -213,44 +232,48 @@
}
this.tableLoading = true
personJobResponsibilitiesSelect(params).then(res => {
- this.tableLoading = false
- this.tableData = res.data.records;
- this.search.total = res.data.total;
- }).catch(err => {
+ this.tableData = (res.data && res.data.records) || [];
+ this.search.total = (res.data && res.data.total) || 0;
+ }).catch(() => {
+ this.tableData = []
+ this.search.total = 0
+ }).finally(() => {
this.tableLoading = false
})
},
+ stateTagType(state) {
+ if (state === '鍏抽棴') return 'success'
+ if (state === '鎻愪氦') return 'info'
+ return 'warning'
+ },
+ userNameById(id) {
+ const item = this.responsibleOptions.find(opt => String(opt.id) === String(id))
+ return item ? item.name : ''
+ },
//鎻愪氦琛ㄥ崟
async submitForm(saveState) {
+ if (this.submitLoading) {
+ return
+ }
this.$refs.form.validate((valid) => {
if (valid === true || saveState !== '1submit') {
- // 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂�
- let user = this.nickName;
- const dateTime = dateFormat(new Date());
+ // 缁欏綋鍓嶇幆鑺傝缃搷浣滀汉涓庢椂闂达紙浠昏亴浜�/涓荤鐜妭璁板綍瀵瑰簲浜哄憳濮撳悕锛�
+ const operatorName = this.nickName;
+ // 娉ㄦ剰锛歞ateFormat 宸ュ叿鍙瘑鍒皬鍐� hh锛実etHours() 鏈韩鍗� 24 灏忔椂鍒�
+ const dateTime = dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss');
// 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡
switch (this.currentStep) {
case 0:
- this.form.submittingOperator = user.name;
+ this.form.submittingOperator = operatorName;
this.form.submittingDate = dateTime;
break;
case 1:
- this.form.incumbentOperator = user.name;
+ this.form.incumbentOperator = this.userNameById(this.form.incumbentId) || operatorName;
this.form.incumbentDate = dateTime;
break;
case 2:
- this.form.supervisorOperator = user.name;
+ this.form.supervisorOperator = this.userNameById(this.form.supervisorId) || operatorName;
this.form.supervisorDate = dateTime;
- break;
- default:
- break;
- }
- // 鑾峰彇褰撳墠鐜妭璐熻矗浜�
- switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) {
- case 1:
- this.form.currentResponsible = this.form.submittingOperator;
- break;
- case 2:
- this.form.currentResponsible = this.form.incumbentOperator;
break;
default:
break;
@@ -273,14 +296,42 @@
default:
break;
}
+ // 褰撳墠鐜妭璐熻矗浜猴細0-鎻愪氦浜� 1-浠昏亴浜� 2-涓荤 3-娴佺▼缁撴潫
+ switch (currentStepAction) {
+ case 0:
+ this.form.currentResponsible = this.form.submittingOperator;
+ break;
+ case 1:
+ this.form.currentResponsible = this.userNameById(this.form.incumbentId);
+ break;
+ case 2:
+ this.form.currentResponsible = this.userNameById(this.form.supervisorId);
+ break;
+ default:
+ this.form.currentResponsible = '';
+ break;
+ }
// 鑾峰彇褰撳墠鐘舵��
this.form.currentState = currentStepAction === 3 ? '鍏抽棴' : this.steps[currentStepAction];
- personJobResponsibilitiesSave(this.form).then(res => {
+ // 绌哄�艰浆 null锛岄伩鍏嶅悗绔� Integer 瀛楁鎺ユ敹鍒扮┖瀛楃涓插鑷存彁浜ゅけ璐�
+ const payload = { ...this.form };
+ if (payload.supervisorId === '' || payload.supervisorId === undefined) payload.supervisorId = null;
+ if (payload.incumbentId === '' || payload.incumbentId === undefined) payload.incumbentId = null;
+ delete payload.submitPerson;
+ delete payload.submitDate;
+ this.submitLoading = true
+ personJobResponsibilitiesSave(payload).then(res => {
if (res.code == 200) {
this.$message.success('鎻愪氦鎴愬姛');
this.getPostList(this.departId);
this.dialogVisible = false;
+ } else {
+ this.$message.error(res.msg || '鎻愪氦澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鎻愪氦澶辫触')
+ }).finally(() => {
+ this.submitLoading = false
});
} else {
let step = this.steps[this.currentStep];
@@ -292,8 +343,9 @@
handleViewClick(row, type) {
this.operationType = type;
this.getUserList();
- row.incumbentId = Number(row.incumbentId);
this.form = { ...row };
+ this.form.incumbentId = row.incumbentId != null ? Number(row.incumbentId) : null;
+ this.form.supervisorId = row.supervisorId != null ? Number(row.supervisorId) : null;
switch (row.currentState) {
case '鎻愪氦':
this.currentStep = 0;
@@ -316,21 +368,30 @@
default:
break;
}
- this.form.currentState = this.currentStep;
this.currentStepClick = this.currentStep === 3 ? 0 : this.currentStep
- console.log('this.form---', this.form);
this.dialogVisible = true;
},
// 涓嬭浇宀椾綅鑱岃矗
downLoadPost(row) {
- exportPersonJobResponsibilities({ id: row.id }).then(res => {
+ if (this.downLoading) {
+ return
+ }
+ this.downLoading = true
+ exportPersonJobResponsibilities({ id: row.id }).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text())
+ this.$message.error(rspObj.msg || rspObj.message || '瀵煎嚭澶辫触')
+ return
+ }
const blob = new Blob([res], { type: 'application/octet-stream' });
- this.$download.saveAs(blob, row.incumbentName + '-宀椾綅鑱岃矗' + '.docx');
+ this.$download.saveAs(blob, (row.incumbentName || row.postName || '宀椾綅鑱岃矗') + '-宀椾綅鑱岃矗' + '.docx');
+ }).catch(() => {}).finally(() => {
+ this.downLoading = false
})
},
// 鍒犻櫎宀椾綅鑱岃矗
deletePost(row) {
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎姝ゆ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ this.$confirm(`纭畾鍒犻櫎鈥�${row.postName || '璇ュ矖浣嶈亴璐�'}鈥濆悧锛焋, '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
@@ -339,31 +400,46 @@
if (res.code == 200) {
this.$message.success('鍒犻櫎鎴愬姛');
this.getPostList(this.departId);
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
});
- }).catch(() => {
- this.$message.error('鍒犻櫎澶辫触');
- });
+ }).catch(() => {});
},
resetForm() {
- this.$refs.form.resetFields();
+ if (this.$refs.form) {
+ this.$refs.form.resetFields();
+ }
+ this.submitLoading = false
},
refreshTable() {
+ this.search.current = 1;
this.getPostList(this.departId);
},
- // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+ // 鑾峰彇璐熻矗浜轰俊鎭帴鍙o紙浠昏亴浜恒�佷富绠′粠鍏ㄥ叕鍙镐汉鍛樹腑閫夋嫨锛�
getUserList() {
- selectUserCondition({type: 2}).then(res => {
+ selectUserCondition({ isCustom: 0 }).then(res => {
if (res.code == 200) {
- this.responsibleOptions = res.data
+ this.responsibleOptions = Array.isArray(res.data) ? res.data : []
+ } else {
+ this.responsibleOptions = []
}
+ }).catch(() => {
+ this.responsibleOptions = []
})
},
choiceStep(index) {
- this.currentStepClick = index;
+ // 鏌ョ湅鏃跺彲鍒囨崲姝ラ鏌ョ湅鍚勭幆鑺備俊鎭紝缂栬緫鏃朵笉鍏佽璺虫楠�
+ if (this.operationType === 'view') {
+ this.currentStep = index
+ this.currentStepClick = index;
+ }
},
handleSizeChange(val) {
this.search.size = val;
+ this.search.current = 1;
this.getPostList(this.departId);
},
handleCurrentChange(val) {
@@ -374,6 +450,7 @@
watch: {
departId: {
handler(newId, oldId) {
+ this.search.current = 1;
this.getPostList(newId);
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/mandate.vue b/src/views/CNAS/personnel/personnelInfo/tabs/mandate.vue
index a12bc4e..f15db44 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/mandate.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/mandate.vue
@@ -1,9 +1,9 @@
<template>
<div class="flex_column">
<div>
- <div v-if="isDepartment" style="display: flex;justify-content: space-between;margin-bottom: 10px">
- <el-button size="small" type="primary" @click="getTableData">鍒锋柊</el-button>
- <el-button size="small" type="primary" :icon="$icon('el-icon-plus')" @click="openDialog">鏂板</el-button>
+ <div style="display: flex;justify-content: space-between;margin-bottom: 10px">
+ <el-button size="small" type="primary" @click="refreshTable">鍒锋柊</el-button>
+ <el-button v-if="isDepartment" size="small" type="primary" :icon="$icon('el-icon-plus')" @click="openDialog">鏂板</el-button>
</div>
<lims-table :tableData="tableData" :column="columnData"
@pagination="page" :height="'calc(100vh - 18em)'"
@@ -19,7 +19,7 @@
deletePersonPostAuthorizationRecord, exportPersonPostAuthorizationRecord,
PersonPostAuthorizationRecordPage
} from "@/api/cnas/personal/personPostAuthorizationRecord";
-import {delCustomById} from "@/api/system/customer";
+import { blobValidate } from "@/utils/ruoyi";
export default {
components: {
@@ -42,9 +42,6 @@
return {
columnData: [
{
- label: '搴忓彿',
- prop: 'id'
- }, {
label: '璇佷功缂栧彿',
prop: 'certificateNumber'
}, {
@@ -103,7 +100,8 @@
size: 20,
total: 0
},
- loading: false
+ loading: false,
+ downLoading: false
}
},
mounted() {
@@ -113,61 +111,97 @@
openDialog(row, type=false) {
this.$refs.mandateModal.openDialog(row, type)
},
+ refreshTable() {
+ this.pagination.current = 1
+ this.getTableData()
+ },
/**
* @desc 鏌ヨ琛ㄦ牸鏁版嵁
*/
async getTableData() {
- const params = this.isDepartment ? {
- departLimsId: this.departId,
+ const params = {
current: this.pagination.current,
- size: this.pagination.pageSize
- } : {
- userId: this.departId,
- current: this.pagination.current,
- size: this.pagination.pageSize
+ size: this.pagination.size
+ }
+ if (this.isDepartment) {
+ params.departLimsId = this.departId
+ } else {
+ params.userId = this.departId
}
this.loading = true
- PersonPostAuthorizationRecordPage(params).then(res => {
+ try {
+ const res = await PersonPostAuthorizationRecordPage(params)
+ this.tableData = (res.data && res.data.records) || []
+ this.pagination.total = (res.data && res.data.total) || 0
+ } catch (e) {
+ this.tableData = []
+ this.pagination.total = 0
+ } finally {
this.loading = false
- this.tableData = res.data.records
- this.pagination.total = res.data.total
- }).catch(err => {
- this.loading = false
- })
+ }
},
page (page) {
this.pagination.size = page.limit
+ this.pagination.current = page.page
this.getTableData()
},
/**
* @desc 鍒犻櫎浠昏亴璁板綍
*/
deleteNotify(id) {
- this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+ this.$confirm('鍒犻櫎鍚庤浠昏亴鎺堟潈璁板綍鍙婂叾涓婁紶鐨勪笂宀楄瘉涔︽枃浠跺皢涓�骞跺垹闄わ紝鏄惁缁х画?', "璀﹀憡", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning"
}).then(() => {
deletePersonPostAuthorizationRecord({id: id}).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛')
- this.getTableData()
+ if (res.code === 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.getTableData()
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
}).catch(e => {
this.$message.error('鍒犻櫎澶辫触')
})
}).catch(() => {})
},
- handleDown(row){
- exportPersonPostAuthorizationRecord({id:row.id}).then(res => {
- const blob = new Blob([res],{ type: 'application/octet-stream' });
- this.$download.saveAs(blob, '浠昏亴鎺堟潈-'+row.certificateNumber+'-'+row.post + '.docx')
- })
+ async handleDown(row) {
+ if (this.downLoading) return
+ if (!row.id) {
+ this.$message.warning('缂哄皯浠昏亴鎺堟潈璁板綍id锛屾棤娉曚笅杞�')
+ return
+ }
+ this.downLoading = true
+ try {
+ const res = await exportPersonPostAuthorizationRecord({id: row.id})
+ if (blobValidate(res)) {
+ const blob = new Blob([res], {type: 'application/octet-stream'})
+ this.$download.saveAs(blob, (row.userName || '浠昏亴鎺堟潈') + '鐨勬娴嬩汉鍛樹笂宀楄瘉.docx')
+ } else {
+ const text = await res.text()
+ let message = '涓嬭浇澶辫触'
+ try {
+ message = JSON.parse(text).msg || message
+ } catch (e) {}
+ this.$message.error(message)
+ }
+ } catch (e) {
+ this.$message.error('涓嬭浇澶辫触')
+ } finally {
+ this.downLoading = false
+ }
}
},
watch: {
departId: {
handler(newId, oldId) {
if (newId) {
+ this.pagination.current = 1
this.getTableData();
+ } else {
+ this.tableData = []
+ this.pagination.total = 0
}
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-capacity.vue b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-capacity.vue
index 76a7efc..4c829b2 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-capacity.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-capacity.vue
@@ -13,7 +13,7 @@
</div>
</div>
<div style="line-height: 30px;">
- <el-button v-if="!isDepartment" size="small" type="primary" @click="addAppointPost('add')">鏂板</el-button>
+ <el-button size="small" type="primary" @click="addAppointPost('add')">鏂板</el-button>
</div>
</div>
<lims-table :tableData="tableData" :column="yearColumnData"
@@ -30,9 +30,9 @@
<el-form v-if="dialogVisible" ref="infoForm" :model="form" :rules="rules">
<el-col :span="12">
<el-form-item label="浜哄憳锛�" label-width="110px" prop="userId">
- <el-select v-model="form.userId" disabled clearable
+ <el-select v-model="form.userId" :disabled="operationType !== 'add' || !isDepartment" clearable
filterable size="small" style="width: 100%;">
- <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
+ <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
@@ -78,8 +78,8 @@
</el-form-item>
</el-col>
<el-col :span="8">
- <el-form-item prop="relatedYearsRemarks ">
- <el-input v-model="form.relatedYearsRemarks " :disabled="operationType === 'view' || operationType === 'confirm'" size="small"></el-input>
+ <el-form-item prop="relatedYearsRemarks">
+ <el-input v-model="form.relatedYearsRemarks" :disabled="operationType === 'view' || operationType === 'confirm'" size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
@@ -164,17 +164,17 @@
<el-col :span="12">
<el-form-item prop="confirmDate" label="纭鏃堕棿锛�">
<el-date-picker v-model="form.confirmDate"
- format="YYYY-MM-DD"
- :disabled="operationType === 'view' || operationType === 'confirm'"
- placeholder="閫夋嫨鏃ユ湡"
+ format="YYYY-MM-DD HH:mm:ss"
+ disabled
+ placeholder="纭鍚庣敱绯荤粺鑷姩璁板綍"
size="small"
value-format="YYYY-MM-DD HH:mm:ss"
- type="date"></el-date-picker>
+ type="datetime"></el-date-picker>
</el-form-item>
</el-col>
</el-form>
<template #footer><span class="dialog-footer">
- <el-button v-if="operationType !== 'view'" @click="resetForm">鍙栨秷</el-button>
+ <el-button @click="resetForm">{{ operationType === 'view' ? '鍏抽棴' : '鍙栨秷' }}</el-button>
<el-button v-if="operationType !== 'view' && operationType !== 'confirm'" type="primary" @click="submitForm">淇濆瓨</el-button>
<el-button v-if="operationType !== 'view' && operationType !== 'confirm'" type="primary" @click="submitForm1">鎻愪氦骞堕�氱煡</el-button>
<el-button v-if="operationType === 'confirm'" type="primary" @click="verifyGet">纭</el-button>
@@ -195,6 +195,8 @@
submitConfirmPersonnelCapability
} from "@/api/cnas/personal/personPersonnelCapacity";
import {selectUserCondition} from "@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment";
+import {basicInformationOfPersonnelSelectPage} from "@/api/cnas/personal/personalList";
+import {blobValidate} from "@/utils/ruoyi";
import {mapGetters} from "@/utils/store-compat";
export default {
@@ -208,6 +210,10 @@
isDepartment: {
type: Boolean,
default: false
+ },
+ personName: {
+ type: String,
+ default: ''
}
},
components: {
@@ -258,8 +264,10 @@
return '鍙儨浠昏宀椾綅';
} else if (params == 'You can work while training') {
return '鍙竟鍩硅杈逛笂宀�';
- } else {
+ } else if (params == 'Iconpetent for the position') {
return '涓嶈儨浠昏宀椾綅';
+ } else {
+ return '-';
}
},
formatType: (params) => {
@@ -267,8 +275,10 @@
return 'success';
} else if (params == 'You can work while training') {
return 'warning';
- } else {
+ } else if (params == 'Iconpetent for the position') {
return 'danger';
+ } else {
+ return 'info';
}
}
}, {
@@ -278,7 +288,7 @@
}, {
label: '纭鏃ユ湡',
prop: 'confirmDate',
- width: '160'
+ width: '170'
}, {
dataType: 'action',
label: '鎿嶄綔',
@@ -348,15 +358,17 @@
verifyGetId: '',
form: {},
responsibleOptions: [],
+ personOptions: [],
+ saving: false,
+ downLoading: false,
rules: {
confirmOperatingPersonnelId: [{ required: true, message: '璇烽�夋嫨纭浜�', trigger: 'change' }],
- confirmDate: [{ required: true, message: '璇烽�夋嫨纭鏃堕棿', trigger: 'change' }],
userId: [{ required: true, message: '璇烽�夋嫨浜哄憳', trigger: 'change' }],
academicDegree: [{ required: true, message: '璇疯緭鍏ュ鍘嗘煡鏍哥粨鏋�', trigger: 'blur' }],
academicConformNot: [{ required: true, message: '璇烽�夋嫨瀛﹀巻绗﹀悎涓庡惁', trigger: 'change' }],
relatedYears: [{ required: true, message: '璇疯緭鍏ョ浉鍏冲勾闄愭煡鏍哥粨鏋�', trigger: 'blur' }],
relatedYearsConformNot: [{ required: true, message: '璇烽�夋嫨鐩稿叧骞撮檺绗﹀悎涓庡惁', trigger: 'change' }],
- relatedTraining: [{ required: true, message: '璇疯緭鍏ョ浉鍩硅闄愭煡鏍哥粨鏋�', trigger: 'blur' }],
+ relatedTraining: [{ required: true, message: '璇疯緭鍏ョ浉鍏冲煿璁煡鏍哥粨鏋�', trigger: 'blur' }],
relatedTrainingConformNot: [{ required: true, message: '璇烽�夋嫨鐩稿叧鍩硅绗﹀悎涓庡惁', trigger: 'change' }],
relevantExperience: [{ required: true, message: '璇疯緭鍏ョ浉鍏崇粡楠屾煡鏍哥粨鏋�', trigger: 'blur' }],
relevantExperienceConformNot: [{ required: true, message: '璇烽�夋嫨鐩稿叧缁忛獙绗﹀悎涓庡惁', trigger: 'change' }],
@@ -372,15 +384,35 @@
},
methods: {
// 涓嬭浇
- downLoadPost(row) {
- exportPersonnelCapacity({id: row.id}).then(res => {
- this.outLoading = false
- const blob = new Blob([res],{ type: 'application/msword' });
- this.$download.saveAs(blob, '浜哄憳鑳藉姏瀵煎嚭.docx')
- })
+ async downLoadPost(row) {
+ if (this.downLoading) return
+ if (!row.id) {
+ this.$message.warning('缂哄皯浜哄憳鑳藉姏璁板綍id锛屾棤娉曞鍑�')
+ return
+ }
+ this.downLoading = true
+ try {
+ const res = await exportPersonnelCapacity({id: row.id})
+ if (blobValidate(res)) {
+ const blob = new Blob([res], {type: 'application/msword'})
+ this.$download.saveAs(blob, (row.userName || '浜哄憳鑳藉姏') + '浜哄憳鑳藉姏璁ゅ畾.docx')
+ } else {
+ const text = await res.text()
+ let message = '瀵煎嚭澶辫触'
+ try {
+ message = JSON.parse(text).msg || message
+ } catch (e) {}
+ this.$message.error(message)
+ }
+ } catch (e) {
+ this.$message.error('瀵煎嚭澶辫触')
+ } finally {
+ this.downLoading = false
+ }
},
// 鏌ヨ
refreshTable() {
+ this.search.current = 1
this.getList(this.departId);
},
// 鑾峰彇浜哄憳鑳藉姏鍒楄〃淇℃伅
@@ -400,17 +432,20 @@
}
this.yearLoading = true
personPersonnelCapacityPage(params).then(res => {
- this.yearLoading = false
- this.tableData = res.data.records;
- this.search.total = res.data.total;
+ this.tableData = (res.data && res.data.records) || [];
+ this.search.total = (res.data && res.data.total) || 0;
}).catch(err => {
console.log(err);
+ this.tableData = []
+ this.search.total = 0
+ }).finally(() => {
this.yearLoading = false
})
},
pagination (page) {
this.search.size = page.limit
- this.refreshTable()
+ this.search.current = page.page
+ this.getList(this.departId)
},
changeLine (val) {
if(val) {
@@ -421,61 +456,99 @@
},
// 鏂板
addAppointPost(type) {
+ if (this.departId == null) {
+ this.$message.warning('璇峰厛鍦ㄥ乏渚ч�夋嫨浜哄憳鎴栭儴闂�')
+ return
+ }
this.operationType = type;
this.title = '鏂板鑳藉姏璁ゅ畾'
- this.dialogVisible = true;
this.form = {}
- this.form.userId = this.departId
+ this.verifyGetId = ''
+ if (!this.isDepartment) {
+ this.form.userId = this.departId
+ this.personOptions = [{id: this.departId, name: this.personName || '褰撳墠浜哄憳'}]
+ } else {
+ this.personOptions = []
+ this.getPersonList()
+ }
+ this.dialogVisible = true;
this.getUserList();
-
},
- // 缂栬緫/鏌ョ湅
+ // 缂栬緫/鏌ョ湅/纭
handleViewClick(type, row) {
this.operationType = type;
this.verifyGetId = row.id
- this.title = this.operationType === 'edit' ? '淇敼鑳藉姏璁ゅ畾' : '鏌ョ湅鑳藉姏璁ゅ畾'
+ this.title = type === 'edit' ? '淇敼鑳藉姏璁ゅ畾' : (type === 'confirm' ? '纭鑳藉姏璁ゅ畾' : '鏌ョ湅鑳藉姏璁ゅ畾')
this.dialogVisible = true;
this.form = {...row}
+ this.personOptions = [{id: row.userId, name: row.userName}]
this.getUserList();
},
// 淇濆瓨
submitForm() {
+ if (this.saving) return
this.$refs.infoForm.validate((valid) => {
if (valid) {
+ this.saving = true
addOrUpdatePersonPersonnelCapacity(this.form).then(res => {
if (res.code == 200) {
- this.$message.success('鎻愪氦鎴愬姛');
+ this.$message.success('淇濆瓨鎴愬姛');
this.getList(this.departId);
this.dialogVisible = false;
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触')
}
- });
+ }).catch(() => {
+ this.$message.error('淇濆瓨澶辫触')
+ }).finally(() => {
+ this.saving = false
+ })
}
});
},
// 鎻愪氦骞堕�氱煡
submitForm1() {
+ if (this.saving) return
this.$refs.infoForm.validate((valid) => {
if (valid) {
- submitConfirmPersonnelCapability(this.form).then(res => {
+ this.saving = true
+ const params = {...this.form}
+ // 纭鏃ユ湡鐢辩‘璁や汉鍦ㄧ‘璁ゆ椂鐢辩郴缁熻褰曪紝鎻愪氦鏃朵笉涓婁紶
+ delete params.confirmDate
+ submitConfirmPersonnelCapability(params).then(res => {
if (res.code == 200) {
- this.$message.success('鎻愪氦鎴愬姛');
+ this.$message.success('鎻愪氦鎴愬姛锛屽凡閫氱煡纭浜�');
this.getList(this.departId);
this.dialogVisible = false;
+ } else {
+ this.$message.error(res.msg || '鎻愪氦澶辫触')
}
- });
+ }).catch(() => {
+ this.$message.error('鎻愪氦澶辫触')
+ }).finally(() => {
+ this.saving = false
+ })
}
});
},
verifyGet () {
+ if (this.saving) return
+ this.saving = true
confirmPersonnelCapability({id: this.verifyGetId}).then(res => {
if (res.code == 200) {
this.$message.success('纭鎴愬姛');
this.resetForm()
this.getList(this.departId);
+ } else {
+ this.$message.error(res.msg || '纭澶辫触')
}
- });
+ }).catch(() => {
+ this.$message.error('纭澶辫触')
+ }).finally(() => {
+ this.saving = false
+ })
},
- // 鍒犻櫎宀椾綅鑱岃矗
+ // 鍒犻櫎浜哄憳鑳藉姏璁板綍
deletePost(id) {
this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎姝ゆ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
confirmButtonText: '纭畾',
@@ -486,21 +559,38 @@
if (res.code == 200) {
this.$message.success('鍒犻櫎鎴愬姛');
this.getList(this.departId);
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触');
});
- }).catch(() => {
- this.$message.error('鍒犻櫎澶辫触');
- });
+ }).catch(() => {});
},
resetForm() {
- this.$refs.infoForm.resetFields();
this.dialogVisible = false;
+ this.$nextTick(() => {
+ if (this.$refs.infoForm) {
+ this.$refs.infoForm.resetFields();
+ }
+ })
},
getUserList(){
selectUserCondition({type: 2}).then(res => {
if (res.code == 200) {
- this.responsibleOptions = res.data
+ this.responsibleOptions = res.data || []
}
+ }).catch(() => {
+ this.responsibleOptions = []
+ })
+ },
+ // 閮ㄩ棬瑙嗚鏂板鏃讹紝鍙�夋湰閮ㄩ棬涓嬬殑浜哄憳
+ getPersonList() {
+ basicInformationOfPersonnelSelectPage({departmentId: this.departId, size: 1000, current: 1}).then(res => {
+ const records = (res.data && res.data.records) || []
+ this.personOptions = records.map(item => ({id: item.userId, name: item.name}))
+ }).catch(() => {
+ this.personOptions = []
})
},
},
@@ -508,7 +598,13 @@
// 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
departId: {
handler(newId, oldId) {
- this.getList(newId);
+ this.search.current = 1
+ if (newId) {
+ this.getList(newId);
+ } else {
+ this.tableData = []
+ this.search.total = 0
+ }
}
},
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-information.vue b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-information.vue
index 5d3939e..1a4ec35 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-information.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-information.vue
@@ -2,7 +2,7 @@
<div>
<div style="text-align: right;margin-bottom: 10px">
<!-- <el-button size="small" @click="$emit('goBackList')">杩斿洖</el-button>-->
- <el-button size="small" type="primary" @click="downPerson">涓嬭浇妗f</el-button>
+ <el-button :loading="downLoading" size="small" type="primary" @click="downPerson">涓嬭浇妗f</el-button>
<el-button size="small" type="primary" @click="dialogVisible = true">浜哄憳鍒嗙被</el-button>
<el-button :loading="saveLoading" size="small" type="primary" @click="save">淇濆瓨</el-button>
</div>
@@ -273,7 +273,8 @@
</el-form-item>
</el-col>
<el-col :span="6">
- <el-upload ref="upload" :action="action" :headers="uploadHeader"
+ <el-upload ref="pictureUpload" :action="action" :headers="uploadHeader"
+ accept=".jpg,.jpeg,.png" :before-upload="imageBeforeUpload"
:on-success="(response, file, fileList) => onSuccess(response, file, fileList, 'pictureUrl')"
:show-file-list="false" style="float: left; margin: 0 10px 0 10px;">
<template #trigger><el-button class="uploadFile" size="small" type="primary">涓婁紶</el-button></template>
@@ -292,7 +293,8 @@
</el-form-item>
</el-col>
<el-col :span="6">
- <el-upload ref="upload" :action="action" :headers="uploadHeader"
+ <el-upload ref="signatureUpload" :action="action" :headers="uploadHeader"
+ accept=".jpg,.jpeg,.png" :before-upload="imageBeforeUpload"
:on-success="(response, file, fileList) => onSuccess(response, file, fileList, 'signatureUrl')"
:show-file-list="false" style="float: left; margin: 0 10px 0 10px;">
<template #trigger><el-button class="uploadFile" size="small" type="primary">涓婁紶</el-button></template>
@@ -319,7 +321,7 @@
</el-form-item>
</el-col>
<el-col :span="4">
- <el-upload ref='upload' :action="fileAction" :auto-upload="true" :data="{ userId: clickNodeVal.userId }"
+ <el-upload ref='fileUpload' :action="fileAction" :auto-upload="true" :data="{ userId: clickNodeVal.userId }"
:before-upload="fileBeforeUpload" :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'
@@ -380,8 +382,7 @@
</el-dialog>
<!-- 鏂板闄勪欢璧勬枡 -->
- <el-dialog :before-close="handleClose" :title="title" v-model="dialogVisible1" width="40%"
- @open="getComparisonList">
+ <el-dialog :before-close="handleClose" :title="title" v-model="dialogVisible1" width="40%">
<el-form ref="annex" :model="annex" :rules="rules" label-width="100px">
<el-row>
<el-col :span="16">
@@ -488,6 +489,7 @@
updateBasicInfoWorkList
} from "@/api/cnas/personal/personalList";
import limsTable from "@/components/Table/lims-table.vue";
+import { blobValidate } from "@/utils/ruoyi";
export default {
props: {
@@ -501,6 +503,7 @@
return {
operationType: '',
basicInfoWorkId: '',
+ downLoading: false,
dialogVisible2: false,
annex2: {
workExperience: ''
@@ -670,6 +673,7 @@
dialogVisible: false,
checkList: [],
successFileList: [], // 闃叉鍚庣鍑虹幇鑴忔暟鎹�
+ pendingDeleteFiles: [], // 淇濆瓨鎴愬姛鍚庡啀鍒犻櫎鐨勬棫鏂囦欢
isSave: false,
}
},
@@ -690,10 +694,22 @@
methods: {
// 涓嬭浇妗f
downPerson() {
- console.log('this.clickNodeVal.userId',this.clickNodeVal.userId)
- exportPersonBasicInfoById({ id: this.clickNodeVal.userId }).then(res => {
+ const userId = this.clickNodeVal.userId
+ if (!userId) {
+ this.$message.warning('璇峰厛閫夋嫨浜哄憳')
+ return
+ }
+ this.downLoading = true
+ exportPersonBasicInfoById({ id: userId }).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text())
+ this.$message.error(rspObj.msg || '涓嬭浇澶辫触')
+ return
+ }
const blob = new Blob([res], { type: 'application/msword' });
- this.$download.saveAs(blob, '浜哄憳妗f.docx');
+ this.$download.saveAs(blob, (this.form.name ? this.form.name + '浜哄憳妗f' : '浜哄憳妗f') + '.docx');
+ }).catch(() => {}).finally(() => {
+ this.downLoading = false
})
},
// 涓婁紶楠岃瘉
@@ -701,35 +717,52 @@
let flag = true
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
- this.$refs.upload.clearFiles()
+ this.$refs.fileUpload && this.$refs.fileUpload.clearFiles()
flag = false
}
if (!flag) {
return Promise.reject(flag); //姝g‘鐨勭粓姝�
}
},
+ // 涓汉鐓х墖/鐢靛瓙绛惧悕鍙厑璁稿浘鐗�
+ imageBeforeUpload(file) {
+ if (!/\.(jpg|jpeg|png)$/i.test(file.name || '')) {
+ this.$message.error('浠呮敮鎸佷笂浼� jpg銆乯peg銆乸ng 鏍煎紡鐨勫浘鐗�')
+ return false
+ }
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M')
+ return false
+ }
+ return true
+ },
onError(err, file, fileList, type) {
this.$message.error('涓婁紶澶辫触')
- this.$refs.upload.clearFiles()
+ this.$refs.fileUpload && this.$refs.fileUpload.clearFiles()
},
handleSuccessUp(response,) {
- this.upLoading = false;
- if (response.code == 200) {
+ if (response && response.code == 200) {
this.$message.success('涓婁紶鎴愬姛');
this.searchTableList()
} else {
- this.$message.error(response.message);
+ this.$message.error((response && (response.msg || response.message)) || '涓婁紶澶辫触');
}
},
// 鏌ヨ闄勪欢鍒楄〃
searchTableList() {
+ const userId = this.clickNodeVal && this.clickNodeVal.userId
+ if (!userId) {
+ this.tableData = []
+ return
+ }
this.tableLoading = true
- getBasicInfoFileList({ userId: this.clickNodeVal.userId }).then(res => {
- this.tableLoading = false
- this.tableData = res.data
+ getBasicInfoFileList({ userId: userId }).then(res => {
+ this.tableData = res.data || []
}).catch(err => {
- this.tableLoading = false
+ this.tableData = []
console.log('err---', err);
+ }).finally(() => {
+ this.tableLoading = false
})
},
// 涓嬭浇
@@ -745,18 +778,18 @@
}).then(() => {
this.tableLoading = true
delBasicInfoFileList({ basicInfoFileId: row.basicInfoFileId }).then(res => {
- this.tableLoading = false
- this.$message.success('鍒犻櫎鎴愬姛')
- this.searchTableList();
- }).catch(err => {
+ if (res.code == 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.searchTableList();
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
+ }).finally(() => {
this.tableLoading = false
})
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '宸插彇娑堝垹闄�'
- });
- })
+ }).catch(() => {})
},
// 鎵撳紑宸ヤ綔缁忓巻鎺㈠喌
annexAdd1(type, row) {
@@ -772,6 +805,10 @@
},
// 鎻愪氦宸ヤ綔缁忓巻
submitForm2() {
+ if (!this.annex2.workExperience || !String(this.annex2.workExperience).trim()) {
+ this.$message.warning('璇疯緭鍏ュ伐浣滅粡鍘�')
+ return
+ }
const params = {
workExperience: this.annex2.workExperience,
userId: this.clickNodeVal.userId,
@@ -780,22 +817,30 @@
this.tableLoading1 = true
if (this.operationType === 'add') {
addBasicInfoWork(params).then(res => {
- this.tableLoading1 = false
if (res.code == 200) {
this.dialogVisible2 = false
this.$message.success('鏂板鎴愬姛')
this.searchTableList2();
+ } else {
+ this.$message.error(res.msg || '鏂板澶辫触')
}
- }).catch(err => {
+ }).catch(() => {
+ this.$message.error('鏂板澶辫触')
+ }).finally(() => {
this.tableLoading1 = false
})
} else {
updateBasicInfoWorkList(params).then(res => {
- this.tableLoading1 = false
- this.dialogVisible2 = false
- this.$message.success('淇敼鎴愬姛')
- this.searchTableList2();
- }).catch(err => {
+ if (res.code == 200) {
+ this.dialogVisible2 = false
+ this.$message.success('淇敼鎴愬姛')
+ this.searchTableList2();
+ } else {
+ this.$message.error(res.msg || '淇敼澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('淇敼澶辫触')
+ }).finally(() => {
this.tableLoading1 = false
})
}
@@ -814,28 +859,34 @@
}).then(() => {
this.tableLoading1 = true
delBasicInfoWorkList({ basicInfoWorkId: row.basicInfoWorkId }).then(res => {
- this.tableLoading1 = false
- this.$message.success('鍒犻櫎鎴愬姛')
- this.searchTableList2();
- }).catch(err => {
+ if (res.code == 200) {
+ this.$message.success('鍒犻櫎鎴愬姛')
+ this.searchTableList2();
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
+ }).finally(() => {
this.tableLoading1 = false
})
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '宸插彇娑堝垹闄�'
- });
- });
+ }).catch(() => {})
},
// 鏌ヨ宸ヤ綔缁忓巻鍒楄〃
searchTableList2() {
+ const userId = this.clickNodeVal && this.clickNodeVal.userId
+ if (!userId) {
+ this.tableData1 = []
+ return
+ }
this.tableLoading1 = true
- getBasicInfoWorkList({ userId: this.clickNodeVal.userId }).then(res => {
- this.tableLoading1 = false
- this.tableData1 = res.data
+ getBasicInfoWorkList({ userId: userId }).then(res => {
+ this.tableData1 = res.data || []
}).catch(err => {
- this.tableLoading1 = false
+ this.tableData1 = []
console.log('err---', err);
+ }).finally(() => {
+ this.tableLoading1 = false
})
},
annexAdd(type, row) {
@@ -843,12 +894,37 @@
this.title = '缂栬緫闄勪欢璧勬枡'
this.addOrupdate = 1
getAnnex({ id: row.id }).then(res => {
+ if (res.code != 200 || !res.data) {
+ this.$message.error(res.msg || '闄勪欢璧勬枡鍔犺浇澶辫触')
+ return
+ }
this.annex = res.data
this.imageUrl = this.javaApi + '/img/' + res.data.fileName
+ this.dialogVisible1 = true
+ }).catch(() => {
+ this.$message.error('闄勪欢璧勬枡鍔犺浇澶辫触')
})
+ return
} else {
this.title = '鏂板闄勪欢璧勬枡'
this.addOrupdate = 2
+ this.imageUrl = ''
+ this.annex = {
+ userId: '',
+ idNumber: '',
+ issueUnit: '',
+ level: '',
+ periodValidity: '',
+ copy: '',
+ original: '',
+ fileName: ''
+ }
+ if (this.$refs.fileName) {
+ this.$refs.fileName.clearFiles()
+ }
+ this.$nextTick(() => {
+ this.$refs.annex && this.$refs.annex.clearValidate()
+ })
}
this.dialogVisible1 = true
},
@@ -870,33 +946,41 @@
if (this.addOrupdate === 1) {
updateAnnex(this.annex).then(res => {
if (res.code == 200) {
- getAnnexByUserId({ userId: this.clickNodeVal.userId }).then(res => {
- this.imageUrl = ''
- this.$refs.fileName.clearFiles()
- this.annex.fileName = ''
- this.resetForm('annex')
- this.annexList = res.data
- this.dialogVisible1 = false
- this.$message.success('鏇存柊鎴愬姛锛�')
- })
+ this.refreshAnnexList('鏇存柊鎴愬姛锛�')
+ } else {
+ this.$message.error(res.msg || '鏇存柊澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鏇存柊澶辫触')
})
} else {
this.annex.id = null
addAnnex(this.annex).then(res => {
if (res.code == 200) {
- getAnnexByUserId({ userId: this.clickNodeVal.userId }).then(res => {
- this.imageUrl = ''
- this.$refs.fileName.clearFiles()
- this.annex.fileName = ''
- this.resetForm('annex')
- this.annexList = res.data
- this.dialogVisible1 = false
- this.$message.success('淇濆瓨鎴愬姛')
- })
+ this.refreshAnnexList('淇濆瓨鎴愬姛')
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触')
}
+ }).catch(() => {
+ this.$message.error('淇濆瓨澶辫触')
})
}
+ },
+ refreshAnnexList(tip) {
+ getAnnexByUserId({ userId: this.clickNodeVal.userId }).then(res => {
+ this.imageUrl = ''
+ if (this.$refs.fileName) {
+ this.$refs.fileName.clearFiles()
+ }
+ this.annex.fileName = ''
+ this.resetForm('annex')
+ this.annexList = res.data || []
+ this.dialogVisible1 = false
+ this.$message.success(tip)
+ }).catch(() => {
+ this.annexList = []
+ this.$message.error('闄勪欢璧勬枡鍒锋柊澶辫触锛岃閲嶆柊鎵撳紑椤甸潰鏌ョ湅')
+ })
},
deleteAnnex(row) {
this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
@@ -905,16 +989,22 @@
type: 'warning'
}).then(() => {
deleteAnnex({ id: row.id }).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛锛�')
- this.annexList = this.annexList.filter(item => item.id != row.id)
+ if (res.code == 200) {
+ this.$message.success('鍒犻櫎鎴愬姛锛�')
+ this.annexList = this.annexList.filter(item => item.id != row.id)
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
})
- })
+ }).catch(() => {})
},
beforeAvatarUpload(file) {
let flag = true
if (file.size > 1024 * 1024 * 10) {
this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
- this.$refs.upload.clearFiles()
+ this.$refs.fileName && this.$refs.fileName.clearFiles()
flag = false
}
if (!flag) {
@@ -925,6 +1015,10 @@
return this.$download.saveAs(fileName, fileName)
},
async onSuccess(response, file, fileList, entityVal) {
+ if (!response || response.code != 200) {
+ this.$message.error((response && (response.msg || response.message)) || '涓婁紶澶辫触')
+ return
+ }
if (entityVal == 'fileName') {
this.annex.fileName = response.data
}
@@ -934,58 +1028,90 @@
},
// 鍒濆鍖栬皟鐢�
init() {
- if (!this.clickNodeVal.userId) {
- let user = JSON.parse(localStorage.getItem('user'))
- this.getUserBasisInfo(user.userId)
- this.clickNodeVal.userId = user.userId
- } else {
- this.getUserBasisInfo(this.clickNodeVal.userId)
+ let userId = this.clickNodeVal && this.clickNodeVal.userId
+ if (!userId) {
+ let user = JSON.parse(localStorage.getItem('user') || '{}')
+ userId = user.userId
+ this.clickNodeVal.userId = userId
+ }
+ if (userId) {
+ this.getUserBasisInfo(userId)
}
},
getUserBasisInfo(userId) {
getCNASPersonnelInfo({ userId: userId }).then(res => {
- this.form = res.data.PersonBasicInfoDto
- this.department = res.data.department
- this.annexList = res.data.annexList
- this.form.departLimsId = res.data.PersonBasicInfoDto.departLimsId.split(',').filter(a => a != "").map(Number)
+ const dto = (res.data && res.data.PersonBasicInfoDto) || {}
+ this.form = { ...dto }
+ this.department = (res.data && res.data.department) || []
+ this.annexList = (res.data && res.data.annexList) || []
+ this.form.departLimsId = dto.departLimsId
+ ? String(dto.departLimsId).split(',').filter(a => a != "").map(Number)
+ : []
+ }).catch(() => {
+ this.form = {}
+ this.annexList = []
+ this.tableData = []
+ this.tableData1 = []
})
},
async save() {
+ const userId = this.clickNodeVal && this.clickNodeVal.userId
+ if (!userId) {
+ this.$message.warning('璇峰厛鍦ㄥ乏渚ч�夋嫨浜哄憳')
+ return
+ }
this.saveLoading = true
- this.form.userId = this.clickNodeVal.userId
- if (Array.isArray(this.form.departLimsId)) {
- if (this.form.departLimsId.length > 0) {
- this.form.departLimsId = this.form.departLimsId.join(',').trim() + ','
+ const payload = { ...this.form }
+ payload.userId = userId
+ if (Array.isArray(payload.departLimsId)) {
+ if (payload.departLimsId.length > 0) {
+ payload.departLimsId = payload.departLimsId.join(',').trim() + ','
} else {
- this.form.departLimsId = ''
+ payload.departLimsId = ''
}
}
- saveCNASPersonnelInfo(this.form).then(res => {
+ saveCNASPersonnelInfo(payload).then(res => {
+ if (res.code == 200) {
+ this.isSave = true
+ this.deletePendingFiles()
+ this.getUserBasisInfo(userId)
+ this.$emit('refreshTree')
+ this.$message.success('淇濆瓨鎴愬姛锛�')
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('淇濆瓨澶辫触')
+ }).finally(() => {
this.saveLoading = false
- this.isSave = true
- this.getUserBasisInfo(this.clickNodeVal.userId)
- this.$message.success('淇濆瓨鎴愬姛锛�')
})
},
- // 鍙栦汉鍛樺垎绫荤殑瀛楀吀
+ // 鎵撳紑浜哄憳鍒嗙被寮规鏃跺洖鏄惧凡淇濆瓨鐨勫垎绫�
getComparisonList() {
- if (this.checkList.length > 0) {
- this.form.personnelClassification = this.checkList.split('锛�')
- }
+ this.checkList = this.form.personnelClassification
+ ? String(this.form.personnelClassification).split(/[锛�,]/).filter(m => m)
+ : []
},
clickPersonnelClassificationSure() {
this.dialogVisible = false
this.form.personnelClassification = this.checkList.filter(m => m).join('锛�')
},
async deleteFile(fileName, entityVal) {
- await deleteCNASFile({ fileName: fileName }).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛锛�')
- this.form[entityVal] = null
+ this.$confirm('纭畾鍒犻櫎璇ユ枃浠跺悧锛熶繚瀛樺悗鐢熸晥銆�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 淇濆瓨鎴愬姛鍚庡啀鍒犻櫎鐗╃悊鏂囦欢锛岄伩鍏嶅彇娑堢紪杈戝悗鏁版嵁搴撲粛鎸囧悜宸插垹闄ょ殑鏂囦欢
+ if (fileName) {
+ this.pendingDeleteFiles.push(fileName)
+ }
+ this.form[entityVal] = ''
let index = this.successFileList.indexOf(fileName)
if (index != -1) {
this.successFileList.splice(index, 1)
}
- })
+ }).catch(() => {})
},
cancellation() {
this.resetForm('annex')
@@ -1006,7 +1132,20 @@
original: '',
fileName: ''
}
+ if (this.$refs.fileName) {
+ this.$refs.fileName.clearFiles()
+ }
done();
+ },
+ // 淇濆瓨鎴愬姛鍚庢竻鐞嗙墿鐞嗘枃浠�
+ deletePendingFiles() {
+ if (!this.pendingDeleteFiles.length) {
+ return
+ }
+ this.pendingDeleteFiles.forEach(fileName => {
+ deleteCNASFile({ fileName }).catch(() => {})
+ })
+ this.pendingDeleteFiles = []
},
resetForm(formName) {
this.$refs[formName].resetFields();
@@ -1015,6 +1154,9 @@
this.form.age = this.calculateAge(val)
},
calculateAge(birthDateString) {
+ if (!birthDateString) {
+ return undefined
+ }
// 瑙f瀽鍑虹敓鏃ユ湡瀛楃涓蹭负鏃ユ湡瀵硅薄
const birthDate = new Date(birthDateString);
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue
index 04792a8..615d7cf 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue
@@ -5,10 +5,10 @@
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
<span style="width: 88px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">浜哄憳鍚嶇О</span>
<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.name"
- @keyup.enter="refreshTable"></el-input>
+ @keyup.enter="handleSearch"></el-input>
</div>
<div style="line-height: 30px;">
- <el-button type="primary" size="small" @click="refreshTable">鏌ヨ</el-button>
+ <el-button type="primary" size="small" @click="handleSearch">鏌ヨ</el-button>
<el-button size="small" @click="refresh">閲嶇疆</el-button>
</div>
</div>
@@ -40,7 +40,7 @@
</template>
</el-table-column>
</el-table>
- <el-pagination :current-page="1" v-model:current-page="page.current" :page-size="page.size"
+ <el-pagination v-model:current-page="page.current" v-model:page-size="page.size"
:page-sizes="[10, 20, 30, 50, 100]" :total="page.total" background
layout="->,total, sizes, prev, pager, next, jumper" style="margin-top: 10px" @size-change="handleSizeChange"
@current-change="handleCurrentChange">
@@ -79,6 +79,7 @@
upUserDepardLimsId
} from "@/api/cnas/personal/personalList";
import store from "@/store";
+import { blobValidate } from "@/utils/ruoyi";
export default {
name: 'PersonnelList',
@@ -174,6 +175,11 @@
this.entity.name = ''
this.refreshTable();
},
+ // 鏌ヨ
+ handleSearch() {
+ this.page.current = 1
+ this.refreshTable()
+ },
// 鏌ヨ浜哄憳鍒楄〃鏁版嵁
refreshTable() {
this.tableLoading = true;
@@ -185,32 +191,35 @@
name: this.entity.name,
}
basicInformationOfPersonnelSelectPage(params).then(res => {
- this.tableLoading = false;
- this.page.total = res.data.total;
- this.tableData = res.data.records;
+ this.page.total = (res.data && res.data.total) || 0;
+ this.tableData = (res.data && res.data.records) || [];
}).catch(err => {
+ this.page.total = 0;
+ this.tableData = [];
+ }).finally(() => {
this.tableLoading = false;
})
},
- // 鍒犻櫎浜哄憳
+ // 浠庝汉鍛樻灦鏋勪腑绉婚櫎
deletePerson(row) {
- this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', '璀﹀憡', {
+ this.$confirm(`纭畾灏嗏��${row.name}鈥濅粠浜哄憳鏋舵瀯涓Щ闄ゅ悧锛熺Щ闄ゅ悗璇ヤ汉鍛樹笉浼氬嚭鐜板湪宸︿晶浜哄憳鏍戜腑锛堜笉浼氬垹闄ょ敤鎴疯处鍙凤級銆俙, '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
delUserDepardLimsId({ id: row.userId }).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛');
- this.refreshTable();
- this.$emit('refreshTree')
- }).catch(e => {
- this.$message.error('鍒犻櫎澶辫触');
- });
+ if (res.code == 200) {
+ this.$message.success('宸蹭粠浜哄憳鏋舵瀯涓Щ闄�');
+ this.refreshTable();
+ this.$emit('refreshTree')
+ }
+ }).catch(() => {});
}).catch(() => {
});
},
handleSizeChange(val) {
this.page.size = val;
+ this.page.current = 1;
this.refreshTable();
},
handleCurrentChange(val) {
@@ -225,10 +234,11 @@
// 鏌ヨ鏂板寮规鐨勪汉鍛樺垪琛�
selectUserList() {
this.tableLoading1 = true
- selectUserCondition().then(res => {
- this.tableLoading1 = false
- this.tableData1 = res.data
- }).catch(err => {
+ selectUserCondition({ name: this.addUserTableInfo.name || '', isCustom: 0 }).then(res => {
+ this.tableData1 = res.data || []
+ }).catch(() => {
+ this.tableData1 = []
+ }).finally(() => {
this.tableLoading1 = false
})
},
@@ -238,7 +248,7 @@
},
// 鎻愪氦闇�瑕佹坊鍔犵殑浜哄憳
selectUser() {
- if (!this.currentCompaniesList.length > 0) {
+ if (!this.currentCompaniesList || this.currentCompaniesList.length === 0) {
this.$message.warning("璇烽�夋嫨閮ㄩ棬锛�")
return;
}
@@ -261,21 +271,35 @@
ids: JSON.stringify(ids),
id: str
}).then(res => {
- this.selectUserDia = false;
- this.$message.success('娣诲姞鎴愬姛');
- this.refreshTable();
- this.$emit('refreshTree')
+ if (res.code == 200) {
+ this.selectUserDia = false;
+ this.multipleSelection = [];
+ this.$message.success('娣诲姞鎴愬姛');
+ this.refreshTable();
+ this.$emit('refreshTree')
+ } else {
+ this.$message.error(res.msg || '娣诲姞澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('娣诲姞澶辫触')
});
},
// 瀵煎嚭浜哄憳淇℃伅
handleDown() {
this.outLoading = true;
- let entity = this.HaveJson(this.entity)
- delete entity.orderBy;
- exportPersonBasicInfo({ ...entity }).then(res => {
- this.outLoading = false;
+ exportPersonBasicInfo({
+ name: this.entity.name,
+ departmentId: this.departId
+ }).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text())
+ this.$message.error(rspObj.msg || '瀵煎嚭澶辫触')
+ return
+ }
const blob = new Blob([res], { type: 'application/octet-stream' });
this.$download.saveAs(blob, '浜哄憳淇℃伅.xlsx')
+ }).catch(() => {}).finally(() => {
+ this.outLoading = false;
})
},
},
@@ -285,6 +309,9 @@
if (newId) {
this.page.current = 1
this.refreshTable();
+ } else {
+ this.tableData = []
+ this.page.total = 0
}
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/personnelTraining.vue b/src/views/CNAS/personnel/personnelInfo/tabs/personnelTraining.vue
index 5d58279..3647a16 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/personnelTraining.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/personnelTraining.vue
@@ -10,10 +10,10 @@
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
<span style="width: 88px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">缂栧埗浜�</span>
<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="page.compilerName"
- @keyup.enter="getYearPlanList(departId)"></el-input>
+ @keyup.enter="searchYearPlan"></el-input>
</div>
<div style="line-height: 30px;">
- <el-button type="primary" size="small" @click="getYearPlanList(departId)">鏌ヨ</el-button>
+ <el-button type="primary" size="small" @click="searchYearPlan">鏌ヨ</el-button>
</div>
</div>
<div style="line-height: 30px;">
@@ -21,7 +21,8 @@
</div>
</div>
<lims-table :tableData="yearPlanTableData" :column="yearPlanColumn" :currentChange="currentChange"
- @pagination="pagination" height="40vh" :page="page" :tableLoading="yearLoading"></lims-table>
+ :highlightCurrentRow="true" @pagination="pagination" height="40vh" :page="page"
+ :tableLoading="yearLoading"></lims-table>
</div>
<div v-if="!editPlanShow" class="table">
<div>
@@ -78,7 +79,7 @@
</span>
<template #footer><span class="dialog-footer">
<el-button :loading="approvalLoading" @click="handleApproval(2)">涓嶆壒鍑�</el-button>
- <el-button :loading="reviewLoading" type="primary" @click="handleApproval(1)">鎵� 鍑�</el-button>
+ <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">鎵� 鍑�</el-button>
</span></template>
</el-dialog>
<el-dialog v-model="uploadDia" title="鏁版嵁瀵煎叆" width="500px">
@@ -136,6 +137,7 @@
queryTheAnnualPlanDetailsTable, reviewAnnualPersonnelTraining
} from "@/api/cnas/personal/personalTraining";
import { selectUserCondition } from "@/api/system/user";
+import { blobValidate } from "@/utils/ruoyi";
export default {
name: 'PersonnelTraining',
@@ -404,6 +406,7 @@
{
name: '缂栬緫',
type: 'text',
+ disabled: () => !this.isOperation,
clickFun: (row) => {
this.addTrainingPlan('edit', row);
},
@@ -411,6 +414,7 @@
{
name: '缁撴灉鏄庣粏',
type: 'text',
+ disabled: () => !this.isOperation,
clickFun: (row) => {
this.editInDetail(row);
},
@@ -462,6 +466,7 @@
multipleSelection: [], // 骞村害鏄庣粏琛ㄩ�変腑鐨勬暟鎹�
uploadDia: false,
uploading: false,
+ downLoading: false,
isOperation: false,
ViewRecord: false,
fileList: [],
@@ -478,9 +483,22 @@
},
methods: {
searchTable() {
+ this.inDetailPagination.current = 1
this.getInDetailPlan(this.currentRowId)
},
// 鏌ヨ-骞村害璁″垝琛�
+ searchYearPlan() {
+ this.page.current = 1
+ this.getYearPlanList(this.departId)
+ },
+ clearPlanSelection() {
+ this.currentRowId = null
+ this.currentChangeRow = {}
+ this.isOperation = false
+ this.inDetailPlanTableData = []
+ this.inDetailPagination.total = 0
+ this.inDetailPagination.current = 1
+ },
getYearPlanList(userId) {
this.yearLoading = true
const params = this.isDepartment ?
@@ -496,36 +514,43 @@
compilerName: this.page.compilerName,
}
personTraining(params).then(res => {
- this.yearLoading = false
- this.yearPlanTableData = res.data.records;
- this.pagination.total = res.data.total;
+ this.yearPlanTableData = (res.data && res.data.records) || [];
+ this.page.total = (res.data && res.data.total) || 0;
if (this.yearPlanTableData.length > 0) {
- this.currentRowId = this.yearPlanTableData[0].id
this.currentChange(this.yearPlanTableData[0])
+ } else {
+ this.clearPlanSelection()
}
- }).catch(err => {
+ }).catch(() => {
+ this.yearPlanTableData = []
+ this.page.total = 0
+ this.clearPlanSelection()
+ }).finally(() => {
this.yearLoading = false
})
},
pagination(page) {
this.page.size = page.limit
- this.getYearPlanList()
+ this.page.current = page.page
+ this.getYearPlanList(this.departId)
},
currentChange(row) {
- const now = new Date();
- const currentYear = now.getFullYear();
- if (row) {
- this.currentChangeRow = row
- this.currentRowId = row.id
- if (row.createTime.slice(0, 4) == currentYear) {
- this.isOperation = true;
- } else {
- this.isOperation = false;
- }
- this.getInDetailPlan(row.id)
+ if (!row) {
+ return
}
+ const currentYear = new Date().getFullYear();
+ this.currentChangeRow = row
+ this.currentRowId = row.id
+ const planYear = row.planYear ? String(row.planYear) : (row.createTime ? String(row.createTime).slice(0, 4) : '')
+ this.isOperation = planYear === String(currentYear)
},
getInDetailPlan(id) {
+ // 閮ㄩ棬瑙嗚涓嬪繀椤诲厛閫変腑涓�浠藉勾搴﹁鍒掞紝鍚﹀垯浼氭妸鎵�鏈夐儴闂ㄧ殑鏄庣粏閮芥煡鍑烘潵
+ if (this.isDepartment && !id) {
+ this.inDetailPlanTableData = []
+ this.inDetailPagination.total = 0
+ return
+ }
if (this.inDetailForm.trainingDate === null) {
this.inDetailForm.trainingDate = ''
}
@@ -533,7 +558,7 @@
const params =
{
userId: userId,
- size: this.inDetailPagination.pageSize,
+ size: this.inDetailPagination.size,
current: this.inDetailPagination.current,
id: id,
trainingLecturerName: this.inDetailForm.trainingLecturerName,
@@ -541,15 +566,18 @@
}
this.yearDetailLoading = true
queryTheAnnualPlanDetailsTable(params).then(res => {
- this.yearDetailLoading = false
- this.inDetailPlanTableData = res.data.records;
- this.inDetailPagination.total = res.data.total;
- }).catch(err => {
+ this.inDetailPlanTableData = (res.data && res.data.records) || [];
+ this.inDetailPagination.total = (res.data && res.data.total) || 0;
+ }).catch(() => {
+ this.inDetailPlanTableData = []
+ this.inDetailPagination.total = 0
+ }).finally(() => {
this.yearDetailLoading = false
})
},
pagination1(page) {
this.inDetailPagination.size = page.limit
+ this.inDetailPagination.current = page.page
this.getInDetailPlan(this.currentRowId)
},
// 鏂板骞村害璁″垝鏄庣粏琛�
@@ -558,39 +586,54 @@
this.$message.warning('璇烽�夋嫨涓�鏉¤鍒掕繘琛屾柊澧�')
return
}
+ if (!this.isOperation) {
+ this.$message.warning('浠呭彲缂栬緫褰撳墠骞村害鐨勫煿璁鍒�')
+ return
+ }
this.$refs.addPlan.showDialog(this.currentRowId, type, row);
},
// 骞村害璁″垝琛�-鍒犻櫎
deleteFun(id) {
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ this.$confirm('鍒犻櫎鍚庤璁″垝鐨勬槑缁嗗拰鍩硅璁板綍灏嗕竴骞跺垹闄わ紝鏄惁缁х画?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
personTrainingDelete({ id: id }).then(res => {
- this.$message.success('鍒犻櫎鎴愬姛锛�');
- this.getYearPlanList(this.departId);
+ if (res.code == 200) {
+ this.$message.success('鍒犻櫎鎴愬姛锛�');
+ if (this.currentRowId === id) {
+ this.clearPlanSelection()
+ }
+ this.getYearPlanList(this.departId);
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
+ }
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
});
}).catch(() => {
- this.$message({
- type: 'info',
- message: '宸插彇娑堝垹闄�'
- });
});
},
// 骞村害璁″垝琛�-瀹℃牳
handleCheck(id) {
this.currentRowId = id
+ this.approverId = ''
+ this.auditRemarks = ''
this.reviewDialog = true
this.getUserList()
},
// 鎻愪氦瀹℃牳
handleReview(status) {
+ if (status === 1 && !this.approverId) {
+ this.$message.warning('璇烽�夋嫨鎵瑰噯浜�')
+ return
+ }
const personTrainingUpdateDto = {
id: this.currentRowId,
auditRemarks: this.auditRemarks,
reviewerStatus: status,
- approverId: this.approverId
+ approverId: status === 1 ? this.approverId : null
}
this.reviewLoading = true
reviewAnnualPersonnelTraining(personTrainingUpdateDto).then(res => {
@@ -598,9 +641,12 @@
this.$message.success('鎻愪氦鎴愬姛锛�');
this.reviewDialog = false
this.getYearPlanList(this.departId);
+ } else {
+ this.$message.error(res.msg || '鎻愪氦澶辫触')
}
- this.reviewLoading = false
}).catch(() => {
+ this.$message.error('鎻愪氦澶辫触')
+ }).finally(() => {
this.reviewLoading = false
})
},
@@ -622,18 +668,31 @@
this.$message.success('鎻愪氦鎴愬姛锛�');
this.approvalDialog = false
this.getYearPlanList(this.departId);
+ } else {
+ this.$message.error(res.msg || '鎻愪氦澶辫触')
}
- this.approvalLoading = false
}).catch(() => {
+ this.$message.error('鎻愪氦澶辫触')
+ }).finally(() => {
this.approvalLoading = false
})
},
// 骞村害璁″垝琛�-涓嬭浇
downLoadPost(row) {
- exportPersonTraining({ id: row.id }).then(res => {
- this.outLoading = false
+ if (this.downLoading) {
+ return
+ }
+ this.downLoading = true
+ exportPersonTraining({ id: row.id }).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text())
+ this.$message.error(rspObj.msg || rspObj.message || '瀵煎嚭澶辫触')
+ return
+ }
const blob = new Blob([res], { type: 'application/msword' });
- this.$download.saveAs(blob, row.fileName + '.docx')
+ this.$download.saveAs(blob, (row.fileName || '浜哄憳鍩硅璁″垝') + '.docx')
+ }).catch(() => {}).finally(() => {
+ this.downLoading = false
})
},
// 鎵撳紑瀵煎叆寮规
@@ -665,26 +724,32 @@
this.$message.error('鏈�夋嫨鏂囦欢')
return
}
- this.uploading = true
- this.$refs.upload.submit();
- this.uploading = false
- },
- onSuccess(response, file, fileList) {
- this.$refs.upload.clearFiles()
- this.uploadDia = false
- this.uploading = false
- if (response.code != 200) {
- this.$message.error(response.msg)
+ const file = this.fileList[0].raw || this.fileList[0]
+ if (!/\.(xls|xlsx)$/i.test(file.name || '')) {
+ this.$message.error('璇烽�夋嫨 .xls 鎴� .xlsx 鏍煎紡鐨勬枃浠�')
return
}
+ if (file.size > 1024 * 1024 * 10) {
+ this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M')
+ return
+ }
+ this.uploading = true
+ this.$refs.upload.submit();
+ },
+ onSuccess(response, file, fileList) {
+ this.uploading = false
+ if (!response || response.code != 200) {
+ this.$message.error((response && (response.msg || response.message)) || '涓婁紶澶辫触')
+ return
+ }
+ this.$refs.upload && this.$refs.upload.clearFiles()
+ this.uploadDia = false
this.$message.success('涓婁紶鎴愬姛')
- this.standardList = []
- this.productList = []
this.getYearPlanList(this.departId)
},
onError(err, file, fileList) {
this.$message.error('涓婁紶澶辫触')
- this.$refs.upload.clearFiles()
+ this.$refs.upload && this.$refs.upload.clearFiles()
this.uploading = false
},
beforeUpload(file, fileList) {
@@ -702,6 +767,10 @@
},
// 骞村害璁″垝鏄庣粏琛�-缂栬緫
editInDetail(row) {
+ if (!this.isOperation) {
+ this.$message.warning('浠呭彲缂栬緫褰撳墠骞村害鐨勫煿璁鍒�')
+ return
+ }
this.editPlanShow = true;
this.currentRow = row
},
@@ -718,10 +787,20 @@
},
// 骞村害璁″垝鏄庣粏琛�-涓嬭浇
downLoadInDetail(row) {
- exportPersonTrainingRecord({ id: row.id }).then(res => {
- this.outLoading = false
+ if (this.downLoading) {
+ return
+ }
+ this.downLoading = true
+ exportPersonTrainingRecord({ id: row.id }).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text())
+ this.$message.error(rspObj.msg || rspObj.message || '瀵煎嚭澶辫触')
+ return
+ }
const blob = new Blob([res], { type: 'application/msword' });
this.$download.saveAs(blob, '浜哄憳鍩硅涓庤�冩牳璁板綍.docx')
+ }).catch(() => {}).finally(() => {
+ this.downLoading = false
})
},
// 骞村害璁″垝鏄庣粏琛�-澶氶��
@@ -744,10 +823,13 @@
if (res.code == 200) {
this.$message.success('鍒犻櫎鎴愬姛');
this.getInDetailPlan(this.currentRowId);
+ } else {
+ this.$message.error(res.msg || '鍒犻櫎澶辫触')
}
+ }).catch(() => {
+ this.$message.error('鍒犻櫎澶辫触')
});
}).catch(() => {
- this.$message.warning('鍙栨秷鍒犻櫎');
});
} else {
this.$message.warning('璇烽�夋嫨闇�瑕佸垹闄ょ殑鏁版嵁')
@@ -755,18 +837,22 @@
},
handleSizeChange(val) {
this.inDetailPagination.size = val;
- this.getInDetailPlan(this.currentChangeRow.id)
+ this.getInDetailPlan(this.currentRowId)
},
handleCurrentChange(val) {
this.inDetailPagination.current = val;
- this.getInDetailPlan(this.currentChangeRow.id)
+ this.getInDetailPlan(this.currentRowId)
},
// 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
getUserList() {
- selectUserCondition().then(res => {
+ selectUserCondition({ isCustom: 0 }).then(res => {
if (res.code == 200) {
- this.responsibleOptions = res.data
+ this.responsibleOptions = Array.isArray(res.data) ? res.data : []
+ } else {
+ this.responsibleOptions = []
}
+ }).catch(() => {
+ this.responsibleOptions = []
});
}
},
@@ -774,19 +860,21 @@
// 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
departId: {
handler(newId, oldId) {
+ this.page.current = 1
+ this.inDetailPagination.current = 1
if (this.isDepartment) {
this.getYearPlanList(newId);
} else {
+ this.clearPlanSelection()
this.getInDetailPlan('')
}
}
},
currentRowId: {
handler(newId, oldId) {
- if (newId) {
- console.log('newId', newId);
+ if (newId && newId !== oldId) {
this.inDetailPagination.current = 1
- this.getInDetailPlan(this.currentChangeRow.id)
+ this.getInDetailPlan(newId)
}
}
}
diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue b/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue
index 879887e..88bde78 100644
--- a/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue
+++ b/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue
@@ -11,11 +11,11 @@
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
<span style="width: 48px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">濮撳悕</span>
<el-input v-model="trainingPagination.userName" class="search"
- @keyup.enter="getPersonnelTraining(departId)"
+ @keyup.enter="refreshTable"
clearable placeholder="璇疯緭鍏�" size="small"></el-input>
</div>
<div style="line-height: 30px;">
- <el-button size="small" type="primary" @click="getPersonnelTraining(departId)">鏌ヨ</el-button>
+ <el-button size="small" type="primary" @click="refreshTable">鏌ヨ</el-button>
</div>
</div>
</div>
@@ -27,7 +27,7 @@
</div>
<div :style="`width: ${isDepartment ? '49%' : '100%'};`">
<div class="title">
- <span style="font-weight: bold">骞村害璁″垝鏄庣粏</span>
+ <span style="font-weight: bold">{{ isDepartment ? '骞村害璁″垝鏄庣粏' : '鍩硅璁板綍鏄庣粏' }}</span>
</div>
<div style="display: flex;justify-content: space-between;">
<el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
@@ -37,14 +37,14 @@
clearable
format="YYYY"
placeholder="閫夋嫨骞�"
- @change="queryPersonnelDetailsPage(currentChangeRow.userId)"
+ @change="searchDetails"
size="small"
type="year"
value-format="YYYY">
</el-date-picker>
</el-form-item>
<el-form-item>
- <el-button size="small" type="primary" @click="queryPersonnelDetailsPage(currentChangeRow.userId)">鏌ヨ</el-button>
+ <el-button size="small" type="primary" @click="searchDetails">鏌ヨ</el-button>
</el-form-item>
</el-form>
<div>
@@ -62,6 +62,7 @@
<script>
import limsTable from "@/components/Table/lims-table.vue";
+import { blobValidate } from "@/utils/ruoyi";
import {
exportTrainingRecord,
queryPersonnelDetails,
@@ -107,7 +108,7 @@
width: '100'
}, {
label: '鍏ュ崟浣嶆椂闂�',
- prop: 'unitTime',
+ prop: 'unitTimeSting',
width: '150'
},
// {
@@ -166,24 +167,53 @@
};
},
mounted() {
- this.getPersonnelTraining(this.departId);
+ if (this.isDepartment) {
+ this.getPersonnelTraining(this.departId);
+ } else {
+ this.queryPersonnelDetailsPage(this.departId);
+ }
},
methods: {
// 鏌ヨ
refreshTable() {
+ this.trainingPagination.current = 1;
this.getPersonnelTraining(this.departId);
},
+ // 鏄庣粏鏌ヨ锛堝勾浠�/浜哄憳鍙樺寲鏃跺洖鍒扮涓�椤碉級
+ searchDetails() {
+ this.trainingPersonPagination.current = 1;
+ const userId = this.isDepartment
+ ? (this.currentChangeRow && this.currentChangeRow.userId)
+ : this.departId;
+ this.queryPersonnelDetailsPage(userId);
+ },
// 鍩硅璁板綍瀵煎嚭
- openDownloadDia (row) {
- let date = this.searchForm.trainingDate
- if (!date) {
- date = this.$moment().format('YYYY')
+ openDownloadDia(row) {
+ const userId = this.isDepartment ? (row && row.userId) : this.departId;
+ if (!userId) {
+ this.$message.warning('璇峰厛閫夋嫨闇�瑕佸鍑虹殑浜哄憳');
+ return;
}
- exportTrainingRecord({userId: row.userId, trainingDate: date}).then(res => {
- this.outLoading = false
- const blob = new Blob([res],{ type: 'application/msword' });
- this.$download.saveAs(blob, '鍩硅璁板綍瀵煎嚭.docx');
- })
+ if (this.outLoading) {
+ return;
+ }
+ let date = this.searchForm.trainingDate;
+ if (!date) {
+ date = this.$moment().format('YYYY');
+ }
+ this.outLoading = true;
+ exportTrainingRecord({userId: userId, trainingDate: date}).then(async res => {
+ if (!blobValidate(res)) {
+ const rspObj = JSON.parse(await res.text());
+ this.$message.error(rspObj.msg || rspObj.message || '瀵煎嚭澶辫触');
+ return;
+ }
+ const blob = new Blob([res], {type: 'application/msword'});
+ const personName = this.isDepartment && row && row.name ? row.name + '-' : '';
+ this.$download.saveAs(blob, personName + date + '鍩硅璁板綍.docx');
+ }).catch(() => {}).finally(() => {
+ this.outLoading = false;
+ });
},
// 鑾峰彇瀹為獙瀹�-鍩硅璁″垝鍒楄〃淇℃伅
getPersonnelTraining(departId) {
@@ -195,25 +225,38 @@
}
this.trainingLoading = true
trainingSelectTrainingRecord(params).then(res => {
- this.trainingLoading = false
- this.trainingTableData = res.data.records;
- this.trainingPagination.total = res.data.total;
+ this.trainingTableData = (res.data && res.data.records) || [];
+ this.trainingPagination.total = (res.data && res.data.total) || 0;
if (this.trainingTableData.length > 0) {
- this.$refs.trainingTableData.setCurrentRow(this.trainingTableData[0])
+ this.currentChangeRow = this.trainingTableData[0];
+ this.$refs.trainingTableData && this.$refs.trainingTableData.setCurrent(this.trainingTableData[0]);
+ } else {
+ this.currentChangeRow = '';
+ this.trainingPersonTableData = [];
+ this.trainingPersonPagination.current = 1;
+ this.trainingPersonPagination.total = 0;
}
- }).catch(err => {
+ }).catch(() => {}).finally(() => {
this.trainingLoading = false
})
},
- // 鑾峰彇涓汉-鍩硅璁″垝鍒楄〃淇℃伅
+ // 鍒囨崲浜哄憳
currentChange(row) {
- this.currentChangeRow = row
- if (row === null) {
- row = this.trainingTableData[0]
+ this.currentChangeRow = row || '';
+ this.trainingPersonPagination.current = 1;
+ if (!row) {
+ this.trainingPersonTableData = [];
+ this.trainingPersonPagination.total = 0;
+ return;
}
this.queryPersonnelDetailsPage(row.userId)
},
queryPersonnelDetailsPage(userId) {
+ if (!userId) {
+ this.trainingPersonTableData = [];
+ this.trainingPersonPagination.total = 0;
+ return;
+ }
if (this.searchForm.trainingDate === null) {
this.searchForm.trainingDate = ''
}
@@ -225,30 +268,37 @@
}
this.trainingPersonLoading = true
queryPersonnelDetails(params).then(res => {
- this.trainingPersonLoading = false
- this.trainingPersonTableData = res.data.records;
- this.trainingPersonPagination.total = res.data.total;
- }).catch(err => {
+ this.trainingPersonTableData = (res.data && res.data.records) || [];
+ this.trainingPersonPagination.total = (res.data && res.data.total) || 0;
+ }).catch(() => {}).finally(() => {
this.trainingPersonLoading = false
})
},
// 鍒嗛〉
pagination(page) {
this.trainingPagination.size = page.limit;
+ this.trainingPagination.current = page.page;
this.getPersonnelTraining(this.departId);
},
// 鍒嗛〉
pagination1(page) {
this.trainingPersonPagination.size = page.limit;
- this.queryPersonnelDetailsPage(this.currentChangeRow.userId);
+ this.trainingPersonPagination.current = page.page;
+ const userId = this.isDepartment
+ ? (this.currentChangeRow && this.currentChangeRow.userId)
+ : this.departId;
+ this.queryPersonnelDetailsPage(userId);
},
},
watch: {
departId: {
handler(newId, oldId) {
if (this.isDepartment) {
+ this.trainingPagination.current = 1;
this.getPersonnelTraining(newId);
} else {
+ this.currentChangeRow = '';
+ this.trainingPersonPagination.current = 1;
this.queryPersonnelDetailsPage(newId)
}
}
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
index 2eea398..7e94000 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -74,6 +74,17 @@
<el-table-column label="澶囨敞" min-width="140" show-overflow-tooltip>
<template #default="scope">{{ scope.row.recordRemark || '鈥�' }}</template>
</el-table-column>
+ <el-table-column label="闄勪欢" min-width="130">
+ <template #default="scope">
+ <el-link v-if="scope.row.attachmentCount > 0" type="primary" @click="handleAttachment(scope.row)">
+ 鏌ョ湅闄勪欢锛坽{ scope.row.attachmentCount }}锛�
+ </el-link>
+ <el-link v-else-if="canUploadAttachment(scope.row)" type="primary" @click="handleAttachment(scope.row)">
+ 涓婁紶闄勪欢
+ </el-link>
+ <span v-else>鈥�</span>
+ </template>
+ </el-table-column>
<el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="300">
<template #default="scope">
<el-button size="small" link type="primary"
@@ -95,6 +106,10 @@
@current-change="handleCurrentChange1">
</el-pagination>
</div>
+ <lims-attachment ref="rowAttachment" upload-url="/deviceMaintenancePlan/uploadAttachment"
+ select-url="/deviceMaintenancePlan/selectAttachments" delete-url="/deviceMaintenancePlan/deleteAttachment"
+ id-param="maintenancePlanDetailId" name-field="deviceName" title="淇濆吇璁板綍闄勪欢"
+ :readonly="attachmentReadonly" @closed="getTableList"></lims-attachment>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible"
:title="dialogTitle" width="880px" @close="resetForm">
<el-form ref="modelForm" :model="form" :rules="rules" label-width="150px" size="small">
@@ -155,6 +170,13 @@
<el-input v-model="form.reviewRemark" :rows="2" placeholder="鍙~鍐欏鏍告剰瑙�"
type="textarea"></el-input>
</el-form-item>
+ <div class="form-section-title">闄勪欢璧勬枡</div>
+ <el-form-item label-width="0">
+ <lims-attachment inline upload-url="/deviceMaintenancePlan/uploadAttachment"
+ select-url="/deviceMaintenancePlan/selectAttachments" delete-url="/deviceMaintenancePlan/deleteAttachment"
+ id-param="maintenancePlanDetailId" name-field="deviceName" title="淇濆吇璁板綍闄勪欢"
+ :main-id="form.maintenancePlanDetailId" :readonly="!isEdit"></lims-attachment>
+ </el-form-item>
<div class="check-note">澶囨敞锛氭甯搞�佽壇濂芥墦鈥溾垰鈥濓紝涓嶆甯稿強鍚︽墦鈥溍椻�濄��</div>
<div v-if="cycleNote" class="check-note">{{ cycleNote }}</div>
</el-form>
@@ -182,6 +204,7 @@
reviewDeviceMaintenance,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from '@/api/system/user'
+import LimsAttachment from '@/components/Attachment/lims-attachment.vue'
import dayjs from 'dayjs'
import { formatDateOnly } from './dateFormat'
import { saveBlobOrShowError } from '@/utils/saveBlob'
@@ -201,6 +224,7 @@
export default {
name: "equipment-maintenance-plan",
+ components: { LimsAttachment },
props: {
clickNodeVal: {
type: Object,
@@ -238,6 +262,7 @@
outLoading: false,
reviewLoading: false,
userOptions: [],
+ attachmentReadonly: false,
}
},
mounted() {
@@ -426,10 +451,11 @@
});
});
},
- // 瀵煎嚭
+ // 瀵煎嚭鏁翠唤淇濆吇璁″垝
handleDownOne() {
this.outLoading = true
- exportDeviceMaintenancePlan({ maintenancePlanId: this.planInfo.maintenancePlanId }).then(res => {
+ const params = { maintenancePlanId: this.planInfo.maintenancePlanId }
+ exportDeviceMaintenancePlan(params).then(res => {
this.outLoading = false
saveBlobOrShowError(res, '璁惧淇濆吇璁″垝琛�.docx', 'application/msword')
}).catch(() => {
@@ -440,6 +466,15 @@
handleReview(row) {
this.handleForm('review', row)
},
+ // 宸插鏍搁�氳繃/涓嶉�氳繃鐨勮鍙锛屽叾浣欏彲涓婁紶闄勪欢
+ canUploadAttachment(row) {
+ return !row || (row.recordStatus !== 2 && row.recordStatus !== 3)
+ },
+ // 鎵撳紑琛岄檮浠跺脊绐楋細鍙紪杈戠殑琛屽厑璁哥洿鎺ヤ笂浼�/鍒犻櫎锛屽凡瀹℃牳鐨勮鍙
+ handleAttachment(row) {
+ this.attachmentReadonly = !this.canUploadAttachment(row)
+ this.$refs.rowAttachment.open(row)
+ },
// 鎻愪氦瀹℃牳缁撴灉锛�1 閫氳繃锛�0 涓嶉�氳繃
submitReview(status) {
this.reviewLoading = true
diff --git a/src/views/CNAS/resourceDemand/device/component/record.vue b/src/views/CNAS/resourceDemand/device/component/record.vue
index add40c3..f3c44a7 100644
--- a/src/views/CNAS/resourceDemand/device/component/record.vue
+++ b/src/views/CNAS/resourceDemand/device/component/record.vue
@@ -3,12 +3,20 @@
<div>
<div class="search">
<el-form :model="search" ref="search" size="small" :inline="true">
- <el-form-item label="鏍峰搧缂栧彿">
- <el-input v-model="search.sampleCode" clearable placeholder="璇疯緭鍏�" size="small"
+ <el-form-item label="璁惧鍚嶇О">
+ <el-input v-model="search.deviceName" clearable placeholder="璇疯緭鍏�" size="small"
+ @keyup.enter="getTableList()"></el-input>
+ </el-form-item>
+ <el-form-item label="璁惧鍨嬪彿">
+ <el-input v-model="search.specificationModel" clearable placeholder="璇疯緭鍏�" size="small"
@keyup.enter="getTableList()"></el-input>
</el-form-item>
<el-form-item label="璁惧缂栧彿">
<el-input v-model="search.managementNumber" clearable placeholder="璇疯緭鍏�" size="small"
+ @keyup.enter="getTableList()"></el-input>
+ </el-form-item>
+ <el-form-item label="鏍峰搧缂栧彿">
+ <el-input v-model="search.sampleCode" clearable placeholder="璇疯緭鍏�" size="small"
@keyup.enter="getTableList()"></el-input>
</el-form-item>
<el-form-item>
@@ -17,7 +25,7 @@
</el-form-item>
</el-form>
<div>
- <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">瀵� 鍑�</el-button>
+ <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵� 鍑�</el-button>
</div>
</div>
<div>
@@ -186,17 +194,6 @@
<el-button v-if="operationType !== 'view'" type="primary" @click="saveRecord">纭� 瀹�</el-button>
</span></template>
</el-dialog>
- <el-dialog v-model="ratifyDialog" title="瀵煎嚭" width="30%" @close="ratifyDialog = false, exportDate = ''">
- <span>鏃堕棿锛�
- <el-date-picker v-model="exportDate" format="YYYY-MM" placeholder="閫夋嫨鏈堜唤" size="small" style="width:100%"
- type="month" value-format="YYYY-MM">
- </el-date-picker>
- </span>
- <template #footer><span class="dialog-footer">
- <el-button @click="ratifyDialog = false, exportDate = ''">鍙� 娑�</el-button>
- <el-button :loading="outLoading" type="primary" @click="handleDown">瀵� 鍑�</el-button>
- </span></template>
- </el-dialog>
</div>
</template>
<script>
@@ -226,8 +223,8 @@
orderCode: '',
sampleCode: '',
useDate: today(),
- useStartTime: '',
- useEndTime: '',
+ useStartTime: '10:00:00',
+ useEndTime: '19:30:00',
temperature: '',
humidity: '',
useBefore: 1,
@@ -244,12 +241,12 @@
size: 20,
current: 1,
total: 0,
- sampleCode: '',
- managementNumber: ''
+ deviceName: '',
+ specificationModel: '',
+ managementNumber: '',
+ sampleCode: ''
},
outLoading: false,
- ratifyDialog: false,
- exportDate: '',
userList: [],
form: defaultForm(),
dialogVisible: false,
@@ -292,8 +289,10 @@
size: 20,
current: 1,
total: 0,
- sampleCode: '',
- managementNumber: ''
+ deviceName: '',
+ specificationModel: '',
+ managementNumber: '',
+ sampleCode: ''
}
this.getTableList();
},
@@ -311,17 +310,14 @@
this.tableLoading = false
})
},
- // 鎵撳紑瀵煎嚭寮规閫夋嫨缂栧埗浜恒�佹壒鍑嗕汉
- openHandleOut() {
- this.ratifyDialog = true
- },
- //瀵煎嚭
+ //瀵煎嚭锛氭寜涓昏〃鍗曠瓫閫夊尯褰撳墠鏉′欢瀵煎嚭
handleDown() {
this.outLoading = true
exportUseRecord({
- sampleCode: this.search.sampleCode,
+ deviceName: this.search.deviceName,
+ specificationModel: this.search.specificationModel,
managementNumber: this.search.managementNumber,
- exportDate: this.exportDate
+ sampleCode: this.search.sampleCode
}).then(res => {
this.outLoading = false
saveBlobOrShowError(res, '浠櫒璁惧杩愯璁板綍.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document')
@@ -390,8 +386,8 @@
managementNumber: row.managementNumber || '',
orderCode: row.orderCode || '',
useDate: start ? start.slice(0, 10) : '',
- useStartTime: start.length >= 19 ? start.slice(11, 19) : '',
- useEndTime: end.length >= 19 ? end.slice(11, 19) : '',
+ useStartTime: start.length >= 19 ? start.slice(11, 19) : '10:00:00',
+ useEndTime: end.length >= 19 ? end.slice(11, 19) : '19:30:00',
temperature: row.temperature || '',
humidity: row.humidity || '',
usePersonId: row.usePersonId || '',
@@ -439,7 +435,7 @@
<style scoped>
.search {
- height: 46px;
+ min-height: 46px;
display: flex;
justify-content: space-between;
margin-top: 4px;
diff --git a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
index 9f02bb5..814c062 100644
--- a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
+++ b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
@@ -14,8 +14,9 @@
</div>
</div>
<div style="line-height: 30px;">
+ <el-button size="small" @click="$refs.importDialog.open()">瀵� 鍏�</el-button>
<el-button size="small" type="primary" :icon="$icon('el-icon-plus')"
- @click="addDialogVisible = true, addInfo = {}, file = null">鏂囦欢鍙楁帶鐢宠</el-button>
+ @click="addDialogVisible = true, addInfo = {}, file = null, fileList = []">鏂囦欢鍙楁帶鐢宠</el-button>
</div>
</div>
<div class="table">
@@ -71,7 +72,9 @@
<div class="search_thing">
<div class="search_label">涓婁紶闄勪欢锛�</div>
<div class="search_input"><el-upload style="margin: 8px 0 0px 50px;" action="#" :auto-upload="false"
- :multiple="false" accept='.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.wps,.et,.dps,.txt,.jpg,.jpeg,.png' :on-change="handleChangeUpload" v-if="addDialogVisible">
+ :multiple="false" accept='.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.wps,.et,.dps,.txt,.jpg,.jpeg,.png'
+ :file-list="fileList" :on-change="handleChangeUpload" :on-remove="handleRemoveUpload"
+ :before-remove="beforeRemoveUpload" :on-preview="handlePreviewUpload" v-if="addDialogVisible">
<el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
</el-upload></div>
</div>
@@ -90,15 +93,25 @@
</el-col>
<el-col :span="12" style="margin-bottom: 16px;">
<div class="search_thing">
- <div class="search_label">鎻愪氦鏃ユ湡锛�</div>
+ <div class="search_label">鍙戝竷鏃ユ湡锛�</div>
<div class="search_input">
- <el-date-picker v-model="addInfo.submitDate" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"
+ <el-date-picker v-model="addInfo.publishDate" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"
format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 100%;">
</el-date-picker>
</div>
</div>
</el-col>
<el-col :span="12" style="margin-bottom: 16px;">
+ <div class="search_thing">
+ <div class="search_label">瀹炴柦鏃ユ湡锛�</div>
+ <div class="search_input">
+ <el-date-picker v-model="addInfo.implementDate" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"
+ format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 100%;">
+ </el-date-picker>
+ </div>
+ </div>
+ </el-col>
+ <el-col :span="24" style="margin-bottom: 16px;">
<div class="search_thing">
<div class="search_label">璇存槑锛�</div>
<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.instructions"
@@ -116,7 +129,7 @@
style="height: 90vh;overflow-y: auto;" />
</el-dialog>
<el-dialog title="瀹℃牳" v-model="checkDialogVisible" width="1000px" top="5vh">
- <UpPdfStamp ref="UpPdfStamp" v-if="checkDialogVisible" @uploadPDF="uploadPDF" :isUpFile="false"></UpPdfStamp>
+ <UpPdfStamp ref="UpPdfStamp" v-if="checkDialogVisible" @uploadPDF="uploadPDF" @uploadPDFErr="handlePdfError" :isUpFile="false"></UpPdfStamp>
<template #footer><span class="dialog-footer">
<el-button @click="handleCheckSub('涓嶉�氳繃')" :loading="noCheckLoading">涓嶉�氳繃</el-button>
<el-button type="primary" @click="handleCheckSub('閫氳繃')" :loading="checkLoading">閫� 杩�</el-button>
@@ -133,6 +146,16 @@
<el-button type="primary" @click="handleCheck0(currentInfo)">纭� 瀹�</el-button>
</span></template>
</el-dialog>
+ <import-dialog
+ ref="importDialog"
+ title="瀵煎叆鏂囦欢鍙楁帶鐢宠"
+ :action="importAction"
+ accept=".xls,.xlsx"
+ template-url="/import-templates/鏂囦欢鍙楁帶鐢宠瀵煎叆妯℃澘.xlsx?v=1"
+ template-name="鏂囦欢鍙楁帶鐢宠瀵煎叆妯℃澘.xlsx"
+ :tips="['琛ㄥご蹇呴』涓庢ā鏉垮畬鍏ㄤ竴鑷达紝涓嶈兘澧炲垹鍒楁垨淇敼鍒楀悕', '鍙戝竷鏃ユ湡銆佸疄鏂芥棩鏈熸牸寮忥細YYYY-MM-DD', '瀵煎叆鍚庣姸鎬佷负鑽夌锛岀敵璇蜂汉涓虹┖锛屽彲鍦ㄩ〉闈笂缂栬緫']"
+ @success="refreshTable"
+ />
</div>
</template>
@@ -140,6 +163,7 @@
import UpPdfStamp from '@/components/UpPdfStamp/index.vue'
import filePreview from '@/components/Preview/filePreview.vue'
import limsTable from "@/components/Table/lims-table.vue";
+import ImportDialog from '@/components/ImportDialog/index.vue'
import {
selectUserCondition,
} from "@/api/business/inspectionTask.js";
@@ -159,10 +183,14 @@
components: {
filePreview,
UpPdfStamp,
- limsTable
+ limsTable,
+ ImportDialog
},
computed: {
...mapGetters(["nickName"]),
+ importAction() {
+ return this.javaApi + '/manageDocumentControlled/importManageDocumentControlled'
+ }
},
data() {
return {
@@ -177,6 +205,7 @@
personList: [],
fileType: [],
file: null,
+ fileList: [],
currentInfo: {},
checkLoading: false,
noCheckLoading: false,
@@ -204,13 +233,16 @@
}
},
},
+ { label: "鏂囦欢鍚嶇О", prop: "name", minWidth: "160" },
+ { label: "鏂囦欢鐗堟湰", prop: "version", width: "100px" },
+ { label: "鍙戝竷鏃ユ湡", prop: "publishDate", width: "110px" },
+ { label: "瀹炴柦鏃ユ湡", prop: "implementDate", width: "110px" },
{
label: "鐢宠浜�",
prop: "createUserName",
},
{ label: "鐢宠鏃堕棿", prop: "createTime" },
{ label: "璇存槑", prop: "instructions" },
- { label: "鎻愪氦鏃ユ湡", prop: "submitDate" },
{ label: "璐d换浜�", prop: "dutyUserName" },
{
label: "鐢宠鐘舵��", prop: "state", dataType: "tag",
@@ -247,8 +279,11 @@
this.handleCheck(row);
},
disabled: (row) => {
+ if (row.state == '閫氳繃') {
+ return true
+ }
if(row.dutyUserName != null && row.dutyUserName != "") {
- return !row.dutyUserName.includes(this.nickName) || row.state == '閫氳繃'
+ return !row.dutyUserName.includes(this.nickName)
}else {
return false
}
@@ -350,76 +385,79 @@
});
},
// 鎻愪氦
+ buildFormData() {
+ const fd = new FormData()
+ // 鏂囦欢淇℃伅涓� raw 鎵嶆槸鐪熺殑鏂囦欢
+ if (this.file) {
+ fd.append("file", this.file.raw)
+ }
+ const fields = ['id', 'documentCode', 'dutyUser', 'type', 'name', 'version', 'writer',
+ 'publishDate', 'implementDate', 'instructions']
+ fields.forEach((key) => {
+ const value = this.addInfo[key]
+ // 绌烘棩鏈�/绌轰笅鎷変笉浼狅紝閬垮厤鍚庣鏃ユ湡鎴栨暟瀛楀瓧娈佃В鏋愬け璐�
+ if (value !== undefined && value !== null && value !== '') {
+ fd.append(key, value)
+ }
+ })
+ return fd
+ },
handleAdd() {
if (!this.addInfo.documentCode) return this.$message({ type: 'error', message: "璇疯緭鍏ョ紪鍙�" })
- if (!this.addInfo.id) {
- // 鏂板
- let fd = new FormData();
- //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
- if (this.file) {
- fd.append("file", this.file.raw);
+ const isEdit = !!this.addInfo.id
+ const request = isEdit ? doManageDocumentControlled : addManageDocumentControlled
+ this.addLoading = true
+ request(this.buildFormData()).then(res => {
+ this.addLoading = false
+ if (res.code == 200) {
+ this.$message({
+ type: 'success',
+ message: isEdit ? '淇敼鎴愬姛' : '娣诲姞鎴愬姛'
+ })
+ this.refreshTable()
+ this.addDialogVisible = false
+ } else {
+ this.$message({
+ type: 'error',
+ message: isEdit ? '淇敼澶辫触' : '娣诲姞澶辫触'
+ })
}
- for (let m in this.addInfo) {
- fd.append(m, this.addInfo[m])
- }
- this.addLoading = true
- addManageDocumentControlled(fd).then(res => {
- this.addLoading = false
- if (res.code == 200) {
- this.$message({
- type: 'success',
- message: '娣诲姞鎴愬姛'
- })
- this.refreshTable()
- this.addDialogVisible = false
- } else {
- this.$message({
- type: 'error',
- message: '娣诲姞澶辫触'
- })
- }
- })
- } else {
- // 淇敼
- let { id, documentCode, dutyUser, type, name, version, writer, submitDate, instructions } = this.addInfo
- let fd = new FormData();
- //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
- if (this.file) {
- fd.append("file", this.file.raw);
- }
- fd.append("id", id);
- fd.append("documentCode", documentCode);
- fd.append("dutyUser", dutyUser);
- fd.append("type", type);
- fd.append("name", name);
- fd.append("version", version);
- fd.append("writer", writer);
- fd.append("submitDate", submitDate);
- fd.append("instructions", instructions);
- this.addLoading = true
- doManageDocumentControlled(fd).then(res => {
- this.addLoading = false
- if (res.code == 200) {
- this.refreshTable()
- this.addDialogVisible = false
- } else {
- this.$message({
- type: 'error',
- message: '娣诲姞澶辫触'
- })
- }
- })
- }
+ }).catch(() => {
+ this.addLoading = false
+ })
},
handleChangeUpload(file, fileLists) {
this.file = file
this.addInfo['name'] = file.name
+ },
+ // 绉婚櫎鏂伴�夌殑闄勪欢鍚庝笉鍐嶄笂浼狅紱鍘熸湁闄勪欢涓嶅厑璁稿湪杩欓噷鍒犻櫎锛屽彧鑳介�夋嫨鏂伴檮浠舵浛鎹�
+ handleRemoveUpload() {
+ this.file = null
+ },
+ beforeRemoveUpload(file) {
+ if (file && !file.raw) {
+ this.$message.warning('閫夋嫨鏂伴檮浠朵繚瀛樺悗浼氳嚜鍔ㄦ浛鎹㈠師闄勪欢')
+ return false
+ }
+ return true
+ },
+ handlePreviewUpload(file) {
+ if (file && file.url) {
+ this.$download.saveAs(file.url, file.name)
+ }
+ },
+ fileNameFromUrl(url) {
+ return (url || '').replace(/^[0-9a-fA-F-]{36}_/, '')
},
// 缂栬緫
handleUpdate(row) {
this.title = '鏂囦欢鍙樻洿鐢宠'
this.addInfo = this.HaveJson(row)
this.file = null
+ // 鍥炴樉宸蹭笂浼犵殑闄勪欢锛屼繚瀛樻椂鏈噸鏂伴�夋嫨鍒欎繚鐣欏師闄勪欢
+ this.fileList = row.url
+ ? [{ name: this.fileNameFromUrl(row.url), url: this.javaApi + '/word/' + row.url }]
+ : []
this.addDialogVisible = true
},
// 鏌ョ湅闄勪欢
@@ -492,9 +530,13 @@
} else {
this.noCheckLoading = true
}
- this.addLoading = true
this.$refs['UpPdfStamp'].generatePDF()
},
+ // 棰勮澶辫触鎴栨病閫夋枃浠舵椂澶嶄綅鎸夐挳锛岄伩鍏嶁�滈�氳繃鈥濅竴鐩磋浆鍦�
+ handlePdfError() {
+ this.checkLoading = false
+ this.noCheckLoading = false
+ },
handleDelete(row) {
this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
confirmButtonText: "纭畾",
diff --git a/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue
index 9e0ec33..8dbbcbf 100644
--- a/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue
+++ b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue
@@ -1,6 +1,9 @@
<template>
<!-- 鍙戞斁鍥炴敹璁板綍 -->
<div>
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氭湰椤垫彁浜ょ殑鍙戞斁銆佸洖鏀惰褰曚細鑷姩鍚屾鍒拌彍鍗曘�愬彂鏀句笌鍥炴敹璁板綍銆戯紝鏃犻渶鍐嶅埌璇ラ〉闈㈤噸澶嶅綍鍏ャ��
+ </div>
<div class="search">
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue b/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue
index d65c19d..01aed84 100644
--- a/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue
+++ b/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue
@@ -1,6 +1,9 @@
<template>
<!-- 鏂囦欢鍙樻洿鐢宠 -->
<div>
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氭湰椤垫彁浜ょ殑鍙樻洿鐢宠浼氳嚜鍔ㄥ悓姝ュ埌鑿滃崟銆愭枃浠朵慨璁㈢敵璇峰鎵硅褰曘�戯紝瀹℃牳閫氳繃鍚庡悓姝ユ壒鍑嗕汉銆�
+ </div>
<div style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue
index 264894b..ae805aa 100644
--- a/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue
+++ b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue
@@ -1,6 +1,9 @@
<template>
<!-- 鏂囦欢浣滃簾鐢宠 -->
<div>
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氬鏍搁�氳繃鍚庝細鑷姩浠庢枃浠舵竻鍗曠Щ闄わ紝骞跺湪鑿滃崟銆愪綔搴熸枃浠堕攢姣佽褰曘�戠敓鎴愪竴鏉″緟鐧昏璁板綍銆�
+ </div>
<div style="display: flex;justify-content: space-between">
<div style="display: flex;">
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
diff --git a/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue b/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
index f527eb7..2d919ef 100644
--- a/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
+++ b/src/views/CNAS/systemManagement/documentRecords/cancellationRecord.vue
@@ -1,6 +1,9 @@
<template>
<!-- 浣滃簾鏂囦欢閿�姣佽褰� -->
<div class="capacity-scope">
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氭枃浠朵綔搴熺敵璇峰鏍搁�氳繃鍚庝細鑷姩鍦ㄦ湰椤电敓鎴愬緟鐧昏璁板綍锛岃琛ュ厖閿�姣佹暟閲忋�侀攢姣佸師鍥犲悗鎵瑰噯銆�
+ </div>
<div class="search">
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
diff --git a/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue b/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
index 4b3344a..d1a27f9 100644
--- a/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
+++ b/src/views/CNAS/systemManagement/documentRecords/distributionCollectionRecord.vue
@@ -1,6 +1,9 @@
<template>
<!-- 鎵�鏈夋枃浠讹紙鍐呫�佸閮ㄦ枃浠讹級鐨勫彂鏀句笌鍥炴敹璁板綍 -->
<div class="capacity-scope">
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氭湰椤佃褰曠敱銆愭枃浠跺彈鎺х敵璇� 鈫� 鍙戞斁鍥炴敹璁板綍銆戣嚜鍔ㄧ敓鎴愶紱琛ュ綍鍘嗗彶鏁版嵁鍙娇鐢ㄢ�滃鍏モ�濇垨鈥滄柊澧炩�濄��
+ </div>
<div class="search">
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
diff --git a/src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue b/src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue
index 89542dd..5ae496e 100644
--- a/src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue
+++ b/src/views/CNAS/systemManagement/documentRecords/revisionRecord.vue
@@ -1,6 +1,9 @@
<template>
<!-- 鏂囦欢淇鐢宠瀹℃壒璁板綍 -->
<div class="capacity-scope">
+ <div style="font-size: 12px; line-height: 20px; color: var(--el-text-color-secondary); margin-bottom: 8px;">
+ 鎻愮ず锛氭湰椤佃褰曠敱銆愭枃浠跺彈鎺х敵璇� 鈫� 鏂囦欢鍙樻洿鐢宠 / 鏂囦欢浣滃簾鐢宠銆戣嚜鍔ㄧ敓鎴愶紝鍙湪鏈〉琛ュ厖绔犺妭鍙枫�佸鎵规剰瑙佸苟鎵撳嵃褰掓。銆�
+ </div>
<div class="search">
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
--
Gitblit v1.9.3