国家化新增模块、迭代字段,提供批量更新

uat_us
wangxiaoshuang 2024-06-27 16:25:18 +08:00
parent 59f27b9d35
commit ced1be74b3
4 changed files with 543 additions and 259 deletions

View File

@ -277,3 +277,19 @@ export function batchAddInternationalization(param) {
data: param data: param
}) })
} }
// 国际化获取迭代列表
export function getPublishVersionSelect() {
return request({
url: `/PublishLog/getPublishVersionSelect`,
method: 'get',
})
}
// 国际化批量更新
export function batchUpdateInternationalInfo(data) {
return request({
url: `/Internationalization/batchUpdateInternationalInfo`,
method: 'put',
data
})
}

View File

@ -6,122 +6,162 @@
v-loading="loading" v-loading="loading"
:model="form" :model="form"
size="small" size="small"
:rules="rules"
> >
<el-form-item label="国际化类型" prop="InternationalizationType"> <el-form-item label="国际化类型" prop="InternationalizationType">
<el-radio-group v-model="form.InternationalizationType"> <el-radio-group v-model="form.InternationalizationType">
<el-radio <el-radio
v-for="item of $d.InternationalizationType" v-for="item of $d.InternationalizationType"
:key="'InternationalizationType'+item.value" :key="'InternationalizationType' + item.value"
:label="item.value" :label="item.value"
>{{ item.label }}</el-radio> >{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="State"> <el-form-item label="状态" prop="State">
<el-radio-group v-model="form.State"> <el-radio-group v-model="form.State">
<el-radio <el-radio
v-for="item of $d.InternationalizationKeyState" v-for="item of $d.InternationalizationKeyState"
:key="'InternationalizationKeyState'+item.value" :key="'InternationalizationKeyState' + item.value"
:label="item.value" :label="item.value"
>{{ item.label }}</el-radio> >{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-table <el-form-item label="迭代" prop="PublishLogId">
:data="form.AddList" <el-select v-model="form.PublishLogId" clearable filterable>
style="width: 100%" <el-option
height="300" v-for="item in PublishVersionList"
> :key="item.Id"
<el-table-column :label="item.Version"
prop="" :value="item.Id"
label="功能模块/服务名" />
> </el-select>
</el-form-item>
<el-table :data="form.AddList" style="width: 100%" height="300">
<el-table-column prop="" label="功能模块/服务名">
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item <el-form-item
label="" label=""
:prop="`AddList.${scope.$index}.Description`" :prop="`AddList.${scope.$index}.Module`"
:rules="[ :rules="[
{ required: true,message: $t('common:ruleMessage:specify'), trigger: ['change','blur']}, {
{ max: 200, message: `${$t('common:ruleMessage:maxLength')} 200` } max: 200,
message: `${$t('common:ruleMessage:maxLength')} 200`,
trigger: ['change', 'blur'],
},
]" ]"
> >
<el-input <el-input
v-model="scope.row.Description" v-model="scope.row.Module"
type="textarea" type="textarea"
maxlength="200" maxlength="200"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="" label="标识">
prop=""
label="标识"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item <el-form-item
label="" label=""
:prop="`AddList.${scope.$index}.Code`" :prop="`AddList.${scope.$index}.Code`"
:rules="[ :rules="[
{ required: true,message: $t('common:ruleMessage:specify'), trigger: ['change','blur']}, {
{ max: 200, message: `${$t('common:ruleMessage:maxLength')} 200` } required: true,
message: $t('common:ruleMessage:specify'),
trigger: ['change', 'blur'],
},
{
max: 200,
message: `${$t('common:ruleMessage:maxLength')} 200`,
},
]" ]"
> >
<el-input <el-input
v-model="scope.row.Code" v-model="scope.row.Code"
type="textarea" type="textarea"
maxlength="200" maxlength="200"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="" label="中文值">
prop=""
label="中文值"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item <el-form-item
label="" label=""
:prop="`AddList.${scope.$index}.ValueCN`" :prop="`AddList.${scope.$index}.ValueCN`"
:rules="[ :rules="[
{ required: true,message: $t('common:ruleMessage:specify'), trigger: ['change','blur']}, {
{ max: 1000, message: `${$t('common:ruleMessage:maxLength')} 1000` } required: true,
message: $t('common:ruleMessage:specify'),
trigger: ['change', 'blur'],
},
{
max: 1000,
message: `${$t('common:ruleMessage:maxLength')} 1000`,
},
]" ]"
> >
<el-input <el-input
v-model="scope.row.ValueCN" v-model="scope.row.ValueCN"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="" label="英文值">
prop=""
label="英文值"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item <el-form-item
label="" label=""
:prop="`AddList.${scope.$index}.Value`" :prop="`AddList.${scope.$index}.Value`"
:rules="[ :rules="[
{ required: true,message: $t('common:ruleMessage:specify'), trigger: ['change','blur']}, {
{ max: 1000, message: `${$t('common:ruleMessage:maxLength')} 1000` } required: true,
message: $t('common:ruleMessage:specify'),
trigger: ['change', 'blur'],
},
{
max: 1000,
message: `${$t('common:ruleMessage:maxLength')} 1000`,
},
]" ]"
> >
<el-input <el-input
v-model="scope.row.Value" v-model="scope.row.Value"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="" label="说明">
align="right" <template slot-scope="scope">
width="100" <el-form-item
> label=""
:prop="`AddList.${scope.$index}.Description`"
:rules="[
{
max: 200,
message: `${$t('common:ruleMessage:maxLength')} 200`,
trigger: ['change', 'blur'],
},
]"
>
<el-input
v-model="scope.row.Description"
type="textarea"
maxlength="200"
:autosize="{ minRows: 2, maxRows: 4 }"
/>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="right" width="100">
<template slot="header"> <template slot="header">
<!-- 新增 --> <!-- 新增 -->
<el-button <el-button
@ -129,7 +169,8 @@
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
@click="handleAdd" @click="handleAdd"
>{{ $t('common:button:new') }}</el-button> >{{ $t("common:button:new") }}</el-button
>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 删除 --> <!-- 删除 -->
@ -138,81 +179,97 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.$index)" @click="handleDelete(scope.$index)"
>{{ $t('common:button:delete') }}</el-button> >{{ $t("common:button:delete") }}</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form> </el-form>
</template> </template>
<template slot="dialog-footer"> <template slot="dialog-footer">
<el-button size="small" type="primary" @click="handleCancle"></el-button> <el-button size="small" type="primary" @click="handleCancle"
<el-button size="small" type="primary" @click="handleSave"></el-button> >取消</el-button
>
<el-button size="small" type="primary" @click="handleSave"
>保存</el-button
>
</template> </template>
</base-model> </base-model>
</template> </template>
<script> <script>
import { batchAddInternationalization } from '@/api/admin' import { batchAddInternationalization } from "@/api/admin";
import BaseModel from '@/components/BaseModel' import BaseModel from "@/components/BaseModel";
const formDataDefault = () => { const formDataDefault = () => {
return { return {
State: 0, State: 0,
InternationalizationType: 1, InternationalizationType: 1,
AddList: [] PublishLogId: null,
} AddList: [],
} };
};
export default { export default {
name: 'BatcnAddForm', name: "BatcnAddForm",
components: { BaseModel }, components: { BaseModel },
data() { data() {
return { return {
loading: false, loading: false,
form: formDataDefault(), form: formDataDefault(),
model_cfg: { visible: false, showClose: true, width: '800px', title: '', appendToBody: true } model_cfg: {
} visible: false,
}, showClose: true,
mounted() { width: "800px",
title: "",
appendToBody: true,
},
rules: {
PublishLogId: [{ required: true, message: "请选择", trigger: "blur" }],
},
PublishVersionList: [],
};
}, },
mounted() {},
methods: { methods: {
openDialog(title, data, options = []) {
openDialog(title, data) { this.PublishVersionList = options;
this.model_cfg.visible = true this.model_cfg.visible = true;
this.model_cfg.title = title this.model_cfg.title = title;
this.form = formDataDefault() this.form = formDataDefault();
}, },
handleSave() { handleSave() {
this.$refs.batcnAddForm.validate(valid => { this.$refs.batcnAddForm.validate((valid) => {
if (!valid) return if (!valid) return;
this.loading = true this.loading = true;
batchAddInternationalization(this.form).then(res => { batchAddInternationalization(this.form)
this.loading = false .then((res) => {
this.$message.success(this.$t('common:message:savedSuccessfully')) this.loading = false;
this.model_cfg.visible = false this.$message.success(this.$t("common:message:savedSuccessfully"));
this.$emit('getList') this.model_cfg.visible = false;
}).catch(() => { this.$emit("getList");
this.loading = false })
}) .catch(() => {
}) this.loading = false;
});
});
}, },
handleCancle() { handleCancle() {
this.model_cfg.visible = false this.model_cfg.visible = false;
}, },
handleAdd() { handleAdd() {
this.form.AddList.push({ this.form.AddList.push({
Description: '', Description: "",
Code: '', Code: "",
ValueCN: '', ValueCN: "",
Value: '' Value: "",
}) });
}, },
handleDelete(index) { handleDelete(index) {
this.$confirm('是否确认删除?', { this.$confirm("是否确认删除?", {
type: 'warning', type: "warning",
distinguishCancelAndClose: true distinguishCancelAndClose: true,
}).then(() => { }).then(() => {
this.form.AddList.splice(index, 1) this.form.AddList.splice(index, 1);
}) });
} },
} },
} };
</script> </script>

