bug fix and performance improvements

This commit is contained in:
quantulr
2023-08-01 15:50:13 +08:00
parent 1f5d58558b
commit 0a48c30f0e
37 changed files with 4661 additions and 209 deletions

View File

@ -26,8 +26,20 @@
<el-checkbox
v-for="item in checkList"
:key="item.id"
:label="item.name"
>{{ item.name }}
:label="
locale === 'zh'
? item.name
: locale === 'ru'
? item.nameRu
: null
"
>{{
locale === "zh"
? item.name
: locale === "ru"
? item.nameRu
: null
}}
</el-checkbox>
<!-- <el-checkbox label="0" @change="handleCheck">其他</el-checkbox> -->
</el-checkbox-group>
@ -107,34 +119,34 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
:label="t('admin.table.demandSubmitter')"
prop="commitUserName"
>
<el-input
v-model="form.commitUserName"
:placeholder="
t('admin.form.placeholder', {
type: t('admin.table.demandSubmitter'),
})
"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="t('admin.form.demandSubmitterPhone')"
prop="commitPhone"
>
<el-input
v-model="form.commitPhone"
:placeholder="t('admin.form.demandSubmitterPhone')"
></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item-->
<!-- :label="t('admin.table.demandSubmitter')"-->
<!-- prop="commitUserName"-->
<!-- >-->
<!-- <el-input-->
<!-- v-model="form.commitUserName"-->
<!-- :placeholder="-->
<!-- t('admin.form.placeholder', {-->
<!-- type: t('admin.table.demandSubmitter'),-->
<!-- })-->
<!-- "-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item-->
<!-- :label="t('admin.form.demandSubmitterPhone')"-->
<!-- prop="commitPhone"-->
<!-- >-->
<!-- <el-input-->
<!-- v-model="form.commitPhone"-->
<!-- :placeholder="t('admin.form.demandSubmitterPhone')"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-form>
<div :style="{ marginLeft: labelWidth + 'px' }">
<el-button @click="backToList"
@ -154,14 +166,15 @@ import {
insertDemand,
updateDemand,
} from "@/api/admin/enterprise/demand";
import { toTitleCase } from "@/utils/string";
import { ElMessage } from "element-plus";
import { computed, onMounted, reactive, toRefs } from "vue";
import { computed, onMounted, reactive, ref, toRefs } from "vue";
import { demandCategoryList } from "@/utils/parameter";
import { useRoute, useRouter } from "vue-router";
import { updateCount } from "@/api/admin/count";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const { t, locale } = useI18n();
const router = useRouter();
const route = useRoute();
const data = reactive({
@ -284,9 +297,11 @@ function addCheck() {
return item.name.trim() == checkInput.value.trim();
});
if (!flag) {
const nameField =
locale.value === "zh" ? "name" : `name${toTitleCase(locale.value)}`;
checkList.push({
id: checkList.length + 1,
name: checkInput.value,
[nameField]: checkInput.value,
});
checkInput.value = "";
}
@ -298,12 +313,16 @@ onMounted(() => {
const obj = Object.assign({}, route, { title: "修改服务需求" });
tab.updatePage(obj);
getDemand({ id: route.query.id }).then((resp) => {
// const nameField = locale === "zh" ? "name" : "nameRu";
console.log(locale.value);
const nameField =
locale.value === "zh" ? "name" : `name${toTitleCase(locale.value)}`;
if (resp.data.kinds) {
resp.data.kinds.forEach((el, index) => {
if (!checkList.find((item) => item.name == el)) {
if (!checkList.find((item) => item[nameField] === el)) {
checkList.push({
id: index,
name: el,
[nameField]: el,
});
}
});