| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <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="this.currentRow.state !== 1">æ¤é</el-button> |
| | | <el-button size="small" type="primary" @click="submitForm(0)" v-if="this.currentRow.state !== 1">æäº¤</el-button> |
| | | <el-button size="small" @click="$emit('goBack')">è¿å</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="form_title"> |
| | | <el-row> |
| | | <el-col :span="7"> |
| | | <span class="form_label">å¹è®å
容ï¼</span> |
| | | <span> {{ trainingForm.trainingContent }} </span> |
| | | </el-col> |
| | | <el-col :span="5"> |
| | | <span class="form_label">ç¶æï¼</span> |
| | | <el-tag v-if="trainingForm.state === 1" type="success">已宿</el-tag> |
| | | <el-tag v-if="trainingForm.state === 2" type="warning">å¾
è¯ä»·</el-tag> |
| | | <el-tag v-if="trainingForm.state === 3" type="primary">æªå¼å§</el-tag> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <span class="form_label">å¹è®è®²å¸ï¼</span> |
| | | <span> {{ trainingForm.trainingLecturerName }} </span> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin: 15px 0"> |
| | | <el-form> |
| | | <el-row> |
| | | <el-col :span="5"> |
| | | <el-form-item label="å¹è®æ¥æ:"> |
| | | <el-date-picker v-model="trainingForm.openingTime" format="yyyy-MM-dd" :disabled="currentRow.state !== 3" |
| | | placeholder="éæ©æ¥æ" size="small" value-format="yyyy-MM-dd" |
| | | type="date" style="width: 60%"></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="7"> |
| | | <el-form-item label="å¹è®å°ç¹"> |
| | | <el-input v-model="trainingForm.placeTraining" :disabled="currentRow.state !== 3" :rows="2" placeholder="请è¾å
¥" |
| | | size="small" style="width: 60%" type="text"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="è¯ä»·äºº"> |
| | | <el-select v-model="trainingForm.assessmentUserId" :disabled="currentRow.state !== 3" placeholder="è¯·éæ©" size="small" style="width: 50%"> |
| | | <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="èæ ¸æ¹å¼"> |
| | | <el-input v-model="trainingForm.assessmentMethod" :disabled="currentRow.state !== 3" :rows="2" placeholder="请è¾å
¥" |
| | | size="small" style="width: 79%" type="textarea"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¯ä»·æ¶é´"> |
| | | <el-date-picker v-model="trainingForm.assessmentDate" :disabled="currentRow.state !== 2 || isDisabled" |
| | | type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" size="small" |
| | | placeholder="éæ©æ¥æ"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¬æ¬¡å¹è®ç»¼åè¯ä»·"> |
| | | <el-input v-model="trainingForm.comprehensiveAssessment" :disabled="currentRow.state !== 2 || isDisabled" :rows="2" placeholder="请è¾å
¥" |
| | | size="small" style="width: 68%" type="textarea"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </el-row> |
| | | </div> |
| | | <el-divider>人å详æ
</el-divider> |
| | | <div> |
| | | <div class="items_center"> |
| | | <span>å§å</span> |
| | | <el-input v-model="userName" class="search" placeholder="请è¾å
¥" |
| | | size="small"></el-input> |
| | | <el-button size="small" type="primary" @click="getInfo">æ¥è¯¢</el-button> |
| | | </div> |
| | | <div class="items_btn"> |
| | | <el-button :disabled="currentRow.state === 1" size="small" type="primary" @click="addPerson">æ°å¢äººå</el-button> |
| | | <el-button :disabled="currentRow.state === 1" size="small" @click="batchDelete">æ¹éå é¤</el-button> |
| | | </div> |
| | | <el-table :data="trainingTableData" height="calc(100vh - 30em)" stripe style="width: 100%" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column label="åºå·" type="index" width="60"></el-table-column> |
| | | <el-table-column label="å§å" prop="userName"></el-table-column> |
| | | <el-table-column label="å·¥å·" prop="account"></el-table-column> |
| | | <el-table-column label="è§è²" prop="roleName"></el-table-column> |
| | | <el-table-column label="çµè¯å·ç " prop="phone"></el-table-column> |
| | | <el-table-column label="èæ ¸ç»æ" prop="examinationResults"> |
| | | <template v-slot="scope"> |
| | | <el-input v-model="scope.row.examinationResults" :disabled="currentRow.state === 1" clearable size="small" style="width: 100%" @blur="updatePersonResult(scope.row)"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <el-dialog :visible.sync="selectUserDia" title="éæ©ç¨æ·" width="70%"> |
| | | <div class="search" style="margin-bottom: 9px;"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">ç¨æ·åï¼</div> |
| | | <div class="search_input"> |
| | | <el-input |
| | | v-model="addUserTableInfo.name" |
| | | clearable |
| | | placeholder="请è¾å
¥" |
| | | size="small" |
| | | @keyup.enter.native="selectUserList" |
| | | ></el-input> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div v-if="selectUserDia" class="body" style="height: 60vh;"> |
| | | <lims-table :tableData="tableData1" :column="column1" |
| | | :isSelection="true" :handleSelectionChange="selectMethod" |
| | | @pagination="pagination1" :height="'calc(100vh - 290px)'" |
| | | :page="page1" :tableLoading="tableLoading1"></lims-table> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="selectUserDia = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="selectUser">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import {selectUserCondition} from "@/api/business/inspectionTask"; |
| | | import {mapGetters} from "vuex"; |
| | | import { |
| | | newPersonnelAddedToTrainingRecords, |
| | | outOfFocusPreservation, trainingAndAssessmentRecordsAdded, trainingAndAssessmentRecordsEvaluate, |
| | | trainingAndAssessmentRecordsPage |
| | | } from "@/api/cnas/personal/personalTraining"; |
| | | |
| | | export default { |
| | | name: 'Edit', |
| | | // import å¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | | components: {limsTable}, |
| | | props: { |
| | | currentRow: { |
| | | type: Object, |
| | | default: () => { |
| | | return {} |
| | | } |
| | | }, |
| | | }, |
| | | data() { |
| | | // è¿éåæ¾æ°æ® |
| | | return { |
| | | isSelectedList: [], // ç¦ç¨çå¤é |
| | | userName: undefined, |
| | | trainingForm: { |
| | | code: '111111', |
| | | date: '2024-10-10', |
| | | }, |
| | | trainingColumn: [ |
| | | { |
| | | label: 'å§å', |
| | | prop: 'userName' |
| | | }, |
| | | { |
| | | label: 'å·¥å·', |
| | | prop: 'account' |
| | | }, |
| | | { |
| | | label: 'è§è²', |
| | | prop: 'roleName' |
| | | }, |
| | | { |
| | | label: 'çµè¯å·ç ', |
| | | prop: 'phone' |
| | | }, |
| | | { |
| | | label: 'èæ ¸ç»æ', |
| | | prop: 'result' |
| | | } |
| | | ], |
| | | trainingTableData: [], |
| | | trainingLoading: false, |
| | | isDisabled: false, |
| | | selectUserDia: false, // æ·»å 人åå¼¹æ¡ |
| | | tableData1: [], |
| | | tableLoading1: false, |
| | | column1: [ |
| | | {label: 'å§å', prop: 'name'}, |
| | | {label: 'è´¦å·', prop: 'account'}, |
| | | {label: 'è§è²', prop: 'roleName'}, |
| | | { |
| | | dataType: 'tag', |
| | | label: 'ç¶æ', |
| | | prop: 'status', |
| | | formatData: (params) => { |
| | | if (params == 0) { |
| | | return 'å¯ç¨' |
| | | } else { |
| | | return '' |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 0) { |
| | | return 'success' |
| | | } else { |
| | | return 'danger' |
| | | } |
| | | } |
| | | }, |
| | | {label: 'çµè¯å·ç ', prop: 'phone'}, |
| | | ], |
| | | page1: { |
| | | total:0, |
| | | size:10, |
| | | current:1 |
| | | }, |
| | | addUserTableInfo: { |
| | | name: null, |
| | | }, |
| | | multipleSelection: [], |
| | | userList: [], |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userId"]), |
| | | }, |
| | | mounted() { |
| | | this.trainingForm = this.currentRow |
| | | this.getInfo() |
| | | this.getUserList() |
| | | this.isDisabled = this.trainingForm.assessmentUserId !== this.userId |
| | | }, |
| | | // æ¹æ³éå |
| | | methods: { |
| | | // è·åå½åæ°æ® |
| | | async getInfo() { |
| | | this.trainingLoading = true |
| | | await trainingAndAssessmentRecordsPage({ |
| | | trainingDetailedId: this.currentRow.id, |
| | | userName: this.userName |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.trainingTableData = res.data |
| | | } |
| | | this.trainingLoading = false |
| | | }) |
| | | }, |
| | | updatePersonResult(row) { |
| | | outOfFocusPreservation(row).then(res => { |
| | | this.$message.success("æä½æåï¼") |
| | | }) |
| | | }, |
| | | addPerson() { |
| | | this.isSelectedList = this.trainingTableData.map(item => item.userId) |
| | | this.selectUserDia = true; |
| | | }, |
| | | selectUserList () { |
| | | this.tableLoading1 = true |
| | | selectUserCondition({...this.addUserTableInfo}).then(res => { |
| | | this.tableData1 = res.data.records |
| | | this.page1.total = res.data.total |
| | | }).catch(err => { |
| | | this.tableLoading1 = false |
| | | }) |
| | | }, |
| | | pagination1 (page) { |
| | | this.page1.size = page.limit |
| | | this.selectUserList() |
| | | }, |
| | | // è¡¨æ ¼éæ©æ¹æ³ |
| | | selectMethod(val) { |
| | | this.multipleSelection = val |
| | | }, |
| | | selectUser() { |
| | | let selects = this.multipleSelection; |
| | | if (selects.length == 0) { |
| | | this.$message.error('æªéæ©æ°æ®'); |
| | | return; |
| | | } |
| | | let list = [] |
| | | selects.forEach(a => { |
| | | const obj = { |
| | | courseId: this.currentRow.id, |
| | | examinationResults: "", |
| | | userId: a.id |
| | | } |
| | | list.push(obj) |
| | | }); |
| | | newPersonnelAddedToTrainingRecords(list).then(res => { |
| | | this.isSelectedList = [] |
| | | this.selectUserDia = false; |
| | | this.getInfo() |
| | | }) |
| | | }, |
| | | // æ¹éå é¤ |
| | | handleSelectionChange(list) { |
| | | this.multipleSelection = list |
| | | }, |
| | | batchDelete() { |
| | | if (this.multipleSelection.length > 0) { |
| | | let ids = this.multipleSelection.map(item => item.trainingRecordId) |
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤æéæ©çæ°æ®?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | let formData = new FormData() |
| | | formData.append('ids', ids) |
| | | deleteTrainingAndAssessmentRecords(formData).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('å 餿å'); |
| | | this.getInfo() |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | this.$message.warning('åæ¶å é¤'); |
| | | }); |
| | | } else { |
| | | this.$message.warning('è¯·éæ©éè¦å é¤çæ°æ®') |
| | | } |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.search.size = val; |
| | | this.getInfo(); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.search.current = val; |
| | | this.getInfo(); |
| | | }, |
| | | /** |
| | | * @desc æäº¤è¡¨å |
| | | */ |
| | | async submitForm(status) { |
| | | let state = this.currentRow.state |
| | | if (this.trainingForm.assessmentUserId) { |
| | | state = 2 |
| | | } |
| | | if (this.trainingForm.comprehensiveAssessment) { |
| | | state = 1 |
| | | } |
| | | if (status === 3) { |
| | | state = 3 |
| | | } |
| | | let data = { |
| | | assessmentMethod: this.trainingForm.assessmentMethod, |
| | | openingTime: this.trainingForm.openingTime, |
| | | placeTraining: this.trainingForm.placeTraining, |
| | | comprehensiveAssessment: this.trainingForm.comprehensiveAssessment, |
| | | trainingDetailedId: this.trainingForm.id, |
| | | assessmentUserId: this.trainingForm.assessmentUserId, |
| | | 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("æä½æå") |
| | | } |
| | | }, |
| | | getUserList(){ |
| | | selectUserCondition({ type: 0 }).then((res) => { |
| | | this.userList = res.data; |
| | | }) |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .page-header { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 0 20px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | h4 { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | h4 .line { |
| | | display: inline-block; |
| | | width: 3px; |
| | | height: 16px; |
| | | background: #3A7BFA; |
| | | margin-right: 4px; |
| | | } |
| | | |
| | | .form_title { |
| | | font-size: 14px; |
| | | padding: 0 20px; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | .el-divider { |
| | | margin: 0 1em 1em 0; |
| | | } |
| | | |
| | | .form__input_label { |
| | | width: 90px; |
| | | margin-right: 6px; |
| | | color: #606266; |
| | | } |
| | | |
| | | .form__input_label2 { |
| | | width: 210px; |
| | | margin-right: 6px; |
| | | color: #606266; |
| | | } |
| | | .search_thing { |
| | | display: flex; |
| | | align-items: center |
| | | } |
| | | .search_label { |
| | | width: 120px; |
| | | } |
| | | .pagination { |
| | | display: flex; |
| | | justify-content: space-between |
| | | } |
| | | |
| | | .items_center { |
| | | float: left; |
| | | width: 50%; |
| | | text-align: left; |
| | | } |
| | | .items_btn { |
| | | text-align: right; |
| | | width: 50%; |
| | | float: right; |
| | | margin-bottom: 1em; |
| | | } |
| | | |
| | | .search { |
| | | width: 180px; |
| | | padding: 0 16px; |
| | | } |
| | | </style> |