Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2024-06-05 16:05:04 +08:00
commit 4bd286ca45
2 changed files with 185 additions and 20 deletions

View File

@ -94,4 +94,20 @@ export function getTrialJudgyInfo(params) {
data: params
})
}
// 获取检查部位列表
export function getTrialBodyPartList(params) {
return request({
url: `/TrialConfig/getTrialBodyPartList`,
method: 'get',
params
})
}
// 新增检查部位
export function addOrUpdateTrialBodyPart(data) {
return request({
url: `/TrialConfig/addOrUpdateTrialBodyPart`,
method: 'post',
data
})
}

View File

@ -582,15 +582,23 @@
custom-class="base-dialog-wrapper"
width="400px"
>
<div class="base-dialog-body">
<div class="base-dialog-body" style="position: relative">
<el-button
size="small"
type="primary"
@click="addBodyPart_model.visible = true"
style="position: absolute; top: 10px; right: 10px; z-index: 9"
>
{{ $t("common:button:add") }}
</el-button>
<el-table
ref="bodyPartTable"
v-loading="listLoading"
:data="$d.Bodypart"
:data="trialBodyPartList"
stripe
height="450"
row-key="id"
@select="handleBodyPartSelectionChange"
height="400"
row-key="Code"
@selection-change="handleBodyPartSelectionChange"
>
<el-table-column
type="selection"
@ -599,12 +607,10 @@
:reserve-selection="true"
/>
<el-table-column
prop="value"
prop="Name"
:label="$t('trials:logincCfg:form:bodypart')"
>
<template slot-scope="scope">{{
$fd("Bodypart", scope.row.value)
}}</template>
<template slot-scope="scope">{{ scope.row.Name }}</template>
</el-table-column>
</el-table>
</div>
@ -683,6 +689,45 @@
</el-button>
</div>
</el-dialog>
<base-model v-if="addBodyPart_model.visible" :config="addBodyPart_model">
<template slot="dialog-body">
<el-form
ref="addBodyPartForm"
:inline="true"
:model="addBodyPartForm"
class="demo-form-inline"
:rules="addBodyPartrules"
>
<!--受试者编号-->
<el-form-item
:label="$t('trials:setting:form:bodyPart')"
prop="bodyPartStr"
label-width="150px"
>
<el-input
v-model="addBodyPartForm.bodyPartStr"
clearable
:maxlength="50"
@focus="errMessage = null"
></el-input>
<span class="errTip" v-if="errMessage">{{ errMessage }}</span>
</el-form-item>
</el-form>
</template>
<template slot="dialog-footer">
<el-button type="primary" @click="addOrUpdateTrialBodyPart">
{{ $t("common:button:confirm") }}
</el-button>
<el-button
@click="
(addBodyPart_model.visible = false),
(addBodyPartForm.bodyPartStr = null)
"
>
{{ $t("common:button:cancel") }}
</el-button>
</template>
</base-model>
</div>
</template>
<script>
@ -692,13 +737,18 @@ import {
deleteClinicalTrialSetData,
DownloadTrialClinicalFile,
} from "@/api/trials";
import { ConfigTrialBasicInfoConfirm } from "@/api/trials/setting";
import {
ConfigTrialBasicInfoConfirm,
getTrialBodyPartList,
addOrUpdateTrialBodyPart,
} from "@/api/trials/setting";
import SignForm from "@/views/trials/components/newSignForm";
import ClinicalDataForm from "./clinicalDataForm";
import const_ from "@/const/sign-code";
import BaseModel from "@/components/BaseModel";
export default {
name: "LogicalConfig",
components: { SignForm, ClinicalDataForm },
components: { SignForm, ClinicalDataForm, BaseModel },
data() {
return {
form: {
@ -822,9 +872,47 @@ export default {
bodyPartListVisible: false,
selectedList: [],
selectedBodyParts: [],
trialBodyPartList: [],
addBodyPart_model: {
visible: false,
title: this.$t("trials:setting:button:add"),
width: "500px",
appendToBody: true,
},
addBodyPartForm: {
bodyPartStr: null,
},
addBodyPartrules: {
bodyPartStr: [
{
required: true,
message: this.$t("trials:setting:format:notBodyPart"),
trigger: ["blur", "change"],
},
{
validator: (rule, value, callback) => {
let flag = this.trialBodyPartList.some(
(item) => item.Name === value
);
if (flag) {
callback(
new Error(this.$t("trials:setting:format:hasBodyPart"))
);
} else {
callback();
}
},
message: this.$t("trials:setting:format:hasBodyPart"),
trigger: ["blur", "change"],
},
],
},
errMessage: null,
};
},
created() {
this.getTrialBodyPartList();
},
methods: {
handleConfirmModality() {
this.form.ModalityList = Object.assign(
@ -839,7 +927,6 @@ export default {
},
handleSelectionChange(val) {
this.selectedList = val;
console.log(this.selectedList);
},
toggleSelection(rows) {
if (rows) {
@ -864,12 +951,67 @@ export default {
handleBodyPartSelectionChange(val) {
this.selectedBodyParts = val;
},
//
async getTrialBodyPartList(data) {
try {
let params = {
TrialId: this.$route.query.trialId,
};
let res = await getTrialBodyPartList(params);
if (res.IsSuccess) {
this.trialBodyPartList = res.Result;
if (data) {
if (this.$refs.bodyPartTable) {
this.$nextTick(() => {
let obj = this.trialBodyPartList.filter(
(item) => item.Code === data.Code
);
console.log(obj);
this.$refs.bodyPartTable.toggleRowSelection(obj[0]);
});
}
}
}
} catch (err) {
console.log(err);
}
},
//
async addOrUpdateTrialBodyPart() {
try {
this.errMessage = null;
let validate = await this.$refs.addBodyPartForm.validate();
if (!validate) return;
let str = this.addBodyPartForm.bodyPartStr;
let data = {
Code: str,
Name: str,
NameCN: str,
TrialId: this.$route.query.trialId,
};
let res = await addOrUpdateTrialBodyPart(data);
if (res.IsSuccess) {
this.getTrialBodyPartList(data);
this.$message.success(
this.$t("trials:seeting:message:addBodyPartSuccess")
);
this.addBodyPart_model.visible = false;
this.addBodyPartForm.bodyPartStr = null;
}
} catch (err) {
console.log(err);
if (err.Code === 5) {
this.getTrialBodyPartList();
this.errMessage = err.ErrorMessage;
}
}
},
handleSetBodyPart() {
this.bodyPartListVisible = true;
this.$nextTick(() => {
var a = this.$d.Bodypart.filter((v) => {
var a = this.trialBodyPartList.filter((v) => {
return !!this.form.BodyPartTypeList.find((v1) => {
return v1 === v.value;
return v1 === v.Name;
});
});
this.toggleBodyPartSelection(a);
@ -887,11 +1029,9 @@ export default {
handleConfirmBodyParts() {
this.form.BodyPartTypeList = Object.assign(
[],
this.selectedBodyParts.map((v) => v.value)
this.selectedBodyParts.map((v) => v.Name)
);
var bodyPartTypes = this.form.BodyPartTypeList.map((i) => {
return this.$fd("Bodypart", i);
});
var bodyPartTypes = this.form.BodyPartTypeList;
this.form.BodyPartTypes = bodyPartTypes.join(" | ");
this.bodyPartListVisible = false;
},
@ -1123,7 +1263,7 @@ export default {
);
this.form.BodyPartTypeList = this.form.BodyPartTypes.split("|");
var bodyPartTypes = this.form.BodyPartTypeList.map((i) => {
return this.$fd("Bodypart", i.trim());
return i.trim();
});
this.form.BodyPartTypes = bodyPartTypes.toString().replaceAll(",", " | ");
// this.form.ClinicalDataSetNamesStr = this.form.ClinicalDataSetNames.join(', ')
@ -1275,4 +1415,13 @@ export default {
color: red;
}
}
.errTip {
color: #f56c6c;
font-size: 12px;
line-height: 1;
padding-top: 4px;
position: absolute;
top: 100%;
left: 0;
}
</style>