Files
foton-laws-system-front/src/pages/regulatoryRepository/standQA/index.vue
T

1175 lines
44 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--问答库-->
<template>
<div id="my-questions">
<div class="search-area">
<el-form :inline="true" :model="questionSerach" >
<el-form-item class="el-form-item search-item" label="标准">
<el-select v-model="questionSerach.classification">
<el-option
v-for="opt in classificationOption"
:key="opt.value"
:value="opt.value"
:label="opt.label"
></el-option>
</el-select>
</el-form-item>
<el-form-item class="el-form-item search-item" label="标准号">
<el-input v-model="questionSerach.standardEncdoing" placeholder="根据标准号查询"></el-input>
</el-form-item>
<el-form-item class="el-form-item search-item" label="标准名称">
<el-input v-model="questionSerach.standardName" placeholder="根据标准名称查询"></el-input>
</el-form-item>
<el-form-item class="el-form-item search-item" label="关键词">
<el-input v-model="questionSerach.problemDescription" placeholder="根据关键词查询"></el-input>
</el-form-item>
<el-form-item>
<el-button size="mini" @click="searchBtn">查询</el-button>
</el-form-item>
<el-form-item>
<el-button size="mini" @click="delSearch">清空</el-button>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="queBtn">提问</el-button>
</el-form-item>
</el-form>
</div>
<div class="tab-box">
<el-table
ref="selections"
tooltip-effect="dark"
style="width: 100%; flex: auto;"
class="drag-table"
height="92%"
border
:loading="tableLoading"
:data="tableData"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
>
<el-table-column show-overflow-tooltip label="分类" prop="classification" align="center" min-width="50" :formatter="formatClassification"></el-table-column>
<el-table-column show-overflow-tooltip label="标准号/问题分类" width="150" align="center" prop="standardEncdoing"></el-table-column>
<el-table-column show-overflow-tooltip label="标准名称" prop="standardName" align="center" min-width="100"></el-table-column>
<el-table-column show-overflow-tooltip label="问题描述" prop="problemDescription" align="center" min-width="300"></el-table-column>
<el-table-column prop="questionTime" width="150" align="center" label="提问日期"></el-table-column>
<el-table-column label="操作" align="center" width="50" fixed="right">
<template slot-scope="scope">
<div @click.stop style="display: inline-block">
<el-dropdown trigger="click" @command="handleCommand2">
<i class="iconfont">&#xe61e;</i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="[scope.row, '查看']">查看</el-dropdown-item>
<el-dropdown-item :command="[scope.row, '订阅']">订阅</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<!--分页-->
<pagination
style="position: relative;"
:page="questionSerach.page"
:total="questionSerach.total"
@pageChange="pageChangeFun"
@pageSizeChange="pageSizeChangeFun"></pagination>
</div>
<!--提问弹窗 -->
<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">
<el-form-item label-width="30px" >
<el-radio-group v-model="standType" @change="standTypeChange">
<el-radio label="INLAND">国内标准</el-radio>
<el-radio label="FOREIGN">海外标准</el-radio>
<el-radio label="BUSINESS_STAND">企业标准</el-radio>
<el-radio label="OTHER">公共</el-radio>
</el-radio-group>
<div style="display: inline-block; margin-left: 20px" v-if="standType === 'OTHER'">
<el-select v-model="questionForm.pubQue" placeholder="请选择公共问题">
<el-option
v-for="item in pubOptions"
:key="item.label"
:label="item.label"
:value="item.label">
</el-option>
</el-select>
</div>
<el-button v-else size="mini" style="margin-left: 30px;" type="primary" @click="addList">选择标准</el-button>
</el-form-item>
<el-form-item label="问题" prop="problemDescription" class="serch-form-item">
<el-input v-model="questionForm.problemDescription" @input="changeInput"></el-input>
</el-form-item>
<el-form-item label="附件">
<el-upload
class="upload-demo"
drag
:file-list="fileList"
:action="actionPath"
accept=".ZIP, .zip, .docx, .DOCX, .xls, .xlsx, .pdf, .PDF"
:before-upload="beforeUploadTheme"
:before-remove="beforeRemoveTheme"
:on-success="onsuccessTheme"
multiple>
<div style="margin-top: 10px">
<i class="el-icon-upload" style="margin: 0"></i>
<div class="el-upload__text" style="margin-top: -15px">将文件拖到此处<em>点击上传</em></div>
</div>
</el-upload>
</el-form-item>
</el-form>
</div>
<span>相似历史问题</span>
<div style="height: 200px; width: 80%; margin-left: 80px;">
<div v-for="item in historyList" :key="item.id" @click="historyJump(item)">
<span class="history-item">{{item.problemDescription}}</span>
<span class="history-item">{{item.questionTime}}</span>
</div>
</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" @click="queSubmit"> </el-button>
</span>
</el-dialog>
<!-- 选择标准抽屉-->
<el-drawer
class="drawer-table"
title="选择标准"
:wrapperClosable="false"
:visible.sync="standModel"
size="900px"
custom-class="demo-drawer"
>
<div class="demo-drawer-content">
<el-form
class="label-input-form"
style="margin-top: 15px;"
label-width="130px"
:modal="handleSelectForm"
:inline="true"
>
<el-form-item label="标准/政策来源" class="search-item">
<el-select
v-model="handleSelectForm.dataSource"
@change="dataSourceChange"
:popper-append-to-body="false"
placeholder="请选择标准来源">
<el-option value="INLAND" label="国内标准库"></el-option>
<el-option value="FOREIGN" label="海外标准库"></el-option>
<el-option value="BUSINESS_STAND" label="企业标准库"></el-option>
</el-select>
</el-form-item>
<el-form-item label="标准号/标准名称" class="search-item">
<el-input
v-model="handleSelectForm.lawNumber"
@change="lawNumberSearch"
placeholder="根据标准号/标准名称查找"
clearable
:maxlength="100"></el-input>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
size="small"
type="primary"
class="common-button-primary"
@click="searchLawBtn">
查询
</el-button>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
class="common-button-default"
size="small"
type="default"
@click="clearLawBtn">
清空
</el-button>
</el-form-item>
</el-form>
<loading :loading="lawInfoTableLoading">数据获取中</loading>
<el-table
ref="selections"
tooltip-effect="dark"
style="width: 100%;"
border
:loading="lawInfoTableLoading"
:data="lawInfoTable"
:height="300"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@selection-change="handleSelectTableChange"
>
<el-table-column
fixed="left"
type="selection"
width="55"
align="center">
</el-table-column>
<div v-if="handleSelectForm.dataSource === 'INLAND'">
<el-table-column
label="标准号"
width="150"
>
<template slot-scope="scope">
<a v-if="scope.row.standYear && textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" class="table-jump" style="color: #F56C6C"
@click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{
scope.row.standNumber
}}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else-if="scope.row.standYear" class="table-jump" style="color: #333333"
@click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{
scope.row.standNumber
}}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else @click="handlePreview(scope.row)" class="table-jump" style="color: #333333">
{{ scope.row.standSortShow }}
{{ scope.row.standNumber }}</a>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="standName"
label="标准名称"
min-width="300"
>
<template slot-scope="scope">
<a v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" @click="handlePreview(scope.row)" class="table-jump" style="color: #F56C6C">{{ scope.row.standName }}</a>
<a v-else @click="handlePreview(scope.row)" style="color: #333333" class="table-jump">{{ scope.row.standName }}</a>
</template>
</el-table-column>
<el-table-column
prop="issueTime"
width="120"
label="发布日期">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{ formatIssueDate(scope.row.issueTime) }}</span>
<span v-else>{{ formatIssueDate(scope.row.issueTime) }}</span>
</template>
</el-table-column>
<el-table-column
prop="ssrq"
width="120"
label="实施日期">
<template slot-scope="scope">
<!-- {{ formatIssueDate(scope.row.putTime) }}-->
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{ scope.row.SSRQ ? scope.row.SSRQ.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.ssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="xcxssrq"
width="150"
label="新车型实施日期">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{ scope.row.xcxssrq ? scope.row.xcxssrq.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.xcxssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="zccssrq"
width="150"
label="在产车实施日期">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{ scope.row.zccssrq ? scope.row.zccssrq.substring(0, 10) : '-' }}</span>
<span v-else>{{ scope.row.zccssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="textStatus"
width="110"
label="文本状态">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{
textStatusMap[scope.row.textStatus]
}}</span>
<span v-else>{{ textStatusMap[scope.row.textStatus] }}</span>
</template>
</el-table-column>
</div>
<div v-if="handleSelectForm.dataSource === 'FOREIGN'">
<el-table-column
label="标准号"
width="150"
>
<template slot-scope="scope">
<a v-if="scope.row.standYear && textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C" class="table-jump" @click="handlePreview(scope.row)">
{{scope.row.standSortShow}} {{ scope.row.standNumber }}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF" class="table-jump" @click="handlePreview(scope.row)">
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else-if="scope.row.standYear" style="color: #333333" class="table-jump" @click="handlePreview(scope.row)">
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}{{ scope.row.standYear ? '-' + scope.row.standYear : '' }}</a>
<a v-else style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">
{{ scope.row.standSortShow }} {{ scope.row.standNumber }}</a>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="standName"
label="标准名称"
min-width="300"
>
<template slot-scope="scope">
<a v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{
scope.row.standName
}}</a>
<a v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF" @click="handlePreview(scope.row)" class="table-jump">{{
scope.row.standName
}}</a>
<a v-else style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{
scope.row.standName
}}</a>
</template>
</el-table-column>
<el-table-column
prop="issueTime"
width="120"
label="发布日期">
<template slot-scope="scope">
<div v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">
{{ formatIssueDate(scope.row.issueTime) }}
</div>
<div v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF">
{{ formatIssueDate(scope.row.issueTime) }}
</div>
<div v-else style="color: #333333">
{{ formatIssueDate(scope.row.issueTime) }}
</div>
</template>
</el-table-column>
<el-table-column
prop="ssrq"
width="120"
label="实施日期">
<template slot-scope="scope">
<!-- {{ formatIssueDate(scope.row.putTime) }}-->
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{
scope.row.ssrq
}}</span>
<span v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF">{{
scope.row.ssrq
}}</span>
<span v-else style="color: #333333">{{ scope.row.ssrq }}</span>
</template>
</el-table-column>
<el-table-column
prop="xcxssrq"
width="150"
label="新车型实施日期">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{
scope.row.xcxssrq
}}</span>
<span v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF">{{
scope.row.xcxssrq
}}</span>
<span v-else style="color: #333333">{{
scope.row.xcxssrq
}}</span>
</template>
</el-table-column>
<el-table-column
prop="zccssrq"
width="150"
label="在产车实施日期">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{
scope.row.zccssrq
}}</span>
<span v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF">{{
scope.row.zccssrq
}}</span>
<span v-else style="color: #333333">{{
scope.row.zccssrq
}}</span>
</template>
</el-table-column>
<el-table-column
prop="textStatus"
width="110"
label="文本状态">
<template slot-scope="scope">
<span v-if="textStatusMap[scope.row.textStatus] === '废止' || textStatusMap[scope.row.textStatus] === '被代替'" style="color: #F56C6C">{{
textStatusMap[scope.row.textStatus]
}}</span>
<span v-else-if="textStatusMap[scope.row.textStatus] === '——' " style="color: #409EFF">{{
textStatusMap[scope.row.textStatus]
}}</span>
<span v-else style="color: #333333">{{ textStatusMap[scope.row.textStatus] }}</span>
</template>
</el-table-column>
</div>
<div v-if="handleSelectForm.dataSource === 'BUSINESS_STAND'">
<el-table-column
show-overflow-tooltip
label="企标编号"
width="150"
>
<template slot-scope="scope">
<!-- <a v-if="scope.row.standYear" class="table-jump" @click="handlePreview(scope.row)">{{ scope.row.standSortShow }} {{ scope.row.standNumber }}-{{ scope.row.standYear }}</a>-->
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standCode }}</a>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="standName"
label="中文名称"
min-width="300"
>
<template slot-scope="scope">
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow === '参考' " style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standName }}</a>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="standEnName"
label="英文名称"
min-width="300"
>
<template slot-scope="scope">
<a v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
<a v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'" style="color: #333333" @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.standEnName }}</a>
</template>
</el-table-column>
<el-table-column
prop="issueTime"
label="发布日期"
width="120"
>
<template slot-scope="scope">
<span v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C">{{scope.row.issueTime}}</span>
<span v-if="scope.row.standStatusShow === '参考' " style="color: #E6A23C">{{scope.row.issueTime}}</span>
<span v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'">{{scope.row.issueTime}}</span>
</template>
</el-table-column>
<el-table-column
prop="putTime"
label="实施日期"
width="120"
>
<template slot-scope="scope">
<span v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C">{{scope.row.putTime}}</span>
<span v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C">{{scope.row.putTime}}</span>
<span v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'">{{scope.row.putTime}}</span>
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="standStatusShow"
label="文本状态"
width="110"
>
<template slot-scope="scope">
<span v-if="scope.row.standStatusShow === '作废'" style="color: #F56C6C">
{{scope.row.standStatusShow}}
</span>
<span v-if="scope.row.standStatusShow === '参考'" style="color: #E6A23C">
{{scope.row.standStatusShow}}
</span>
<span v-if="scope.row.standStatusShow !== '作废' && scope.row.standStatusShow !== '参考'">
{{scope.row.standStatusShow}}
</span>
</template>
</el-table-column>
</div>
</el-table>
<!--分页-->
<pagination
v-show="this.lawInfoTableLoading === false"
style="position: relative;"
:page="handleSelectForm.page"
:total="handleSelectForm.total"
@pageChange="handleSelectPageChange"
@pageSizeChange="handleSelectPageSizeChange"></pagination>
<div slot="footer" class="demo-drawer-footer">
<el-button class="common-button-default" size="mini" @click="standModel = false">取消</el-button>
<el-button type="primary" size="mini" class="common-button-primary" @click="handleSelectConfirm" v-show="lawInfoTableLoading === false">确定</el-button>
</div>
</div>
</el-drawer>
<!-- 详情抽屉-->
<el-drawer
class="drawer-table"
title="查看问题"
:wrapperClosable="false"
:visible.sync="answerListDrawer"
size="900px"
custom-class="demo-drawer"
>
<div class="demo-drawer-content">
<!-- <loading :loading="lawInfoTableLoading">数据获取中</loading>-->
<div style="height: 90%;overflow-y: auto;">
<template v-for="(item, index) in answerList">
<div class="clearfix">
<div class="answer-box" >
<question-item-info :answer="item"></question-item-info>
</div>
</div>
</template>
</div>
<div slot="footer" class="demo-drawer-footer">
<el-button class="common-button-default" size="mini" @click="answerListDrawer = false">取消</el-button>
</div>
</div>
</el-drawer>
</div>
</template>
<script>
import questionsItem from './components/questions-item'
import answerItem from "./components/answerItem";
import questionItemInfo from "./components/questionItemInfo";
import standItem from './components/stand-item'
function debounce(func, wait = 500){
let timeout;
return function(event){
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
},wait)
}
}
export default {
name: "standQA",
components:{
questionItemInfo,
questionsItem,
answerItem,
standItem
},
data(){
return{
historyList: [],
pubOptions: [], //公共问题
handleSelectForm: {
standName: '', //标准名称
numberName: '', //政策名称
lawsNumber: '', //政策编号
standNumber: '', //标准编号
standCode: '', //企标编号
textStatus: '', //标准状态
dataSource: 'INLAND',
standType: 'INLAND',
lawNumber: '', // 标准编号/政策编号
lawName: '', // 标准名称/政策名称
page: 1,
pageSize: this.$store.getters.userInfo.configContent,
bpnId: '',
total: 0,
quoteIdList: '',
validFlag: '0',
menuId: 'nomenu'
},
textStatusMap: {},// 文本状态id与name对应
textState: [],
DYGGWT: [],
standModel: false,
lawInfoTableLoading: true,
handleSelectTableList: [],
lawInfoTable: [],
// 上传地址
actionPath: 'api/att/attFile/uploadNew',
fileList: [], //上传文件的列表
activeName: 'INLAND',
activeType: 'INLAND',
activestand: '',
activeQue: '',
standType: 'INLAND',
dialogVisible: false,
questionForm:{
classification: 'INLAND', //标准类型
problemDescription: '', //问题
standardEncdoing: '', //标准编号
standardName: '', //标准名称
standardId:'', //标准id
fileList: '',
publicType: '',
},
queRules:{
problemDescription: [
{required: true, message: '请输入问题', trigger: 'blur'},
],
},
classificationOption: [
{
value: 'INLAND',
label: '国内标准'
},
{
value: 'FOREIGN',
label: '海外标准'
},
{
value: 'BUSINESS_STAND',
label: '企业标准'
},
{
value: 'OTHER',
label: '公共问题'
}
],
tableData: [],
tableLoading: false,
tableTotal: 0,
questionSerach:{
classification: 'INLAND',
standardName: '', //标准名称
standardEncdoing: '', //标准编号
problemDescription: '', //关键词/问题描述
page: 1,
pageSize: this.$store.getters.userInfo.configContent,
total: 0
},
answerList: [],
answerListDrawer: false,
answer: '',
standList: [],
standIdList: [],
questionsList: [],
standMap: new Map()
}
},
mounted(){
this.questionSerach.standardName = this.$route.query.standName
this.questionSerach.classification = this.$route.query.standType
this.searchBtn()
// 查询各下拉框数据
this.$http.get("sys/dictype/getDicTypeListCode", "", {
_this: this,
loading: "loading"
}, res => {
this.setMap(res.data.WBZTCLASS);// 文本状态
this.textState = res.data.WBZTCLASS // 文本状态
this.pubOptions = res.data.DYGGWT //问答公共问题
}, e => {
});
},
methods:{
formatClassification(e){
for (let i=0; i<this.classificationOption.length; i++){
if(e.classification === this.classificationOption[i].value){
return this.classificationOption[i].label
}
}
},
// 展示区域 更多
handleCommand2 (command) {
switch (command[1]) {
case '查看':
this.handleDetail(command[0])
break
case '订阅':
this.subscribe(command[0])
break
}
},
handleDetail(row){
console.log('row = ', row)
this.$http.get('lawss/AskQuestions/getAskQuestionsByakId',{
id: row.id,
state: 'yes'
},{
_this: this
}, res => {
this.answerListDrawer = true
this.answerList = res.data
}, e => {
})
},
subscribe(row){
this.$http.postData('lawss/Subscription/insertSubscription',{
askId: row.id,
usId: this.$store.getters.userInfo.userId,
},{
_this: this
}, res => {
console.log(res);
})
},
refreshStandMap(){
this.standMap = new Map()
this.standList.forEach(item=>{
this.standMap.set(item.standardId,item)
})
},
changeInput:debounce(function(val){
if(val.length){
this.$http.get('lawss/AskQuestions/resemblance',{
problemDescription: val,
},{
_this: this
}, res => {
this.historyList = res.data
})
}
}),
//点击跳转问题详情
historyJump(item){
this.$router.push({
path: '/standQA',
query:{
standId: item.standardId,
queId: item.id,
sourceType: 'dialog',
standType: item.classification,
standName: item.standardName,
}
})
this.dialogVisible = false
},
// 点击查看
handlePreview(item) {
let routeUrl = this.$router.resolve({
name: "OtherStandardDetails",
params: {
id: item.id || item.standId,
pageType: item.standType + '_STAND'
}
});
window.open(routeUrl.href, "_blank");
},
// 将文本状态的id与name对应
setMap(data) {
data.forEach(item => {
this.$set(this.textStatusMap, item.value, item.label)
})
},
dataSourceChange() {
this.handleSelectForm.page = 1
this.lawInfoTableLoading = true
this.handleSelectForm.standType = this.handleSelectForm.dataSource
this.searchLawBtn()
},
isRelateAccessChange(){
this.handleSelectForm.page = 1
this.lawInfoTableLoading = true
this.handleSelectForm.standType = this.handleSelectForm.dataSource
this.searchLawBtn()
},
//根据标准编号的查询
lawNumberSearch() {
this.handleSelectForm.standNumber = this.handleSelectForm.lawNumber
this.handleSelectForm.lawsNumber = this.handleSelectForm.lawNumber
this.handleSelectForm.standCode = this.handleSelectForm.lawNumber
},
addList() {
this.handleSelectForm.lawNumber = ''
this.handleSelectForm.dataSource = this.standType
this.handleSelectForm.standType = this.standType
this.searchLawBtn()
this.standModel = true;
},
//选择标准确定按钮
handleSelectConfirm(){
if(this.handleSelectTableList.length === 1){
if(this.handleSelectForm.dataSource === 'BUSINESS_STAND'){
this.questionForm.standardEncdoing = this.handleSelectTableList[0].standCode
}else{
this.questionForm.standardEncdoing = this.handleSelectTableList[0].standYear ?
this.handleSelectTableList[0].standSortShow + '\xa0' + this.handleSelectTableList[0].standNumber + '-' + this.handleSelectTableList[0].standYear :
this.handleSelectTableList[0].standSortShow + this.handleSelectTableList[0].standNumber
}
this.questionForm.standardName = this.handleSelectTableList[0].standName
this.questionForm.standardId = this.handleSelectTableList[0].id
this.standModel = false
}else{
this.$message.warning('请选择一条数据进行添加')
}
},
//选择标准的查询按钮
searchLawBtn(){
this.lawInfoTableLoading = true
if (this.handleSelectForm.dataSource === 'INLAND'){
this.$http.get('sarStandardsInfo/sar-standards-info/getSarStandardsInfoPageByWk1',this.handleSelectForm,{
_this: this
},res=>{
if (res.ok){
this.lawInfoTable = res.data.list
this.handleSelectForm.total = res.data.count
if ((this.lawInfoTable.length === 0 || this.lawInfoTable === []) && this.handleSelectForm.page !== 1) {
this.lawInfoTableLoading = true
this.handleSelectPageChange(1)
}else {
this.lawInfoTableLoading = false
this.lawInfoTableLoading = false
}
}else {
this.$message.error(res.message)
}
},e=>{
this.lawInfoTable = []
this.handleSelectForm.total = 0
})
}else if(this.handleSelectForm.dataSource === 'FOREIGN'){
this.$http.get('sarStandardsInfo/sar-standards-info/getSarStandardsInfoPageByWk1',this.handleSelectForm,{
_this: this
},res=>{
if (res.ok){
this.lawInfoTable = res.data.list
this.handleSelectForm.total = res.data.count
if ((this.lawInfoTable.length === 0 || this.lawInfoTable === []) && this.handleSelectForm.page !== 1) {
this.lawInfoTableLoading = true
this.handleSelectPageChange(1)
}else {
this.lawInfoTableLoading = false
}
}else {
this.$message.error(res.message)
this.lawInfoTableLoading = false
}
},e=>{
this.lawInfoTable = []
this.handleSelectForm.total = 0
})
}else if(this.handleSelectForm.dataSource === 'BUSINESS_STAND'){
this.$http.get('lawss/sarBussionessStand/getSarBussionStandPage',this.handleSelectForm,{
_this: this
},res=>{
if (res.ok){
this.lawInfoTable = res.data.list
this.handleSelectForm.total = res.data.count
if ((this.lawInfoTable.length === 0 || this.lawInfoTable === []) && this.handleSelectForm.page !== 1) {
this.lawInfoTableLoading = true
this.handleSelectPageChange(1)
}else {
this.lawInfoTableLoading = false
}
}else {
this.$message.error(res.message)
this.lawInfoTableLoading = false
}
},e=>{
this.lawInfoTable = []
this.handleSelectForm.total = 0
})
}else {
this.$message.warning('请先选择标准/政策来源')
}
},
//手动查找的清空按钮
clearLawBtn(){
this.lawInfoTableLoading = true
this.handleSelectForm.lawNumber = ''
this.handleSelectForm.textStatus = ''
this.handleSelectForm.isRelateAccess = ''
this.handleSelectForm.standNumber = ''
this.handleSelectForm.lawsNumber = ''
this.handleSelectForm.standCode = ''
//清空标准名称/政策名称的查询
this.handleSelectForm.lawName = ''
this.handleSelectForm.standName = ''
this.handleSelectForm.numberName = ''
this.searchLawBtn()
},
formatIssueDate(str) {
const momentDate = this.$moment(str)
if (momentDate.isValid()) {
return this.$moment(str).format('YYYY-MM-DD')
} else {
return str
}
},
//添加标准勾选框数据
handleSelectTableChange (data) {
this.handleSelectTableList = data
},
handleSelectPageChange(page){
this.lawInfoTableLoading = true
this.handleSelectForm.page = page
this.searchLawBtn()
},
handleSelectPageSizeChange(pageSize){
this.lawInfoTableLoading = true
this.handleSelectForm.pageSize = pageSize
this.searchLawBtn()
},
//单选框type值改变
standTypeChange(){
this.questionForm.classification = this.standType
},
//提问按钮
queBtn(){
this.fileList = []
if(this.standList.length === 0){
this.standType = !this.activeType ? 'INLAND' : this.activeType
this.questionForm = {
pubQue : '',//公共问题
classification: !this.activeType ? 'INLAND' : this.activeType, //标准类型
problemDescription: '', //问题
questioner: this.$store.getters.userInfo.userId, //提问人
standardEncdoing: '', //标准编号
standardName: '', //标准名称
standardId:'', //标准id
fileList: '',
}
}else{
const selectedStand = this.activestand == '0' || this.activeType === 'INLAND' ? this.standList[0] : this.standMap.get(this.activestand)
this.standType = selectedStand.classification
this.questionForm = {
pubQue : selectedStand.classification === "OTHER" ? selectedStand.standardId : '',//公共问题
classification: selectedStand.classification, //标准类型
problemDescription: '', //问题
questioner: this.$store.getters.userInfo.userId, //提问人
standardEncdoing: selectedStand.standardEncdoing, //标准编号
standardName: selectedStand.standardName, //标准名称
standardId: selectedStand.standardId, //标准id
fileList: '',
}
}
this.dialogVisible = true
},
handleClose(){
this.dialogVisible = false
},
//清空
delSearch(){
this.questionSerach = {
standardName: '', //标准名称
standardEncdoing: '', //标准编号
questioner: this.$store.getters.userInfo.userId, //提问人
problemDescription: '', //关键词/问题描述
page:1,
pageSize:this.$store.getters.userInfo.configContent,
total: 0
}
this.searchBtn()
},
pageChangeFun(page) {
this.questionSerach.page = page
this.searchBtn()
},
pageSizeChangeFun(pageSize) {
this.questionSerach.pageSize = pageSize
this.searchBtn()
},
searchBtn(){
this.questionSerach.questioner = ''
this.tableLoading = true
this.$http.postData('lawss/AskQuestions/list',{
...this.questionSerach
},{
_this: this
}, res => {
this.tableData = res.data.records
this.questionSerach.total = res.data.total
this.tableLoading = false
})
},
//文件上传前
beforeUploadTheme(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;
},
//删除文件前
beforeRemoveTheme(){
this.fileList.forEach((item,index) => {
if(item.name === file.name || item.id === file.id){
this.fileList.splice(index, 1)
}
})
// let list = ''
// this.fileInfoList.forEach(item => {
// if (list.length > 0) {
// list += ','
// list += item.name
// } else {
// list+= item.name
// }
// })
// this.questionForm.fileInfo = list
},
//文件上传成功
onsuccessTheme(res,file,fileList){
if(res.ok){
this.fileList.push(res.data)
this.$message.success('上传成功')
}else{
this.$message.warning(res.message)
fileList.pop()
}
// let list = ''
// this.fileInfoList.forEach(item => {
// if (list.length > 0) {
// list += ','
// list += item.name
// } else {
// list+= item.name
// }
// })
// this.questionForm.fileInfo = list
},
//提交问题
queSubmit(){
if(this.standType === 'OTHER'){
this.questionForm.standardId = this.questionForm.pubQue
this.questionForm.standardName = this.questionForm.pubQue
this.questionForm.standardEncdoing = this.questionForm.pubQue
}
if(this.questionForm.standardId){
this.questionForm.fileList = this.fileList
this.$refs['queForm'].validate((valid) => {
if(valid){
this.$http.postData('lawss/AskQuestions/insertAskQuestions',{ ...this.questionForm },
{
_this: this
}, res => {
this.dialogVisible = false
this.searchBtn()
}, e => {
})
}else{
return this.$message.warning('请输入问题')
}
})
}else{
this.$message.warning('请选择至少一条标准')
}
},
},
};
</script>
<style lang="less" scoped>
/deep/ .contentClass{
height: calc(~ '100% - 20px');
overflow: auto;
}
#my-questions{
height: calc(100vh - 75px);
display: flex;
flex-direction: column;
background: #F5F7FA;
margin-bottom: 10px;
.tab-box{
height: 93%;
}
.type-tabs {
/deep/.el-tabs__header {
margin-right: 0;
}
/deep/.el-tabs__content {
overflow-y: auto;
padding: 0;
.el-tab-pane {
height: 100%;
}
}
}
.question-box{
}
.question-box {
height: 100%;
border-top: none;
border-bottom: none;
/deep/.el-tabs__nav {
height: 100%;
overflow: auto;
}
/deep/ &.el-tabs--border-card .el-tabs__item{
height: 65px;
border-color: #d1dbe5 transparent;
text-align: left !important;
border-top-color: transparent;
&.is-active {
border-top-color: #d1dbe5;
}
}
}
/deep/.el-tabs__content{
height: 100%;
padding: 0;
}
/deep/.el-tab-pane{
height: 100%;
}
.com-box{
/deep/.el-tabs__item .is-left{
height: auto;
}
}
}
/deep/.el-tabs--left .el-tabs__item.is-left {
text-align: left;
height: 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;
}
/deep/.el-upload-dragger{
width: 490px !important;
}
.el-input{
width: 90%;
}
/deep/.el-dialog__body{
padding: 10px;
}
/deep/.el-upload-dragger {
height: 90px;
}
.history-item{
padding: 15px;
line-height: 1.5;
font-size: 14px;
color: #409EFF;
cursor: pointer;
}
</style>