[update] 增加问答库模块,修改自测bug
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user