Commit 621e803c authored by dragondean@qq.com's avatar dragondean@qq.com

完善国际化

parent 35f4d3da
<template> <template>
<div> <div>
<el-select v-model="formData.country" :disabled="readonly"> <el-select v-model="formData.country" :disabled="readonly">
<el-option v-for="(item) in treeList" :value="item.id" :label="item.titleZh" :key="item.id" /> <el-option v-for="(item) in treeList" :value="item.id" :label="$l(item, 'title')" :key="item.id" />
</el-select> </el-select>
<el-select v-model="formData.province" class="ml-10" :disabled="readonly"> <el-select v-model="formData.province" class="ml-10" :disabled="readonly">
<el-option v-for="(item) in provinceList" :value="item.id" :label="item.titleZh" :key="item.id" /> <el-option v-for="(item) in provinceList" :value="item.id" :label="$l(item, 'title')" :key="item.id" />
</el-select> </el-select>
<el-select v-model="formData.city" class="ml-10" :disabled="readonly"> <el-select v-model="formData.city" class="ml-10" :disabled="readonly">
<el-option v-for="(item) in cityList" :value="item.id" :label="item.titleZh" :key="item.id" /> <el-option v-for="(item) in cityList" :value="item.id" :label="$l(item, 'title')" :key="item.id" />
</el-select> </el-select>
</div> </div>
</template> </template>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
clearable clearable
remote remote
reserve-keyword reserve-keyword
placeholder="请输入关键词" :placeholder="$t('请输入关键词')"
:remote-method="remoteMethod" :remote-method="remoteMethod"
:loading="loading"> :loading="loading">
<el-option <el-option
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
:value="index"> :value="index">
</el-option> </el-option>
</el-select> </el-select>
<el-button v-if="quickable" type="text" @click="showQuickCreate=true" class="ml-10">快速新建</el-button> <el-button v-if="quickable" type="text" @click="showQuickCreate=true" class="ml-10">{{$t('快速新建')}}</el-button>
<!-- <quick-create v-if="showQuickCreate" @success="onQuickCreateSuccess" @close="showQuickCreate=false" :default="{type}"></quick-create> --> <!-- <quick-create v-if="showQuickCreate" @success="onQuickCreateSuccess" @close="showQuickCreate=false" :default="{type}"></quick-create> -->
</div> </div>
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
if(index < 0){ if(index < 0){
getCustomerContactsSelect({ids: this.value}).then(res => { getCustomerContactsSelect({ids: this.value}).then(res => {
if(!res.data || !res.data.length){ if(!res.data || !res.data.length){
return this.$message.error('联系人信息获取失败') return this.$message.error(this.$t('联系人信息获取失败'))
} }
this.list.unshift(res.data[0]) this.list.unshift(res.data[0])
this.index = 0 this.index = 0
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
this.showQuickCreate = false this.showQuickCreate = false
getCustomerContactsListByCustomer({customerId: id}).then(res => { getCustomerContactsListByCustomer({customerId: id}).then(res => {
if(!res.data || !res.data.length){ if(!res.data || !res.data.length){
return this.$message.error('联系人信息获取失败') return this.$message.error(this.$t('联系人信息获取失败'))
} }
let data = res.data[0] let data = res.data[0]
data.contactsName = data.name // 字段名跟getCustomerContactsSelect对齐 data.contactsName = data.name // 字段名跟getCustomerContactsSelect对齐
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
<el-input v-model="queryParams.searchKey" placeholder="用户名/手机/邮箱" style="width:200px" /> <el-input v-model="queryParams.searchKey" :placeholder="$t('用户名/手机/邮箱')" style="width:200px" />
<!-- <dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" /> --> <!-- <dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" /> -->
<el-button type="primary" @click="reLoad">搜索</el-button> <el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button>
</div> </div>
<div class="list"> <div class="list">
<template v-for="item in list" > <template v-for="item in list" >
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
已选客户 {{$t('已选客户')}}
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="item in choosedList" :key="item.customerContactsId"> <div class="item" v-for="item in choosedList" :key="item.customerContactsId">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
clearable clearable
remote remote
reserve-keyword reserve-keyword
placeholder="请输入关键词" :placeholder="$t('请输入关键词')"
:remote-method="remoteMethod" :remote-method="remoteMethod"
:loading="loading"> :loading="loading">
<el-option <el-option
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
<el-input v-model="queryParams.searchKey" placeholder="用户名/手机/邮箱" style="width:200px" /> <el-input v-model="queryParams.searchKey" :placeholder="$t('用户名/手机/邮箱')" style="width:200px" />
<dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" /> <dict-selector :type="DICT_TYPE.USER_TYPE" v-model="queryParams.customerType" style="width:100px" />
<el-button type="primary" @click="reLoad">搜索</el-button> <el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button>
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="item in list" :key="item.id"> <div class="item" v-for="item in list" :key="item.id">
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
已选客户 {{$t('已选客户')}}
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="item in choosedList" :key="item.id"> <div class="item" v-for="item in choosedList" :key="item.id">
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
}, },
loadNextPage(){ loadNextPage(){
if(this.page >= this.pages){ if(this.page >= this.pages){
return this.$message.error('已加载全部') return this.$message.info(this.$t('已加载全部'))
} }
this.queryParams.page ++ this.queryParams.page ++
this.getList() this.getList()
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<div class="dict-selector"> <div class="dict-selector">
<el-select v-if="formType == 'select'" v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple" :disabled="disabled" @change="val => $emit('change', val)"> <el-select v-if="formType == 'select'" v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple" :disabled="disabled" @change="val => $emit('change', val)">
<el-option v-for="dict in formattedList" <el-option v-for="dict in formattedList"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.value" :label="$l(dict, 'label')" :value="dict.value"/>
</el-select> </el-select>
<el-radio-group v-if="formType == 'radio'" v-model="valueSync" :disabled="disabled"> <el-radio-group v-if="formType == 'radio'" v-model="valueSync" :disabled="disabled">
<el-radio v-for="dict in formattedList" :label="dict.value" :checked="valueSync === dict.value" :key="dict.value">{{dict.label}}</el-radio> <el-radio v-for="dict in formattedList" :label="dict.value" :checked="valueSync === dict.value" :key="dict.value">{{$l(dict, 'label')}}</el-radio>
</el-radio-group> </el-radio-group>
<el-checkbox-group v-if="formType == 'checkbox'" v-model="valueSync" :disabled="disabled"> <el-checkbox-group v-if="formType == 'checkbox'" v-model="valueSync" :disabled="disabled">
<el-checkbox v-for="dict in formattedList" :label="dict.value" :key="dict.value">{{dict.label}}</el-checkbox> <el-checkbox v-for="dict in formattedList" :label="dict.value" :key="dict.value">{{$l(dict, 'label')}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</template> </template>
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
this.dictList.forEach(item => { this.dictList.forEach(item => {
arr.push({ arr.push({
label: item.label, label: item.label,
labelEn: item.labelEn,
value: this.format(item.value), value: this.format(item.value),
cssClass: item.cssClass, cssClass: item.cssClass,
colorType: item.colorType colorType: item.colorType
......
<template> <template>
<div class="need-know" :id="'need-know_' + keyname" v-if="detail"> <div class="need-know" :id="'need-know_' + keyname" v-if="detail">
<!-- <h2>{{detail.titleZh}}</h2> --> <!-- <h2>{{detail.titleZh}}</h2> -->
<div class="body" ref="body" v-html="detail.contentZh"></div> <div class="body" ref="body" v-html="$l(detail, 'content')"></div>
</div> </div>
</template> </template>
<script> <script>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
clearable clearable
remote remote
reserve-keyword reserve-keyword
placeholder="请输入商品关键词" :placeholder="$t('请输入商品关键词')"
:disabled="disabled" :disabled="disabled"
:remote-method="remoteMethod" :remote-method="remoteMethod"
@focus="remoteMethod()" @focus="remoteMethod()"
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
<el-select v-model="queryParams.typeId" placeholder="选择类型" style="width:120px" clearable> <el-select v-model="queryParams.typeId" :placeholder="$t('选择类型')" style="width:120px" clearable>
<el-option v-for="item in typeList" :key="item.id" :label="item.titleZh" :value="item.id" /> <el-option v-for="item in typeList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select> </el-select>
<el-select v-model="queryParams.attrId" placeholder="选择属性" style="width:120px" clearable> <el-select v-model="queryParams.attrId" :placeholder="$t('选择属性')" style="width:120px" clearable>
<el-option v-for="item in attrList" :key="item.id" :label="item.attrName" :value="item.id" /> <el-option v-for="item in attrList" :key="item.id" :label="item.attrName" :value="item.id" />
</el-select> </el-select>
<el-input v-model="queryParams.titleZh" placeholder="产品关键字" style="width:120px" clearable /> <el-input v-model="queryParams.titleZh" :placeholder="$t('产品关键字')" style="width:120px" clearable />
<el-button type="primary" @click="reLoad">搜索</el-button> <el-button type="primary" @click="reLoad">{{$t('搜索')}}</el-button>
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="item in list" :key="item.id"> <div class="item" v-for="item in list" :key="item.id">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<el-col :span="10"> <el-col :span="10">
<el-card> <el-card>
<div slot="header" class="header"> <div slot="header" class="header">
已选产品 {{$t('已选产品')}}
</div> </div>
<div class="list"> <div class="list">
<div class="item" v-for="(choosed) in choosedList" :key="choosed.id" :data-data="JSON.stringify(choosed)"> <div class="item" v-for="(choosed) in choosedList" :key="choosed.id" :data-data="JSON.stringify(choosed)">
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
}, },
loadNextPage() { loadNextPage() {
if (this.page >= this.pages) { if (this.page >= this.pages) {
return this.$message.error('已加载全部') return this.$message.error(this.$t('已加载全部'))
} }
this.queryParams.page++ this.queryParams.page++
this.getList() this.getList()
......
<template> <template>
<div> <div>
<div class="filters mb-10"> <div class="filters mb-10">
运输方式 {{$t('运输方式')}}
<dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" placeholder="请选择运输方式" style="width:150px" /> <dict-selector :type='DICT_TYPE.ECW_TRANSPORT_TYPE' v-model="transportType" :placeholder="$t('请选择运输方式')" style="width:150px" />
始发地 {{$t('始发地')}}
<el-select placeholder="请选择始发地" v-model="exportCity" clearable> <el-select :placeholder="$t('请选择始发地')" v-model="exportCity" clearable>
<el-option v-for="item in exportCityList" :key="item.id" :label="item.titleZh" :value="item.id" /> <el-option v-for="item in exportCityList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select> </el-select>
目的地 {{$t('目的地')}}
<el-select placeholder="请选择目的地" v-model="importCity" clearable> <el-select :placeholder="$t('请选择目的地')" v-model="importCity" clearable>
<el-option v-for="item in importCityList" :key="item.id" :label="item.titleZh" :value="item.id" /> <el-option v-for="item in importCityList" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select> </el-select>
出货渠道: {{$t('出货渠道')}}:
<el-select placeholder="请选择目渠道" v-model="channelId" clearable> <el-select :placeholder="$t('请选择目渠道')" v-model="channelId" clearable>
<el-option v-for="item in channelList" :key="item.channelId" :label="item.nameZh" :value="item.channelId" /> <el-option v-for="item in channelList" :key="item.channelId" :label="item.nameZh" :value="item.channelId" />
</el-select> </el-select>
</div> </div>
<div class="mb-10"> <div class="mb-10">
<el-radio-group v-model="checkAll"> <el-radio-group v-model="checkAll">
<el-radio :label="true">全选</el-radio> <el-radio :label="true">{{$t('全选')}}</el-radio>
<el-radio :label="false">全不选</el-radio> <el-radio :label="false">{{$t('全不选')}}</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<el-row class="" :gutter="10"> <el-row class="" :gutter="10">
...@@ -30,19 +30,27 @@ ...@@ -30,19 +30,27 @@
<el-col :span="12" :key="item.value"> <el-col :span="12" :key="item.value">
<el-card class="mb-10"> <el-card class="mb-10">
<div slot="header"> <div slot="header">
{{item.label}} {{$l(item, 'label')}}
<el-link type="primary" @click.native="toggleHide(item.value)" style="float:right">{{item._hide ? '展开' : '折叠'}}</el-link> <el-link type="primary" @click.native="toggleHide(item.value)" style="float:right">{{item._hide ? $t('展开') : $t('折叠')}}</el-link>
</div> </div>
<!--table需要给一个key,否则全选的时候不会自动更新渲染--> <!--table需要给一个key,否则全选的时候不会自动更新渲染-->
<el-table v-if="!hideMap[item.value]" :data="item.routerList" :span-method="SpanMethod" border :key="selectedRoutes.length + item.value"> <el-table v-if="!hideMap[item.value]" :data="item.routerList" :span-method="SpanMethod" border :key="selectedRoutes.length + item.value">
<el-table-column label="始发地" prop="startTitleZh" /> <el-table-column :label="$t('始发地')" prop="startTitleZh">
<el-table-column label="目的地" prop="destTitleZh" />
<el-table-column label="渠道" prop="startTitleZh">
<template slot-scope="{row}"> <template slot-scope="{row}">
{{row.channel.nameZh}} {{$l(row, 'startTitle')}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" prop=""> <el-table-column :label="$t('目的地')" prop="destTitleZh" >
<template slot-scope="{row}">
{{$l(row, 'destTitle')}}
</template>
</el-table-column>
<el-table-column :label="$t('渠道')" prop="startTitleZh">
<template slot-scope="{row}">
{{$l(row.channel, 'name')}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')" prop="">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-checkbox :checked="getSelectedIndex(row) > -1" @change="toggleChecker(row, $event)"></el-checkbox> <el-checkbox :checked="getSelectedIndex(row) > -1" @change="toggleChecker(row, $event)"></el-checkbox>
</template> </template>
...@@ -130,6 +138,7 @@ export default { ...@@ -130,6 +138,7 @@ export default {
let child = { let child = {
label: item.label, label: item.label,
labelEn: item.labelEn,
value: item.value, value: item.value,
_hide: false, // 是否折叠 _hide: false, // 是否折叠
routerList: routerList routerList: routerList
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-button size="mini" type="primary" icon="el-icon-plus" @click="listData.push({})"></el-button> <el-button size="mini" type="primary" icon="el-icon-plus" @click="listData.push({})"></el-button>
</div> </div>
<el-table :data="listData" border> <el-table :data="listData" border>
<el-table-column label="序号" width="90px"> <el-table-column :label="$t('序号')" width="90px">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.$index + 1}} {{scope.$index + 1}}
</template> </template>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<el-input v-model="row.job" /> <el-input v-model="row.job" />
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column label="操作"> <el-table-column :label="$t('操作')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="danger" size="mini" icon="el-icon-delete" @click="del(scope.$index)"></el-button> <el-button type="danger" size="mini" icon="el-icon-delete" @click="del(scope.$index)"></el-button>
</template> </template>
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
}, },
methods:{ methods:{
del(index){ del(index){
this.$confirm('确定删除此行?') this.$confirm(this.$t('确定删除此行?'))
.then(res => { .then(res => {
this.listData.splice(index, 1) this.listData.splice(index, 1)
}) })
......
...@@ -15,6 +15,9 @@ console.log({i18n}) ...@@ -15,6 +15,9 @@ console.log({i18n})
Vue.prototype.$l = (object, field) => { Vue.prototype.$l = (object, field) => {
let prefix = i18n.locale.split('_')[0] let prefix = i18n.locale.split('_')[0]
let append = prefix.charAt(0).toUpperCase() + prefix.toLowerCase().substr(1) let append = prefix.charAt(0).toUpperCase() + prefix.toLowerCase().substr(1)
// 如果object是null则返回字段名
if(!object) return field + append
return object[field + append] || object[field] return object[field + append] || object[field]
} }
/* Vue.filter('$t', Vue.$i18n) /* Vue.filter('$t', Vue.$i18n)
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
"编号": "No", "编号": "No",
"新增": "Create", "新增": "Create",
"搜索": "Search", "搜索": "Search",
"重置": "Reset" "重置": "Reset",
"新建订单": "New Order"
} }
\ No newline at end of file
This diff is collapsed.
...@@ -2,44 +2,44 @@ ...@@ -2,44 +2,44 @@
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="适用商品" prop="idList"> <el-form-item :label="$t('适用商品')" prop="idList">
<products-selector :defaultIds="form.idList" v-model="form.idList" /> <products-selector :defaultIds="form.idList" v-model="form.idList" />
</el-form-item> </el-form-item>
<el-form-item label="货柜位置" prop="containerLocation"> <el-form-item :label="$t('货柜位置')" prop="containerLocation">
<dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" /> <dict-selector :type="DICT_TYPE.ECW_CONTAINER_LOCATION" v-model="form.containerLocation" />
</el-form-item> </el-form-item>
<el-form-item label="出运要求" prop="requirements"> <el-form-item :label="$t('出运要求')" prop="requirements">
<el-checkbox true-label="1" v-model="form.requirements">证书要求(支持多证书)</el-checkbox> <el-checkbox true-label="1" v-model="form.requirements">{{$t('证书要求(支持多证书)')}}</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item label="订单方数上限" prop="square"> <el-form-item :label="$t('订单方数上限')" prop="square">
<el-input v-model="form.square" placeholder="" class="w-200"></el-input> <el-input v-model="form.square" placeholder="" class="w-200"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="包装要求" prop="packaging"> <el-form-item :label="$t('包装要求')" prop="packaging">
<dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="form.packaging" /> <dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="form.packaging" />
</el-form-item> </el-form-item>
<el-form-item label="是否预约入仓" prop="needBook"> <el-form-item :label="$t('是否预约入仓')" prop="needBook">
<dict-selector formatter="bool" form-type="radio" :type="DICT_TYPE.ECW_YESNO" v-model="form.needBook" :formater="Boolean" /> <dict-selector formatter="bool" form-type="radio" :type="DICT_TYPE.ECW_YESNO" v-model="form.needBook" :formater="Boolean" />
</el-form-item> </el-form-item>
<el-form-item label="每日入仓上限" prop="dayLimit" v-if="form.needBook"> <el-form-item :label="$t('每日入仓上限')" prop="dayLimit" v-if="form.needBook">
<el-input placeholder="" v-model="form.dayLimit" class="w-200"> <el-input placeholder="" v-model="form.dayLimit" class="w-200">
<template slot="suffix">立方米</template> <template slot="suffix">{{$t('立方米')}}</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品特性" prop="attrId"> <el-form-item :label="$t('商品特性')" prop="attrId">
<!-- <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_ORDER_ATTR" v-model="form.attrId" multiple /> --> <!-- <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_ORDER_ATTR" v-model="form.attrId" multiple /> -->
<el-checkbox-group v-model="attrIds"> <el-checkbox-group v-model="attrIds">
<el-checkbox v-for="item in attrList" :label="item.id" :key="item.id">{{item.attrName}}</el-checkbox> <el-checkbox v-for="item in attrList" :label="item.id" :key="item.id">{{item.attrName}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="商品材质" prop="materialType"> <el-form-item :label="$t('商品材质')" prop="materialType">
<dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialType" multiple /> <dict-selector form-type="checkbox" :type="DICT_TYPE.ECW_PRODUCT_MATERIAL" v-model="form.materialType" multiple />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="$router.back()">返 回</el-button> <el-button @click="$router.back()">{{$t('返回')}}</el-button>
<el-button type="default" @click="reset">重 置</el-button> <el-button type="default" @click="reset">{{$t('重置')}}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
} }
let data = Object.assign({}, this.form) let data = Object.assign({}, this.form)
batchUpdateProduct(data).then((response) => { batchUpdateProduct(data).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess(this.$t("修改成功"));
this.$router.back(); this.$router.back();
}); });
}); });
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="关键字" prop="attrName"> <el-form-item :label="$t('关键字')" prop="attrName">
<el-input v-model="queryParams.attrName" placeholder="请输入关键字" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.attrName" :placeholder="$t('请输入关键字')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:product-attr:create']">新增</el-button> v-hasPermi="['ecw:product-attr:create']">{{$t('新增')}}</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
...@@ -25,23 +25,23 @@ ...@@ -25,23 +25,23 @@
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column :label="$t('编号')" align="center" prop="id" />
<el-table-column label="排序" align="center" prop="sort" /> <el-table-column :label="$t('排序')" align="center" prop="sort" />
<el-table-column label="属性名称" align="center" prop="attrName" /> <el-table-column :label="$t('属性名称')" align="center" prop="attrName" />
<el-table-column label="属性代码" align="center" prop="attrCode" /> <el-table-column :label="$t('属性代码')" align="center" prop="attrCode" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column :label="$t('备注')" align="center" prop="remark" />
<el-table-column prop="status" label="状态" width="100"> <el-table-column prop="status" :label="$t('状态')" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.status" :active-value="CommonStatusEnum.ENABLE" :inactive-value="CommonStatusEnum.DISABLE" @change="handleStatusChange(scope.row)" /> <el-switch v-model="scope.row.status" :active-value="CommonStatusEnum.ENABLE" :inactive-value="CommonStatusEnum.DISABLE" @change="handleStatusChange(scope.row)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:product-attr:update']">修改</el-button> v-hasPermi="['ecw:product-attr:update']">{{$t('修改')}}</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['ecw:product-attr:delete']">删除</el-button> v-hasPermi="['ecw:product-attr:delete']">{{$t('删除')}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -51,28 +51,31 @@ ...@@ -51,28 +51,31 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="排序" prop="sort"> <el-form-item :label="$t('排序')" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序" /> <el-input v-model="form.sort" :placeholder="$t('请输入排序')" />
</el-form-item> </el-form-item>
<el-form-item label="属性名称" prop="attrName"> <el-form-item :label="$t('属性名称')" prop="attrName">
<el-input v-model="form.attrName" placeholder="请输入属性名称" /> <el-input v-model="form.attrName" :placeholder="$t('请输入属性名称')" />
</el-form-item> </el-form-item>
<el-form-item label="属性代码" prop="attrCode"> <el-form-item :label="$t('属性英文名')" prop="attrName">
<el-input v-model="form.attrCode" placeholder="请输入属性代码" /> <el-input v-model="form.attrNameEn" :placeholder="$t('请输入属性英文名')" />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item :label="$t('属性代码')" prop="attrCode">
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-input v-model="form.attrCode" :placeholder="$t('请输入属性代码')" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item :label="$t('备注')" prop="remark">
<el-select v-model="form.status" placeholder="请选择状态"> <el-input v-model="form.remark" :placeholder="$t('请输入备注')" />
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/> </el-form-item>
<el-form-item :label="$t('状态')" prop="status">
<el-select v-model="form.status" :placeholder="$t('请选择状态')">
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="$l(dict, 'label')" :value="parseInt(dict.value)"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">{{$t('取消')}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -119,9 +122,9 @@ export default { ...@@ -119,9 +122,9 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
attrName: [{ required: true, message: "属性名称不能为空", trigger: "blur" }], attrName: [{ required: true, message: this.$t("属性名称不能为空"), trigger: "blur" }],
attrCode: [{ required: true, message: "属性代码不能为空", trigger: "blur" }], attrCode: [{ required: true, message: this.$t("属性代码不能为空"), trigger: "blur" }],
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }], sort: [{ required: true, message: this.$t("排序不能为空"), trigger: "blur" }],
}, },
// 枚举 // 枚举
CommonStatusEnum: CommonStatusEnum, CommonStatusEnum: CommonStatusEnum,
...@@ -178,7 +181,7 @@ export default { ...@@ -178,7 +181,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加产品属性"; this.title = this.$t("添加产品属性");
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -187,7 +190,7 @@ export default { ...@@ -187,7 +190,7 @@ export default {
getProductAttr(id).then(response => { getProductAttr(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改产品属性"; this.title = this.$t("修改产品属性");
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -199,7 +202,7 @@ export default { ...@@ -199,7 +202,7 @@ export default {
// 修改的提交 // 修改的提交
if (this.form.id != null) { if (this.form.id != null) {
updateProductAttr(this.form).then(response => { updateProductAttr(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess(this.$t("修改成功"));
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
...@@ -207,7 +210,7 @@ export default { ...@@ -207,7 +210,7 @@ export default {
} }
// 添加的提交 // 添加的提交
createProductAttr(this.form).then(response => { createProductAttr(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess(this.$t("新增成功"));
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
...@@ -215,12 +218,12 @@ export default { ...@@ -215,12 +218,12 @@ export default {
}, },
handleStatusChange(row) { handleStatusChange(row) {
let text = row.status === CommonStatusEnum.ENABLE ? "启用" : "停用"; let text = row.status === CommonStatusEnum.ENABLE ? this.$t("确定要启用此数据么?") : this.$t("确定要停用此数据么?");
this.$modal.confirm('确认要' + text + '编号为' + row.id + '的数据吗?').then(function() { this.$modal.confirm(text).then(function() {
return updateProductAttr(row); return updateProductAttr(row);
}).then(() => { }).then(() => {
this.$modal.msgSuccess(text + "成功"); this.$modal.msgSuccess("操作成功");
}).catch(function() { }).catch(function() {
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE; : CommonStatusEnum.ENABLE;
...@@ -230,11 +233,11 @@ export default { ...@@ -230,11 +233,11 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal.confirm('是否确认删除产品属性编号为"' + id + '"的数据项?').then(function() { this.$modal.confirm(this.$t('是否确认删除产品属性编号为{id}的数据项?', {id})).then(function() {
return deleteProductAttr(id); return deleteProductAttr(id);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess(this.$t("删除成功"));
}).catch(() => {}); }).catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
...@@ -245,7 +248,7 @@ export default { ...@@ -245,7 +248,7 @@ export default {
params.pageSize = undefined; params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行导出 // 执行导出
this.$modal.confirm('是否确认导出所有产品属性数据项?').then(() => { this.$modal.confirm(this.$t('是否确认导出所有产品属性数据项?')).then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportProductAttrExcel(params); return exportProductAttrExcel(params);
}).then(response => { }).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment