diff --git a/src/main.js b/src/main.js index e286ef86..4cbcdfbc 100644 --- a/src/main.js +++ b/src/main.js @@ -255,6 +255,19 @@ async function VueInit() { } catch (e) { } } + Vue.prototype.$company = (isShort = true) => { + let companyName = null + if (localStorage.getItem('CompanyInfo')) { + let CompanyInfo = JSON.parse(localStorage.getItem('CompanyInfo')) + let isZh = zzSessionStorage.getItem('lang') === 'zh' || _vm.$i18n.locale == 'zh' + if (isZh) { + companyName = isShort ? CompanyInfo.CompanyShortNameCN : CompanyInfo.CompanyNameCN + } else { + companyName = isShort ? CompanyInfo.CompanyShortName : CompanyInfo.CompanyName + } + } + return companyName; + } Vue.prototype.$updateDictionary = function () { Vue.prototype.$d = function (code) { var dictInfo = res.Result diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 70ef429f..a2cf9be9 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -97,6 +97,7 @@ const actions = { zzSessionStorage.setItem('my_username', username.trim()) zzSessionStorage.setItem('my_password', md5(password)) zzSessionStorage.setItem('my_EMail', response.Result.BasicInfo.EMail) + localStorage.setItem('CompanyInfo', JSON.stringify(response.Result.CompanyInfo)) const data = response.Result if (data.BasicInfo.IsFirstAdd || data.BasicInfo.LoginState === 1) { try { diff --git a/src/views/trials/trials-panel/setting/trial-config/components/dicomConfig.vue b/src/views/trials/trials-panel/setting/trial-config/components/dicomConfig.vue index 5a4a376c..6c79f133 100644 --- a/src/views/trials/trials-panel/setting/trial-config/components/dicomConfig.vue +++ b/src/views/trials/trials-panel/setting/trial-config/components/dicomConfig.vue @@ -37,7 +37,7 @@

{{ form.CalledAE }} -

{{ $t("common:button:tip:copy") }}
+
{{ $t('common:button:tip:copy') }}

@@ -61,7 +61,7 @@ effect="plain" v-if="form.IsTestOK !== null" > - {{ $fd("DicomTest", form.IsTestOK) }} + {{ $fd('DicomTest', form.IsTestOK) }} - {{ $t("common:button:DicomTest") }} + {{ $t('common:button:DicomTest') }} @@ -88,7 +88,7 @@ type="primary" @click="addOrUpdateDicomAE" > - {{ $t("common:button:save") }} + {{ $t('common:button:save') }} - {{ $t("trials:trialCfg:button:confirm") }} + {{ $t('trials:trialCfg:button:confirm') }} - {{ $t("trials:trialCfg:button:update") }} + {{ $t('trials:trialCfg:button:update') }} - {{ $t("trials:trialCfg:button:updateAndConfirm") }} + {{ $t('trials:trialCfg:button:updateAndConfirm') }} - {{ $t("common:button:cancel") }} + {{ $t('common:button:cancel') }} @@ -148,9 +148,9 @@ custom-class="base-dialog-wrapper" >
- {{ $t("common:dialogTitle:sign") }} + {{ $t('common:dialogTitle:sign') }} {{ - `(${$t("common:label:sign")}${currentUser})` + `(${$t('common:label:sign')}${currentUser})` }}
- {{ $t("trials:trialCfg:button:confirmCfg") }} + {{ $t('trials:trialCfg:button:confirmCfg') }} @@ -243,7 +243,7 @@ > - {{ $t("trials:trialCfg:button:confirmCfg") }} + {{ $t('trials:trialCfg:button:confirmCfg') }} @@ -256,11 +256,11 @@ import { testSCPServerConnect, ConfigTrialPACSInfoConfirm, getTrialPacsConfigInfo, -} from "@/api/trials"; -import SignForm from "@/views/trials/components/newSignForm"; -import const_ from "@/const/sign-code"; +} from '@/api/trials' +import SignForm from '@/views/trials/components/newSignForm' +import const_ from '@/const/sign-code' export default { - name: "dicomConfig", + name: 'dicomConfig', components: { SignForm }, data() { return { @@ -279,91 +279,91 @@ export default { IsPACSConnect: [ { required: true, - message: this.$t("common:ruleMessage:specify"), - trigger: "blur", + message: this.$t('common:ruleMessage:specify'), + trigger: 'blur', }, ], CalledAE: [ { required: true, - message: this.$t("common:ruleMessage:specify"), - trigger: "blur", + message: this.$t('common:ruleMessage:specify'), + trigger: 'blur', }, { validator: (rule, value, callback) => { - let reg = /[a-zA-Z0-9]/; - if (!reg.test(value) && value !== "") { + let reg = /[a-zA-Z0-9]/ + if (!reg.test(value) && value !== '') { callback( - new Error(this.$t("common:ruleMessage:CallingAEPattern")) - ); + new Error(this.$t('common:ruleMessage:CallingAEPattern')) + ) } else { - callback(); + callback() } }, - message: this.$t("common:ruleMessage:CallingAEPattern"), - trigger: "blur", + message: this.$t('common:ruleMessage:CallingAEPattern'), + trigger: 'blur', }, { min: 1, max: 16, - message: this.$t("common:ruleMessage:CallingAEPattern"), - trigger: "blur", + message: this.$t('common:ruleMessage:CallingAEPattern'), + trigger: 'blur', }, ], Ip: [ { required: true, - message: this.$t("common:ruleMessage:specify"), - trigger: "blur", + message: this.$t('common:ruleMessage:specify'), + trigger: 'blur', }, { validator: (rule, value, callback) => { if ( - value === "" || - typeof value === "undefined" || + value === '' || + typeof value === 'undefined' || value == null ) { - callback(new Error(this.$t("common:ruleMessage:ipPattern"))); + callback(new Error(this.$t('common:ruleMessage:ipPattern'))) } else { const reg = - /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; - if (!reg.test(value) && value !== "") { - callback(new Error(this.$t("common:ruleMessage:ipPattern"))); + /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ + if (!reg.test(value) && value !== '') { + callback(new Error(this.$t('common:ruleMessage:ipPattern'))) } else { - callback(); + callback() } } }, - message: this.$t("common:ruleMessage:ipPattern"), - trigger: "blur", + message: this.$t('common:ruleMessage:ipPattern'), + trigger: 'blur', }, ], Port: [ { required: true, - message: this.$t("common:ruleMessage:specify"), - trigger: "blur", + message: this.$t('common:ruleMessage:specify'), + trigger: 'blur', }, { - type: "number", + type: 'number', min: 0, max: 65535, - message: this.$t("common:ruleMessage:portPattern"), - trigger: "blur", + message: this.$t('common:ruleMessage:portPattern'), + trigger: 'blur', }, { validator: (rule, value, callback) => { if ( value && - (String(value).includes(".") || + (String(value).includes('.') || new RegExp(/\D/g).test(String(value))) ) { - callback(new Error(this.$t("common:ruleMessage:portPattern"))); + callback(new Error(this.$t('common:ruleMessage:portPattern'))) } else { - callback(); + callback() } }, - trigger: "blur", + trigger: 'blur', }, ], }, @@ -371,91 +371,94 @@ export default { Id: null, signVisible: false, signCode: null, - currentUser: zzSessionStorage.getItem("userName"), + currentUser: zzSessionStorage.getItem('userName'), confirmData: [], confirmVisible: false, updateVisible: false, defaultObj: {}, - }; + } }, methods: { copyLink() { this.$copyText( - `${this.$t("trials:dicomCfg:form:CalledAE")}: ${ + `${this.$t('trials:dicomCfg:form:CalledAE')}: ${ this.form.CalledAE - }\n${this.$t("trials:dicomCfg:form:Ip")}: ${this.form.Ip}\n${this.$t( - "trials:dicomCfg:form:Port" + }\n${this.$t('trials:dicomCfg:form:Ip')}: ${this.form.Ip}\n${this.$t( + 'trials:dicomCfg:form:Port' )}: ${this.form.Port}\n${this.$t( - "trials:dicomCfg:form:Description" - )}: ${this.$t("trials:dicomCfg:Description:message")}` + 'trials:dicomCfg:form:Description' + )}: ${this.$t('trials:dicomCfg:Description:message').replace( + 'xxx', + this.$company() + )}` ) .then((res) => { // 复制成功 this.$message.success( - this.$t("trials:researchRecord:message:copySuccessfully") - ); + this.$t('trials:researchRecord:message:copySuccessfully') + ) }) .catch(() => { // 复制失败 - this.$alert(this.$t("trials:researchRecord:message:copyFailed")); - }); + this.$alert(this.$t('trials:researchRecord:message:copyFailed')) + }) }, // 获取默认值 async getTrialPacsConfigInfo() { try { let param = { TrialId: this.$route.query.trialId, - }; - let res = await getTrialPacsConfigInfo(param); + } + let res = await getTrialPacsConfigInfo(param) if (res.IsSuccess) { - this.defaultObj = res.Result; + this.defaultObj = res.Result } } catch (err) { - console.log(err); + console.log(err) } }, changeConnect(val) { if (!val) { - this.form.CalledAE = null; - this.form.Ip = null; - this.form.Port = null; - this.form.Modality = null; - this.form.IsTestOK = null; + this.form.CalledAE = null + this.form.Ip = null + this.form.Port = null + this.form.Modality = null + this.form.IsTestOK = null } else { - this.form.CalledAE = this.defaultObj.TrialCalledAE; - this.form.Ip = this.defaultObj.Ip; - this.form.Port = this.defaultObj.Port; - this.testSCPServerConnect(); + this.form.CalledAE = this.defaultObj.TrialCalledAE + this.form.Ip = this.defaultObj.Ip + this.form.Port = this.defaultObj.Port + this.testSCPServerConnect() } }, initForm(res) { - this.getInfo(); - this.getTrialPacsConfigInfo(); + this.getInfo() + this.getTrialPacsConfigInfo() }, // 取消配置更新 confirmCancel() { - this.isEdit = false; - this.form = { ...this.initialForm }; + this.isEdit = false + this.form = { ...this.initialForm } }, // 测试dicomAE async testSCPServerConnect() { try { - let validate = await this.$refs.dicomConfigForm.validate(); - if (!validate) return; + let validate = await this.$refs.dicomConfigForm.validate() + if (!validate) return let data = { CalledAE: this.form.CalledAE, Ip: this.form.Ip, Port: this.form.Port, - }; - this.loading = true; - let d = await testSCPServerConnect(data); - this.loading = false; + } + this.loading = true + let d = await testSCPServerConnect(data) + this.loading = false if (d.IsSuccess) { - this.form.IsTestOK = d.Result; + this.form.IsTestOK = d.Result } } catch (err) { - console.log(err); - this.loading = false; + console.log(err) + this.loading = false } }, // 获取配置 @@ -463,66 +466,66 @@ export default { try { let data = { TrialId: this.$route.query.trialId, - }; - this.loading = true; - let res = await getTrialDicomAE(data); - this.loading = false; + } + this.loading = true + let res = await getTrialDicomAE(data) + this.loading = false if (res.IsSuccess) { - res.Result = res.Result || {}; - this.form.IsPACSConnect = res.OtherInfo.IsPACSConnect; - this.form.IsTrialPACSConfirmed = res.OtherInfo.IsTrialPACSConfirmed; + res.Result = res.Result || {} + this.form.IsPACSConnect = res.OtherInfo.IsPACSConnect + this.form.IsTrialPACSConfirmed = res.OtherInfo.IsTrialPACSConfirmed if (!res.OtherInfo.IsTrialPACSConfirmed) { - this.isEdit = true; + this.isEdit = true } - this.form.IsTestOK = res.Result.IsTestOK || null; - this.form.CalledAE = res.Result.CalledAE; - this.form.Ip = res.Result.IP; - this.form.Port = res.Result.Port; - this.Id = res.Result.Id; + this.form.IsTestOK = res.Result.IsTestOK || null + this.form.CalledAE = res.Result.CalledAE + this.form.Ip = res.Result.IP + this.form.Port = res.Result.Port + this.Id = res.Result.Id - this.initialForm.IsPACSConnect = res.OtherInfo.IsPACSConnect; + this.initialForm.IsPACSConnect = res.OtherInfo.IsPACSConnect this.initialForm.IsTrialPACSConfirmed = - res.OtherInfo.IsTrialPACSConfirmed; - this.initialForm.IsTestOK = res.Result.IsTestOK; - this.initialForm.CalledAE = res.Result.CalledAE; - this.initialForm.Ip = res.Result.IP; - this.initialForm.Port = res.Result.Port; + res.OtherInfo.IsTrialPACSConfirmed + this.initialForm.IsTestOK = res.Result.IsTestOK + this.initialForm.CalledAE = res.Result.CalledAE + this.initialForm.Ip = res.Result.IP + this.initialForm.Port = res.Result.Port } } catch (err) { - console.log(err); - this.loading = false; + console.log(err) + this.loading = false } }, // 新增或修改配置 async addOrUpdateDicomAE() { try { - let validate = await this.$refs.dicomConfigForm.validate(); - if (!validate) return; + let validate = await this.$refs.dicomConfigForm.validate() + if (!validate) return if (this.Id) { - this.form.Id = this.Id; + this.form.Id = this.Id } - this.form.TrialId = this.$route.query.trialId; - this.loading = true; - let res = await addOrUpdateDicomAE(this.form); - this.loading = false; + this.form.TrialId = this.$route.query.trialId + this.loading = true + let res = await addOrUpdateDicomAE(this.form) + this.loading = false if (res.IsSuccess) { // this.$emit("refresh"); - this.Id = res.Result; - return res.Result || res.IsSuccess; + this.Id = res.Result + return res.Result || res.IsSuccess } - return false; + return false } catch (err) { - console.log(err); - this.loading = false; - return false; + console.log(err) + this.loading = false + return false } }, // 关闭签名框 closeSignDialog(isSign, signInfo) { if (isSign) { - this.signConfirm(signInfo); + this.signConfirm(signInfo) } else { - this.signVisible = false; + this.signVisible = false } }, async signConfirm(signInfo) { @@ -534,89 +537,89 @@ export default { IsTrialPACSConfirmed: true, }, signInfo, - }; - let res = await ConfigTrialPACSInfoConfirm(data); + } + let res = await ConfigTrialPACSInfoConfirm(data) if (res.IsSuccess) { - this.signVisible = false; - this.confirmVisible = false; - this.updateVisible = false; - this.isEdit = false; - res = await this.addOrUpdateDicomAE(); - if (res) this.$emit("refresh"); + this.signVisible = false + this.confirmVisible = false + this.updateVisible = false + this.isEdit = false + res = await this.addOrUpdateDicomAE() + if (res) this.$emit('refresh') } } catch (err) { - console.log(err); + console.log(err) } }, // 配置更新 handleUpdateConfigData() { - const { DicomConfigUpdates } = const_.processSignature; - this.signCode = DicomConfigUpdates; - this.signVisible = true; + const { DicomConfigUpdates } = const_.processSignature + this.signCode = DicomConfigUpdates + this.signVisible = true }, // 配置确认 handleConfirmConfigData() { - const { DicomConfigConfirmation } = const_.processSignature; - this.signCode = DicomConfigConfirmation; - this.signVisible = true; + const { DicomConfigConfirmation } = const_.processSignature + this.signCode = DicomConfigConfirmation + this.signVisible = true }, // 打开配置信息确认框 handleConfirm() { - this.$refs["dicomConfigForm"].validate(async (valid) => { - if (!valid) return; + this.$refs['dicomConfigForm'].validate(async (valid) => { + if (!valid) return if (!this.form.IsTestOK && this.form.IsPACSConnect) return this.$message.warning( - this.$t("trials:dicomCfg:message:IsTestNo") - ); - this.getConfigArr(); - this.confirmVisible = true; - }); + this.$t('trials:dicomCfg:message:IsTestNo') + ) + this.getConfigArr() + this.confirmVisible = true + }) }, // 打开配置信息更新框 handleUpdate() { - this.$refs["dicomConfigForm"].validate(async (valid) => { - if (!valid) return; + this.$refs['dicomConfigForm'].validate(async (valid) => { + if (!valid) return if (!this.form.IsTestOK && this.form.IsPACSConnect) return this.$message.warning( - this.$t("trials:dicomCfg:message:IsTestNo") - ); - this.getConfigArr(); - this.updateVisible = true; - }); + this.$t('trials:dicomCfg:message:IsTestNo') + ) + this.getConfigArr() + this.updateVisible = true + }) }, // 配置信息数组结构 getConfigArr() { this.confirmData = [ { - Name: this.$t("trials:dicomCfg:form:pacsLine"), // pacs直连 - NewVal: this.$fd("PACSConnectMode", this.form.IsPACSConnect), - OldVal: this.$fd("PACSConnectMode", this.initialForm.IsPACSConnect), + Name: this.$t('trials:dicomCfg:form:pacsLine'), // pacs直连 + NewVal: this.$fd('PACSConnectMode', this.form.IsPACSConnect), + OldVal: this.$fd('PACSConnectMode', this.initialForm.IsPACSConnect), }, { - Name: this.$t("trials:dicomCfg:form:CalledAE"), // AE名称 + Name: this.$t('trials:dicomCfg:form:CalledAE'), // AE名称 NewVal: this.form.CalledAE, OldVal: this.initialForm.CalledAE, }, { - Name: this.$t("trials:dicomCfg:form:Ip"), // IP地址 + Name: this.$t('trials:dicomCfg:form:Ip'), // IP地址 NewVal: this.form.Ip, OldVal: this.initialForm.Ip, }, { - Name: this.$t("trials:dicomCfg:form:Port"), + Name: this.$t('trials:dicomCfg:form:Port'), NewVal: this.form.Port, OldVal: this.initialForm.Port, }, { - Name: this.$t("trials:dicomCfg:form:IsTestOK"), // 状态 - NewVal: this.$fd("DicomTest", this.form.IsTestOK), - OldVal: this.$fd("DicomTest", this.initialForm.IsTestOK), + Name: this.$t('trials:dicomCfg:form:IsTestOK'), // 状态 + NewVal: this.$fd('DicomTest', this.form.IsTestOK), + OldVal: this.$fd('DicomTest', this.initialForm.IsTestOK), }, - ]; + ] }, }, -}; +}