考评组 选择添加复选

This commit is contained in:
leave 2020-11-02 14:11:45 +08:00
parent 57f13b9459
commit 77a097ea81
2 changed files with 113 additions and 226 deletions

View File

@ -92,6 +92,12 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
oldSelectedList: {
type: Array,
default: () => {
return []
}
},
options: { options: {
type: Object, type: Object,
default: () => { default: () => {
@ -101,14 +107,13 @@ export default {
}, },
data () { data () {
return { return {
// showChooseList: true,
popupData: { popupData: {
tableList: [], tableList: [],
selectedList: [] selectedList: []
}, },
rqAssessmentParameter: { rqAssessmentParameter: {
currPage: 1, currPage: 1,
pageSize: 100, pageSize: 1,
searchName: '', searchName: '',
totalCount: 1, totalCount: 1,
totalPage: 1 totalPage: 1
@ -119,7 +124,8 @@ export default {
PopupRight PopupRight
}, },
computed: {}, computed: {},
beforeMount () {}, beforeMount () {
},
mounted () { mounted () {
this.handleGainAssessmentGroupList() this.handleGainAssessmentGroupList()
console.log('showChooseList: ', this.showChooseList) console.log('showChooseList: ', this.showChooseList)
@ -154,7 +160,7 @@ export default {
return item.id return item.id
}).join(',') }).join(',')
if (this.$listeners.cb) { if (this.$listeners.cb) {
this.$emit('cb', {value: id, list}) this.$emit('cb', { value: id, list })
} else { } else {
this.$emit('update:list', id) this.$emit('update:list', id)
this.$emit('update:showChooseList', false) this.$emit('update:showChooseList', false)
@ -179,14 +185,27 @@ export default {
this.handleGainAssessmentGroupList(val) this.handleGainAssessmentGroupList(val)
} }
}, },
watch: {} watch: {
'showChooseList': function (newVal, oldVal) {
if (newVal) {
this.$nextTick(res => {
if (this.oldSelectedList.length > 0) {
this.oldSelectedList.forEach((row) => {
this.$refs.popupMultipleTable.toggleRowSelection(row, true)
})
}
})
}
console.log('showChooseList', newVal, oldVal)
}
}
} }
</script> </script>
<style lang='less' scoped> <style lang='less' scoped>
.popup-search{ .popup-search {
margin: 10px 0; margin: 10px 0;
} }
</style> </style>

View File

@ -96,77 +96,14 @@
</div> </div>
</el-form> </el-form>
<div> <div>
<popup-right <ChooseInitiate
v-if="showChooseList" @cb='handleCallBackChoose'
@cancel="hundlePopupHide" subumitText='确定'
@submit="handleSubmitPopup" :popupRightTitle='popupTitle'
:title="popupRightTitle" :oldSelectedList='formData.assessmentList'
class="popup" :showChooseList.sync='showChooseList'
>
<div slot="content">
<div class="popup-search">
<el-input
v-model="rqAssessmentParameter.searchName"
@change="handlePopupSearchChange"
prefix-icon="el-icon-search"
placeholder="搜索考评组"
size="mini"
></el-input>
</div>
<div class="popup-table">
<el-table
v-if="popupData.tableList.length"
ref="popupMultipleTable"
:data="popupData.tableList"
@selection-change="handleSelectionChange"
tooltip-effect="dark"
:row-key="handleGetRowKeys"
>
<el-table-column
type="selection"
width="40"
:reserve-selection="true"
></el-table-column>
<el-table-column
label="全选"
width="250"
><template slot-scope="scope">{{scope.row.name}}</template></el-table-column>
<el-table-column
width="80"
align="right"
><template slot-scope="scope">{{scope.row.counts}}</template></el-table-column>
</el-table>
<div
v-else
class="popup-empty comonPromptFont"
>
<img
src=""
style="height: 150px; width: 150px;"
/> />
<div>暂无考评组</div>
<div>考评组用于自定义配置被考核人的考核指标和考核流程</div>
<el-button
@click="handlePopupCreat"
type="text"
>新建考评组</el-button>
</div>
</div>
<el-pagination
:hide-on-single-page="true"
:current-page.sync="rqAssessmentParameter.currPage"
:page-size="rqAssessmentParameter.pageSize"
:total="rqAssessmentParameter.totalCount"
:page-count="rqAssessmentParameter.totalPage"
@current-change="handleCurrentChange"
layout="total, prev, pager, next, jumper"
></el-pagination>
</div>
<div
slot="footer-left"
class="popup-footer-left"
>已选择{{popupData.selectedList.length}}</div>
</popup-right>
<el-dialog <el-dialog
title="发起考核" title="发起考核"
:visible.sync="dialogSendVisible" :visible.sync="dialogSendVisible"
@ -187,14 +124,13 @@
</div> </div>
</template> </template>
<script> <script>
import PopupRight from '@/components/PopupRight' import ChooseInitiate from '@/components/ChooseInitiate'
import { getWorkList } from '@/api/workbench'
import { apiInitiateAssessmentInfo } from '@/api/initiateAssessment' import { apiInitiateAssessmentInfo } from '@/api/initiateAssessment'
export default { export default {
data () { data () {
return { return {
dialogSendVisible: false, dialogSendVisible: false,
popupRightTitle: '选择考评组(月度)考核', popupTitle: '选择考评组(月度)考核',
showChooseList: false, showChooseList: false,
formData: { formData: {
cycleTimeType: 0, cycleTimeType: 0,
@ -210,22 +146,11 @@ export default {
rangDate: [{ required: true, message: '请选择时间周期', trigger: 'change' }], rangDate: [{ required: true, message: '请选择时间周期', trigger: 'change' }],
assessmentList: [{ type: 'array', required: true, message: '请选择参与考评组', trigger: 'change' }], assessmentList: [{ type: 'array', required: true, message: '请选择参与考评组', trigger: 'change' }],
'mergeType.name': [{ required: true, message: '请填写新建考核名称', trigger: 'blur' }] 'mergeType.name': [{ required: true, message: '请填写新建考核名称', trigger: 'blur' }]
},
popupData: {
tableList: [],
selectedList: []
},
rqAssessmentParameter: {
currPage: 1,
pageSize: 100,
searchName: '',
totalCount: 1,
totalPage: 1
} }
} }
}, },
components: { components: {
PopupRight ChooseInitiate
}, },
watch: { watch: {
'formData.cycleTimeType': function (newVal, oldVal) { 'formData.cycleTimeType': function (newVal, oldVal) {
@ -233,31 +158,24 @@ export default {
} }
}, },
created () { created () {
this.handleGainAssessmentGroupList()
}, },
methods: { methods: {
handleChangeRangDate (chgVal) { handleChangeRangDate (chgVal) {
this.popupTitle = '选择考评组(月度)考核'
let nameStr = this.$format(chgVal, 'yyyy年MM月绩效考核') let nameStr = this.$format(chgVal, 'yyyy年MM月绩效考核')
if (this.formData.cycleTimeType === 1) { if (this.formData.cycleTimeType === 1) {
// //
this.popupTitle = '选择考评组(自定义)考核'
nameStr = chgVal[0] + '至' + chgVal[1] + '绩效考核' nameStr = chgVal[0] + '至' + chgVal[1] + '绩效考核'
} }
this.formData.mergeType.name = nameStr this.formData.mergeType.name = nameStr
}, },
hundlePopupHide () { hundlePopupHide () {
this.popupData.selectedList = []
this.$refs.popupMultipleTable.clearSelection() this.$refs.popupMultipleTable.clearSelection()
this.showChooseList = false this.showChooseList = false
}, },
handleChooseGroup () { handleChooseGroup () {
this.showChooseList = !this.showChooseList this.showChooseList = !this.showChooseList
this.$nextTick(res => {
if (this.formData.assessmentList.length > 0) {
this.formData.assessmentList.forEach((row) => {
this.$refs.popupMultipleTable.toggleRowSelection(row, true)
})
}
})
}, },
handleGetRowKeys (row) { handleGetRowKeys (row) {
return row.id return row.id
@ -297,41 +215,10 @@ export default {
}) })
}) })
}, },
handlePopupSearchChange (val) { handleCallBackChoose (val) {
// //
this.handleGainAssessmentGroupList() this.formData.assessmentList = val.list
},
handleSelectionChange (val) {
//
this.popupData.selectedList = val
},
handlePopupCreat () {
this.showChooseList = false this.showChooseList = false
//
this.$router.push({ name: 'workbench-edit-group' })
},
handleSubmitPopup () {
const list = this.popupData.selectedList
this.formData.assessmentList = this.popupData.selectedList
this.showChooseList = false
},
handleCurrentChange (val) {
this.handleGainAssessmentGroupList(val)
},
//
handleGainAssessmentGroupList (currPage) {
currPage = currPage > 0 ? currPage : this.rqAssessmentParameter.currPage
let para = {
pageSize: this.rqAssessmentParameter.pageSize,
currPage: currPage,
name: this.rqAssessmentParameter.searchName
}
getWorkList(para).then(res => {
this.rqAssessmentParameter.totalPage = res.data.totalPage
this.rqAssessmentParameter.totalCount = res.data.totalCount
this.currPage = res.data.currPage
this.popupData.tableList = res.data.list
})
} }
} }
} }
@ -348,24 +235,5 @@ export default {
.line-space { .line-space {
margin-top: 20px; margin-top: 20px;
} }
.popup {
&-search {
margin-bottom: 20px;
}
&-empty {
padding-top: 100px;
height: 500px;
width: 410px;
font-size: 14px;
text-align: center;
display: block;
align-content: center;
justify-content: center;
}
&-footer-left {
color: @fontBlue;
}
}
} }
</style> </style>