待办任务->问答流程

This commit is contained in:
zyn
2023-04-03 14:56:55 +08:00
parent 72242c89f1
commit 2646ffef5e
4 changed files with 531 additions and 5 deletions
@@ -1992,18 +1992,16 @@ export default {
}
case '27':
this.$router.push({
name: 'MyQuestions',
query:{
name: 'MyQuestions2',
query: {
taskIds: row.taskIds,
prcId: row.prcId,
prcNum: row.prcNum,
prcName: row.prcName,
prcType: row.prcType,
}
})
break
break
}
},
},
@@ -0,0 +1,301 @@
<!--我的回答-->
<template>
<div>
<el-divider style="margin: 10px 0;"></el-divider>
<div id="message-content">
<el-form ref="form" :model="form" :rules="rules">
<el-form-item prop="reply">
<el-input
type="textarea"
:rows="2"
placeholder="请输入回答内容"
v-model="form.reply">
</el-input>
</el-form-item>
<div>
<el-button
type="primary"
class="common-button-primary"
size="small"
style="float: right;"
@click="handleSubmit"
>提交</el-button>
<el-button
type="primary"
class="common-button-primary"
size="small"
style="float: right;margin-right: 10px;"
@click="openUploadFileDialog"
>上传文件</el-button>
<el-button
type="primary"
class="common-button-primary"
size="small"
style="float: right;"
@click="queArchive"
>问题归档</el-button>
<el-button
type="primary"
class="common-button-primary"
size="small"
style="float: right;margin-right: 10px;"
@click="invitation"
>邀请</el-button>
</div>
</el-form>
</div>
<el-dialog
width='400px'
:visible.sync="importModalshowflagtemp"
title="上传文件"
:footer-hide="true"
append-to-body
>
<el-upload
multiple
drag
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-remove="removeOneFile"
:action="actionPath"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
name="file"
:limit="5"
:on-exceed="handleExceed"
:file-list="fileList"
ref="importFileAboutStand">
<i class="el-icon-upload"></i>
<div class="el-upload__text">点击或拖拽上传文件</div>
</el-upload>
</el-dialog>
<!--归档弹窗 -->
<el-dialog
title="问题归档"
:visible.sync="dialogVisible"
width="650px"
:before-close="handleClose">
<div>
<el-form ref="queForm" :rules="queRules" class="label-input-form" label-width="80px" :model="questionForm">
<div v-for="(item,index) in queList" :key="index">
<el-form-item label="回答" prop="problemDescription" class="serch-form-item">
<el-input v-model="item.reply"></el-input>
</el-form-item>
</div>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="common-button-default" size="mini" @click="dialogVisible = false"> </el-button>
<el-button class="common-button-primary" size="mini" type="primary" :loading="submitBtnLoading" @click="queSubmit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: "answerItem",
props: {
list: {
type: Array,
required: false
},
asdId:{
type: String,
required: true
}
},
data(){
return{
roleFlag: false,
nodeList: [],
flag:'',
mergeSelectList: [],
// 上传地址
actionPath: 'api/att/attFile/uploadNew',
importModalshowflagtemp: false,
submitBtnLoading: false,
dialogVisible: false,
queList:[],
queRules:{},
questionForm:{
problemDescription: '', //回答
},
fileList: [],
form:{
reply: '',
answerer: this.$store.getters.userInfo.userId,
},
rules: {
reply: [
{ required: true, message: '请输入回复内容', trigger: 'blur' },
{ min: 1, max: 500, message: '长度在 1 到 500 个字符', trigger: 'blur' }
]
},
}
},
methods:{
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
deleteReplyToenNotice(){
let taskId = this.$route.query.taskIds
return new Promise((resolve,reject) => {
this.$http.post('lawss/activiti/deleteReplyToenNotice',{
taskId,
answerer: this.$store.getters.userInfo.usid || this.$store.getters.userInfo.userId
},
{
_this: this
}, res => {
resolve(res)
}, e => {
reject(e)
})
})
},
//提交
handleSubmit(){
this.$refs['form'].validate((valid) => {
if (valid) {
this.$emit('emitInsState',false)
// let asdId = sessionStorage.getItem('queId')
this.form.fileList = this.fileList
this.form.askId = this.asdId
this.$http.postData('lawss/Reply/insertReply',{ ...this.form },{
_this: this
}, res => {
if(this.list.length === 0){
this.deleteReplyToenNotice()
.then(res => {
this.$http.post("lawss/activiti/completeTask", {
json: JSON.stringify(this.form),
taskId: this.$route.query.taskIds,
userId: this.$store.getters.userInfo.userId
}, {}, res => {
});
this.form.reply = ''
this.fileList = []
this.$emit('emitInsState',true)
}).catch(e => console.log(e))
}else{
this.$http.post("lawss/activiti/completeTask", {
json: JSON.stringify(this.form),
taskId: this.$route.query.taskIds,
userId: this.$store.getters.userInfo.userId
}, {}, res => {
});
if(res.respCode === '200'){
this.form.reply = ''
this.fileList = []
this.$emit('emitInsState',true)
console.log('----------1111----------')
//此处需要调用父组件中的方法,将问题列表进行刷新操作
}
}
}, e => {
})
}
})
},
//上传文件
openUploadFileDialog(){
this.importModalshowflagtemp = true
},
//上传成功
uploadSuccess(res,file,fileList){
if(res.ok){
this.fileList.push(res.data)
this.$message.success('上传成功')
}else{
this.$message.warning(res.message)
fileList.pop()
}
// this.importModalshowflagtemp = false
},
//文件上传前
beforeUpload(file){
console.log(file);
var filename = file.name;
var index1 = filename.lastIndexOf('.')
var index2 = filename.length
var fileSuffix = filename.substring(index1, index2)
//把后缀转大写
if(fileSuffix){
fileSuffix = fileSuffix.toUpperCase()
}
// 判断上传文件格式
if (fileSuffix === ".PDF" || fileSuffix === ".DOC" || fileSuffix === ".DOCX" || fileSuffix === ".PPT"
|| fileSuffix === ".PPTX" || fileSuffix === ".XLS" || fileSuffix === ".XLSX"
|| fileSuffix === ".PNG" || fileSuffix === ".JPG" || fileSuffix === ".JPEG") {
return true;
} else {
this.$message.error("文件" + file.name + "格式不正确,请上传pdf、doc、docx、ppt、pptx、xls、xlsx、png、jpg、jpeg等文件");
return false;
}
// 判断文件上传大小
if (file.size / 1024 / 1024 > 300) {
this.$message.warning("文件" + file.name + "大小不能超过300M");
return false;
}
return true;
},
//删除文件
removeOneFile(){
this.fileList.forEach((item,index) => {
if(item.name === file.name || item.id === file.id){
this.fileList.splice(index, 1)
}
})
},
handleClose(){
this.queList = []
this.dialogVisible = false
},
queSubmit(){
console.log(this.queList);
let queList = JSON.stringify(this.queList)
this.$emit('emitInsState',false)
this.$http.postData('lawss/Reply/updateReply',queList,
{
_this: this
}, res => {
if(res.respCode === '200'){
this.$emit('emitInsState',true)
}
}, e => {
})
},
//问题归档
queArchive(){
console.log(this.mergeSelectList);
this.mergeSelectList = this.mergeSelectList.filter ( item => item.state !== 'yes' && item.checked);
for (let i = 0; i < this.mergeSelectList.length; i++) {
if(this.mergeSelectList[i].checked){
this.queList.push(this.mergeSelectList[i])
}
}
if(this.queList && this.queList.length > 0){
this.dialogVisible = true
}else {
this.$message.warning('请选择归档内容')
}
},
//邀请
invitation(){
this.$emit('roleFlagBoo',true)
},
},
created () {
this.mergeSelectList = JSON.parse(JSON.stringify(this.list))
},
};
</script>
<style lang="less" scoped>
#message-content{
}
</style>
@@ -0,0 +1,218 @@
<!--我的问答-->
<template>
<div id="my-questions">
<div class="search-area">
<el-form :model="form" :inline="true" label-width="80px">
<el-form-item label="标准类型">
<el-input v-model="form.classification" readonly></el-input>
</el-form-item>
<el-form-item label="标准号">
<el-input v-model="form.standardEncdoing" readonly></el-input>
</el-form-item>
<el-form-item label="标准名称">
<el-input v-model="form.standardName" readonly></el-input>
</el-form-item>
<el-form-item label="问题">
<el-input v-model="form.problemDescription" readonly></el-input>
</el-form-item>
</el-form>
</div>
<div class="tab-box">
<template v-for="(item, index) in answerList">
<div class="clearfix">
<div class="answer-box" >
<question-item-info :key="qiiKey"
:answer="item"
:fileList="fileListSetFunc(item)"
:questionerForm="form"></question-item-info>
</div>
</div>
</template>
<loading :loading="dataLoading">正在加载数据</loading>
</div>
<div class="info-answer">
<answer-item2 :key="aiKey" :list="answerList" :asdId="asdId" @roleFlagBoo="roleFlagBooFunc" @emitInsState="emitInsState"></answer-item2>
</div>
<!-- 选择回答人-->
<Role-tree
is-title="选择回答人"
:is-visible.sync="roleFlag"
@checkedRole="checkedRole"
:nodeList="nodeList"
></Role-tree>
</div>
</template>
<script>
import questionItemInfo from "@/pages/personal/pages/my-questions/components/questionItemInfo";
import answerItem2 from "@/pages/personal/pages/my-questions/components/answerItem2";
export default {
name: "index2",
components:{
questionItemInfo,
answerItem2
},
data(){
return{
form:{
classification:"",
standardEncdoing:"",
standardName:"",
problemDescription:"",
fileList:[]
},
answerList:[],
qiiKey:1,
aiKey:1,
dataLoading:true,
// 选择回答人
roleFlag: false,
nodeList: [],
asdId:""
}
},
mounted(){
this.getData()
},
methods:{
getData(){
let taskId = this.$route.query.taskIds
this.$http.get('lawss/activiti/selectAskId',{
taskId,
},
{
_this: this
}, val => {
this.asdId = val
this.$http.post('lawss/AskQuestions/selectQuestionReplyInfo',{
id: val
},
{
_this: this
}, res => {
this.form=res.data[0]
if(res.data[1].length){
res.data[1].forEach(item => {
item.checkedShow = true
if(item.state && item.state === 'yes'){
item.checked = true
}else {
item.checked = false
}
})
}
this.answerList = res.data[1]
this.dataLoading = false
}, e => {
})
}, e => {
})
},
fileListSetFunc(item){
return this.assemble(item.appendixId,item.appendixName)
},
assemble(ids,names){
let list= [];
if(ids && ids !== '' && names && names !== ''){
let idArray=ids.split(',');
let nameArray=names.split(',');
for(let i=0; i<idArray.length; i++){
list.push({id:idArray[i],name:nameArray[i]});
}
}
return list;
},
// 邀请
roleFlagBooFunc(boo){
if(boo){
this.roleFlag = true
}
},
checkedRole(data){
if(data[0].id){
let asdId = sessionStorage.getItem('queId')
this.$http.postData('lawss/AskUser/insertAskUser',{
asdId: asdId,
usid: data[0].id,
},{
_this: this
}, res => {
}, e => {
})
}
},
emitInsState(state){
if(state){
this.getData()
}else {
this.dataLoading = true
}
},
}
};
</script>
<style lang="less" scoped>
.search-area {
display: flex;
justify-content: space-between;
background: #FFF;
padding: 10px 10px 0;
border-bottom: 1px solid #DCDFE6;
}
.search-area .el-form-item {
margin-bottom: 10px;
}
/deep/ .search-area .el-form-item .el-form-item__label{
color: #333;
padding-right: 5px;
}
/deep/ .search-area .el-form-item .el-form-item__content {
line-height: 30px;
.el-input input{
height: 30px;
width: 350px;
}
}
#my-questions {
height: calc(100vh - 75px);
display: flex;
flex-direction: column;
background: #F5F7FA;
margin-bottom: 10px;
.tab-box {
height: 68%;
background-color: #fff;
overflow: auto;
}
}
.answer-box{
height: auto;
width: auto;
background: #F5F7FA;
float: right;
margin: 20px 10px 0 80px;
word-break: break-word; /* 文本行的任意字内断开 */
word-wrap: break-word; /* IE */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP printers */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: pre; /* CSS2 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
}
.info-answer{
height: 200px;
width: 100%;
position: absolute;
bottom: 0;
//border-top: 1px solid #cccccc;
}
</style>
+9
View File
@@ -330,6 +330,15 @@ const routes = [
// menuId: ''
}
},
{
path: '/questions2',
name: 'MyQuestions2',
component: resolve => require(['@/pages/personal/pages/my-questions/index2.vue'], resolve),
meta: {
requireAuth: false,
title: '我的问答'
}
},
{
path: '/questionDetail',
name: 'QuestionDetail',