View File

@ -9,147 +9,216 @@
label-width="130px" label-width="130px"
size="small" size="small"
> >
<el-form-item label="国际化类型" prop="InternationalizationType"> <el-form-item
label="国际化类型"
prop="InternationalizationType"
v-if="status !== 'batch'"
>
<el-radio-group v-model="form.InternationalizationType"> <el-radio-group v-model="form.InternationalizationType">
<el-radio <el-radio
v-for="item of $d.InternationalizationType" v-for="item of $d.InternationalizationType"
:key="'InternationalizationType'+item.value" :key="'InternationalizationType' + item.value"
:label="item.value" :label="item.value"
>{{ item.label }}</el-radio> >{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="功能模块/服务名" prop="Description"> <el-form-item
label="功能模块/服务名"
prop="Module"
v-if="status !== 'batch'"
>
<el-input <el-input
v-model="form.Description" v-model="form.Module"
type="textarea" type="textarea"
maxlength="200" maxlength="200"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
<el-form-item label="标识" prop="Code"> <el-form-item label="标识" prop="Code" v-if="status !== 'batch'">
<el-input <el-input
v-model="form.Code" v-model="form.Code"
type="textarea" type="textarea"
maxlength="200" maxlength="200"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
<el-form-item label="中文值" prop="ValueCN"> <el-form-item label="中文值" prop="ValueCN" v-if="status !== 'batch'">
<el-input <el-input
v-model="form.ValueCN" v-model="form.ValueCN"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
<el-form-item label="英文值" prop="Value"> <el-form-item label="英文值" prop="Value" v-if="status !== 'batch'">
<el-input <el-input
v-model="form.Value" v-model="form.Value"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4 }"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="State"> <el-form-item label="状态" prop="State">
<el-radio-group v-model="form.State"> <el-radio-group v-model="form.State">
<el-radio <el-radio
v-for="item of $d.InternationalizationKeyState" v-for="item of $d.InternationalizationKeyState"
:key="'InternationalizationKeyState'+item.value" :key="'InternationalizationKeyState' + item.value"
:label="item.value" :label="item.value"
>{{ item.label }}</el-radio> >{{ item.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="说明" prop="Description" v-if="status !== 'batch'">
<el-input
v-model="form.Description"
type="textarea"
maxlength="200"
:autosize="{ minRows: 2, maxRows: 4 }"
/>
</el-form-item>
<el-form-item label="迭代" prop="PublishLogId">
<el-select v-model="form.PublishLogId" clearable filterable>
<el-option
v-for="item in PublishVersionList"
:key="item.Id"
:label="item.Version"
:value="item.Id"
/>
</el-select>
</el-form-item>
</el-form> </el-form>
</template> </template>
<template slot="dialog-footer"> <template slot="dialog-footer">
<el-button size="small" type="primary" @click="handleCancle"></el-button> <el-button size="small" type="primary" @click="handleCancle"
<el-button size="small" type="primary" @click="handleSave"></el-button> >取消</el-button
>
<el-button size="small" type="primary" @click="handleSave"
>保存</el-button
>
</template> </template>
</base-model> </base-model>
</template> </template>
<script> <script>
import { addOrUpdateInternationalization } from '@/api/admin' import { addOrUpdateInternationalization } from "@/api/admin";
import BaseModel from '@/components/BaseModel' import BaseModel from "@/components/BaseModel";
const formDataDefault = () => { const formDataDefault = () => {
return { return {
Id: null, Id: null,
State: 0, State: 0,
Description: null, Description: null,
Module: null,
Code: null, Code: null,
Value: null, Value: null,
ValueCN: null, ValueCN: null,
InternationalizationType: 1 InternationalizationType: 1,
} PublishLogId: null,
} };
};
export default { export default {
name: 'I18nForm', name: "I18nForm",
components: { BaseModel }, components: { BaseModel },
data() { data() {
return { return {
status: "add", // add update batch
loading: false, loading: false,
form: formDataDefault(), form: formDataDefault(),
rules: { rules: {
State: [ State: [{ required: true, message: "请选择", trigger: "blur" }],
{ required: true, message: '请选择', trigger: 'blur' } Module: [
{
max: 200,
message: `${this.$t("common:ruleMessage:maxLength")} 200`,
trigger: "blur",
},
], ],
Description: [ Description: [
{ required: true, message: '请注明', trigger: 'blur' }, {
{ max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200` } max: 200,
message: `${this.$t("common:ruleMessage:maxLength")} 200`,
trigger: "blur",
},
], ],
Code: [ Code: [
{ required: true, message: '请注明', trigger: 'blur' }, { required: true, message: "请注明", trigger: "blur" },
{ max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200` } {
max: 200,
message: `${this.$t("common:ruleMessage:maxLength")} 200`,
},
], ],
Value: [ Value: [
{ required: true, message: '请注明', trigger: 'blur' }, { required: true, message: "请注明", trigger: "blur" },
{ max: 1000, message: `${this.$t('common:ruleMessage:maxLength')} 1000` } {
max: 1000,
message: `${this.$t("common:ruleMessage:maxLength")} 1000`,
},
], ],
ValueCN: [ ValueCN: [
{ required: true, message: '请注明', trigger: 'blur' }, { required: true, message: "请注明", trigger: "blur" },
{ max: 1000, message: `${this.$t('common:ruleMessage:maxLength')} 1000` } {
max: 1000,
message: `${this.$t("common:ruleMessage:maxLength")} 1000`,
},
], ],
InternationalizationType: [ InternationalizationType: [
{ required: true, message: '请选择', trigger: 'blur' } { required: true, message: "请选择", trigger: "blur" },
] ],
PublishLogId: [{ required: true, message: "请选择", trigger: "blur" }],
}, },
model_cfg: { visible: false, showClose: true, width: '600px', title: '', appendToBody: true } model_cfg: {
} visible: false,
}, showClose: true,
mounted() { width: "600px",
title: "",
appendToBody: true,
},
PublishVersionList: [],
};
}, },
mounted() {},
methods: { methods: {
openDialog(title, data, options = [], status) {
openDialog(title, data) { this.PublishVersionList = options;
this.model_cfg.visible = true this.status = status;
this.model_cfg.title = title this.model_cfg.visible = true;
this.model_cfg.title = title;
if (Object.keys(data).length > 0) { if (Object.keys(data).length > 0) {
for (const k in this.form) { for (const k in this.form) {
if (data.hasOwnProperty(k)) { if (data.hasOwnProperty(k)) {
this.form[k] = data[k] this.form[k] = data[k];
} }
} }
} else { } else {
this.form = formDataDefault() this.form = formDataDefault();
} }
}, },
handleSave() { handleSave() {
this.$refs.i18nForm.validate(valid => { this.$refs.i18nForm.validate((valid) => {
if (!valid) return if (!valid) return;
this.loading = true this.loading = true;
addOrUpdateInternationalization(this.form).then(res => { if (this.status === "batch") {
this.loading = false return this.$emit("batch", this.form);
this.$message.success(this.$t('common:message:savedSuccessfully')) }
this.model_cfg.visible = false addOrUpdateInternationalization(this.form)
this.$emit('getList') .then((res) => {
}).catch(() => { this.loading = false;
this.loading = false this.$message.success(this.$t("common:message:savedSuccessfully"));
}) this.model_cfg.visible = false;
}) this.$emit("getList");
})
.catch(() => {
this.loading = false;
});
});
}, },
handleCancle() { handleCancle() {
this.model_cfg.visible = false this.model_cfg.visible = false;
} },
} },
} };
</script> </script>
<style lang="scss" scoped>
::v-deep .el-select {
width: 100%;
}
</style>

View File

@ -7,11 +7,11 @@
v-model="searchData.InternationalizationType" v-model="searchData.InternationalizationType"
clearable clearable
filterable filterable
style="width:130px;" style="width: 130px"
> >
<el-option <el-option
v-for="item of $d.InternationalizationType" v-for="item of $d.InternationalizationType"
:key="'InternationalizationType'+item.value" :key="'InternationalizationType' + item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
@ -19,10 +19,10 @@
</el-form-item> </el-form-item>
<el-form-item label="功能模块/服务名"> <el-form-item label="功能模块/服务名">
<el-input <el-input
v-model="searchData.Description" v-model="searchData.Module"
size="small" size="small"
clearable clearable
style="width:130px;" style="width: 130px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="标识"> <el-form-item label="标识">
@ -30,7 +30,7 @@
v-model="searchData.Code" v-model="searchData.Code"
size="small" size="small"
clearable clearable
style="width:130px;" style="width: 130px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="中文值"> <el-form-item label="中文值">
@ -38,27 +38,55 @@
v-model="searchData.ValueCN" v-model="searchData.ValueCN"
size="small" size="small"
clearable clearable
style="width:130px;" style="width: 130px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="英文值"> <el-form-item label="英文值">
<el-input <el-input
v-model="searchData.Value" v-model="searchData.Value"
size="small" size="small"
style="width:130px;" style="width: 130px"
clearable clearable
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态"> <el-form-item label="状态">
<el-select v-model="searchData.State" clearable filterable style="width:130px;"> <el-select
v-model="searchData.State"
clearable
filterable
style="width: 130px"
>
<el-option <el-option
v-for="item of $d.InternationalizationKeyState" v-for="item of $d.InternationalizationKeyState"
:key="'InternationalizationKeyState'+item.value" :key="'InternationalizationKeyState' + item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="说明">
<el-input
v-model="searchData.Description"
size="small"
clearable
style="width: 130px"
/>
</el-form-item>
<el-form-item label="迭代">
<el-select
v-model="searchData.PublishLogId"
clearable
filterable
style="width: 130px"
>
<el-option
v-for="item in PublishVersionList"
:key="item.Id"
:label="item.Version"
:value="item.Id"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button
type="primary" type="primary"
@ -84,20 +112,27 @@
> >
批量新增 批量新增
</el-button> </el-button>
<el-button
type="primary"
icon="el-icon-edit-outline"
size="mini"
:disabled="selectTableList.length <= 0"
@click="handleBatchUpdate"
>
批量更新
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
v-loading="loading" v-loading="loading"
v-adaptive="{bottomOffset:45}" v-adaptive="{ bottomOffset: 45 }"
height="100" height="100"
:data="list" :data="list"
class="table" class="table"
@sort-change="handleSortByColumn" @sort-change="handleSortByColumn"
> @selection-change="handleSelectionChange"
<el-table-column ><el-table-column type="selection" width="50" />
type="index" <el-table-column type="index" width="50" />
width="50"
/>
<el-table-column <el-table-column
label="国际化类型" label="国际化类型"
prop="InternationalizationType" prop="InternationalizationType"
@ -106,21 +141,42 @@
sortable="custom" sortable="custom"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.InternationalizationType === 0" type="primary"> <el-tag
{{ $fd('InternationalizationType', scope.row.InternationalizationType) }} v-if="scope.row.InternationalizationType === 0"
type="primary"
>
{{
$fd(
"InternationalizationType",
scope.row.InternationalizationType
)
}}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.InternationalizationType === 1" type="warning"> <el-tag
{{ $fd('InternationalizationType', scope.row.InternationalizationType) }} v-else-if="scope.row.InternationalizationType === 1"
type="warning"
>
{{
$fd(
"InternationalizationType",
scope.row.InternationalizationType
)
}}
</el-tag> </el-tag>
<el-tag v-else> <el-tag v-else>
{{ $fd('InternationalizationType', scope.row.InternationalizationType) }} {{
$fd(
"InternationalizationType",
scope.row.InternationalizationType
)
}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="功能模块/服务名" label="功能模块/服务名"
prop="Description" prop="Module"
min-width="100" min-width="120"
show-overflow-tooltip show-overflow-tooltip
sortable="custom" sortable="custom"
/> />
@ -154,16 +210,30 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.State === 0" type="danger"> <el-tag v-if="scope.row.State === 0" type="danger">
{{ $fd('InternationalizationKeyState', scope.row.State) }} {{ $fd("InternationalizationKeyState", scope.row.State) }}
</el-tag> </el-tag>
<el-tag v-else-if="scope.row.State === 1" type="primary"> <el-tag v-else-if="scope.row.State === 1" type="primary">
{{ $fd('InternationalizationKeyState', scope.row.State) }} {{ $fd("InternationalizationKeyState", scope.row.State) }}
</el-tag> </el-tag>
<el-tag v-else> <el-tag v-else>
{{ $fd('InternationalizationKeyState', scope.row.State) }} {{ $fd("InternationalizationKeyState", scope.row.State) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
label="说明"
prop="Description"
min-width="100"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
label="迭代"
prop="Version"
min-width="100"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column <el-table-column
label="更新时间" label="更新时间"
prop="UpdateTime" prop="UpdateTime"
@ -197,11 +267,10 @@
> >
删除 删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination" style="text-align: right;margin-top:5px;"> <div class="pagination" style="text-align: right; margin-top: 5px">
<pagination <pagination
:total="total" :total="total"
:page.sync="searchData.PageIndex" :page.sync="searchData.PageIndex"
@ -209,20 +278,22 @@
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<i18n-form <i18n-form ref="i18nForm" @getList="getList" @batch="batch" />
ref="i18nForm"
@getList="getList"
/>
<BatchAddForm ref="batcnAddForm" @getList="getList" /> <BatchAddForm ref="batcnAddForm" @getList="getList" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getInternationalizationList, deleteInternationalization } from '@/api/admin' import {
import Pagination from '@/components/Pagination' getInternationalizationList,
import I18nForm from './components/I18nForm.vue' deleteInternationalization,
import BatchAddForm from './components/BatchAddForm.vue' getPublishVersionSelect,
import moment from 'moment' batchUpdateInternationalInfo,
} from "@/api/admin";
import Pagination from "@/components/Pagination";
import I18nForm from "./components/I18nForm.vue";
import BatchAddForm from "./components/BatchAddForm.vue";
import moment from "moment";
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
Description: null, Description: null,
@ -230,14 +301,16 @@ const searchDataDefault = () => {
ValueCN: null, ValueCN: null,
InternationalizationType: null, InternationalizationType: null,
State: null, State: null,
Module: null,
PublishLogId: null,
Asc: true, Asc: true,
SortField: '', SortField: "",
PageIndex: 1, PageIndex: 1,
PageSize: 20 PageSize: 20,
} };
} };
export default { export default {
name: 'I18n', name: "I18n",
components: { Pagination, I18nForm, BatchAddForm }, components: { Pagination, I18nForm, BatchAddForm },
data() { data() {
return { return {
@ -245,100 +318,169 @@ export default {
searchData: searchDataDefault(), searchData: searchDataDefault(),
list: [], list: [],
total: 0, total: 0,
loading: false loading: false,
} PublishVersionList: [],
selectTableList: [],
};
}, },
mounted() { mounted() {
this.getList() this.getList();
this.getPublishVersionSelect();
}, },
methods: { methods: {
//
async getPublishVersionSelect() {
try {
let res = await getPublishVersionSelect();
if (res.IsSuccess) {
this.PublishVersionList = res.Result;
}
} catch (err) {
console.log(err);
}
},
getList() { getList() {
this.loading = true this.loading = true;
getInternationalizationList(this.searchData).then((res) => { getInternationalizationList(this.searchData)
this.loading = false .then((res) => {
this.list = res.Result.CurrentPageData this.loading = false;
this.total = res.Result.TotalCount this.list = res.Result.CurrentPageData;
}).catch(() => { this.total = res.Result.TotalCount;
this.loading = false })
}) .catch(() => {
this.loading = false;
});
},
//
handleBatchUpdate() {
this.$nextTick(() => {
this.$refs["i18nForm"].openDialog(
"批量更新",
{},
this.PublishVersionList,
"batch"
);
});
},
async batch(row) {
let { PublishLogId, State } = row;
let data = {
PublishLogId,
State,
IdList: this.selectTableList.map((item) => item.Id),
};
try {
let res = await batchUpdateInternationalInfo(data);
if (res.IsSuccess) {
this.$message.success(this.$t("common:message:updatedSuccessfully"));
this.getList();
this.$nextTick(() => {
this.$refs["i18nForm"].handleCancle();
});
}
} catch (err) {
console.log(err);
}
}, },
handleAdd() { handleAdd() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['i18nForm'].openDialog('新增', {}) this.$refs["i18nForm"].openDialog(
}) "新增",
{},
this.PublishVersionList,
"add"
);
});
}, },
handleBatchAdd() { handleBatchAdd() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['batcnAddForm'].openDialog('批量新增', {}) this.$refs["batcnAddForm"].openDialog(
}) "批量新增",
{},
this.PublishVersionList
);
});
}, },
handleEdit(row) { handleEdit(row) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['i18nForm'].openDialog('编辑', row) this.$refs["i18nForm"].openDialog(
}) "编辑",
row,
this.PublishVersionList,
"update"
);
});
}, },
// //
handleReset() { handleReset() {
this.searchData = searchDataDefault() this.searchData = searchDataDefault();
this.getList() this.getList();
}, },
// //
handleDelete(row) { handleDelete(row) {
this.$confirm('是否确认删除?', { this.$confirm("是否确认删除?", {
type: 'warning', type: "warning",
distinguishCancelAndClose: true distinguishCancelAndClose: true,
}) }).then(() => {
.then(() => { this.loading = true;
this.loading = true deleteInternationalization(row.Id)
deleteInternationalization(row.Id) .then((res) => {
.then(res => { this.loading = false;
this.loading = false if (res.IsSuccess) {
if (res.IsSuccess) { this.getList();
this.getList() this.$message.success(
this.$message.success(this.$t('common:message:deletedSuccessfully')) this.$t("common:message:deletedSuccessfully")
} );
}).catch(() => { this.loading = false }) }
}) })
.catch(() => {
this.loading = false;
});
});
}, },
// //
handleSortByColumn(column) { handleSortByColumn(column) {
if (column.order === 'ascending') { if (column.order === "ascending") {
this.searchData.Asc = true this.searchData.Asc = true;
} else { } else {
this.searchData.Asc = false this.searchData.Asc = false;
} }
this.searchData.SortField = column.prop this.searchData.SortField = column.prop;
this.searchData.PageIndex = 1 this.searchData.PageIndex = 1;
this.getList() this.getList();
},
//
handleSelectionChange(val) {
this.selectTableList = val;
},
},
};
</script>
<style lang="scss">
.log {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
} }
} }
} }
</script>
<style lang="scss">
.log {
height: 100%;
box-sizing: border-box;
display: flex;
padding: 10px;
border-radius: 5px;
.left {
display: flex;
flex-direction: column;
width: 0;
flex-grow: 4;
// border-right: 1px solid #ccc;
.filter-container {
display: flex;
align-items: center;
margin: 5px;
}
.data-table {
flex: 1;
padding: 5px 0px;
}
.pagination-container {
text-align: right;
}
}
}
</style> </style>