123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- <template>
- <div class="WordTable" v-loading="loading">
- <div class="wheader">
- <Header />
- </div>
- <div class="main">
- <div class="top">
- <div class="left">
- <div class="type_dv">
- <span :class="[typeIndex == 0 ? 'sele' : '']" @click="cutType(0)"
- >音节</span
- >
- <span :class="[typeIndex == 1 ? 'sele' : '']" @click="cutType(1)"
- >汉字</span
- >
- <span :class="[typeIndex == 2 ? 'sele' : '']" @click="cutType(2)"
- >词汇</span
- >
- </div>
- <!-- <el-radio-group v-model="headText">
- <el-radio :label="1">词头</el-radio>
- <el-radio :label="2">文本</el-radio>
- </el-radio-group> -->
- </div>
- <div class="right">
- <div class="seek">
- <img src="../../assets/teacherdev/search-icon.png" alt="" />
- <input v-model="keyword" type="text" />
- </div>
- <div class="seekBtn" @click="page1getdata">搜索</div>
- </div>
- </div>
- <div class="table">
- <el-table
- :data="dataList.list"
- style="width: 100%"
- @sort-change="sort_change"
- ref="table"
- >
- <el-table-column prop="number" label="序号" width="48" align="center">
- </el-table-column>
- <el-table-column
- prop="word"
- :label="typeIndex == 0 ? '音节' : '汉字'"
- width="93"
- sortable
- >
- <template slot-scope="item">
- <span
- :style="{
- color:
- item.row.levelName && levelMap[item.row.levelName]
- ? levelMap[item.row.levelName].color
- : '',
- }"
- >{{ item.row.word }}</span
- >
- </template>
- </el-table-column>
- <template v-if="typeIndex != 0">
- <el-table-column prop="pinYin" label="拼音" width="95" sortable>
- </el-table-column>
- </template>
- <el-table-column prop="gradeName" label="等次" width="95" sortable>
- <template slot-scope="item">
- <span
- :style="{
- color:
- item.row.gradeName && levelMap[item.row.gradeName]
- ? levelMap[item.row.gradeName].color
- : '',
- }"
- >{{ item.row.gradeName }}</span
- >
- </template>
- </el-table-column>
- <el-table-column prop="levelName" label="级别" width="106" sortable>
- <template slot-scope="item">
- <span
- :style="{
- color:
- item.row.levelName && levelMap[item.row.levelName]
- ? levelMap[item.row.levelName].color
- : '',
- }"
- >{{ item.row.levelName }}</span
- >
- </template>
- </el-table-column>
- <el-table-column prop="freq" label="频数" width="108" sortable>
- </el-table-column>
- <el-table-column prop="textRatio" label="比例" width="110" sortable>
- <!-- <template slot-scope="item">
- <span v-if="headText == 1">{{ item.row.wordRatio }}%</span>
- <span v-else>{{ item.row.textRatio }}%</span>
- </template> -->
- </el-table-column>
- <el-table-column prop="" label="备注">
- <template slot-scope="item">
- <div style="display: flex">
- <span
- v-for="(items, i) in item.row.remarks"
- :key=""
- class="beizhu"
- style="margin-right: 10px"
- >
- <span
- style="font-size: 18px; font-weight: 400"
- v-html="items.word"
- >
- </span>
- <span
- :style="{
- color:
- items.levelName && levelMap[items.levelName]
- ? levelMap[items.levelName].color
- : '',
- }"
- >
- {{ items.levelName }}
- </span>
- <span>
- {{ items.freq }}
- </span>
- </span>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="page" v-if="dataList.list.length > 0">
- <el-pagination
- background
- @current-change="handleCurrentChange"
- :current-page="page"
- :page-size="pageSize"
- layout="prev, pager, next, jumper"
- :total="dataList.total"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import Header from "@/components/Header.vue";
- import { postapi } from "@/api/api";
- import staticData from "../../common/data";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {
- Header,
- },
- props: {},
- data() {
- //这里存放数据
- return {
- typeIndex: 0,
- headText: 1,
- keyword: "",
- dataList: {
- list: [],
- },
- page: 1,
- pageSize: 10,
- partitionKey: null,
- searchType: null,
- levelMap: null,
- loading: false,
- sortType: null,
- sortField: null,
- };
- },
- //计算属性 类似于data概念
- computed: {},
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- handleCurrentChange(val) {
- this.page = val;
- this.getlist();
- },
- getlist() {
- this.loading = true;
- postapi({
- url: "/GCLSTRCServer/tools/TS/glossary/list",
- data: {
- pageIndex: this.page,
- pageSize: this.pageSize,
- partitionKey: this.partitionKey,
- searchType: this.typeIndex,
- word: this.keyword,
- sortField: this.sortField,
- sortType: this.sortType,
- },
- })
- .then((res) => {
- let num = this.page * this.pageSize - this.pageSize + 1;
- res.data.result.list.forEach((item) => {
- item.remarks = JSON.parse(item.remarks);
- item.number = num;
- num++;
- });
- this.dataList = res.data.result;
- this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- page1getdata() {
- this.loading = true;
- this.page = 1;
- this.getlist();
- },
- sort_change(column, prop, order) {
- if (this.$refs.table) this.$refs.table.clearSort();
- column.column.order = column.order;
- if (column.prop == "pinyin") {
- this.sortField = "pin_yin";
- } else if (column.prop == "gradeName") {
- this.sortField = "grade_id";
- } else if (column.prop == "levelName") {
- this.sortField = "level_id";
- } else if (column.prop == "textRatio") {
- this.sortField = "text_ratio";
- } else {
- this.sortField = column.prop;
- }
- if (column.order == "descending") {
- this.sortType = 1;
- } else {
- this.sortType = 0;
- }
- this.getlist();
- },
- cutType(index) {
- this.typeIndex = index;
- this.page1getdata();
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.partitionKey = this.$route.query.partitionKey * 1;
- this.levelMap = staticData.LevelMap;
- this.getlist();
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .WordTable {
- background: #f6f6f6;
- height: 100%;
- .wheader {
- background: #ffffff;
- }
- .main {
- width: 1200px;
- margin: 23px auto;
- .top {
- display: flex;
- justify-content: space-between;
- .left {
- display: flex;
- align-items: center;
- .type_dv {
- margin-right: 40px;
- // width: 172px;
- padding: 0 2px;
- height: 40px;
- background: #eeeeee;
- border-radius: 4px;
- display: flex;
- align-items: center;
- span {
- display: inline-block;
- height: 36px;
- width: 56px;
- font-weight: 400;
- font-size: 14px;
- line-height: 40px;
- text-align: center;
- color: #888888;
- cursor: pointer;
- }
- .sele {
- color: #000000;
- background: #ffffff;
- box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
- }
- }
- }
- .right {
- display: flex;
- .seek {
- display: flex;
- width: 264px;
- height: 40px;
- background: #ffffff;
- border: 1px solid #dddddd;
- border-radius: 2px 0px 0px 2px;
- img {
- width: 16px;
- height: 16px;
- margin: 12px 4px 12px 12px;
- }
- input {
- flex: 1;
- border: none;
- outline: none;
- background: none;
- height: 40px;
- }
- }
- .seekBtn {
- width: 56px;
- height: 40px;
- background: #ffa800;
- border: 1px solid #ffa800;
- border-radius: 0px 2px 2px 0px;
- cursor: pointer;
- font-weight: 400;
- font-size: 16px;
- line-height: 40px;
- text-align: center;
- color: #ffffff;
- }
- }
- }
- .table {
- margin-top: 21px;
- }
- .page {
- margin-top: 24px;
- }
- .beizhu {
- height: 28px;
- display: inline-block;
- background: #f9f9f9;
- border-radius: 4px;
- display: flex;
- align-items: center;
- font-size: 12px;
- font-weight: 500;
- padding-left: 4px;
- padding-right: 7px;
- > :not(:nth-last-child(1)) {
- margin-right: 8px;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .WordTable {
- .table {
- .el-table th {
- background: #ffffff;
- padding: 7px 0;
- }
- .el-table th > .cell {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-weight: 700;
- color: #333333;
- font-size: 14px;
- }
- .el-table td {
- padding: 8px 0;
- }
- .el-table td > .cell {
- font-size: 14px;
- line-height: 22px;
- color: #333333;
- font-weight: 600;
- }
- }
- .el-radio__input.is-checked + .el-radio__label {
- color: #000000;
- }
- .el-radio__input.is-checked .el-radio__inner {
- border: 2px solid #c8c8c8;
- background: #1e1e1e;
- }
- .el-radio__inner::after {
- background: none;
- }
- .el-radio__inner {
- background: #c8c8c8;
- border: none;
- }
- .el-pagination.is-background .el-pager li:not(.disabled).active {
- background: #ffffff !important;
- color: rgba(0, 0, 0, 0.85);
- border: 1px solid #333333;
- }
- .el-pager {
- .number {
- background: #ffffff !important;
- border: 1px solid #d9d9d9;
- border-radius: 2px;
- }
- }
- .btn-prev,
- .btn-next {
- border: 1px solid #d9d9d9;
- border-radius: 2px;
- background: #ffffff !important;
- }
- }
- </style>
|