国际化修改弹窗查询
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
b8beac28c4
commit
d6f9b5cc7d
85
src/App.vue
85
src/App.vue
|
@ -27,6 +27,7 @@
|
|||
<el-form label-width="100px" size="small">
|
||||
<el-form-item label="关键字">
|
||||
<el-input v-model="key" @input="keyChange" />
|
||||
<el-input v-model="key" @input="keyChange" style="display: none" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
@ -53,7 +54,7 @@
|
|||
v-model="scope.row.Value"
|
||||
@input="
|
||||
(e) => {
|
||||
$set(scope.row, 'Value', e);
|
||||
$set(scope.row, 'Value', e)
|
||||
}
|
||||
"
|
||||
size="mini"
|
||||
|
@ -66,7 +67,7 @@
|
|||
v-model="scope.row.ValueCN"
|
||||
@input="
|
||||
(e) => {
|
||||
$set(scope.row, 'ValueCN', e);
|
||||
$set(scope.row, 'ValueCN', e)
|
||||
}
|
||||
"
|
||||
size="mini"
|
||||
|
@ -88,11 +89,11 @@
|
|||
import {
|
||||
batchAddOrUpdateFrontInternationalization,
|
||||
getFrontInternationalizationList,
|
||||
} from "@/api/dictionary/dictionary";
|
||||
import Vue from "vue";
|
||||
import i18n from "./lang";
|
||||
} from '@/api/dictionary/dictionary'
|
||||
import Vue from 'vue'
|
||||
import i18n from './lang'
|
||||
export default {
|
||||
name: "App",
|
||||
name: 'App',
|
||||
data() {
|
||||
return {
|
||||
drawer: false,
|
||||
|
@ -100,7 +101,7 @@ export default {
|
|||
show: false,
|
||||
key: null,
|
||||
arr: [],
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.show = process.env.VUE_APP_OSS_PATH === "/hir_test/dist";
|
||||
|
@ -108,7 +109,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
changeValue(target, attr, e) {
|
||||
this.$set(target, attr, e);
|
||||
this.$set(target, attr, e)
|
||||
},
|
||||
keyChange(v) {
|
||||
if (this.key) {
|
||||
|
@ -120,65 +121,65 @@ export default {
|
|||
~v.Value.indexOf(this.key) ||
|
||||
~v.ValueCN.indexOf(this.key)
|
||||
)
|
||||
);
|
||||
)
|
||||
} else {
|
||||
this.tableData = Object.assign([], this.arr);
|
||||
this.tableData = Object.assign([], this.arr)
|
||||
}
|
||||
},
|
||||
handleSave() {
|
||||
this.$confirm("确定修改当前页面国际化内容?").then(() => {
|
||||
this.$confirm('确定修改当前页面国际化内容?').then(() => {
|
||||
batchAddOrUpdateFrontInternationalization(this.tableData).then(
|
||||
async (res) => {
|
||||
var zhMessages = {},
|
||||
enMessages = {};
|
||||
var Internationalization = await getFrontInternationalizationList();
|
||||
Vue.prototype.$tl = Internationalization.Result;
|
||||
enMessages = {}
|
||||
var Internationalization = await getFrontInternationalizationList()
|
||||
Vue.prototype.$tl = Internationalization.Result
|
||||
this.tableData.forEach((v) => {
|
||||
// zhMessages[v.Description + '_' + v.Code] = v.ValueCN
|
||||
// enMessages[v.Description + '_' + v.Code] = v.Value
|
||||
zhMessages[v.Code] = v.ValueCN;
|
||||
enMessages[v.Code] = v.Value;
|
||||
});
|
||||
i18n.mergeLocaleMessage("zh", zhMessages);
|
||||
i18n.mergeLocaleMessage("en", enMessages);
|
||||
this.drawer = false;
|
||||
this.$message.success("国际化修改成功");
|
||||
zhMessages[v.Code] = v.ValueCN
|
||||
enMessages[v.Code] = v.Value
|
||||
})
|
||||
i18n.mergeLocaleMessage('zh', zhMessages)
|
||||
i18n.mergeLocaleMessage('en', enMessages)
|
||||
this.drawer = false
|
||||
this.$message.success('国际化修改成功')
|
||||
}
|
||||
);
|
||||
});
|
||||
)
|
||||
})
|
||||
},
|
||||
openI18n() {
|
||||
this.tableData = [];
|
||||
this.key = null;
|
||||
this.drawer = true;
|
||||
let arr = [];
|
||||
this.tableData = []
|
||||
this.key = null
|
||||
this.drawer = true
|
||||
let arr = []
|
||||
let tableData = this.$tl.map((v) => {
|
||||
let a = { ...v };
|
||||
let a = { ...v }
|
||||
// if (!a.Description) {
|
||||
// a.Description = this.$route.path
|
||||
// }
|
||||
return a;
|
||||
});
|
||||
return a
|
||||
})
|
||||
tableData = tableData.filter((v) => {
|
||||
// return ~this.$path.indexOf(v.Description + '_' + v.Code)
|
||||
return ~this.$path.indexOf(v.Code);
|
||||
});
|
||||
return ~this.$path.indexOf(v.Code)
|
||||
})
|
||||
this.$path.forEach((v) => {
|
||||
let o = tableData.find((a) => {
|
||||
return a.Code === v;
|
||||
});
|
||||
return a.Code === v
|
||||
})
|
||||
if (o) {
|
||||
arr.push(o);
|
||||
arr.push(o)
|
||||
} else {
|
||||
arr.push({
|
||||
Code: v,
|
||||
Description: null,
|
||||
Value: null,
|
||||
ValueCN: null,
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
this.arr = arr;
|
||||
})
|
||||
this.arr = arr
|
||||
if (this.key) {
|
||||
this.tableData = Object.assign(
|
||||
[],
|
||||
|
@ -188,15 +189,15 @@ export default {
|
|||
~v.Value.indexOf(this.key) ||
|
||||
~v.ValueCN.indexOf(this.key)
|
||||
)
|
||||
);
|
||||
)
|
||||
} else {
|
||||
this.tableData = Object.assign([], this.arr);
|
||||
this.tableData = Object.assign([], this.arr)
|
||||
}
|
||||
// console.log(JSON.stringify(this.$path));
|
||||
// console.log(JSON.stringify(this.tableData));
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -220,7 +221,7 @@ input::-webkit-inner-spin-button {
|
|||
-webkit-appearance: none !important;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield !important;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue