diff --git a/src/api/system/baseForm.js b/src/api/system/baseForm.js index d16d26a..c539f4b 100644 --- a/src/api/system/baseForm.js +++ b/src/api/system/baseForm.js @@ -1,12 +1,18 @@ import request from "@/utils/request"; function customParamsSerializer(params) { - let result = ''; + let result = ""; for (let key in params) { if (params.hasOwnProperty(key)) { if (Array.isArray(params[key])) { - params[key].forEach((item,index) => { - result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; - }); + if (typeof params[key] === "object") { + params[key].forEach((item, index) => { + if (typeof item === "object") { + result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; + } else { + result += `${key}[${index}]=${item}&`; + } + }); + } } else { result += `${key}=${params[key]}&`; } diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 2238dfe..6d9e84e 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -2,7 +2,7 @@
-
退出
+ @@ -47,24 +47,25 @@
- + - + +
@@ -261,7 +262,7 @@ import addPatrol from '@/views/task/list/components/addPatrol.vue' import answerQuestion from '@/views/task/list/components/answerQuestion.vue' import showPlan from '@/views/task/list/components/showPlan.vue' import showArticle from '@/views/dashboard/components/showArticle.vue' - + import state from '@/store/modules/user.js' export default { name: 'Dashboard', computed: { @@ -339,7 +340,8 @@ export default { // 我的任务 unitTypeList: [], myselfList: [], - myselfTotal: '', + myselfTotal: '', + stateObj:{}, auditStatusList: [{ id:4, value:'待开展', @@ -358,117 +360,50 @@ export default { type:'danger' }], myselfTable: [{ - label: "任务名称", - prop: 'name', - width: 200, - // fixed:'left', - align: 'left', - }, { - label: "状态", - prop: 'audit_status', - width: 120, - align: 'center', - customFn: (row) => { - return (
{ - this.auditStatusList.map(item => { - if (item.id == row.audit_status) { - return ( { - item.value - } ) - } - }) - }
) - } + label: "任务名称", + prop: 'name', + width: 200, + // fixed:'left', + align: 'left', + }, { + label: "任务内容及要求", + prop: 'content', + minWidth: 200, + align: 'left', }, { label: "开始日期", prop: 'start_date', width: 120, align: 'center' }, { - label: "结束日期", + label: "要求完成日期", prop: 'end_date', width: 120, align: 'center' - }, - // { - // label: "任务类型", - // prop: 'unit_type_detail.value', - // width: 120, - // align: 'center', - // }, - { - label: "任务内容及要求", - prop: 'content', - - align:'center', - }, - // { - // label: "参与对象", - // prop: '_names', - // width: 360, - // align: 'left', - // customFn: row => { - // return (
{ - // row._names ? - // row._names.map(item => { - // return (
{ - // item.group_name ? - // // 组别 - //
{ - // item.group_name - // }: { - // item.details.map(detail => { - // return ( { - // detail.name - // } - // ) - // }) - // }
: - // // 其他 - // { - // item.name - // } - // }
) - // }): '' - // }
) - // } - // }, - { - label: "负责人(科室)", - prop: 'main_admin.name', - width: 120, - align: 'center', + }, { + label: "状态", + prop: 'audit_status', + width: 120, + align: 'center', + customFn: (row) => { + return (
{ + this.auditStatusList.map(item => { + if (item.id == row.audit_status) { + return ( { + item.value + } ) + } + }) + }
) + } }, { - label: "创建时间", - prop: 'created_at', + label: "责任人(科室)", + prop: 'main_admin.name', width: 120, align: 'center', - formatter: (cell, data, value, index) => { - return value ? value.substring(0, 11) : '' - } - }, - ], + }], depYear:'', depList:[], auditTable:{ @@ -907,6 +842,8 @@ export default { // this.getLeads() this.depYear = (new Date()).getFullYear() + '' console.log(this.depYear) + this.stateObj = state.state + console.log("this.stateObj",this.stateObj) // this.updateMissionPlan() this.getUserId() this.getUnitTypeList() @@ -1144,74 +1081,32 @@ export default { page: 1, page_size: 99, myself: 1, - audit_status: 1 + audit_status: '', + pid:'' }) - // 判断小组中是否有人提交了检查 - // 处理参于人员选择 - for (var r of res.data) { - var _names = [] - // 只有人员 - if (r.accept_admin_ids && r.accept_admin_ids.length > 0) { - r.accept_admin_detail.map(item => { - let hasDetail = item.detail ? true : false - _names.push({ - 'name': item.admin?.name, - 'hasDetail': hasDetail - }) - }) - r._names = _names - } - // 部门 - if (r.accept_department_ids && r.accept_department_ids.length > 0) { - r.accept_department_detail.map(item => { - let hasDetail = item.detail ? true : false - _names.push({ - 'name': item.department?.name, - 'hasDetail': hasDetail - }) - }) - r._names = _names - } - // 组别 - if (r.groups && r.groups.length > 0) { - for (var g of r.groups) { - for (var de of g.details) { - if (g.type == 1) { - let is_index = 0 - for (var a of r.grounp_admin_detail) { - if (de.name === a.admin?.name) { - if (a.detail) { - is_index++ - } - } - } - de.hasDetail = is_index > 0 ? true : false - } - if (g.type == 2) { - let is_index = 0 - for (var dp of r.grounp_department_detail) { - if (de.name === dp.department.name) { - if (dp.detail) { - is_index++ - } - } - } - de.hasDetail = is_index > 0 ? true : false - } - } - } - // 处理过的groups - r.groups.map((item, index) => { - _names.push({ - group_name: item.name, - details: item.details - }) - }) - r._names = _names - } - } + // 我的任务中 选择accept_department_ids部门的,只有选择到的科室负责人能看到 is_manger = true + // 且具体执行人为空 + let spliceIndex = [] + let _arr = [] + res.data.map((r,index)=>{ + let doAdmins = r.do_admin_ids ? r.do_admin_ids : [] + if(this.path_type == 5 && r.accept_department_ids.length > 0){ + let isDepartment = r.accept_department_ids.indexOf(this.stateObj.department_id)!=-1 ? true : false + let isDomains = doAdmins.indexOf(this.stateObj.login_id)!=-1 ? true : false + if(doAdmins.length==0){ + if(!(isDepartment && this.stateObj.is_manger)){ + spliceIndex.push(index) + } + }else{ + if(!((isDepartment && this.stateObj.is_manger)||isDomains)){ + spliceIndex.push(index) + } + } + } + }) + const newArr = res.data.filter((_, index) => !spliceIndex.includes(index)); - this.myselfList = res.data + this.myselfList = newArr this.myselfTotal = res.total // this.activeCount = parseInt(this.activeList.length/6)==1?1:parseInt(this.activeList.length/6)+1 @@ -1240,6 +1135,7 @@ export default { checkUnits(id, type) { this.$refs.checkUnit.id = id this.$refs.checkUnit.type = type + this.$refs.checkUnit.url_type = 5 this.isautoplay = false this.$refs.checkUnit.isShow = true }, diff --git a/src/views/task/list/components/addUnit.vue b/src/views/task/list/components/addUnit.vue index 6952a75..294bd1a 100644 --- a/src/views/task/list/components/addUnit.vue +++ b/src/views/task/list/components/addUnit.vue @@ -1,6 +1,6 @@ - + +
- - - - - - - - - - - - - - +
+ + + + + + + + + + + + + +
+ + + +
@@ -323,60 +335,71 @@ } from 'element-ui' import { save, - get, + get, updatemission - } from "@/api/task/unit.js"; - import { - saveuploads, - savetrain, - savestudy, - listuploads, - listtrain, - liststudy + } from "@/api/task/unit.js"; + import addUnit from '../components/addUnit.vue' + import { + saveuploads, + savetrain, + savestudy, + listuploads, + listtrain, + liststudy } from "@/api/task/feedback.js"; - import { - getparameteritem - } from "@/api/system/dictionary.js"; - import { - listasklog - } from "@/api/task/ask.js"; - import { - listpatrol - } from '@/api/task/patrol.js' - import { - getToken - } from '@/utils/auth' - import state from "@/store/modules/user.js" - import answerQuestion from '../../list/components/answerQuestion.vue' + import { save as saveLog} from "@/api/system/baseForm.js" + import { + getparameteritem + } from "@/api/system/dictionary.js"; + import { + listasklog + } from "@/api/task/ask.js"; + import { + listpatrol + } from '@/api/task/patrol.js' + import { + getToken + } from '@/utils/auth' + import state from "@/store/modules/user.js" + import answerQuestion from '../../list/components/answerQuestion.vue' import viewFile from '@/components/viewFile/viewFile.vue' - import {contactGroup} from '../js/index.js' + import showLogs from '../components/showLogs.vue' + + import { + contactGroup + } from '../js/index.js' export default { components: { - answerQuestion, - viewFile + answerQuestion, + viewFile, + addUnit, + showLogs }, data() { return { isShow: false, type: '', - id: '', - login_id:"", - department_id:'', - pictureList: [], - auditStatusList:[{ - id:1, - value:'通过' - },{ - id:5, - value:'不通过' - }], - showform:{}, - form: { - mission_name:'', - showlist:'', - trainlist:'', - uploadslist:'', - studylist:'', + id: '', + login_id: "", + department_id: '', + pictureList: [], + stateObj: {}, + url_type: 1, + auditStatusList: [{ + id: 1, + value: '通过' + }, { + id: 5, + value: '不通过' + }], + showform: {}, + unitTypeList:[], + form: { + mission_name: '', + showlist: '', + trainlist: '', + uploadslist: '', + studylist: '', type: '', name: '', unit_type: '', @@ -399,661 +422,809 @@ name: '', type: 1, link_id: [] - }], - is_what_unitType:'', - ask_log:[], - study_log:[], - train_log:[], - uploads_log:[], - inspection_log:[], - askLogTable:[{ - label: "提交时间", - prop: 'created_at', - align:'center', - width:180, - formatter: (cell, data, value, index) => { - return value?value.substring(0,16):'' - } - },{ - label: "提交人", - prop: 'admin.name', - align:'center', - width:120 - }, - { - label: "正确率", - prop: 'correct', - align:'center', - width:120, - formatter: (cell, data, value, index) => { - return value? parseFloat(value/cell.data.length).toFixed(2)*100 + "%":0 - } - },{ - label: "答题情况", - prop: 'data', - align:'center', - customFn:(row)=>{ - let range = row.correct?parseFloat(row.correct/row.data.length).toFixed(2)*100 + "%":0 - return(
{ - this.openAnswer(row.data,row.correct,range) - } - } - } - >共{row.data.length}条问题,答对 - {row.correct}
) - } - }, - ], - studyForm:{ - my_study_time:'', - study_remark:'' - }, - studytitle:'', - studyurl:'', - studyLogTable:[{ - label: "提交时间", - prop: 'created_at', - align:'center', - width:180, - formatter: (cell, data, value, index) => { - return value?value.substring(0,16):'' - } - },{ - label: "提交人", - prop: 'admin.name', - align:'center', - width:120, - }, - { - label: "学习时长", - prop: 'my_study_time', - align:'center', - width:120, - formatter: (cell, data, value, index) => { - return value?parseInt(value)+'分钟':'' - } - },{ - label: "备注", - prop: 'study_remark', - align:'left', - } - ], - uploadsForm:{ - my_uploads:[], - uploads_remark:'' - }, - my_uploads_list:[], - uploadOther: { - token: "" - }, - action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, - uploadsLogTable:[{ - label: "提交时间", - prop: 'created_at', - align:'center', - width:180, - formatter: (cell, data, value, index) => { - return value?value.substring(0,16):'' - } - },{ - label: "提交人", - prop: 'admin.name', - align:'center', - width:120 - }, - { - label: "备注", - prop: 'uploads_remark', - align:'center', - width:180 - }, - { - label: "资料", - prop: 'my_upload_detail', - align:'left', - customFn:(row)=>{ - return(
{ - row.my_upload_detail&&row.my_upload_detail.length>0? - row.my_upload_detail.map(item=>{ - return(
{item.original_name}
) - }) - :'' - }
) - } - }], - trainForm:{ - train_score:'', - train_feedback:'' - }, - rateValue:'', - trainLogTable:[{ - label: "提交时间", - prop: 'created_at', - align:'center', - width:180, - formatter: (cell, data, value, index) => { - return value?value.substring(0,16):'' - } - },{ - label: "提交人", - prop: 'admin.name', - align:'center', - width:120 - }, - { - label: "培训评价", - prop: 'train_score', - align:'center', - width:120, - formatter: (cell, data, value, index) => { - let score = parseFloat(value).toFixed(1) - if(score==5){ - return '优秀' - }else if(score==4||score==4.5){ - return '良好' - }else{ - return '一般' - } - } - },{ - label: "培训反馈", - prop: 'train_feedback', - align:'left', - }], - - inspectionLogTable:[{ - label: "提交人", - prop: 'up_admin.name', - align:'center', - width:100 - },{ - label:"组别", - prop:'_names', - width:240, - customFn:(row)=>{ - return(
- { - row._names? - row._names.map(item=>{ - return(
- { - item.group_name? - // 组别 -
{item.group_name}:
-
{ - item.details.map(detail=>{ - return( - {detail.name} - ) - }) - }
-
- :'无' - // 其他 - // {item.name} - } -
) - }):'无' - }
) - } - },{ - label:"检查日期", - prop:'date', - width:110, - },{ - label:"检查站点/地点", - prop:'site.name', - align:'left', - width:120, - formatter:(cell,data,value,index)=>{ - if(cell.site){ - return cell.site.name - }else{ - return cell.address - } - } - },{ - label:"问题描述", - prop:'ask_introduce', - align:'left', - width:180 - },{ - label:"问题类型", - prop:'ask.value', - width:80, - },{ - label:"问题图片", - prop:'files', - width:80, - customFn: (row) => { - let arr = [] - return (
{ - row.files.length>0? - row.files.map(item=>{ - arr.push(item.url) - }):'' - } - { - arr.length>0? - :'' - } - -
) - } - },{ - label:"责任科室", - prop:'ask_department', - width:300, - customFn: (row) => { - - return(
- { - row.accept_department_ids_details&&row.accept_department_ids_details.length>0? - row.accept_department_ids_details.map(item=>{ - return({item.name}) - }) - :(row.accept_admin_ids_details&&row.accept_admin_ids_details.length>0? - - row.accept_admin_ids_details.map(item=>{ - return ({item.name}) - }) - :row.ask_department) - } - -
) - }}] - } - }, - created() { - this.uploadOther.token = getToken(); - this.login_id = state.state.login_id - this.department_id = state.state.department_id - }, - methods: { - print () { - this.$Print('#printunit'); - }, - changeRate(e){ - console.log("e",e) - if(e==5){ - this.rateValue = '优秀' - }else if(e==4||e==4.5){ - this.rateValue = '良好' - }else if(e==0.5||e==1){ - this.rateValue = '差' - }else if(e==1.5||e==2){ - this.rateValue = '较差' - }else if(e==2.5||e==3.5){ - this.rateValue = '一般' - } - }, - async getDetail() { - let res = await get(this.id) - console.log(res) - this.form = { - mission_name:'', - audit_status: res.audit_status?res.audit_status:1, - showlist:'', - trainlist:'', - uploadslist:'', - studylist:'', - type: res?.type, - name: res?.name, - unit_type: res?.unit_type, - start_date: res?.start_date, - end_date: res?.end_date, - is_audit: res.audit_admin_id ? 1 : 0, - audit_admin_id: res.audit_admin_id ? res.audit_admin_id : '', - file_ids: res?.file_ids, - content: res?.content, - end_type: res?.end_type, - end_content: res?.end_content, - accept_admin_ids: res?.accept_admin_ids, - accept_department_ids: res?.accept_department_ids, - mission_groups: res?.groups, + }], + is_what_unitType: '', + ask_log: [], + study_log: [], + train_log: [], + uploads_log: [], + inspection_log: [], + askLogTable: [{ + label: "提交时间", + prop: 'created_at', + align: 'center', + width: 180, + formatter: (cell, data, value, index) => { + return value ? value.substring(0, 16) : '' + } + }, { + label: "提交人", + prop: 'admin.name', + align: 'center', + width: 120 + }, + { + label: "正确率", + prop: 'correct', + align: 'center', + width: 120, + formatter: (cell, data, value, index) => { + return value ? parseFloat(value / cell.data.length).toFixed(2) * 100 + "%" : 0 + } + }, { + label: "答题情况", + prop: 'data', + align: 'center', + customFn: (row) => { + let range = row.correct ? parseFloat(row.correct / row.data.length).toFixed(2) * 100 + "%" : 0 + return (
{ + this.openAnswer(row.data, row.correct, range) + } + } + }> + 共 { + row.data.length + } + 条问题, 答对 { + row.correct + }
) + } + }, + ], + studyForm: { + my_study_time: '', + study_remark: '' + }, + studytitle: '', + studyurl: '', + studyLogTable: [{ + label: "提交时间", + prop: 'created_at', + align: 'center', + width: 180, + formatter: (cell, data, value, index) => { + return value ? value.substring(0, 16) : '' + } + }, { + label: "提交人", + prop: 'admin.name', + align: 'center', + width: 120, + }, + { + label: "学习时长", + prop: 'my_study_time', + align: 'center', + width: 120, + formatter: (cell, data, value, index) => { + return value ? parseInt(value) + '分钟' : '' + } + }, { + label: "备注", + prop: 'study_remark', + align: 'left', + } + ], + uploadsForm: { + my_uploads: [], + uploads_remark: '' + }, + my_uploads_list: [], + uploadOther: { + token: "" + }, + action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, + uploadsLogTable: [{ + label: "提交时间", + prop: 'created_at', + align: 'center', + width: 180, + formatter: (cell, data, value, index) => { + return value ? value.substring(0, 16) : '' + } + }, { + label: "提交人", + prop: 'admin.name', + align: 'center', + width: 120 + }, + { + label: "备注", + prop: 'uploads_remark', + align: 'center', + width: 180 + }, + { + label: "资料", + prop: 'my_upload_detail', + align: 'left', + customFn: (row) => { + return (
{ + row.my_upload_detail && row.my_upload_detail.length > 0 ? + row.my_upload_detail.map(item => { + return (
{ + item.original_name + }
) + }) : + '' + }
) + } + }], + trainForm: { + train_score: '', + train_feedback: '' + }, + rateValue: '', + trainLogTable: [{ + label: "提交时间", + prop: 'created_at', + align: 'center', + width: 180, + formatter: (cell, data, value, index) => { + return value ? value.substring(0, 16) : '' + } + }, { + label: "提交人", + prop: 'admin.name', + align: 'center', + width: 120 + }, + { + label: "培训评价", + prop: 'train_score', + align: 'center', + width: 120, + formatter: (cell, data, value, index) => { + let score = parseFloat(value).toFixed(1) + if (score == 5) { + return '优秀' + } else if (score == 4 || score == 4.5) { + return '良好' + } else { + return '一般' + } + } + }, { + label: "培训反馈", + prop: 'train_feedback', + align: 'left', + } + ], - } + inspectionLogTable: [{ + label: "提交人", + prop: 'up_admin.name', + align: 'center', + width: 100 + }, { + label: "组别", + prop: '_names', + width: 240, + customFn: (row) => { + return (
{ + row._names ? + row._names.map(item => { + return (
{ + item.group_name ? + // 组别 +
{ + item.group_name + }:
< + div style = { + { + "display": "flex", + "flex-wrap": "wrap" + } + } > { + item.details.map(detail => { + return ( { + detail.name + } + ) + }) + }
< + /div> : + '无' + // 其他 + // {item.name} + }
) + }): '无' + }
) + } + }, { + label: "检查日期", + prop: 'date', + width: 110, + }, { + label: "检查站点/地点", + prop: 'site.name', + align: 'left', + width: 120, + formatter: (cell, data, value, index) => { + if (cell.site) { + return cell.site.name + } else { + return cell.address + } + } + }, { + label: "问题描述", + prop: 'ask_introduce', + align: 'left', + width: 180 + }, { + label: "问题类型", + prop: 'ask.value', + width: 80, + }, { + label: "问题图片", + prop: 'files', + width: 80, + customFn: (row) => { + let arr = [] + return (
{ + row.files.length > 0 ? + row.files.map(item => { + arr.push(item.url) + }) : '' + } { + arr.length > 0 ? + + :'' + } - this.mission_groups_list = [] - let group_details = [] - if(res.groups.length>0){ - for (var g of res.groups) { - this.mission_groups_list.push({ - name: g.name, - type: g.type, - link_id: g.link_id - }) - } - - this.showform.group_details = contactGroup(res.groups) - } - console.log(this.showform.group_details,this.mission_groups_list) - // this.mission_groups_list = res?.mission_groups - for (var f of res.files) { - this.pictureList.push({ - id: f.id, - url: f.url, - name: f.original_name - }) - } - this.showform = res - this.is_what_unitType = res.unit_type_detail?res.unit_type_detail.value:'' - if(this.type=='show'){ - switch(this.is_what_unitType){ - case '检查': - this.getInspection() - break; - case '学习': - this.getStudy() - break; - case '答题': - this.getAskLog() - break; - case '培训': - this.getTrain() - break; - case '资料收集': - this.getUploads() - break; - } - } +
) + } + }, + { + label: "责任科室", + prop: 'ask_department', + width: 300, + customFn: (row) => { - }, - async getAskLog(){ - const res = await listasklog({mission_id:this.id,page:1,page_size:999}) - this.ask_log = res.data - }, - openAnswer(arr,correct,range){ - this.$refs.answerQuestion.askList = arr - this.$refs.answerQuestion.isSubmit = true - this.$refs.answerQuestion.correct = correct - this.$refs.answerQuestion.range = range - this.$refs.answerQuestion.isShow = true - }, - async getInspection(){ - const res = await listpatrol({mission_id:this.id,page:1,page_size:999}) - for(var k of res.data){ - var _names = [] - // 组别 - if(this.showform.groups&&this.showform.groups.length>0){ - for(var g of this.showform.groups){ - if(g.type==1){ - - if(g.link_id.indexOf(k.up_admin.id)>-1){ - _names.push({ - group_name:g.name, - details:g.details - }) - } - } - if(g.type==2){ - if(g.link_id.indexOf(k.up_admin.department_id)>-1){ - _names.push({ - group_name:g.name, - details:g.details - }) - } - } - } - k._names = _names - } - - console.log(k._names) - - } - - - - this.inspection_log = res.data - - }, - async getTrain(){ - const res = await listtrain({mission_id:this.id,page:1,page_size:999}) - this.train_log = res.data - }, - async getUploads(){ - const res = await listuploads({mission_id:this.id,page:1,page_size:999,sort_name:'created_at',sort_type:'DESC'}) - this.uploads_log = res.data - }, - async getStudy(){ - const res = await liststudy({mission_id:this.id,page:1,page_size:999}) - this.study_log = res.data - }, - openStudy(url,name){ - this.studyurl = url - this.studytitle = name - this.studytime - this.$refs.viewFile.studytype = 'study' - this.$refs.viewFile.needStudyTime = this.showform.study_time - this.$refs.viewFile.diaShow = true - }, - studytime(e){ - console.log("e",e) - if(!this.studyForm.my_study_time){ - this.studyForm.my_study_time = 0 - } - this.studyForm.my_study_time = parseInt(this.studyForm.my_study_time) + e - }, - handleRemove(file, fileList) { - this.my_uploads_list = fileList - }, - handlesuccess(response, file, fileList) { - this.my_uploads_list = fileList - }, - submitFeedback(){ - if(this.type=='train'){ - if(!this.trainForm.train_score){ - Message({ - type: 'warning', - message: '请提交培训评价' - }) - return - } - savetrain({ - mission_id: this.id, - ...this.trainForm - }).then(res => { - Message({ - type: 'success', - message: '提交成功' - }) - updatemission({ - id:this.id - }).then(r=>{ - this.isShow = false - this.$emit('refresh') - }) - }) - }else if(this.type=='study'){ - console.log(this.trainForm) - if(!this.studyForm.my_study_time || this.studyForm.my_study_time===0){ - Message({ - type: 'warning', - message: '请先学习' - }) - return - }else{ - if(this.studyForm.my_study_time { - Message({ - type: 'success', - message: '提交成功' - }) - updatemission({ - id:this.id - }).then(r=>{ - this.isShow = false - this.$emit('refresh') - }) - }) - }else if(this.type=='uploads'){ - let _files = [] - if (this.my_uploads_list.length > 0) { - for (var h of this.my_uploads_list) { - if (h.response) { - _files.push(h.response.id) - } else { - _files.push(h.id) - } - } - this.uploadsForm.my_uploads = _files - } else { - this.uploadsForm.my_uploads = [] - Message({ - type: 'warning', - message: '请上传资料' - }) - return - } - saveuploads({ - mission_id: this.id, - ...this.uploadsForm - }).then(res => { - Message({ - type: 'success', - message: '提交成功' - }) - updatemission({ - id:this.id - }).then(r=>{ - this.isShow = false - this.$emit('refresh') - }) - - - }) - - } + return (
{ + row.accept_department_ids_details && row.accept_department_ids_details.length > 0 ? + row.accept_department_ids_details.map(item => { + return ( { + item.name + } ) + }): (row.accept_admin_ids_details && row.accept_admin_ids_details.length > 0 ? + + row.accept_admin_ids_details.map(item => { + return ( { + item.name + } ) + }): row.ask_department) + }
) + } + }] + } + }, + created() { + this.stateObj = state.state + this.uploadOther.token = getToken(); + this.login_id = state.state.login_id + this.department_id = state.state.department_id + this.getUnitTypeList() + }, + methods: { + print() { + this.$Print('#printunit'); + }, + openLogs(){ + this.$refs.showLogs.typeName = this.showform.name + this.$refs.showLogs.id = this.showform.id + this.$refs.showLogs.isShow = true + }, + // 我的任务中的操作 + openMyMission(remark, e) { + switch (remark) { + case '检查': + this.addPatrol(e) + break; + case '学习': + this.type = 'study' + break; + case '答题': + this.openAnswers(e) + break; + case '培训': + this.type = 'train' + break; + case '资料收集': + case '方案': + this.type = 'uploads' + break; + // case '方案': + // this.openCases(e) + // break; - }, - submitCheck() { - let _files = [] - if (this.pictureList.length > 0) { - for (var h of this.pictureList) { - if (h.response) { - _files.push(h.response.id) - } else { - _files.push(h.id) - } - } - this.form.file_ids = _files - } else { - this.form.file_ids = [] - } - this.form.mission_groups = this.mission_groups_list - // return - save({ - id: this.id, - ...this.form - }).then(res => { - Message({ - type: 'success', - message: '审核成功' - }) - updatemission({ - id:this.id - }) - this.isShow = false - this.$emit('refresh') - }) - }, - }, - watch: { - isShow(newVal) { - if (newVal) { - console.log("type",this.type) - this.getDetail() - } else { - this.id = '' - this.type = '' - this.pictureList = [] - this.my_uploads_list = [] - this.uploadsForm = {} - this.trainForm={} - this.studyForm={} - this.studytitle='', - this.studyurl='', - this.is_what_unitType = '' - this.mission_groups_list = [{ - name: '', - type: 1, - link_id: [] - }] - this.$refs['dialog'].reset() - } - } - } + } + }, + addPatrol(scope) { + this.$refs['addPatrol'].login_id = this.stateObj.login_id + this.$refs['addPatrol'].department_id = this.stateObj.department_id + this.$refs['addPatrol'].mission_id = scope.id + this.$refs['addPatrol'].isShow = true + this.$refs['addPatrol'].type = 'add' + }, + openAnswers(scope) { + this.$refs['answerQuestion'].mission_id = scope.id + this.$refs['answerQuestion'].askList = scope.ask + this.$refs['answerQuestion'].isShow = true + }, + changeRate(e) { + console.log("e", e) + if (e == 5) { + this.rateValue = '优秀' + } else if (e == 4 || e == 4.5) { + this.rateValue = '良好' + } else if (e == 0.5 || e == 1) { + this.rateValue = '差' + } else if (e == 1.5 || e == 2) { + this.rateValue = '较差' + } else if (e == 2.5 || e == 3.5) { + this.rateValue = '一般' + } + }, + async getDetail() { + let res = await get(this.id) + console.log(res) + this.form = { + mission_name: '', + audit_status: res.audit_status ? res.audit_status : 1, + showlist: '', + trainlist: '', + uploadslist: '', + studylist: '', + type: res?.type, + name: res?.name, + unit_type: res?.unit_type, + start_date: res?.start_date, + end_date: res?.end_date, + is_audit: res.audit_admin_id ? 1 : 0, + audit_admin_id: res.audit_admin_id ? res.audit_admin_id : '', + file_ids: res?.file_ids, + content: res?.content, + end_type: res?.end_type, + end_content: res?.end_content, + accept_admin_ids: res?.accept_admin_ids, + accept_department_ids: res?.accept_department_ids, + mission_groups: res?.groups, - } + } + + this.mission_groups_list = [] + let group_details = [] + if (res.groups.length > 0) { + for (var g of res.groups) { + this.mission_groups_list.push({ + name: g.name, + type: g.type, + link_id: g.link_id + }) + } + + this.showform.group_details = contactGroup(res.groups) + } + console.log(this.showform.group_details, this.mission_groups_list) + // this.mission_groups_list = res?.mission_groups + for (var f of res.files) { + this.pictureList.push({ + id: f.id, + url: f.url, + name: f.original_name + }) + } + this.showform = res + this.is_what_unitType = res.unit_type_detail ? res.unit_type_detail.value : '' + if (this.type == 'show') { + switch (this.is_what_unitType) { + case '检查': + this.getInspection() + break; + case '学习': + this.getStudy() + break; + case '答题': + this.getAskLog() + break; + case '培训': + this.getTrain() + break; + case '资料收集': + case '方案': + this.getUploads() + break; + } + } + + }, + async getAskLog() { + const res = await listasklog({ + mission_id: this.id, + page: 1, + page_size: 999 + }) + this.ask_log = res.data + }, + openAnswer(arr, correct, range) { + this.$refs.answerQuestion.askList = arr + this.$refs.answerQuestion.isSubmit = true + this.$refs.answerQuestion.correct = correct + this.$refs.answerQuestion.range = range + this.$refs.answerQuestion.isShow = true + }, + async getInspection() { + const res = await listpatrol({ + mission_id: this.id, + page: 1, + page_size: 999 + }) + for (var k of res.data) { + var _names = [] + // 组别 + if (this.showform.groups && this.showform.groups.length > 0) { + for (var g of this.showform.groups) { + if (g.type == 1) { + + if (g.link_id.indexOf(k.up_admin.id) > -1) { + _names.push({ + group_name: g.name, + details: g.details + }) + } + } + if (g.type == 2) { + if (g.link_id.indexOf(k.up_admin.department_id) > -1) { + _names.push({ + group_name: g.name, + details: g.details + }) + } + } + } + k._names = _names + } + + console.log(k._names) + + } + + + + this.inspection_log = res.data + + }, + async getUnitTypeList() { + const res = await getparameteritem('unitTypeList') + this.unitTypeList = res.detail + }, + async getTrain() { + const res = await listtrain({ + mission_id: this.id, + page: 1, + page_size: 999 + }) + this.train_log = res.data + }, + async getUploads() { + const res = await listuploads({ + mission_id: this.id, + page: 1, + page_size: 999, + sort_name: 'created_at', + sort_type: 'DESC' + }) + this.uploads_log = res.data + }, + async getStudy() { + const res = await liststudy({ + mission_id: this.id, + page: 1, + page_size: 999 + }) + this.study_log = res.data + }, + openStudy(url, name) { + this.studyurl = url + this.studytitle = name + this.studytime + this.$refs.viewFile.studytype = 'study' + this.$refs.viewFile.needStudyTime = this.showform.study_time + this.$refs.viewFile.diaShow = true + }, + editorUnit(id, type, formtype) { + console.log(id,type) + if (id) { + this.$refs.addUnit.id = id + } + this.$refs.addUnit.type = type + this.$refs.addUnit.department_id = this.stateObj.department_id + this.$refs.addUnit.isShow = true + }, + studytime(e) { + console.log("e", e) + if (!this.studyForm.my_study_time) { + this.studyForm.my_study_time = 0 + } + this.studyForm.my_study_time = parseInt(this.studyForm.my_study_time) + e + }, + handleRemove(file, fileList) { + this.my_uploads_list = fileList + }, + handlesuccess(response, file, fileList) { + this.my_uploads_list = fileList + }, + submitFeedback() { + if (this.type == 'train') { + if (!this.trainForm.train_score) { + Message({ + type: 'warning', + message: '请提交培训评价' + }) + return + } + savetrain({ + mission_id: this.id, + ...this.trainForm + }).then(res => { + Message({ + type: 'success', + message: '提交成功' + }) + updatemission({ + id: this.id + }).then(r => { + this.isShow = false + this.$emit('refresh') + }) + saveLog({ + table_name:"missions_logs", + mission_id:this.id, + mission_name:this.showform.name, + op_name:'执行培训任务', + remark:'' + }).then(res=>{ + }) + }) + } else if (this.type == 'study') { + console.log(this.trainForm) + if (!this.studyForm.my_study_time || this.studyForm.my_study_time === 0) { + Message({ + type: 'warning', + message: '请先学习' + }) + return + } else { + if (this.studyForm.my_study_time < this.showform.study_time) { + Message({ + type: 'warning', + message: '当前学习时长不足,请继续学习' + }) + return + } + } + savestudy({ + mission_id: this.id, + ...this.studyForm + }).then(res => { + Message({ + type: 'success', + message: '提交成功' + }) + updatemission({ + id: this.id + }).then(r => { + this.isShow = false + this.$emit('refresh') + }) + saveLog({ + table_name:"missions_logs", + mission_id:this.id, + mission_name:this.showform.name, + op_name:'执行学习任务', + remark:'' + }).then(res=>{ + }) + }) + } else if (this.type == 'uploads') { + let _files = [] + if (this.my_uploads_list.length > 0) { + for (var h of this.my_uploads_list) { + if (h.response) { + _files.push(h.response.id) + } else { + _files.push(h.id) + } + } + this.uploadsForm.my_uploads = _files + } else { + this.uploadsForm.my_uploads = [] + Message({ + type: 'warning', + message: '请上传资料' + }) + return + } + saveuploads({ + mission_id: this.id, + ...this.uploadsForm + }).then(res => { + Message({ + type: 'success', + message: '提交成功' + }) + updatemission({ + id: this.id + }).then(r => { + this.isShow = false + this.$emit('refresh') + }) + saveLog({ + table_name:"missions_logs", + mission_id:this.id, + mission_name:this.showform.name, + op_name:`执行${this.is_what_unitType}任务`, + remark:'' + }).then(res=>{ + }) + + + }) + + } + + }, + submitCheck() { + let _files = [] + if (this.pictureList.length > 0) { + for (var h of this.pictureList) { + if (h.response) { + _files.push(h.response.id) + } else { + _files.push(h.id) + } + } + this.form.file_ids = _files + } else { + this.form.file_ids = [] + } + this.form.mission_groups = this.mission_groups_list + // return + save({ + id: this.id, + ...this.form + }).then(res => { + Message({ + type: 'success', + message: '审核成功' + }) + updatemission({ + id: this.id + }) + this.isShow = false + this.$emit('refresh') + }) + }, + }, + watch: { + isShow(newVal) { + if (newVal) { + console.log("type", this.type) + this.getDetail() + } else { + this.id = '' + this.type = '' + this.pictureList = [] + this.my_uploads_list = [] + this.uploadsForm = {} + this.trainForm = {} + this.studyForm = {} + this.studytitle = '', + this.studyurl = '', + this.is_what_unitType = '' + this.mission_groups_list = [{ + name: '', + type: 1, + link_id: [] + }] + this.$refs['dialog'].reset() + } + } + } + + } diff --git a/src/views/task/list/unit.vue b/src/views/task/list/unit.vue index 53653b5..51ad05d 100644 --- a/src/views/task/list/unit.vue +++ b/src/views/task/list/unit.vue @@ -33,7 +33,7 @@
-
+
全选
@@ -41,11 +41,11 @@
-
+
- 共有{{list.length}}项任务,{{total}}项任务,共{{auditStatus1}}项未完成
- -