Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
ec7851eb9d
|
@ -0,0 +1,167 @@
|
||||||
|
<!--
|
||||||
|
mitm.html is the lite "man in the middle"
|
||||||
|
|
||||||
|
This is only meant to signal the opener's messageChannel to
|
||||||
|
the service worker - when that is done this mitm can be closed
|
||||||
|
but it's better to keep it alive since this also stops the sw
|
||||||
|
from restarting
|
||||||
|
|
||||||
|
The service worker is capable of intercepting all request and fork their
|
||||||
|
own "fake" response - wish we are going to craft
|
||||||
|
when the worker then receives a stream then the worker will tell the opener
|
||||||
|
to open up a link that will start the download
|
||||||
|
-->
|
||||||
|
<script>
|
||||||
|
// This will prevent the sw from restarting
|
||||||
|
let keepAlive = () => {
|
||||||
|
keepAlive = () => {}
|
||||||
|
var ping = location.href.substr(0, location.href.lastIndexOf('/')) + '/ping'
|
||||||
|
var interval = setInterval(() => {
|
||||||
|
if (sw) {
|
||||||
|
sw.postMessage('ping')
|
||||||
|
} else {
|
||||||
|
fetch(ping).then(res => res.text(!res.ok && clearInterval(interval)))
|
||||||
|
}
|
||||||
|
}, 10000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// message event is the first thing we need to setup a listner for
|
||||||
|
// don't want the opener to do a random timeout - instead they can listen for
|
||||||
|
// the ready event
|
||||||
|
// but since we need to wait for the Service Worker registration, we store the
|
||||||
|
// message for later
|
||||||
|
let messages = []
|
||||||
|
window.onmessage = evt => messages.push(evt)
|
||||||
|
|
||||||
|
let sw = null
|
||||||
|
let scope = ''
|
||||||
|
|
||||||
|
function registerWorker() {
|
||||||
|
return navigator.serviceWorker.getRegistration('./').then(swReg => {
|
||||||
|
return swReg || navigator.serviceWorker.register('sw.js', { scope: './' })
|
||||||
|
}).then(swReg => {
|
||||||
|
const swRegTmp = swReg.installing || swReg.waiting
|
||||||
|
|
||||||
|
scope = swReg.scope
|
||||||
|
|
||||||
|
return (sw = swReg.active) || new Promise(resolve => {
|
||||||
|
swRegTmp.addEventListener('statechange', fn = () => {
|
||||||
|
if (swRegTmp.state === 'activated') {
|
||||||
|
swRegTmp.removeEventListener('statechange', fn)
|
||||||
|
sw = swReg.active
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now that we have the Service Worker registered we can process messages
|
||||||
|
function onMessage (event) {
|
||||||
|
let { data, ports, origin } = event
|
||||||
|
|
||||||
|
// It's important to have a messageChannel, don't want to interfere
|
||||||
|
// with other simultaneous downloads
|
||||||
|
if (!ports || !ports.length) {
|
||||||
|
throw new TypeError("[StreamSaver] You didn't send a messageChannel")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof data !== 'object') {
|
||||||
|
throw new TypeError("[StreamSaver] You didn't send a object")
|
||||||
|
}
|
||||||
|
|
||||||
|
// the default public service worker for StreamSaver is shared among others.
|
||||||
|
// so all download links needs to be prefixed to avoid any other conflict
|
||||||
|
data.origin = origin
|
||||||
|
|
||||||
|
// if we ever (in some feature versoin of streamsaver) would like to
|
||||||
|
// redirect back to the page of who initiated a http request
|
||||||
|
data.referrer = data.referrer || document.referrer || origin
|
||||||
|
|
||||||
|
// pass along version for possible backwards compatibility in sw.js
|
||||||
|
data.streamSaverVersion = new URLSearchParams(location.search).get('version')
|
||||||
|
|
||||||
|
if (data.streamSaverVersion === '1.2.0') {
|
||||||
|
console.warn('[StreamSaver] please update streamsaver')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since v2.0.0 */
|
||||||
|
if (!data.headers) {
|
||||||
|
console.warn("[StreamSaver] pass `data.headers` that you would like to pass along to the service worker\nit should be a 2D array or a key/val object that fetch's Headers api accepts")
|
||||||
|
} else {
|
||||||
|
// test if it's correct
|
||||||
|
// should thorw a typeError if not
|
||||||
|
new Headers(data.headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since v2.0.0 */
|
||||||
|
if (typeof data.filename === 'string') {
|
||||||
|
console.warn("[StreamSaver] You shouldn't send `data.filename` anymore. It should be included in the Content-Disposition header option")
|
||||||
|
// Do what File constructor do with fileNames
|
||||||
|
data.filename = data.filename.replace(/\//g, ':')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since v2.0.0 */
|
||||||
|
if (data.size) {
|
||||||
|
console.warn("[StreamSaver] You shouldn't send `data.size` anymore. It should be included in the content-length header option")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since v2.0.0 */
|
||||||
|
if (data.readableStream) {
|
||||||
|
console.warn("[StreamSaver] You should send the readableStream in the messageChannel, not throught mitm")
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @since v2.0.0 */
|
||||||
|
if (!data.pathname) {
|
||||||
|
console.warn("[StreamSaver] Please send `data.pathname` (eg: /pictures/summer.jpg)")
|
||||||
|
data.pathname = Math.random().toString().slice(-6) + '/' + data.filename
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove all leading slashes
|
||||||
|
data.pathname = data.pathname.replace(/^\/+/g, '')
|
||||||
|
|
||||||
|
// remove protocol
|
||||||
|
let org = origin.replace(/(^\w+:|^)\/\//, '')
|
||||||
|
|
||||||
|
// set the absolute pathname to the download url.
|
||||||
|
data.url = new URL(`${scope + org}/${data.pathname}`).toString()
|
||||||
|
|
||||||
|
if (!data.url.startsWith(`${scope + org}/`)) {
|
||||||
|
throw new TypeError('[StreamSaver] bad `data.pathname`')
|
||||||
|
}
|
||||||
|
|
||||||
|
// This sends the message data as well as transferring
|
||||||
|
// messageChannel.port2 to the service worker. The service worker can
|
||||||
|
// then use the transferred port to reply via postMessage(), which
|
||||||
|
// will in turn trigger the onmessage handler on messageChannel.port1.
|
||||||
|
|
||||||
|
const transferable = data.readableStream
|
||||||
|
? [ ports[0], data.readableStream ]
|
||||||
|
: [ ports[0] ]
|
||||||
|
|
||||||
|
if (!(data.readableStream || data.transferringReadable)) {
|
||||||
|
keepAlive()
|
||||||
|
}
|
||||||
|
|
||||||
|
return sw.postMessage(data, transferable)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.opener) {
|
||||||
|
// The opener can't listen to onload event, so we need to help em out!
|
||||||
|
// (telling them that we are ready to accept postMessage's)
|
||||||
|
window.opener.postMessage('StreamSaver::loadedPopup', '*')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (navigator.serviceWorker) {
|
||||||
|
registerWorker().then(() => {
|
||||||
|
window.onmessage = onMessage
|
||||||
|
messages.forEach(window.onmessage)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// FF v102 just started to supports transferable streams, but still needs to ping sw.js
|
||||||
|
// even tough the service worker dose not have to do any kind of work and listen to any
|
||||||
|
// messages... #305
|
||||||
|
keepAlive()
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,130 @@
|
||||||
|
/* global self ReadableStream Response */
|
||||||
|
|
||||||
|
self.addEventListener('install', () => {
|
||||||
|
self.skipWaiting()
|
||||||
|
})
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(self.clients.claim())
|
||||||
|
})
|
||||||
|
|
||||||
|
const map = new Map()
|
||||||
|
|
||||||
|
// This should be called once per download
|
||||||
|
// Each event has a dataChannel that the data will be piped through
|
||||||
|
self.onmessage = event => {
|
||||||
|
// We send a heartbeat every x second to keep the
|
||||||
|
// service worker alive if a transferable stream is not sent
|
||||||
|
if (event.data === 'ping') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = event.data
|
||||||
|
const downloadUrl = data.url || self.registration.scope + Math.random() + '/' + (typeof data === 'string' ? data : data.filename)
|
||||||
|
const port = event.ports[0]
|
||||||
|
const metadata = new Array(3) // [stream, data, port]
|
||||||
|
|
||||||
|
metadata[1] = data
|
||||||
|
metadata[2] = port
|
||||||
|
|
||||||
|
// Note to self:
|
||||||
|
// old streamsaver v1.2.0 might still use `readableStream`...
|
||||||
|
// but v2.0.0 will always transfer the stream through MessageChannel #94
|
||||||
|
if (event.data.readableStream) {
|
||||||
|
metadata[0] = event.data.readableStream
|
||||||
|
} else if (event.data.transferringReadable) {
|
||||||
|
port.onmessage = evt => {
|
||||||
|
port.onmessage = null
|
||||||
|
metadata[0] = evt.data.readableStream
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
metadata[0] = createStream(port)
|
||||||
|
}
|
||||||
|
|
||||||
|
map.set(downloadUrl, metadata)
|
||||||
|
port.postMessage({ download: downloadUrl })
|
||||||
|
}
|
||||||
|
|
||||||
|
function createStream (port) {
|
||||||
|
// ReadableStream is only supported by chrome 52
|
||||||
|
return new ReadableStream({
|
||||||
|
start (controller) {
|
||||||
|
// When we receive data on the messageChannel, we write
|
||||||
|
port.onmessage = ({ data }) => {
|
||||||
|
if (data === 'end') {
|
||||||
|
return controller.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data === 'abort') {
|
||||||
|
controller.error('Aborted the download')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.enqueue(data)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancel (reason) {
|
||||||
|
console.log('user aborted', reason)
|
||||||
|
port.postMessage({ abort: true })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
self.onfetch = event => {
|
||||||
|
const url = event.request.url
|
||||||
|
|
||||||
|
// this only works for Firefox
|
||||||
|
if (url.endsWith('/ping')) {
|
||||||
|
return event.respondWith(new Response('pong'))
|
||||||
|
}
|
||||||
|
|
||||||
|
const hijacke = map.get(url)
|
||||||
|
|
||||||
|
if (!hijacke) return null
|
||||||
|
|
||||||
|
const [ stream, data, port ] = hijacke
|
||||||
|
|
||||||
|
map.delete(url)
|
||||||
|
|
||||||
|
// Not comfortable letting any user control all headers
|
||||||
|
// so we only copy over the length & disposition
|
||||||
|
const responseHeaders = new Headers({
|
||||||
|
'Content-Type': 'application/octet-stream; charset=utf-8',
|
||||||
|
|
||||||
|
// To be on the safe side, The link can be opened in a iframe.
|
||||||
|
// but octet-stream should stop it.
|
||||||
|
'Content-Security-Policy': "default-src 'none'",
|
||||||
|
'X-Content-Security-Policy': "default-src 'none'",
|
||||||
|
'X-WebKit-CSP': "default-src 'none'",
|
||||||
|
'X-XSS-Protection': '1; mode=block',
|
||||||
|
'Cross-Origin-Embedder-Policy': 'require-corp'
|
||||||
|
})
|
||||||
|
|
||||||
|
let headers = new Headers(data.headers || {})
|
||||||
|
|
||||||
|
if (headers.has('Content-Length')) {
|
||||||
|
responseHeaders.set('Content-Length', headers.get('Content-Length'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headers.has('Content-Disposition')) {
|
||||||
|
responseHeaders.set('Content-Disposition', headers.get('Content-Disposition'))
|
||||||
|
}
|
||||||
|
|
||||||
|
// data, data.filename and size should not be used anymore
|
||||||
|
if (data.size) {
|
||||||
|
console.warn('Depricated')
|
||||||
|
responseHeaders.set('Content-Length', data.size)
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileName = typeof data === 'string' ? data : data.filename
|
||||||
|
if (fileName) {
|
||||||
|
console.warn('Depricated')
|
||||||
|
// Make filename RFC5987 compatible
|
||||||
|
fileName = encodeURIComponent(fileName).replace(/['()]/g, escape).replace(/\*/g, '%2A')
|
||||||
|
responseHeaders.set('Content-Disposition', "attachment; filename*=UTF-8''" + fileName)
|
||||||
|
}
|
||||||
|
|
||||||
|
event.respondWith(new Response(stream, { headers: responseHeaders }))
|
||||||
|
|
||||||
|
port.postMessage({ debug: 'Download started' })
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
import streamSaver from "streamsaver";
|
import streamSaver from "streamsaver";
|
||||||
import "streamsaver/examples/zip-stream.js";
|
import "streamsaver/examples/zip-stream.js";
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
streamSaver.mitm = `${window.location.origin}/mitm.html?version=2.0.0`
|
||||||
// 下载文件并压缩
|
// 下载文件并压缩
|
||||||
function zipFiles(zipName, files) {
|
function zipFiles(zipName, files) {
|
||||||
console.log("同步下载打包开始时间:" + new Date());
|
console.log("同步下载打包开始时间:" + new Date());
|
||||||
store.dispatch('trials/setUnLock', true)
|
store.dispatch('trials/setUnLock', true)
|
||||||
|
files = formatFiles(files)
|
||||||
// 创建压缩文件输出流
|
// 创建压缩文件输出流
|
||||||
const zipFileOutputStream = streamSaver.createWriteStream(zipName);
|
const zipFileOutputStream = streamSaver.createWriteStream(zipName);
|
||||||
// 创建下载文件流
|
// 创建下载文件流
|
||||||
|
@ -50,6 +52,23 @@ async function updateFile(file, name) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 同名文件修改名称
|
||||||
|
function formatFiles(files) {
|
||||||
|
let fileObj = {};
|
||||||
|
files.forEach(file => {
|
||||||
|
let arr = Object.keys(fileObj);
|
||||||
|
if (!~arr.indexOf(file.name)) {
|
||||||
|
fileObj[file.name] = 1;
|
||||||
|
} else {
|
||||||
|
let name = file.name;
|
||||||
|
file.name = name.split(".")[0] + `(${fileObj[name]})` + name
|
||||||
|
.substring(name.lastIndexOf('.'))
|
||||||
|
.toLocaleLowerCase()
|
||||||
|
fileObj[name]++;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return files;
|
||||||
|
}
|
||||||
function decodeUtf8(bytes) {
|
function decodeUtf8(bytes) {
|
||||||
let str = bytes.split('?');
|
let str = bytes.split('?');
|
||||||
let str2 = str[0].split('/');
|
let str2 = str[0].split('/');
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="OtherInfo.IsSign"
|
:disabled="OtherInfo.IsSign"
|
||||||
@click="apply(item.ReadingQuestionTrialId, index)"
|
@click="apply(item.ReadingQuestionTrialId, index)"
|
||||||
>{{ $t("common:button:save") }}</el-button
|
>{{ $t('common:button:save') }}</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
|
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="OtherInfo.IsSign"
|
:disabled="OtherInfo.IsSign"
|
||||||
@click="reset(item.ReadingQuestionTrialId, index)"
|
@click="reset(item.ReadingQuestionTrialId, index)"
|
||||||
>{{ $t("common:button:reset") }}</el-button
|
>{{ $t('common:button:reset') }}</el-button
|
||||||
>
|
>
|
||||||
<!-- 产生裁判阅片的条件 -->
|
<!-- 产生裁判阅片的条件 -->
|
||||||
<el-form-item
|
<el-form-item
|
||||||
|
@ -71,13 +71,16 @@
|
||||||
:label="item.value"
|
:label="item.value"
|
||||||
v-if="
|
v-if="
|
||||||
(JudgyInfo.ArbitrationRule === 1 &&
|
(JudgyInfo.ArbitrationRule === 1 &&
|
||||||
QuestionList[index].Type === 'number' &&
|
(QuestionList[index].Type === 'number' ||
|
||||||
|
QuestionList[index].Type === 'calculation') &&
|
||||||
item.value !== 2 &&
|
item.value !== 2 &&
|
||||||
item.value !== 3) ||
|
item.value !== 3) ||
|
||||||
(JudgyInfo.ArbitrationRule === 2 &&
|
(JudgyInfo.ArbitrationRule === 2 &&
|
||||||
QuestionList[index].Type === 'number' &&
|
(QuestionList[index].Type === 'number' ||
|
||||||
|
QuestionList[index].Type === 'calculation') &&
|
||||||
item.value === 1) ||
|
item.value === 1) ||
|
||||||
(QuestionList[index].Type !== 'number' &&
|
((QuestionList[index].Type === 'number' ||
|
||||||
|
QuestionList[index].Type === 'calculation') &&
|
||||||
item.value !== 4 &&
|
item.value !== 4 &&
|
||||||
item.value !== 5)
|
item.value !== 5)
|
||||||
"
|
"
|
||||||
|
@ -98,7 +101,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="OtherInfo.IsSign"
|
:disabled="OtherInfo.IsSign"
|
||||||
@click="addGroup(index, null)"
|
@click="addGroup(index, null)"
|
||||||
>{{ $t("trials:adRules:button:addRule") }}</el-button
|
>{{ $t('trials:adRules:button:addRule') }}</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
|
@ -211,14 +214,14 @@
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
<div style="margin-top: 20px">
|
<div style="margin-top: 20px">
|
||||||
<!-- 当前选择答案分组: -->
|
<!-- 当前选择答案分组: -->
|
||||||
{{ $t("trials:adRules:title:selectAnswerGroup") }}
|
{{ $t('trials:adRules:title:selectAnswerGroup') }}
|
||||||
<el-tag
|
<el-tag
|
||||||
v-if="
|
v-if="
|
||||||
QuestionList[index].grouping.length > 0 &&
|
QuestionList[index].grouping.length > 0 &&
|
||||||
QuestionList[index].QuestionGenre !== 3
|
QuestionList[index].QuestionGenre !== 3
|
||||||
"
|
"
|
||||||
>{{
|
>{{
|
||||||
QuestionList[index].grouping.toString().replaceAll(",", "|")
|
QuestionList[index].grouping.toString().replaceAll(',', '|')
|
||||||
}}</el-tag
|
}}</el-tag
|
||||||
>
|
>
|
||||||
<el-tag
|
<el-tag
|
||||||
|
@ -235,7 +238,7 @@
|
||||||
).label
|
).label
|
||||||
)
|
)
|
||||||
.toString()
|
.toString()
|
||||||
.replaceAll(",", "|")
|
.replaceAll(',', '|')
|
||||||
}}</el-tag
|
}}</el-tag
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -245,7 +248,7 @@
|
||||||
@click="addGroup2(index)"
|
@click="addGroup2(index)"
|
||||||
>
|
>
|
||||||
<!-- 添加分组 -->
|
<!-- 添加分组 -->
|
||||||
{{ $t("trials:adRules:title:addGroup") }}
|
{{ $t('trials:adRules:title:addGroup') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -253,7 +256,7 @@
|
||||||
v-if="QuestionList[index].QuestionGenre !== 3"
|
v-if="QuestionList[index].QuestionGenre !== 3"
|
||||||
style="margin-top: 20px"
|
style="margin-top: 20px"
|
||||||
>
|
>
|
||||||
{{ $t("trials:adRules:title:group") }}
|
{{ $t('trials:adRules:title:group') }}
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="itemA of QuestionList[index].AnswerGroup2List"
|
v-for="itemA of QuestionList[index].AnswerGroup2List"
|
||||||
:key="itemA"
|
:key="itemA"
|
||||||
|
@ -261,7 +264,7 @@
|
||||||
style="margin-right: 10px"
|
style="margin-right: 10px"
|
||||||
@close="
|
@close="
|
||||||
() => {
|
() => {
|
||||||
return tagClose2(index, indexA);
|
return tagClose2(index, indexA)
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>{{ itemA }}</el-tag
|
>{{ itemA }}</el-tag
|
||||||
|
@ -272,7 +275,7 @@
|
||||||
style="margin-top: 20px"
|
style="margin-top: 20px"
|
||||||
>
|
>
|
||||||
<!-- 分组: -->
|
<!-- 分组: -->
|
||||||
{{ $t("trials:adRules:title:group") }}
|
{{ $t('trials:adRules:title:group') }}
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="itemA of QuestionList[index].AnswerGroup2List"
|
v-for="itemA of QuestionList[index].AnswerGroup2List"
|
||||||
:key="itemA"
|
:key="itemA"
|
||||||
|
@ -280,17 +283,17 @@
|
||||||
style="margin-right: 10px"
|
style="margin-right: 10px"
|
||||||
@close="
|
@close="
|
||||||
() => {
|
() => {
|
||||||
return tagClose2(index, indexA);
|
return tagClose2(index, indexA)
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
itemA
|
itemA
|
||||||
.split("|")
|
.split('|')
|
||||||
.map((v) =>
|
.map((v) =>
|
||||||
$fd(QuestionList[index].DictionaryCode, parseInt(v))
|
$fd(QuestionList[index].DictionaryCode, parseInt(v))
|
||||||
)
|
)
|
||||||
.join("|")
|
.join('|')
|
||||||
}}
|
}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
@ -457,12 +460,12 @@
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="
|
@click="
|
||||||
QuestionVisible = false;
|
QuestionVisible = false
|
||||||
$set(QuestionList[selectIndex], 'groupingA', []);
|
$set(QuestionList[selectIndex], 'groupingA', [])
|
||||||
$set(QuestionList[selectIndex], 'groupingB', []);
|
$set(QuestionList[selectIndex], 'groupingB', [])
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ $t("common:button:cancel") }}
|
{{ $t('common:button:cancel') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
|
v-hasPermi="['trials:trials-panel:setting:reading-unit:edit']"
|
||||||
|
@ -471,7 +474,7 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="save"
|
@click="save"
|
||||||
>
|
>
|
||||||
{{ $t("common:button:save") }}
|
{{ $t('common:button:save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -482,13 +485,13 @@ import {
|
||||||
getTrialConfirmCriterionList,
|
getTrialConfirmCriterionList,
|
||||||
getTrialCriterionJudgeQuestionList,
|
getTrialCriterionJudgeQuestionList,
|
||||||
setTrialCriterionJudgeQuestionAnswerGroup,
|
setTrialCriterionJudgeQuestionAnswerGroup,
|
||||||
} from "@/api/trials/reading";
|
} from '@/api/trials/reading'
|
||||||
import { setTrialJudgyInfo, getTrialJudgyInfo } from "@/api/trials/setting";
|
import { setTrialJudgyInfo, getTrialJudgyInfo } from '@/api/trials/setting'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
trialReadingCriterionId: {
|
trialReadingCriterionId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -512,23 +515,23 @@ export default {
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: this.$t(
|
message: this.$t(
|
||||||
"trials:trials-list:setitng:JudgeDifferenceTypeRequired"
|
'trials:trials-list:setitng:JudgeDifferenceTypeRequired'
|
||||||
),
|
),
|
||||||
trigger: "blur",
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
JudgeDifferenceValue: [
|
JudgeDifferenceValue: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: this.$t(
|
message: this.$t(
|
||||||
"trials:trials-list:setitng:JudgeDifferenceValueRequired"
|
'trials:trials-list:setitng:JudgeDifferenceValueRequired'
|
||||||
),
|
),
|
||||||
trigger: "blur",
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: /^[0-9]+(.[0-9]{2})?$/,
|
pattern: /^[0-9]+(.[0-9]{2})?$/,
|
||||||
message: this.$t("trials:trials-list:setitng:JudgeDifferenceValue"),
|
message: this.$t('trials:trials-list:setitng:JudgeDifferenceValue'),
|
||||||
trigger: "blur",
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => {
|
validator: (rule, value, callback) => {
|
||||||
|
@ -536,115 +539,115 @@ export default {
|
||||||
callback(
|
callback(
|
||||||
new Error(
|
new Error(
|
||||||
this.$t(
|
this.$t(
|
||||||
"trials:trials-list:setitng:JudgeDifferenceValueMin"
|
'trials:trials-list:setitng:JudgeDifferenceValueMin'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trigger: "blur",
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
TrialReadingCriterionId(v) {
|
TrialReadingCriterionId(v) {
|
||||||
if (v === null) return;
|
if (v === null) return
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
getTrialCriterionJudgeQuestionList({
|
getTrialCriterionJudgeQuestionList({
|
||||||
TrialId: this.$route.query.trialId,
|
TrialId: this.$route.query.trialId,
|
||||||
// ReadingQuestionCriterionTrialId: v,
|
// ReadingQuestionCriterionTrialId: v,
|
||||||
TrialReadingCriterionId: this.trialReadingCriterionId,
|
TrialReadingCriterionId: this.trialReadingCriterionId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
this.QuestionList = res.Result;
|
this.QuestionList = res.Result
|
||||||
this.OtherInfo = res.OtherInfo;
|
this.OtherInfo = res.OtherInfo
|
||||||
this.activeNames = this.QuestionList.map(
|
this.activeNames = this.QuestionList.map(
|
||||||
(v) => v.ReadingQuestionTrialId
|
(v) => v.ReadingQuestionTrialId
|
||||||
);
|
)
|
||||||
this.QuestionList.forEach((v) => {
|
this.QuestionList.forEach((v) => {
|
||||||
this.$set(v, "grouping", []);
|
this.$set(v, 'grouping', [])
|
||||||
this.$set(v, "groupingA", []);
|
this.$set(v, 'groupingA', [])
|
||||||
this.$set(v, "groupingB", []);
|
this.$set(v, 'groupingB', [])
|
||||||
this.$set(
|
this.$set(
|
||||||
v,
|
v,
|
||||||
"AnswerGroupList",
|
'AnswerGroupList',
|
||||||
Object.assign([], v.AnswerCombination)
|
Object.assign([], v.AnswerCombination)
|
||||||
);
|
)
|
||||||
this.$set(v, "AnswerGroup2List", Object.assign([], v.AnswerGroup));
|
this.$set(v, 'AnswerGroup2List', Object.assign([], v.AnswerGroup))
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.getTrialJudgyInfo();
|
this.getTrialJudgyInfo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 修改仲裁规则
|
// 修改仲裁规则
|
||||||
changeArbitrationRule(value) {
|
changeArbitrationRule(value) {
|
||||||
if (value !== 1) {
|
if (value !== 1) {
|
||||||
this.QuestionList.forEach((item) => {
|
this.QuestionList.forEach((item) => {
|
||||||
item.JudgeDifferenceValue = 0;
|
item.JudgeDifferenceValue = 0
|
||||||
item.JudgeDifferenceType = 0;
|
item.JudgeDifferenceType = 0
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
JudgeTypeChange(value, index) {
|
JudgeTypeChange(value, index) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (value === 4 || value === 5) {
|
if (value === 4 || value === 5) {
|
||||||
if (this.$refs["JudgeDifferenceValue" + value + index][0]) {
|
if (this.$refs['JudgeDifferenceValue' + value + index][0]) {
|
||||||
this.$refs["JudgeDifferenceValue" + value + index][0].resetFields();
|
this.$refs['JudgeDifferenceValue' + value + index][0].resetFields()
|
||||||
// this.QuestionList[index].JudgeDifferenceValue = 0;
|
// this.QuestionList[index].JudgeDifferenceValue = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
saveAllSync() {
|
saveAllSync() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
var arr = [];
|
var arr = []
|
||||||
this.QuestionList.forEach((v, i) => {
|
this.QuestionList.forEach((v, i) => {
|
||||||
arr.push(this.applySync(v.ReadingQuestionTrialId, i));
|
arr.push(this.applySync(v.ReadingQuestionTrialId, i))
|
||||||
});
|
})
|
||||||
Promise.all(arr)
|
Promise.all(arr)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
console.log(res)
|
||||||
resolve(true);
|
resolve(true)
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
console.log("进入catch");
|
console.log('进入catch')
|
||||||
resolve(false);
|
resolve(false)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
applySync(ReadingQuestionTrialId, index) {
|
applySync(ReadingQuestionTrialId, index) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
console.log(this.QuestionList[index].JudgeType);
|
console.log(this.QuestionList[index].JudgeType)
|
||||||
if (this.QuestionList[index].JudgeType === 0) {
|
if (this.QuestionList[index].JudgeType === 0) {
|
||||||
reject(false);
|
reject(false)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 2 &&
|
this.QuestionList[index].JudgeType === 2 &&
|
||||||
this.QuestionList[index].AnswerGroup2List.length === 0
|
this.QuestionList[index].AnswerGroup2List.length === 0
|
||||||
) {
|
) {
|
||||||
reject(false);
|
reject(false)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 3 &&
|
this.QuestionList[index].JudgeType === 3 &&
|
||||||
this.QuestionList[index].AnswerGroupList.length === 0
|
this.QuestionList[index].AnswerGroupList.length === 0
|
||||||
) {
|
) {
|
||||||
reject(false);
|
reject(false)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 4 ||
|
this.QuestionList[index].JudgeType === 4 ||
|
||||||
|
@ -652,17 +655,17 @@ export default {
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let validate = await this.$refs[
|
let validate = await this.$refs[
|
||||||
"JudgeDifferenceValue" +
|
'JudgeDifferenceValue' +
|
||||||
this.QuestionList[index].JudgeType +
|
this.QuestionList[index].JudgeType +
|
||||||
index
|
index
|
||||||
][0].validate();
|
][0].validate()
|
||||||
if (!validate) return reject(false);
|
if (!validate) return reject(false)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return reject(false);
|
return reject(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.btnLoading = true;
|
this.btnLoading = true
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
setTrialCriterionJudgeQuestionAnswerGroup({
|
setTrialCriterionJudgeQuestionAnswerGroup({
|
||||||
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
||||||
AnswerGroup: this.QuestionList[index].AnswerGroup2List,
|
AnswerGroup: this.QuestionList[index].AnswerGroup2List,
|
||||||
|
@ -676,126 +679,126 @@ export default {
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
resolve();
|
resolve()
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
reject(false);
|
reject(false)
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
setTrialJudgyInfo() {
|
setTrialJudgyInfo() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
setTrialJudgyInfo({
|
setTrialJudgyInfo({
|
||||||
TrialId: this.$route.query.trialId,
|
TrialId: this.$route.query.trialId,
|
||||||
ArbitrationRule: this.JudgyInfo.ArbitrationRule,
|
ArbitrationRule: this.JudgyInfo.ArbitrationRule,
|
||||||
TrialReadingCriterionId: this.trialReadingCriterionId,
|
TrialReadingCriterionId: this.trialReadingCriterionId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
this.$message.success(this.$t("common:message:savedSuccessfully")); // '保存成功'
|
this.$message.success(this.$t('common:message:savedSuccessfully')) // '保存成功'
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getTrialJudgyInfo() {
|
getTrialJudgyInfo() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
getTrialJudgyInfo({
|
getTrialJudgyInfo({
|
||||||
TrialId: this.$route.query.trialId,
|
TrialId: this.$route.query.trialId,
|
||||||
TrialReadingCriterionId: this.trialReadingCriterionId,
|
TrialReadingCriterionId: this.trialReadingCriterionId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.JudgyInfo = res.Result;
|
this.JudgyInfo = res.Result
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch((v) => {
|
.catch((v) => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
tagClose2(index, indexA) {
|
tagClose2(index, indexA) {
|
||||||
// '删除该规则组?'
|
// '删除该规则组?'
|
||||||
this.$confirm(this.$t("trials:adRules:message:msg1")).then(() => {
|
this.$confirm(this.$t('trials:adRules:message:msg1')).then(() => {
|
||||||
this.QuestionList[index].AnswerGroup2List.splice(indexA, 1);
|
this.QuestionList[index].AnswerGroup2List.splice(indexA, 1)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
tagClose(index, indexA) {
|
tagClose(index, indexA) {
|
||||||
// '删除该规则组?'
|
// '删除该规则组?'
|
||||||
this.$confirm(this.$t("trials:adRules:message:msg1")).then(() => {
|
this.$confirm(this.$t('trials:adRules:message:msg1')).then(() => {
|
||||||
this.QuestionList[index].AnswerGroupList.splice(indexA, 1);
|
this.QuestionList[index].AnswerGroupList.splice(indexA, 1)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
var index = this.selectIndex;
|
var index = this.selectIndex
|
||||||
var indexA = this.indexA;
|
var indexA = this.indexA
|
||||||
if (this.QuestionList[index].groupingA.length === 0) {
|
if (this.QuestionList[index].groupingA.length === 0) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg2")); // '请先选择答案A'
|
this.$alert(this.$t('trials:adRules:message:msg2')) // '请先选择答案A'
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (this.QuestionList[index].groupingB.length === 0) {
|
if (this.QuestionList[index].groupingB.length === 0) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg3")); // '请先选择答案B'
|
this.$alert(this.$t('trials:adRules:message:msg3')) // '请先选择答案B'
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (this.type === "add") {
|
if (this.type === 'add') {
|
||||||
this.QuestionList[index].AnswerGroupList.push({
|
this.QuestionList[index].AnswerGroupList.push({
|
||||||
AnswerGroupA: this.QuestionList[index].groupingA,
|
AnswerGroupA: this.QuestionList[index].groupingA,
|
||||||
AnswerGroupB: this.QuestionList[index].groupingB,
|
AnswerGroupB: this.QuestionList[index].groupingB,
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$set(
|
this.$set(
|
||||||
this.QuestionList[index].AnswerGroupList[indexA],
|
this.QuestionList[index].AnswerGroupList[indexA],
|
||||||
"AnswerGroupA",
|
'AnswerGroupA',
|
||||||
this.QuestionList[index].groupingA
|
this.QuestionList[index].groupingA
|
||||||
);
|
)
|
||||||
this.$set(
|
this.$set(
|
||||||
this.QuestionList[index].AnswerGroupList[indexA],
|
this.QuestionList[index].AnswerGroupList[indexA],
|
||||||
"AnswerGroupB",
|
'AnswerGroupB',
|
||||||
this.QuestionList[index].groupingB
|
this.QuestionList[index].groupingB
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
this.$set(this.QuestionList[index], "groupingA", []);
|
this.$set(this.QuestionList[index], 'groupingA', [])
|
||||||
this.$set(this.QuestionList[index], "groupingB", []);
|
this.$set(this.QuestionList[index], 'groupingB', [])
|
||||||
this.$message.success(this.$t("trials:adRules:message:msg4")); // '成功新增答案规则'
|
this.$message.success(this.$t('trials:adRules:message:msg4')) // '成功新增答案规则'
|
||||||
this.QuestionVisible = false;
|
this.QuestionVisible = false
|
||||||
},
|
},
|
||||||
addGroup2(index) {
|
addGroup2(index) {
|
||||||
if (this.QuestionList[index].grouping.length === 0) {
|
if (this.QuestionList[index].grouping.length === 0) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg5")); // '请先选择答案,再添加分组'
|
this.$alert(this.$t('trials:adRules:message:msg5')) // '请先选择答案,再添加分组'
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
var grouping = this.QuestionList[index].grouping
|
var grouping = this.QuestionList[index].grouping
|
||||||
.toString()
|
.toString()
|
||||||
.replaceAll(",", "|");
|
.replaceAll(',', '|')
|
||||||
this.QuestionList[index].AnswerGroup2List.push(`|${grouping}|`);
|
this.QuestionList[index].AnswerGroup2List.push(`|${grouping}|`)
|
||||||
this.$set(this.QuestionList[index], "grouping", []);
|
this.$set(this.QuestionList[index], 'grouping', [])
|
||||||
},
|
},
|
||||||
addGroup(index, indexA) {
|
addGroup(index, indexA) {
|
||||||
this.selectIndex = index;
|
this.selectIndex = index
|
||||||
this.type = "add";
|
this.type = 'add'
|
||||||
if (indexA !== null) {
|
if (indexA !== null) {
|
||||||
this.indexA = indexA;
|
this.indexA = indexA
|
||||||
this.type = "edit";
|
this.type = 'edit'
|
||||||
this.$set(
|
this.$set(
|
||||||
this.QuestionList[index],
|
this.QuestionList[index],
|
||||||
"groupingA",
|
'groupingA',
|
||||||
this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupA
|
this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupA
|
||||||
);
|
)
|
||||||
this.$set(
|
this.$set(
|
||||||
this.QuestionList[index],
|
this.QuestionList[index],
|
||||||
"groupingB",
|
'groupingB',
|
||||||
this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupB
|
this.QuestionList[index].AnswerGroupList[indexA].AnswerGroupB
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
this.QuestionVisible = true;
|
this.QuestionVisible = true
|
||||||
},
|
},
|
||||||
reset(ReadingQuestionTrialId, index) {
|
reset(ReadingQuestionTrialId, index) {
|
||||||
// '确定重置当前设置的裁判任务生成规则吗?'
|
// '确定重置当前设置的裁判任务生成规则吗?'
|
||||||
this.$confirm(this.$t("trials:adRules:message:msg6")).then(() => {
|
this.$confirm(this.$t('trials:adRules:message:msg6')).then(() => {
|
||||||
this.btnLoading = true;
|
this.btnLoading = true
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
setTrialCriterionJudgeQuestionAnswerGroup({
|
setTrialCriterionJudgeQuestionAnswerGroup({
|
||||||
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
||||||
AnswerGroup: [],
|
AnswerGroup: [],
|
||||||
|
@ -805,39 +808,39 @@ export default {
|
||||||
JudgeDifferenceType: 0,
|
JudgeDifferenceType: 0,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.$set(this.QuestionList[index], "AnswerGroup2List", []);
|
this.$set(this.QuestionList[index], 'AnswerGroup2List', [])
|
||||||
this.$set(this.QuestionList[index], "AnswerGroupList", []);
|
this.$set(this.QuestionList[index], 'AnswerGroupList', [])
|
||||||
this.$set(this.QuestionList[index], "JudgeType", 0);
|
this.$set(this.QuestionList[index], 'JudgeType', 0)
|
||||||
this.$set(this.QuestionList[index], "JudgeDifferenceValue", 0);
|
this.$set(this.QuestionList[index], 'JudgeDifferenceValue', 0)
|
||||||
this.$set(this.QuestionList[index], "JudgeDifferenceType", 0);
|
this.$set(this.QuestionList[index], 'JudgeDifferenceType', 0)
|
||||||
this.$message.success(this.$t("trials:adRules:message:msg7")); // '重置成功'
|
this.$message.success(this.$t('trials:adRules:message:msg7')) // '重置成功'
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
async apply(ReadingQuestionTrialId, index) {
|
async apply(ReadingQuestionTrialId, index) {
|
||||||
if (this.QuestionList[index].JudgeType === 0) {
|
if (this.QuestionList[index].JudgeType === 0) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg8")); // '请先配置规则才能应用'
|
this.$alert(this.$t('trials:adRules:message:msg8')) // '请先配置规则才能应用'
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 2 &&
|
this.QuestionList[index].JudgeType === 2 &&
|
||||||
this.QuestionList[index].AnswerGroup2List.length === 0
|
this.QuestionList[index].AnswerGroup2List.length === 0
|
||||||
) {
|
) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg8")); // '请先配置规则才能应用'
|
this.$alert(this.$t('trials:adRules:message:msg8')) // '请先配置规则才能应用'
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 3 &&
|
this.QuestionList[index].JudgeType === 3 &&
|
||||||
this.QuestionList[index].AnswerGroupList.length === 0
|
this.QuestionList[index].AnswerGroupList.length === 0
|
||||||
) {
|
) {
|
||||||
this.$alert(this.$t("trials:adRules:message:msg8"));
|
this.$alert(this.$t('trials:adRules:message:msg8'))
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
this.QuestionList[index].JudgeType === 4 ||
|
this.QuestionList[index].JudgeType === 4 ||
|
||||||
|
@ -845,15 +848,15 @@ export default {
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let validate = await this.$refs[
|
let validate = await this.$refs[
|
||||||
"JudgeDifferenceValue" + this.QuestionList[index].JudgeType + index
|
'JudgeDifferenceValue' + this.QuestionList[index].JudgeType + index
|
||||||
][0].validate();
|
][0].validate()
|
||||||
if (!validate) return;
|
if (!validate) return
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.btnLoading = true;
|
this.btnLoading = true
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
setTrialCriterionJudgeQuestionAnswerGroup({
|
setTrialCriterionJudgeQuestionAnswerGroup({
|
||||||
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
ReadingQuestionTrialId: ReadingQuestionTrialId,
|
||||||
AnswerGroup: this.QuestionList[index].AnswerGroup2List,
|
AnswerGroup: this.QuestionList[index].AnswerGroup2List,
|
||||||
|
@ -867,49 +870,49 @@ export default {
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.$message.success(this.$t("trials:adRules:message:msg9")); // '应用成功'
|
this.$message.success(this.$t('trials:adRules:message:msg9')) // '应用成功'
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
tabClick(v) {
|
tabClick(v) {
|
||||||
this.ReadingQuestionCriterionTrialId =
|
this.ReadingQuestionCriterionTrialId =
|
||||||
this.CriterionList[this.index].ReadingQuestionCriterionTrialId;
|
this.CriterionList[this.index].ReadingQuestionCriterionTrialId
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
getTrialCriterionJudgeQuestionList({
|
getTrialCriterionJudgeQuestionList({
|
||||||
TrialId: this.$route.query.trialId,
|
TrialId: this.$route.query.trialId,
|
||||||
TrialReadingCriterionId: this.trialReadingCriterionId,
|
TrialReadingCriterionId: this.trialReadingCriterionId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
this.QuestionList = res.Result;
|
this.QuestionList = res.Result
|
||||||
this.OtherInfo = res.OtherInfo;
|
this.OtherInfo = res.OtherInfo
|
||||||
this.activeNames = this.QuestionList.map(
|
this.activeNames = this.QuestionList.map(
|
||||||
(v) => v.ReadingQuestionTrialId
|
(v) => v.ReadingQuestionTrialId
|
||||||
);
|
)
|
||||||
this.QuestionList.forEach((v) => {
|
this.QuestionList.forEach((v) => {
|
||||||
this.$set(v, "grouping", []);
|
this.$set(v, 'grouping', [])
|
||||||
this.$set(v, "groupingA", []);
|
this.$set(v, 'groupingA', [])
|
||||||
this.$set(v, "groupingB", []);
|
this.$set(v, 'groupingB', [])
|
||||||
this.$set(
|
this.$set(
|
||||||
v,
|
v,
|
||||||
"AnswerGroupList",
|
'AnswerGroupList',
|
||||||
Object.assign([], v.AnswerCombination)
|
Object.assign([], v.AnswerCombination)
|
||||||
);
|
)
|
||||||
this.$set(v, "AnswerGroup2List", Object.assign([], v.AnswerGroup));
|
this.$set(v, 'AnswerGroup2List', Object.assign([], v.AnswerGroup))
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.btnLoading = false;
|
this.btnLoading = false
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -24,10 +24,10 @@ module.exports = {
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
port: '8080',
|
port: '8080',
|
||||||
// headers: {
|
headers: {
|
||||||
// 'Cross-Origin-Opener-Policy': 'same-origin',
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||||
// 'Cross-Origin-Embedder-Policy': 'require-corp'
|
'Cross-Origin-Embedder-Policy': 'require-corp'
|
||||||
// },
|
},
|
||||||
// open: true,
|
// open: true,
|
||||||
overlay: {
|
overlay: {
|
||||||
warnings: false,
|
warnings: false,
|
||||||
|
|
Loading…
Reference in New Issue