¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- å²ä½èè´£ --> |
| | | <template> |
| | | <div class="view"> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <el-form ref="page" size="small" :inline="true"> |
| | | <el-form-item label="åå·¥"> |
| | | <el-input v-model="userName" clearable placeholder="请è¾å
¥åå·¥" size="small" style="width: 20vh;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button size="small" type="primary" @click="refreshTable">æ¥è¯¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div> |
| | | <el-button size="small" type="primary" @click="addPost">æ°å¢</el-button> |
| | | <!-- <el-button size="small" type="primary">导åºexcel</el-button>--> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <el-table :data="tableData" v-loading="tableLoading" height="66.5vh" style="width: 100%"> |
| | | <el-table-column label="åºå·" type="index" width="60"></el-table-column> |
| | | <el-table-column label="åå·¥ç¼å·" min-width="120" prop="account"></el-table-column> |
| | | <el-table-column label="å²ä½åç§°" min-width="180" prop="postName"></el-table-column> |
| | | <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="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> |
| | | <el-table-column label="ä¸»ç®¡å®¡æ ¸æ¥æ" min-width="180" prop="supervisorDate"></el-table-column> |
| | | <el-table-column fixed="right" label="æä½" width="140" align="center"> |
| | | <template v-slot="scope"> |
| | | <el-button v-if="!isDepartment || scope.row.currentState === 'å
³é'" size="small" type="text" |
| | | @click="handleViewClick(scope.row, 'view')">æ¥ç |
| | | </el-button> |
| | | <el-button v-if="isDepartment && scope.row.currentState !== 'å
³é'" size="small" type="text" |
| | | @click="handleViewClick(scope.row, 'edit')">ç¼è¾ |
| | | </el-button> |
| | | <el-button size="small" type="text" @click="downLoadPost(scope.row)">导åº</el-button> |
| | | <el-button v-if="isDepartment" size="small" style="color: #f56c6c" type="text" @click="deletePost(scope.row)">å é¤</el-button> |
| | | </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" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange"> |
| | | </el-pagination> |
| | | </div> |
| | | <!-- æ°å¢å²ä½èè´£ --> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" |
| | | title="æ°å¢å²ä½èè´£" |
| | | 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" |
| | | @click.native="choiceStep(i)"></el-step> |
| | | </el-steps> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="130px"> |
| | | <div> |
| | | <el-card style="margin-top: 1em; height: 40vh; overflow-y: scroll;"> |
| | | <!-- æ°å¢è®¾å¤äºè®°å½å¡ç --> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å²ä½åç§°ï¼" prop="postName"> |
| | | <el-input v-model="form.postName" :disabled="currentStep !== 0 || operationType === 'view'" |
| | | size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å·¥ä½ç®æ ï¼" prop="jobObjective"> |
| | | <el-input v-model="form.jobObjective" :disabled="currentStep !== 0 || operationType === 'view'" |
| | | size="small" |
| | | type="textarea"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å²ä½èè´£ï¼" prop="jobResponsibilities"> |
| | | <el-input v-model="form.jobResponsibilities" :disabled="currentStep !== 0 || operationType === 'view'" |
| | | size="small" |
| | | type="textarea"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <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 |
| | | placeholder="è¯·éæ©ä»»è人" size="small" style="width: 100%;"> |
| | | <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col v-if="currentStep === 1 || operationType === 'view'" :span="12"> |
| | | <el-form-item |
| | | :rules="[{ required: currentStep === 1, message: 'è¯·éæ©ä¸»ç®¡', trigger: 'blur' }]" |
| | | label="主管ï¼" |
| | | prop="supervisorId"> |
| | | <el-select v-model="form.supervisorId" :disabled="currentStep !== 1 || operationType === 'view'" |
| | | 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> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-card> |
| | | <el-row style="margin-top: 1em;"> |
| | | <el-col :span="4"> |
| | | æä½äººï¼{{ form.submitPerson }} |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | æ¥æï¼{{ form.submitDate }} |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-form> |
| | | <span slot="footer" 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> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { dateFormat } from '@/utils/date' |
| | | import { |
| | | exportPersonJobResponsibilities, personJobResponsibilitiesDelete, |
| | | personJobResponsibilitiesSave, |
| | | personJobResponsibilitiesSelect |
| | | } from "@/api/cnas/personal/personJobResponsibilities"; |
| | | import {selectUserCondition} from "@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | userName: '', |
| | | tableData: [], |
| | | tableLoading: false, |
| | | responsibleOptions: [], |
| | | search: { |
| | | size: 20, |
| | | current: 1, |
| | | total: 0 |
| | | }, |
| | | dialogVisible: false, |
| | | currentStep: 0, // æ¥éª¤æ¡æ¾ç¤ºç¬¬å æ¥ |
| | | currentStepClick: 0, // ç¹å»æ¥éª¤æ¡åå |
| | | operationType: '', |
| | | steps: ['æäº¤', 'ä»»è人确认', '主管确认'], |
| | | form: { |
| | | postName: '', // å²ä½åç§° |
| | | jobObjective: '', // å·¥ä½ç®æ |
| | | jobResponsibilities: '', // å²ä½èè´£ |
| | | incumbentId: '', // ä»»è人 |
| | | supervisorId: '' // 主管 |
| | | }, |
| | | rules: { |
| | | postName: [{ required: true, message: '请è¾å
¥å²ä½åç§°', trigger: 'blur' }], |
| | | jobObjective: [{ required: true, message: '请è¾å
¥å·¥ä½ç®æ ', trigger: 'blur' }], |
| | | jobResponsibilities: [{ required: true, message: '请è¾å
¥å²ä½èè´£', trigger: 'blur' }], |
| | | incumbentId: [{ required: true, message: 'è¯·éæ©ä»»è人', trigger: 'change' }], |
| | | supervisorId: [{ required: true, message: 'è¯·éæ©ä¸»ç®¡', trigger: 'change' }] |
| | | } |
| | | // departId: 0 |
| | | }; |
| | | }, |
| | | props: { |
| | | departId: { |
| | | type: Number, |
| | | default: () => { |
| | | return null; |
| | | } |
| | | }, |
| | | isDepartment: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getPostList(this.departId); |
| | | }, |
| | | methods: { |
| | | addPost() { |
| | | this.dialogVisible = true; |
| | | this.form = { |
| | | postName: '', // å²ä½åç§° |
| | | jobObjective: '', // å·¥ä½ç®æ |
| | | jobResponsibilities: '', // å²ä½èè´£ |
| | | incumbentId: '', // ä»»è人 |
| | | supervisorId: '', // æä½äºº |
| | | submitPerson: '', // 主管 |
| | | submitDate: '', // æ¥æ |
| | | currentStep: 0 // æ¥æ |
| | | }; |
| | | this.currentStep = 0; |
| | | this.getUserList(); |
| | | }, |
| | | // æ¥è¯¢åè¡¨ä¿¡æ¯ |
| | | getPostList(userId) { |
| | | this.search.userId = userId; |
| | | const params = this.isDepartment ? { |
| | | userName: this.userName, |
| | | departmentId: this.search.userId, |
| | | size: this.search.size, |
| | | current: this.search.current, |
| | | }: { |
| | | userName: this.userName, |
| | | userId: this.search.userId, |
| | | size: this.search.size, |
| | | current: this.search.current, |
| | | } |
| | | this.tableLoading = true |
| | | personJobResponsibilitiesSelect(params).then(res => { |
| | | this.tableLoading = false |
| | | this.tableData = res.data.records; |
| | | this.search.total = res.data.total; |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | //æäº¤è¡¨å |
| | | async submitForm(saveState) { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid === true || saveState !== '1submit') { |
| | | // ç»å½åç¯è设置åå»ºäººä¸æ¶é´ |
| | | let user = this.nickName; |
| | | const dateTime = dateFormat(new Date()); |
| | | // è·åå½åç¯èæä½äººä¸æ¥æ |
| | | switch (this.currentStep) { |
| | | case 0: |
| | | this.form.submittingOperator = user.name; |
| | | this.form.submittingDate = dateTime; |
| | | break; |
| | | case 1: |
| | | this.form.incumbentOperator = user.name; |
| | | this.form.incumbentDate = dateTime; |
| | | break; |
| | | case 2: |
| | | this.form.supervisorOperator = user.name; |
| | | 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; |
| | | } |
| | | let currentStepAction; |
| | | // 设置该æä½å¤ææ¯å¦ä¸ºæäº¤ï¼ä¿åï¼é©³åï¼éè¿ |
| | | switch (saveState) { |
| | | // æäº¤ï¼éè¿ |
| | | case '1submit': |
| | | currentStepAction = this.currentStep + 1; |
| | | break; |
| | | // ä¿å |
| | | case '2save': |
| | | currentStepAction = this.currentStep; |
| | | break; |
| | | // 驳å |
| | | case '3reject': |
| | | currentStepAction = this.currentStep - 1; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | // è·åå½åç¶æ |
| | | this.form.currentState = currentStepAction === 3 ? 'å
³é' : this.steps[currentStepAction]; |
| | | personJobResponsibilitiesSave(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('æäº¤æå'); |
| | | this.getPostList(this.departId); |
| | | this.dialogVisible = false; |
| | | } |
| | | }); |
| | | } else { |
| | | let step = this.steps[this.currentStep]; |
| | | this.$message.warning(step + ' æµç¨ä¸æå¿
填项æªå¡«ï¼'); |
| | | } |
| | | }); |
| | | }, |
| | | // ç¼è¾ |
| | | handleViewClick(row, type) { |
| | | this.operationType = type; |
| | | this.getUserList(); |
| | | row.incumbentId = Number(row.incumbentId); |
| | | this.form = { ...row }; |
| | | switch (row.currentState) { |
| | | case 'æäº¤': |
| | | this.currentStep = 0; |
| | | break; |
| | | case 'ä»»è人确认': |
| | | this.currentStep = 1; |
| | | this.form.submitPerson = row.submittingOperator; |
| | | this.form.submitDate = row.submittingDate; |
| | | break; |
| | | case '主管确认': |
| | | this.currentStep = 2; |
| | | this.form.submitPerson = row.incumbentOperator; |
| | | this.form.submitDate = row.incumbentDate; |
| | | break; |
| | | case 'å
³é': |
| | | this.currentStep = 3; |
| | | this.form.submitPerson = row.supervisorOperator; |
| | | this.form.submitDate = row.supervisorDate; |
| | | break; |
| | | 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 => { |
| | | const blob = new Blob([res],{ type: 'application/octet-stream' }); |
| | | this.$download.saveAs(blob, row.incumbentName+'-å²ä½èè´£'+'.docx'); |
| | | this.$message.success('å¯¼åºæå') |
| | | }) |
| | | }, |
| | | // å é¤å²ä½èè´£ |
| | | deletePost(row) { |
| | | this.$confirm('æ¤æä½å°æ°¸ä¹
å 餿¤æ°æ®, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | personJobResponsibilitiesDelete({id: row.id}).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('å 餿å'); |
| | | this.getPostList(this.departId); |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | this.$message.error('å é¤å¤±è´¥'); |
| | | }); |
| | | }, |
| | | resetForm() { |
| | | this.$refs.form.resetFields(); |
| | | }, |
| | | refreshTable() { |
| | | this.getPostList(this.departId); |
| | | }, |
| | | // è·åè´è´£äººä¿¡æ¯æ¥å£ |
| | | getUserList() { |
| | | selectUserCondition().then(res => { |
| | | if (res.code == 200) { |
| | | this.responsibleOptions = res.data |
| | | } |
| | | }) |
| | | }, |
| | | choiceStep(index) { |
| | | this.currentStepClick = index; |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.search.size = val; |
| | | this.getPostList(this.departId); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.search.current = val; |
| | | this.getPostList(this.departId); |
| | | } |
| | | }, |
| | | watch: { |
| | | departId: { |
| | | handler(newId, oldId) { |
| | | this.getPostList(newId); |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['nickName']) |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | </style> |