You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

401 lines
20 KiB

<!--教师审核主类-->
<template>
<div v-if="pageType === 1">
<div class="title-line-outer">
<div class="title-line-inner">
<a-radio-group v-model="checkStatus" button-style="solid" class="search-radio-group-style" @change="statusChange">
<a-radio-button v-for="status in checkStatusData" :value="status.value" :key="status.value">
{{ status.label }}
</a-radio-button>
</a-radio-group>
<a-select placeholder="请输入并选择审核教师" v-model="searchValue" style="width: 12rem;margin-left: 1rem" :filterOption="false"
:notFoundContent="fetching ? undefined : null" @search="fetchTeacher" :allowClear="true" @change="handleChange" :showSearch="true"
:defaultActiveFirstOption=" false" :show-arrow="false" :labelInValue="true">
<a-spin v-if="fetching" slot="notFoundContent" size="small" />
<a-select-option v-for="person in personData" :key="person.person_id">
{{ person.person_name }}
</a-select-option>
</a-select>
<template v-if="checkStatus === '-2' || checkStatus === '0'">
<a-button class="left-top-add-btn-style" type="primary" style="background-color: #fc012c; border-color: #fc012c" @click="approve(-1)">批量未通过</a-button>
<a-button class="left-top-add-btn-style" type="primary" style="right: 9rem" @click="approve(1)">批量通过</a-button>
</template>
</div>
</div>
<div class="table-container-style">
<a-table :rowSelection ="checkStatus === '-2' || checkStatus === '0'?{fixed:true,selectedRowKeys:selectedRows,onChange:selectedRowsChange,getCheckboxProps:setCheckboxProps}:null"
:loading="dataLoading" :columns="getColumns" :dataSource="personDataList" rowKey="value_id" :scroll="{x:true}" :pagination="false">
<span slot="dictionary" slot-scope="value"><!--字典类型字段-->
{{getDictionaryValue(value)}}
</span>
<span slot="associate" slot-scope="value"><!--字典类型字段-->
{{getDictionaryValue(value)}}
</span>
<span slot="img" slot-scope="value" style="display:flex;justify-items: center;justify-content: center"><!--图片-->
<ShowAttachment v-if="value && value !== '' && value !== '[]'" :type="2" :img="getImg(value)" :file-list="getFileList(value)"
picture-width="8rem" picture-height="4.5rem" :badge-count="getBadgeCount(value)"/>
</span>
<span slot="attachment" slot-scope="value"><!--附件类型字段-->
<ShowAttachment v-if="value && value !== '' && value !== '[]'" :type="1" :file-list="getFileList(value)" :badge-count="getBadgeCount(value)"/>
</span>
<span slot="editor" slot-scope="value" v-html="value"></span><!--//附件类型字段-->
<span slot="depart_person" slot-scope="value"><!--部门人员类型字段-->
{{getDeptPersonValue(value)}}
</span>
<span slot="check_status" slot-scope="value" :style="{color:value === 1?'#31a8fa':value === 0?'#f8b62b':'#fc012c'}">
{{getCheckStatusName(value)}}
</span>
<template slot="operate" slot-scope="value,record">
<i class="office-operate-search operate-style" style="margin-right: 0.5rem" title="查看" @click="view(3,record)"></i>
<i v-if="checkStatus === '-2' || checkStatus === '0'" class="office-edit1 operate-style" :style="{color:record.check_flag !== 0?'#999':'#31a8fa',marginRight:'0.5rem',
pointerEvents:record.check_flag !== 0?'none':null}" title="审批" @click="view(4,record)"></i>
</template>
</a-table>
</div>
<a-pagination :current="pageNumber" :pageSize="pageSize" :hideOnSinglePage="true" :total="totalRow" class="pagination-style" @change="pageChange"/>
<modal-panel v-if="checkStatus === '-2' || checkStatus === '0'" addChildType="slot" :modalTitle="'审核' + (approveType === 1?'通过':'未通过')" :show="showComment" modalWidth="50%" @callback="commentCallback">
<ApprovalComment :type="approveType" ref="commentPanel"/>
</modal-panel>
</div>
<edit-and-view-form v-else-if="formData !== null && formData !== undefined" :pageType="editPageType" :dataNumType="data_num_type" :dataInfo="formData" :showOperateList="true"
@back="returnBack" :form_id="purview_id" @submitSuccess="onSubmitSuccess" :businessType="3" :person-info="personInfo"/>
</template>
<script>
import {Button,Table,Pagination,Select,Spin,Modal} from 'ant-design-vue'
import ARadioGroup from 'ant-design-vue/es/radio/Group'
import ARadioButton from 'ant-design-vue/es/radio/RadioButton'
import 'ant-design-vue/es/radio/style/css'
import InterfaceConfig from './interfaceConfig'
import EditAndViewForm from '../formCommon/EditAndViewForm'
import CommonOperate from '../utils/commonOperate'
import debounce from 'lodash/debounce'
import CommonInterfaceConfig from '../../../commonInterface/interfaceConfig'
import FillingIngerfaceConfig from '../teacherInfoFilling/interfaceConfig'
import ModalPanel from '../../../components/common/modal/ModalPanel'
import ApprovalComment from './ApprovalComment'
import StaticParams from '../../../global-llibs/staticParams'
import ShowAttachment from '../../../components/common/showAttachment/ShowAttachment'
export default {
name: "ApproveList",
props:["purview_id","purview_name","data_num_type",],
data:function () {
this.lastFetchId = 0;
this.fetchTeacher = debounce(this.fetchTeacher, 500);
return {
pageType:1, // 1:列表 2 查看/审批
checkStatusData:[{value:"-2",label:'全部'},{value:"0",label:'待审批'},{value:"1",label:'已通过'},{value:"-1",label:'未通过'}],
checkStatus:"-2",
dataLoading:true,
fieldsList:[],//字段数据
personDataList:[],//填报数据
editPageType:3,
formData:null,
pageSize:10,
pageNumber:1,
totalRow:0,
totalPage:1,
searchValue:undefined,
personData:[],
fetching: false,
selectedRows:[],
approveType:1,
showComment:false,
personInfo:{}
}
},
components:{
AButton:Button,
ARadioGroup,
ARadioButton,
ATable:Table,
EditAndViewForm,
APagination:Pagination,
ASelect:Select,
ASpin:Spin,
ASelectOption:Select.Option,
ModalPanel,
ApprovalComment,
ShowAttachment
},
computed:{
getColumns:function () {
let ary = [];
if (this.fieldsList && this.fieldsList.length > 0){
ary.push({title:"序号",customRender:(text,record,index)=>{return index + 1},fixed:'left',align:'center',width:60})
ary.push({title:"教师编号",dataIndex:"workers_no",fixed:'left',align:'center',width:100})
ary.push({title:"教师姓名",dataIndex:"person_name",fixed:'left',align:'center',width:150})
ary.push( {title:"单位(部门)",customRender:(text,record,)=>
{return record.org_name + (record.dept_name && record.dept_name !== "" && record.dept_name !== record.org_name?
"(" + record.dept_name + ")":"")},fixed:'left',align:'center',width:200})
this.fieldsList.forEach((field)=>{
let type = parseInt(field.field_type)
if (parseInt(field.field_input_type) !== 2 && type !== 20 && type < 200 && type !== 11){
//字典填充类型的单行文本、文本标签、子表单及布局字段不能出现在表头中
let obj = {title:field.field_name,dataIndex:field.column_name,align:'center'};
if ([3,4,6,15,25,26].some((num)=>{return type === num})){//字典类型的
obj.scopedSlots = {"customRender":"dictionary"}
}else if (type === 9){//附件类型
obj.scopedSlots = {"customRender":"img"}
}else if (type === 10){//附件类型
obj.scopedSlots = {"customRender":"attachment"}
}else if (type === 11){//富文本
obj.scopedSlots = {"customRender":"editor"}
}else if ([17,18].some((num)=>{return type === num})){//部门 人员
obj.scopedSlots = {"customRender":"depart_person"}
}else if(27 === type){
obj.scopedSlots = {"customRender":"associate"}
}
ary.push(obj)
}
})
ary.push({title:"最新修改时间",dataIndex:"last_modify_time",fixed:'right',align:'center',width:160})
ary.push({title:"审批状态",dataIndex:"check_flag",scopedSlots:{customRender:"check_status"},fixed:'right',align:'center',width:90})
ary.push({title:"操作",scopedSlots:{customRender:"operate"},fixed:'right',align:'center'})
}
return ary
}
},
mounted() {
this.getListData()
},
methods:{
getBadgeCount:function(value){
let ary = JSON.parse(value);
return ary.length > 1?ary.length:0;
},
getFileList:function(value){
return JSON.parse(value);
},
getImg:function(value){
return JSON.parse(value)[0];
},
setCheckboxProps:function(record){
return {
props:{
disabled:record.check_flag !== 0
}
}
},
commentCallback:function(type){
if (type[0] === 'ok'){
if (this.approveType === -1 && (!this.$refs.commentPanel.content || StaticParams.trim(this.$refs.commentPanel.content) === "")){
this.$refs.commentPanel.showTip = true;
return ;
}else {
let params = {
org_id:this.BaseConfig.person_info_my.bureau_id,
system_id:10,
form_id:this.purview_id,
value_ids:this.selectedRows.join(","),
check_flag:this.approveType,
check_info:this.$refs.commentPanel.content?this.$refs.commentPanel.content:"",
person_id:this.BaseConfig.userInfo.person_id_cookie,
dept_id:this.BaseConfig.person_info_my.dep_id,
};
if (this.selectedRows.length === 1){
params.update_ts = this.personDataList.filter((item)=>{return item.value_id === this.selectedRows[0]})[0].update_ts;
}
this.InterfaceConfig.callInterface([{
url:InterfaceConfig.saveCheckInfoByValueId.url,
method:InterfaceConfig.saveCheckInfoByValueId.method,
params:params,
isTestLogin:InterfaceConfig.saveCheckInfoByValueId.isTestLogin
}],(data)=>{
let result = data[0].data;
if (result.code === 2000){
this.$toast("审核成功")
this.selectedRows = [];
this.getListData();
}
})
}
}
this.showComment = false
},
approve:function(type){
if (this.selectedRows.length === 0){
Modal.warning({
title:"批量审核",
content:"未选择审核数据,无法只执行批量审核操作",
okText:'我知道了',
centered:true
});
return
}
this.approveType = type;
if (this.$refs.commentPanel){
this.$refs.commentPanel.content = undefined;
this.$refs.commentPanel.approveType = this.approveType;
this.$refs.commentPanel.showTip = false;
}
this.showComment = true;
},
selectedRowsChange:function(selectedRowKeys,){
this.selectedRows = selectedRowKeys;
},
handleChange:function(){
this.personData = [];
this.fetching = false;
this.pageNumber = 1;
this.getListData();
},
fetchTeacher(value) {
// if(value === ""){
// this.personData = [];
// this.fetching = false;
// return;
// }
// console.log('fetching teacher', value);
this.lastFetchId += 1;
const fetchId = this.lastFetchId;
this.data = [];
this.fetching = true;
this.InterfaceConfig.callInterface([{
url:CommonInterfaceConfig.personInfo_GetPersonInfoList.url,
method:CommonInterfaceConfig.personInfo_GetPersonInfoList.method,
params:{
bureau_id:this.BaseConfig.person_info_my.bureau_id,
org_id:this.BaseConfig.person_info_my.bureau_id,
query_child:true,
b_use:1,
person_name:value,
query_bureau_child:false,
pageNumber:1,
pageSize:9999999
},
isTestLogin:CommonInterfaceConfig.personInfo_GetPersonInfoList.isTestLogin
}],(data)=>{
let result = data[0].data;
if (fetchId !== this.lastFetchId) {
// for fetch callback order
return;
}
if (result.success){
let ary = result.list && result.list.length > 0?result.list.map(person=>({
person_id:person.person_id,
person_name:person.person_name
})):[]
this.personData = ary
}
this.fetching = false;
})
},
/*
* 查看编辑上报记录(一人多条)
* */
view:function(type,record){
let params = {
org_id:this.BaseConfig.person_info_my.bureau_id,
system_id:10,
form_id:this.purview_id,
value_id:record.value_id,
teacher_id:record.person_id
}
this.InterfaceConfig.callInterface([{
url:FillingIngerfaceConfig.getPersonalInfoByValueId.url,
method:FillingIngerfaceConfig.getPersonalInfoByValueId.method,
params:params,
isTestLogin:FillingIngerfaceConfig.getPersonalInfoByValueId.isTestLogin
}],(data)=>{
let restult = data[0].data;
if (restult.code === 2000){
this.formData = restult.data;
this.pageType = 2;
this.editPageType = type;
this.personInfo = {
person_id:record.person_id,
org_name:record.org_name,
dept_name:record.dept_name,
person_name:record.person_name,
workers_no: record.workers_no?record.workers_no:""
};
}
})
},
onSubmitSuccess:function(){
if (this.personDataList.length === 1 && this.pageNumber > 1){
this.pageNumber -= 1;
}
this.pageType = 1;
this.isLoading = true;
this.getListData();
},
/*
* 获取字典类型字段值
* */
getDictionaryValue:function(value){
return CommonOperate.getDictionaryValue(value);
},
getDeptPersonValue:function(value){
return CommonOperate.getDeptPersonValue(value);
},
returnBack:function(){
this.isLoading = true;
this.getListData();
this.pageType = 1;
},
statusChange:function(){
this.selectedRows = [];
this.pageNumber = 1;
this.getListData();
},
pageChange:function(page, pageSize){
this.selectedRows = [];
this.pageNumber = page
this.pageSize = pageSize
this.getListData()
},
getCheckStatusName:function(value){
return (this.checkStatusData.filter((item)=>{return parseInt(item.value) === value})[0]).label
},
getListData(){
let params = {
org_id:this.BaseConfig.person_info_my.bureau_id,
system_id:10,
form_id:this.purview_id,
person_id:this.searchValue && this.searchValue.key?this.searchValue.key:"",
check_flag:parseInt(this.checkStatus),
page_number:this.pageNumber,
page_size:this.pageSize
}
this.InterfaceConfig.callInterface([{
url:InterfaceConfig.getAdminCheckInfoByFormId.url,
method:InterfaceConfig.getAdminCheckInfoByFormId.method,
params:params,
isTestLogin:InterfaceConfig.getAdminCheckInfoByFormId.isTestLogin
}],(data)=>{
let result = data[0].data;
this.dataLoading = false
if (result.code === 2000){
this.selectedRows = [];
this.formData = result.data;
this.fieldsList = JSON.parse(result.data.form_json);
this.personDataList = result.data.form_data_list;
this.totalRow = result.data.total_row;
this.totalPage = result.data.total_page;
}
})
}
}
}
</script>
<style scoped lang="scss">
.operate-style{
font-size: 1rem;
color:#31a8fa;
cursor:pointer;
}
</style>