术语配置测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
03e390013e
commit
62d5b39036
152
src/App.vue
152
src/App.vue
|
@ -37,7 +37,12 @@
|
||||||
height="100"
|
height="100"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-table-column prop="Code" label="标签" width="300" show-overflow-tooltip>
|
<el-table-column
|
||||||
|
prop="Code"
|
||||||
|
label="标签"
|
||||||
|
width="300"
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column-->
|
<!-- <el-table-column-->
|
||||||
<!-- prop="Description"-->
|
<!-- prop="Description"-->
|
||||||
|
@ -54,7 +59,7 @@
|
||||||
v-model="scope.row.Value"
|
v-model="scope.row.Value"
|
||||||
@input="
|
@input="
|
||||||
(e) => {
|
(e) => {
|
||||||
$set(scope.row, 'Value', e);
|
$set(scope.row, 'Value', e)
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -67,7 +72,7 @@
|
||||||
v-model="scope.row.ValueCN"
|
v-model="scope.row.ValueCN"
|
||||||
@input="
|
@input="
|
||||||
(e) => {
|
(e) => {
|
||||||
$set(scope.row, 'ValueCN', e);
|
$set(scope.row, 'ValueCN', e)
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
@ -90,13 +95,13 @@
|
||||||
import {
|
import {
|
||||||
batchAddOrUpdateFrontInternationalization,
|
batchAddOrUpdateFrontInternationalization,
|
||||||
getFrontInternationalizationList,
|
getFrontInternationalizationList,
|
||||||
} from "@/api/dictionary/dictionary";
|
} from '@/api/dictionary/dictionary'
|
||||||
import { getTrialExtralConfig } from "@/api/trials";
|
import { getTrialExtralConfig } from '@/api/trials'
|
||||||
import feedBack from "@/views/trials/trials-layout/components/feedBack";
|
import feedBack from '@/views/trials/trials-layout/components/feedBack'
|
||||||
import Vue from "vue";
|
import Vue from 'vue'
|
||||||
import i18n from "./lang";
|
import i18n from './lang'
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: 'App',
|
||||||
components: { feedBack },
|
components: { feedBack },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -105,38 +110,43 @@ export default {
|
||||||
show: false,
|
show: false,
|
||||||
key: null,
|
key: null,
|
||||||
arr: [],
|
arr: [],
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.show = process.env.VUE_APP_OSS_PATH === "/test/dist";
|
this.show = process.env.VUE_APP_OSS_PATH === '/test/dist'
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
"$route.query": {
|
|
||||||
async handler() {
|
|
||||||
if (
|
|
||||||
this.$route.query.trialId &&
|
|
||||||
this.$route.query.trialId !==
|
|
||||||
this.$store.state.trials.config.trialId &&
|
|
||||||
this.$store.state.trials.whiteList.indexOf(this.$route.path) === -1
|
|
||||||
) {
|
|
||||||
let res = await getTrialExtralConfig({
|
|
||||||
TrialId: this.$route.query.trialId,
|
|
||||||
});
|
|
||||||
if (res.IsSuccess) {
|
|
||||||
this.$store.dispatch("trials/setConfig", {
|
|
||||||
trialId: this.$route.query.trialId,
|
|
||||||
...res.Result,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
immediate: true,
|
|
||||||
deep: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
// watch: {
|
||||||
|
// '$route.query': {
|
||||||
|
// async handler() {
|
||||||
|
// if (!this.$route.query.trialId) {
|
||||||
|
// this.$store.dispatch('trials/setConfig', {})
|
||||||
|
// }
|
||||||
|
// if (
|
||||||
|
// this.$route.query.trialId &&
|
||||||
|
// this.$route.query.trialId !==
|
||||||
|
// this.$store.state.trials.config.trialId &&
|
||||||
|
// this.$store.state.trials.whiteList.indexOf(this.$route.path) === -1
|
||||||
|
// ) {
|
||||||
|
// let res = await getTrialExtralConfig({
|
||||||
|
// TrialId: this.$route.query.trialId,
|
||||||
|
// })
|
||||||
|
// console.log(222222222222)
|
||||||
|
// res.Result.aa = { 阅片人: '采集人', 申办方: 'aaa' }
|
||||||
|
// if (res.IsSuccess) {
|
||||||
|
// this.$store.dispatch('trials/setConfig', {
|
||||||
|
// trialId: this.$route.query.trialId,
|
||||||
|
// ...res.Result,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// immediate: true,
|
||||||
|
// deep: true,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
changeValue(target, attr, e) {
|
changeValue(target, attr, e) {
|
||||||
this.$set(target, attr, e);
|
this.$set(target, attr, e)
|
||||||
},
|
},
|
||||||
keyChange(v) {
|
keyChange(v) {
|
||||||
if (this.key) {
|
if (this.key) {
|
||||||
|
@ -148,65 +158,65 @@ export default {
|
||||||
~v.Value.indexOf(this.key) ||
|
~v.Value.indexOf(this.key) ||
|
||||||
~v.ValueCN.indexOf(this.key)
|
~v.ValueCN.indexOf(this.key)
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
this.tableData = Object.assign([], this.arr);
|
this.tableData = Object.assign([], this.arr)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSave() {
|
handleSave() {
|
||||||
this.$confirm("确定修改当前页面国际化内容?").then(() => {
|
this.$confirm('确定修改当前页面国际化内容?').then(() => {
|
||||||
batchAddOrUpdateFrontInternationalization(this.tableData).then(
|
batchAddOrUpdateFrontInternationalization(this.tableData).then(
|
||||||
async (res) => {
|
async (res) => {
|
||||||
var zhMessages = {},
|
var zhMessages = {},
|
||||||
enMessages = {};
|
enMessages = {}
|
||||||
var Internationalization = await getFrontInternationalizationList();
|
var Internationalization = await getFrontInternationalizationList()
|
||||||
Vue.prototype.$tl = Internationalization.Result;
|
Vue.prototype.$tl = Internationalization.Result
|
||||||
this.tableData.forEach((v) => {
|
this.tableData.forEach((v) => {
|
||||||
// zhMessages[v.Description + '_' + v.Code] = v.ValueCN
|
// zhMessages[v.Description + '_' + v.Code] = v.ValueCN
|
||||||
// enMessages[v.Description + '_' + v.Code] = v.Value
|
// enMessages[v.Description + '_' + v.Code] = v.Value
|
||||||
zhMessages[v.Code] = v.ValueCN;
|
zhMessages[v.Code] = v.ValueCN
|
||||||
enMessages[v.Code] = v.Value;
|
enMessages[v.Code] = v.Value
|
||||||
});
|
})
|
||||||
i18n.mergeLocaleMessage("zh", zhMessages);
|
i18n.mergeLocaleMessage('zh', zhMessages)
|
||||||
i18n.mergeLocaleMessage("en", enMessages);
|
i18n.mergeLocaleMessage('en', enMessages)
|
||||||
this.drawer = false;
|
this.drawer = false
|
||||||
this.$message.success("国际化修改成功");
|
this.$message.success('国际化修改成功')
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
openI18n() {
|
openI18n() {
|
||||||
this.tableData = [];
|
this.tableData = []
|
||||||
this.key = null;
|
this.key = null
|
||||||
this.drawer = true;
|
this.drawer = true
|
||||||
let arr = [];
|
let arr = []
|
||||||
let tableData = this.$tl.map((v) => {
|
let tableData = this.$tl.map((v) => {
|
||||||
let a = { ...v };
|
let a = { ...v }
|
||||||
// if (!a.Description) {
|
// if (!a.Description) {
|
||||||
// a.Description = this.$route.path
|
// a.Description = this.$route.path
|
||||||
// }
|
// }
|
||||||
return a;
|
return a
|
||||||
});
|
})
|
||||||
tableData = tableData.filter((v) => {
|
tableData = tableData.filter((v) => {
|
||||||
// return ~this.$path.indexOf(v.Description + '_' + v.Code)
|
// return ~this.$path.indexOf(v.Description + '_' + v.Code)
|
||||||
return ~this.$path.indexOf(v.Code);
|
return ~this.$path.indexOf(v.Code)
|
||||||
});
|
})
|
||||||
this.$path.forEach((v) => {
|
this.$path.forEach((v) => {
|
||||||
let o = tableData.find((a) => {
|
let o = tableData.find((a) => {
|
||||||
return a.Code === v;
|
return a.Code === v
|
||||||
});
|
})
|
||||||
if (o) {
|
if (o) {
|
||||||
arr.push(o);
|
arr.push(o)
|
||||||
} else {
|
} else {
|
||||||
arr.push({
|
arr.push({
|
||||||
Code: v,
|
Code: v,
|
||||||
Description: null,
|
Description: null,
|
||||||
Value: null,
|
Value: null,
|
||||||
ValueCN: null,
|
ValueCN: null,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
this.arr = arr;
|
this.arr = arr
|
||||||
if (this.key) {
|
if (this.key) {
|
||||||
this.tableData = Object.assign(
|
this.tableData = Object.assign(
|
||||||
[],
|
[],
|
||||||
|
@ -216,15 +226,15 @@ export default {
|
||||||
~v.Value.indexOf(this.key) ||
|
~v.Value.indexOf(this.key) ||
|
||||||
~v.ValueCN.indexOf(this.key)
|
~v.ValueCN.indexOf(this.key)
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
this.tableData = Object.assign([], this.arr);
|
this.tableData = Object.assign([], this.arr)
|
||||||
}
|
}
|
||||||
// console.log(JSON.stringify(this.$path))
|
// console.log(JSON.stringify(this.$path))
|
||||||
// console.log(JSON.stringify(this.tableData))
|
// console.log(JSON.stringify(this.tableData))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -249,7 +259,7 @@ input::-webkit-inner-spin-button {
|
||||||
-webkit-appearance: none !important;
|
-webkit-appearance: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="number"] {
|
input[type='number'] {
|
||||||
-moz-appearance: textfield !important;
|
-moz-appearance: textfield !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +285,7 @@ textarea {
|
||||||
color: $light_gray;
|
color: $light_gray;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-family: "Times New Roman";
|
font-family: 'Times New Roman';
|
||||||
text-shadow: 1px 0.5px 1.5px #666;
|
text-shadow: 1px 0.5px 1.5px #666;
|
||||||
}
|
}
|
||||||
.title-logo {
|
.title-logo {
|
||||||
|
|
13
src/main.js
13
src/main.js
|
@ -295,13 +295,18 @@ async function VueInit() {
|
||||||
}
|
}
|
||||||
Vue.prototype.$path = []
|
Vue.prototype.$path = []
|
||||||
var t = function (key) {
|
var t = function (key) {
|
||||||
// if (![Vue.prototype.toPath + '_' + key].includes(Vue.prototype.$path)) {
|
|
||||||
if (!~Vue.prototype.$path.indexOf(key)) {
|
if (!~Vue.prototype.$path.indexOf(key)) {
|
||||||
// Vue.prototype.$path.push(Vue.prototype.toPath + '_' + key)
|
|
||||||
Vue.prototype.$path.push(key)
|
Vue.prototype.$path.push(key)
|
||||||
}
|
}
|
||||||
// return i18n.t(Vue.prototype.toPath + '_' + key)
|
let text = i18n.t(key)
|
||||||
return i18n.t(key)
|
if (store.state.trials.config.aa) {
|
||||||
|
Object.keys(store.state.trials.config.aa).forEach(key => {
|
||||||
|
let test = new RegExp(key)
|
||||||
|
text = text.replace(test, store.state.trials.config.aa[key])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// return i18n.t(key)
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
Vue.prototype.$t = t
|
Vue.prototype.$t = t
|
||||||
_vm = new Vue({
|
_vm = new Vue({
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { getToken } from '@/utils/auth'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { OSSclient } from './utils/oss'
|
import { OSSclient } from './utils/oss'
|
||||||
import WHITELIST from "./utils/whiteList"
|
import WHITELIST from "./utils/whiteList"
|
||||||
|
import { getTrialExtralConfig } from '@/api/trials'
|
||||||
// import getPageTitle from '@/utils/get-page-title'
|
// import getPageTitle from '@/utils/get-page-title'
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false })
|
NProgress.configure({ showSpinner: false })
|
||||||
|
@ -88,6 +89,27 @@ router.beforeEach(async (to, from, next) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!to.query.trialId) {
|
||||||
|
store.dispatch('trials/setConfig', {})
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
to.query.trialId &&
|
||||||
|
to.query.trialId !==
|
||||||
|
store.state.trials.config.trialId &&
|
||||||
|
store.state.trials.whiteList.indexOf(to.path) === -1
|
||||||
|
) {
|
||||||
|
let res = await getTrialExtralConfig({
|
||||||
|
TrialId: to.query.trialId,
|
||||||
|
})
|
||||||
|
res.Result.aa = { 阅片人: '采集人', 申办方: 'aaa' }
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
store.dispatch('trials/setConfig', {
|
||||||
|
trialId: to.query.trialId,
|
||||||
|
...res.Result,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
|
|
Loading…
Reference in New Issue