[update] 增加问答库模块,修改自测bug

This commit is contained in:
lideqin
2023-09-20 18:08:00 +08:00
parent 2fb7e230d6
commit 5abf9338bd
16 changed files with 1059 additions and 4 deletions
+7 -1
View File
@@ -129,6 +129,9 @@ const getWorkGroupTreeList = (params) => getAction('/sys/lawsWorkingGroup/list',
// 企业级别映射管理,获取列表
const getEnterpriseLevelMapList = (params) => getAction('/sys/lawsGrade/list', params)
// 车型项目下拉数据
const getCarTypeProjectList = (params) => getAction('/projectLibrary/lawsProjectLibrary/list', params)
export {
addRole,
editRole,
@@ -202,5 +205,8 @@ export {
getWorkGroupTreeList,
getEnterpriseLevelMapList
getEnterpriseLevelMapList,
getCarTypeProjectList
}
+11
View File
@@ -2,5 +2,16 @@ module.exports = {
// 标准化活动
standardizationActivity: {
nodeName: 'Node name' // 节点名称
},
// 问答库
questionAnswer: {
classify: '分类',
title: '标题',
quiz: '提问',
questionDesc: '问题描述',
attach: '附件',
quizTime: '提问时间',
answer: '回答',
poster: '发帖人'
}
}
+11
View File
@@ -2,5 +2,16 @@ module.exports = {
// 标准化活动
standardizationActivity: {
nodeName: '节点名称', // 节点名称
},
// 问答库
questionAnswer: {
classify: '分类',
title: '标题',
quiz: '提问',
questionDesc: '问题描述',
attach: '附件',
quizTime: '提问时间',
answer: '回答',
poster: '发帖人'
}
}
+3
View File
@@ -131,6 +131,9 @@ module.exports = {
fileDownloadFail: 'File download failure',
pleaseEnterTreeSystem: 'Please enter the tree system',
project: 'Project',
standardNumber: 'Standard Number',
standardName: 'Standard Name',
standardNumOrName: 'Standard Number Or Standard Name',
// 树右键
treeRight: {
addFolder: 'Create New Folder',
+3
View File
@@ -131,6 +131,9 @@ module.exports = {
fileDownloadFail: '文件下载失败',
pleaseEnterTreeSystem: '输入树状图体系',
project: '项目',
standardNumber: '标准编号',
standardName: '标准名称',
standardNumOrName: '标准号/标准名称',
// 树右键
treeRight: {
addFolder: '新增文件夹',
+5
View File
@@ -153,6 +153,11 @@ export default {
type: Boolean,
required: false,
default: true
},
isDownload: {
type: Boolean,
required: false,
default: true
}
},
watch: {
@@ -0,0 +1,74 @@
<template>
<div class="selection-wrapper">
<div class="box-title-text">
<a-input class="box-input" :value="value" :title="value" @input="indexClick($event)"
:disabled="isDisabled" readonly
:placeholder="placeholder"/>
<a-button v-if="!isDisabled" type="primary" class="button-box" @click="standardClick">
{{this.$t('standardSelect.standardSelection')}}
</a-button>
</div>
<standard-model-selection-modal ref="standardSelectionModal" v-bind="$attrs" :value="value" @input="modalInput" @nameChange="modalNameChange"></standard-model-selection-modal>
</div>
</template>
<script>
import StandardModelSelectionModal from './StandardModelSelectionModal'
export default {
name: 'StandardModelSelection',
components: { StandardModelSelectionModal },
props: {
value: {
type: String,
default: ''
},
placeholder: {
type: String,
default: ''
},
isDisabled: {
type: Boolean,
default: false
}
},
methods: {
// 点击选择标准按钮
standardClick () {
this.$refs.standardSelectionModal.open()
},
// 输入框输入监听
indexClick (event) {
this.$emit('input', event.target.value)
},
modalInput (value) {
this.$emit('input', value)
},
modalNameChange (value) {
this.$emit('nameChange', value)
}
},
model: {
prop: 'value',
event: 'input'
}
}
</script>
<style scoped lang="less">
.selection-wrapper {
height: 40px;
line-height: 40px;
}
.box-title-text {
height: 100%;
display: flex;
align-items: center;
.box-input {
width: 100%;
}
.button-box {
margin-left: 10px;
}
}
</style>
@@ -0,0 +1,186 @@
<template>
<a-drawer
:title="$t('standardSelect.standardSelection')"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :sm="8">
<a-form-item :label="$t('standardSelect.source')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag style="width: 100%" v-model="queryParam.source"
:placeholder="$t('pleaseSelect')+$t('standardSelect.source')"
:triggerChange="false" dictCode="standard_source"/>
</a-form-item>
</a-col>
<a-col :sm="8">
<a-form-item :label="$t('standardSelect.standardNumOrName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('standardSelect.standardNumOrName')"
v-model="queryParam.standardNumOrName"></a-input>
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 41px;margin-bottom: 20px" class="table-page-search-submitButtons">
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</div>
</a-row>
</a-form>
</div>
<a-table
:columns="columns"
rowKey="standardNumber"
:scroll="{x: 900}"
:data-source="dataList"
:pagination="ipagination"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading">
</a-table>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleCancel" >{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</template>
<script>
import { getStandardList } from '@/api/api'
import JDictSelectTag from '../dict/JDictSelectTag'
export default {
name: 'StandardModelSelectionModal',
components: { JDictSelectTag },
props: {
source: {
type: [String, Number],
default: '1'
},
value: {
type: String,
default: ''
}
},
data () {
return {
visible: false,
confirmLoading: false,
labelCol: {
sm: 8
},
wrapperCol: {
sm: 14
},
selectedRowKeys: [],
selectedRowList: [],
loading: false,
queryParam: {},
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
columns: [
{
title: this.$t('number'),
dataIndex: 'standardNumber',
ellipsis: true,
align: 'center',
width: 150
},
{
title: this.$t('title'),
dataIndex: 'standardName',
ellipsis: true,
align: 'center',
width: 150
},
{
title: this.$t('standardSelect.textState'),
dataIndex: 'standardState_dictText',
align: 'center',
width: 150
}
],
dataList: []
}
},
methods: {
open () {
this.source ? this.queryParam.source = this.source : this.queryParam = {}
this.visible = true
this.queryParam = {}
this.replacePage()
},
// 获取表格数据
replacePage () {
const query = {
...this.queryParam,
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize
}
this.selectedRowKeys = []
this.loading = true
getStandardList(query).then((res) => {
if (res.success) {
this.dataList = res.result.records
this.ipagination.total = res.result.total
this.selectedRowKeys = this.value.split(',')
} else {
this.dataList = []
}
}).finally(() => {
this.loading = false
})
},
searchQuery () {
this.replacePage()
},
searchReset () {
this.queryParam = {}
this.replacePage()
},
// 表格选择改变
onSelectChange (value, row) {
this.selectedRowKeys = value
this.selectedRowList = row
},
handleCancel () {
this.visible = false
},
handleSubmit () {
const serialNumber = []
const serialNameArr = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.selectedRowList.forEach(res => {
serialNumber.push(res.standardNumber)
serialNameArr.push(res.standardName)
})
this.$emit('input', serialNumber.join(','))
this.$emit('nameChange', serialNameArr.join(','))
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,247 @@
<template>
<a-card :bordered="false">
<!-- 搜索区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item :label="$t('businessSupport.questionAnswer.classify')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
:placeholder="$t('pleaseEnter')+$t('businessSupport.questionAnswer.classify')"
dict-code="esp_project_status"
v-model="queryParam.classify">
</j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item :label="$t('standardNumber')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('standardNumber')" v-model="queryParam.standardNo"></a-input>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item :label="$t('standardName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('standardName')" v-model="queryParam.standardName"></a-input>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :span="6">
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('title')" v-model="queryParam.title"></a-input>
</a-form-item>
</a-col>
</template>
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a @click="handleToggleSearch">
{{ toggleSearchStatus ? $t('putAway') : $t('open') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px" v-has="'businessSupport:questionAnswer:search'">{{ $t('query') }}</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<!-- 操作区域 -->
<div class="table-operator">
<!-- 提问 -->
<a-button icon="plus" type="primary" v-has="'businessSupport:questionAnswer:quiz'"
@click="handleQuiz">
{{ $t('businessSupport.questionAnswer.quiz') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
size="middle"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<!-- 附件 -->
<template v-slot:attach="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<a v-if="text" class="link-a" @click="handleAttachClick(record)">{{ text }}</a>
<span v-else>{{ global.emptyLine }}</span>
</a-tooltip>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record}" class="action-span-cell">
<!-- 是自己的提问 -->
<template v-if="record.createBy === userInfo.id">
<a @click="handleDetail(record)"
class="table-ope-btn"
v-has="'businessSupport:questionAnswer:detail'">
{{ $t('view') }}
</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.id)"
class="table-ope-btn"
v-has="'businessSupport:questionAnswer:delete'">
{{ $t('delete') }}
</a>
</template>
<!-- 是别人的提问 -->
<template v-else>
<a @click="handleAnswer(record)"
class="table-ope-btn"
v-has="'businessSupport:questionAnswer:answer'">
{{ $t('businessSupport.questionAnswer.answer') }}
</a>
</template>
</div>
</j-table>
</div>
<quiz-modal ref="quizModal"></quiz-modal>
</a-card>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JTable from '@/components/jero/JTable'
import Vue from 'vue'
import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
import { getFileAccessHttpUrl } from '@/api/manage'
import QuizModal from './modules/QuizModal'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default {
name: 'QuestionAnswerList',
mixins: [JeroListMixin],
components: { QuizModal, JTable },
data () {
return {
labelCol: {
span: 4
},
wrapperCol: {
span: 14
},
columns: [
{
title: this.$t('businessSupport.questionAnswer.classify'),
align: 'center',
width: 180,
dataIndex: 'classify_dictText',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('standardNumber'),
align: 'center',
width: 180,
dataIndex: 'standardNumber',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('standardName'),
align: 'center',
width: 180,
dataIndex: 'standardName',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('title'),
align: 'center',
width: 180,
dataIndex: 'title',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('project'),
align: 'center',
width: 180,
dataIndex: 'project',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('businessSupport.questionAnswer.questionDesc'),
align: 'center',
width: 180,
dataIndex: 'questionDesc',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('businessSupport.questionAnswer.attach'),
align: 'center',
width: 180,
dataIndex: 'attach',
scopedSlots: { customRender: 'attach' }
},
{
title: this.$t('businessSupport.questionAnswer.quizTime'),
align: 'center',
width: 180,
dataIndex: 'quizTime',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 200
}
],
url: {
list: ''
},
userInfo: {}
}
},
mounted () {
this.userInfo = Vue.ls.get(USER_INFO)
},
methods: {
// 提问
handleQuiz () {
this.$refs.quizModal.title = this.$t('businessSupport.questionAnswer.quiz')
this.$refs.quizModal.open()
// this.$router.push({
// path: '/businessSupport/questionDetail'
// })
},
// 点击相关材料
handleAttachClick (record) {
// 截取文件后缀名
const fileSuffix = record.declareFileName ? record.declareFileName.split('.')[record.declareFileName.split('.').length - 1] : ''
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${record.declareFile}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${record.declareFileName}`
// 图片预览,使用自己添加的组件
if (FILE_TYPE_IMGS.includes(fileSuffix)) {
this.imageUrl = getFileAccessHttpUrl(record.declareFile)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
// this.$refs.imagePreviewModal.open(file)
return
}
// pdf预览
if (FILE_TYPE_PDF.includes(fileSuffix)) {
const url = previewPdf(record.declareFile)
window.open(url)
return
}
// 其余可预览文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,217 @@
<template>
<div class="answer-page">
<div class="answer-page-title">{{ model.title }}</div>
<div class="answer-page-second-title">
{{ $t('businessSupport.questionAnswer.poster') + '' + model.orgCodeTxt + ' ' + model.poster }}
</div>
<a-divider dashed/>
<div class="base-info-wrapper">
<a-row :gutter="24">
<a-col :span="4" class="base-info-title">{{ $t('standardNumOrName') }}</a-col>
<a-col :span="20" class="base-info-value"><a>{{ model.standardNumber + ' ' + model.standardName }}</a></a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="4" class="base-info-title">{{ $t('project') }}</a-col>
<a-col :span="20" class="base-info-value">{{ model.project }}</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="4" class="base-info-title">{{ $t('businessSupport.questionAnswer.attach') }}</a-col>
<a-col :span="20" class="base-info-value"><a>{{ model.attach }}</a></a-col>
</a-row>
</div>
<a-divider dashed/>
<!-- 问题描述部分 -->
<div class="question-desc-wrapper">
<p>{{ model.questionDesc }}</p>
<p class="right-bottom-p">
<span class="time-span">{{ model.quizTime }}</span>
<span class="right-bottom-p-span">{{ answerArr.length }}个回复</span>
</p>
</div>
<!-- 历史回答数据 -->
<div v-for="(item, index) in answerArr" :key="index" class="answer-wrapper">
<div class="left-user-info">
<a-avatar shape="square" :src="getAvatarView(item.avatar)" icon="user"/>
<p>{{ item.realname }}</p>
<p>{{ item.orgCodeTxt }}</p>
</div>
<div class="right-answer-wrapper">
<p v-if="item.isTop" class="top-p">置顶</p>
<p :class="!item.isTop ? 'no-top-desc' : ''">{{ item.answerDesc }}</p>
<p class="right-bottom-p">
<span>{{ item.answerTime }}</span>
<a class="right-bottom-p-a" v-if="item.isTop">取消置顶</a>
<a class="right-bottom-p-a" v-else>设置为置顶</a>
<a class="right-bottom-p-a">删除</a>
</p>
</div>
</div v-for="(item, index) in answerArr" :key="index">
<!-- 回答区域 -->
<div class="answer-wrapper">
<div class="left-user-info">
<a-avatar shape="square" :src="getAvatarView(currentUser.avatar)" icon="user"/>
<p>{{ currentUser.realname }}</p>
<p>{{ currentUser.orgCodeTxt }}</p>
</div>
<div class="right-answer-form-wrapper">
<p>回复问题</p>
<a-textarea v-model="answerDesc"></a-textarea>
<a-button class="submit-btn" type="primary">提交</a-button>
</div>
</div>
</div>
</template>
<script>
import { USER_INFO } from '@/store/mutation-types'
import Vue from 'vue'
import { getFileAccessHttpUrl } from '@/api/manage'
export default {
name: 'AnswerPage',
data () {
return {
model: {
title: '问题问题',
orgCodeTxt: '车型技术部',
poster: '超级管理员',
standardNumber: 'GB 7528-2020',
standardName: '机动车运行安全',
project: '机动车运行安全',
attach: '机动车运行安全.jpg',
questionDesc: '问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述' +
'问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述问题描述' +
'问题描述问题描述问题描述问题描述',
quizTime: '2023-07-04 14:39',
answerNum: 2
},
answerArr: [
{
avatar: '',
realname: '李某某',
orgCodeTxt: '标准法规部',
isTop: true,
answerDesc: '回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述' +
'回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述' +
'回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述',
answerTime: '2023-07-04 16:38'
},
{
avatar: '',
realname: '李某某',
orgCodeTxt: '标准法规部',
isTop: false,
answerDesc: '回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述' +
'回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述' +
'回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述回答描述',
answerTime: '2023-07-04 16:38'
}
],
currentUser: {
avatar: '',
realname: '',
orgCodeTxt: ''
},
answerDesc: ''
}
},
mounted () {
const userInfo = Vue.ls.get(USER_INFO)
this.currentUser = Object.assign({}, userInfo)
},
methods: {
getAvatarView (avatar) {
return getFileAccessHttpUrl(avatar)
}
}
}
</script>
<style scoped lang="less">
.answer-page {
padding: 24px;
}
.answer-page-title {
font-size: 20px;
font-family: PingFang SC-Medium, PingFang SC, sans-serif;
color: #1D2129;
font-weight: 600;
text-align: center;
margin-bottom: 24px;
}
.answer-page-second-title {
font-size: 16px;
text-align: center;
font-weight: 550;
}
.base-info-wrapper {
font-size: 16px;
font-family: PingFang SC-Medium, PingFang SC, sans-serif;
.base-info-title {
font-weight: 530;
color: #1D2129;
}
.base-info-value {
color: #1D2129;
}
}
// 问题描述部分
.question-desc-wrapper {
position: relative;
padding-bottom: 40px;
}
// 历史回答数据
.answer-wrapper {
width: 100%;
//height: 100%;
border: 1px solid #1D2129;
display: flex;
//flex: 1;
.left-user-info {
width: 300px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgb(247, 248, 250);
}
.right-answer-wrapper {
position: relative;
padding: 20px 10px 40px 10px;
box-sizing: border-box;
}
.right-answer-form-wrapper {
padding: 20px;
width: 100%;
.submit-btn {
margin-top: 20px;
}
}
.top-p {
color: #D52C26;
}
.no-top-desc {
margin-top: 20px;
}
}
// 右下角的时间和按钮区域
.right-bottom-p {
height: 20px;
display: flex;
width: auto;
position: absolute;
right: 10px;
bottom: 0;
.time-span {
color: #86909C;
}
.right-bottom-p-span {
margin-left: 8px;
}
.right-bottom-p-a {
margin-left: 8px;
}
}
</style>
@@ -0,0 +1,216 @@
<template>
<a-modal
:title="title"
:maskClosable="true"
:width="800"
:closable="true"
@cancel="handleCancel"
@ok="handleOk"
:visible="visible">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('businessSupport.questionAnswer.classify')">
<a-select :placeholder="$t('pleaseSelect') + $t('businessSupport.questionAnswer.classify')"
allowClear
v-decorator.trim="[ 'level', validatorRules.level]">
<a-select-option :value="null" :key="-1">请选择</a-select-option>
<a-select-option :value="1">国内标准</a-select-option>
<a-select-option :value="2">海外标准</a-select-option>
<a-select-option :value="3">企业标准</a-select-option>
<a-select-option :value="4">其他问题</a-select-option>
</a-select>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardNumber')">
<standard-model-selection
v-decorator.trim="[ 'standardNumber', validatorRules.standardNumber]"
:placeholder="$t('pleaseEnterOrSelect') + $t('standardNumber')"
@nameChange="standardNameChange"
/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardName')">
<a-input disabled :placeholder="$t('pleaseEnter') + $t('standardName')"
v-decorator.trim="[ 'standardName', validatorRules.standardName]"/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('title')">
<a-input v-decorator.trim="[ 'title', validatorRules.title]"
:placeholder="$t('pleaseEnter') + $t('title')"/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('project')">
<a-select :placeholder="$t('pleaseSelect') + $t('project')"
allowClear
v-decorator.trim="[ 'project', validatorRules.project]">
<a-select-option :value="null" :key="-1">请选择</a-select-option>
<a-select-option v-for="item in projectList" :value="item.id" :key="item.id">{{ item.projectName }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('businessSupport.questionAnswer.quizTime')">
<a-date-picker
v-decorator.trim="[ 'quizTime', validatorRules.quizTime]"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
showTime
></a-date-picker>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('businessSupport.questionAnswer.questionDesc')">
<a-textarea
v-decorator.trim="[ 'questionDesc', validatorRules.questionDesc]"
:placeholder="$t('pleaseEnter')+$t('businessSupport.questionAnswer.questionDesc')"
:maxLength="500"
:rows="4" />
<j-upload v-decorator.trim="[ 'attach', validatorRules.attach]"
isDownload>
</j-upload>
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { postAction } from '@/api/manage'
import { getCarTypeProjectList } from '@/api/api'
// 双向绑定的标准选择器
import StandardModelSelection from '@/components/selection/StandardModelSelection'
import pick from 'lodash.pick'
export default {
name: 'QuizModal',
components: { StandardModelSelection },
data () {
return {
title: '',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
validatorRules: {
classify: {
rules: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('businessSupport.questionAnswer.classify') }
],
validateTrigger: 'change'
},
standardNumber: {
rules: [
{ required: true, message: this.$t('pleaseSelectOrEnter') + this.$t('standardNumber') }
],
validateTrigger: 'blur'
},
standardName: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('standardName') }
],
validateTrigger: 'blur'
},
title: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('title') }
],
validateTrigger: 'blur'
},
project: {
rules: [
{ required: false, message: this.$t('pleaseSelect') + this.$t('project') }
],
validateTrigger: 'change'
},
quizTime: {
rules: [
{ required: false, message: this.$t('pleaseSelect') + this.$t('businessSupport.questionAnswer.quizTime') }
],
validateTrigger: 'change'
},
questionDesc: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('businessSupport.questionAnswer.questionDesc') }
],
validateTrigger: 'blur'
},
attach: {
rules: [
{ required: false, message: this.$t('pleaseSelect') + this.$t('businessSupport.questionAnswer.attach') }
],
validateTrigger: 'change'
}
},
url: {
quiz: ''
},
projectList: [] // 项目下拉框数据
}
},
created () {
this.getCarTypeProjectList()
},
methods: {
open () {
this.visible = true
this.form.resetFields()
const param = {}
param.quizTime = new Date().getFullYear() + '-' + new Date().getMonth() + '-' + new Date().getDay() + ' ' +
new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds()
this.$nextTick(() => {
this.form.setFieldsValue(pick(param, 'quizTime'))
})
},
// 获取项目下拉框数据
getCarTypeProjectList () {
getCarTypeProjectList().then(res => {
if (res.success) {
this.projectList = res.result
} else {
this.projectList = []
}
})
},
// 标准选择名称改变的回调
standardNameChange (value) {
const param = { standardName: value }
this.$nextTick(() => {
this.form.setFieldsValue(pick(param, 'standardName'))
})
},
handleCancel () {
this.close()
},
handleOk () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const param = Object.assign({}, values)
postAction(this.url.quiz, param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
close () {
this.visible = false
}
}
}
</script>
<style scoped>
</style>
@@ -25,7 +25,36 @@
<div class="detail-page-part-form" v-if="index !== 3">
<div class="detail-page-part-form-item" v-for="formItem in form[part]" :key="formItem.id">
<label>{{ formItem.dbFieldTxt }}</label>
<span v-if="detailData[formItem.dbFieldName + '_dictText']">{{ detailData[formItem.dbFieldName + '_dictText'] }}</span>
<div v-if="formItem.fieldShowType === FieldType.FILE_UP.value" class="file-box">
<template v-if="detailData[formItem.dbFieldName]">
<div class="detail-page-process-manuscript-file" v-for="(fileId, index) in detailData[formItem.dbFieldName].split(',')" :key="fileId">
<div class="detail-page-process-manuscript-file-info">
<a-icon type="link" />
<div class="detail-page-process-manuscript-file-name"
@click="handlePreview(fileId, detailData[formItem.dbFieldName + '_dictText'].split(',')[index])">
{{ detailData[formItem.dbFieldName + '_dictText'].split(',')[index] }}
</div>
</div>
<!-- 下载 -->
<a-button
type="link"
icon="download"
class="file-btn"
@click="handleDownload(fileId, detailData[formItem.dbFieldName + '_dictText'].split(',')[index])">
{{ $t('download') }}
</a-button>
<!-- 无水印下载-->
<!--<a-button type="link" v-has="btnPermission.unwatermarkedDownload" class="file-btn">-->
<!-- <i class="iconfont icon-water-drop-slash"></i>-->
<!-- {{ $t('unwatermarkedDownload') }}-->
<!--</a-button>-->
</div>
</template>
<template v-else>
<span></span>
</template>
</div>
<span v-else-if="detailData[formItem.dbFieldName + '_dictText']">{{ detailData[formItem.dbFieldName + '_dictText'] }}</span>
<span v-else-if="detailData[formItem.dbFieldName]">{{ detailData[formItem.dbFieldName] }}</span>
<span v-else></span>
</div>
@@ -93,17 +122,26 @@
<script>
import '@assets/less/common.less'
import { downloadFile } from '@/api/manage'
import { FieldType } from '@/enums/commonEnums'
import { downloadFile, getFileAccessHttpUrl } from '@/api/manage'
import { getEnterpriseStandardInfoById, getEnterpriseStandardAddForm } from '@/api/enterpriseStandardLibraryApi'
import UpdateRecordModal from '../../../standardRegulationLibrary/commonPage/modules/UpdateRecordModal'
import SubmitQuestionModal from '../../../standardRegulationLibrary/commonPage/modules/SubmitQuestionModal'
import EnterpriseStandardEvaluateModal from './module/EnterpriseStandardEvaluateModal'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default {
name: 'EnterpriseStandardDetail',
components: { EnterpriseStandardEvaluateModal, SubmitQuestionModal, UpdateRecordModal },
data () {
return {
FieldType,
partList: [], // 页面模块列表
form: {}, // 页面字段
detailData: {}, // 页面数据
@@ -165,6 +203,34 @@ export default {
}
})
},
handlePreview (fileId, fileName) {
// 截取文件后缀名
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${fileId}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${fileName}`
// 图片预览,使用自己添加的组件
if (FILE_TYPE_IMGS.includes(fileSuffix)) {
this.imageUrl = getFileAccessHttpUrl(fileId)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
// this.$refs.imagePreviewModal.open(file)
return
}
// pdf预览
if (FILE_TYPE_PDF.includes(fileSuffix)) {
const url = previewPdf(fileId)
window.open(url)
return
}
// 其余可预览文件仍使用KKFile进行预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url)
},
handleDownload (fileId, fileName) {
// 下载文件
downloadFile(`/sys/common/download/${fileId}`, fileName)
},
// 过程稿件里的下载
downloadDraft (fileId, fileName) {
downloadFile(`/sys/common/download/${fileId}`, fileName)
@@ -193,4 +259,14 @@ export default {
.detail-page-part-table {
margin: 20px;
}
.file-box {
flex: 1;
width: 0;
}
.file-btn > ::v-deep span {
display: inline;
color: @primary-color;
font-size: 14px;
}
</style>
@@ -11,7 +11,7 @@
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('system.enterpriseLevelMap.levelCategory')">
<a-select :placeholder="$t('pleaseEnter') + $t('system.enterpriseLevelMap.levelCategory')"
<a-select :placeholder="$t('pleaseSelect') + $t('system.enterpriseLevelMap.levelCategory')"
allowClear
:disabled="true"
v-decorator.trim="[ 'level', validatorRules.level]">