| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561 |
- <template>
- <div id="tableList">
- <el-table
- :data="tableData"
- :span-method="objectSpanMethod"
- stripe
- style="width: 100%"
- @select-all="selectAll"
- @select="select"
- @sort-change="sortChange"
- :row-key="rowKey"
- :load="load"
- :cell-style="timeStyle"
- lazy
- :border="true"
- ref="pagerset"
- v-loading="loading"
- :row-class-name="navText.tableColor ? navText.tableColorFunc : ''"
- :header-cell-style="{
- 'background-color': '#eee',
- color: '#333',
- fontSize: '14px',
- }"
- :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
- >
- <el-table-column
- v-if="navText.choiceRadio"
- align="center"
- type="selection"
- :fixed="navText.radioFixed"
- width="55"
- >
- <template slot-scope="scope">
- <el-radio
- style="margin-left: 10px"
- v-model="tableRadio"
- :label="scope.row[navText.radioKey]"
- @change="radioChange"
- >{{ "" }}</el-radio
- >
- </template>
- </el-table-column>
- <el-table-column
- v-if="navText.choice"
- :reserve-selection="navText.openCheckMore"
- align="center"
- type="selection"
- width="55"
- header-align="center"
- fixed="left"
- :selectable="
- navText.selectableStatus ? navText.selectableFunc : selectFuncTrue
- "
- >
- </el-table-column>
- <el-table-column
- v-if="navText.dontNum ? false : true"
- type="index"
- :index="setIndex"
- label="序号"
- width="70"
- align="center"
- header-align="center"
- >
- </el-table-column>
- <af-table-column
- v-for="(item, index) in compTableSet(tableSet)"
- :width="item.width"
- :label="item.label"
- :align="item.dontCenter ? 'left' : 'center'"
- :sortable="item.prop === 'sort' || item.sort"
- :sort-method="sortMethods"
- :show-overflow-tooltip="item.showTooltip ? false : true"
- header-align="center"
- :prop="item.prop"
- sort-by="sort"
- :key="index"
- >
- <template slot-scope="scope">
- <div class="imgboxsq" v-if="item.scope === 'img'">
- <img
- style="height: 60px; width: 60px"
- v-if="!scope.row[item.prop]"
- src="@/assets/404_images/wuyuxaog.png"
- alt=""
- />
- <el-image
- v-else
- class="el_images"
- lazy
- :src="$methodsTools.splitImgHost(scope.row[item.prop])"
- style="height: 100%; width: 100%"
- :preview-src-list="[
- $methodsTools.splitImgHost(scope.row[item.prop]),
- ]"
- alt="加载失败"
- >
- </el-image>
- </div>
- <div v-else-if="item.scope === 'sortType'">
- <el-input-number
- v-model="scope.row[item.prop]"
- :min="0"
- style="width: 80px"
- :controls="false"
- @change="blurBackData(scope.row)"
- ></el-input-number>
- </div>
- <template
- v-else-if="
- item.scope === 'copyTime' && scope.row[item.prop] != null
- "
- >
- <div v-for="(item, index) in scope.row['copyTime']" :key="index">
- <span>{{ item }}</span>
- </div>
- </template>
- <span v-else-if="item.scope === 'sex'">
- {{
- scope.row[item.prop] == 1
- ? "男"
- : scope.row[item.prop] == 2
- ? "女"
- : "未知"
- }}
- </span>
- <span v-else-if="item.scope === 'TimeLists'"
- >{{ $methodsTools.onlyForma(scope.row[item.prop1], item.Diszing) }}
- {{ scope.row[item.prop1] ? "至" : "" }}
- {{
- $methodsTools.onlyForma(scope.row[item.prop2], item.Diszing)
- }}</span
- >
- <span v-else-if="item.scope === 'aTimeList'">{{
- scope.row[item.prop] === null
- ? "--"
- : $methodsTools.onlyForma(scope.row[item.prop], !item.isDiszing)
- }}</span>
- <span v-else-if="item.scope === 'time'">{{
- numTime(scope.row[item.prop])
- }}</span>
- <div v-else-if="item.scope === 'isOptions'">
- <template v-for="(itemt, indext) in item.options">
- <span
- :key="indext"
- v-if="itemt.value === scope.row[item.prop]"
- :style="itemt.style ? itemt.style : ''"
- >{{ itemt.label }}
- <el-button
- type="text"
- v-if="itemt.click"
- @click="backFunc(scope.row)"
- >查看</el-button
- ></span
- >
- </template>
- </div>
- <span v-else-if="item.scope === 'isgzhOpenId'">{{
- scope.row[item.prop] ? "是" : "否"
- }}</span>
- <span v-else-if="item.scope === 'InfoMore'"
- >{{ scope.row[item.prop1] }} - {{ scope.row[item.prop2] }}
- </span>
- <span v-else-if="item.scope === 'type'">
- {{ item.values[scope.row[item.prop]] }}
- </span>
- <span v-else-if="item.scope === 'peopleNums'">
- {{ scope.row[item.prop1] }} / {{ scope.row[item.prop2] }}
- </span>
- <div v-else-if="item.scope === 'solt'">
- <slot :name="item.soltName" :scope="scope"></slot>
- </div>
- <span v-else>
- {{ scope.row[item.prop] }}
- {{
- (scope.row[item.prop] || scope.row[item.prop] === 0) && item.ch
- ? item.ch
- : ""
- }}
- </span>
- </template>
- </af-table-column>
- <el-table-column
- label="操作"
- align="center"
- fixed="right"
- :width="navText.changeWidth ? navText.changeWidth : '180px'"
- v-if="!navText.tableHide"
- >
- <template slot-scope="scope">
- <slot name="btn" :scope="scope"></slot>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <script>
- export default {
- props: [
- "tableSets",
- "tableData",
- "navText",
- "rowKey",
- "loading",
- "objectSpanMethod",
- "setIndex",
- "radio",
- ],
- data: function () {
- return {
- tableSet: this.tableSets,
- allCheckData: [], //表格多选
- isIndeterminate: false,
- props: {
- label(data, node) {
- return data.menuName || data.name;
- },
- isLeaf(data, node) {
- return data.hasChildren ? false : true;
- },
- },
- treeDatas: [],
- treeDatas1: [],
- treeDatas2: [],
- };
- },
- computed: {
- tableRadio: {
- get() {
- return this.radio;
- },
- set(val) {
- this.$emit("update:radio", val);
- },
- },
- compTableSet: function () {
- return function (options) {
- var arrays = options.filter((item) => {
- return item.hidden !== false;
- });
- return arrays;
- };
- },
- numTime: function () {
- return function (res) {
- return Number(res / 3600).toFixed(2);
- };
- },
- },
- created() {
- this.inittableSet = JSON.stringify(this.tableSet);
- this.initTR();
- },
- methods: {
- selectFuncTrue() {
- return true;
- },
- radioChange(val) {},
- blurBackData(row) {
- this.$emit("sortFunc", row);
- },
- backFunc(row) {
- this.$emit("backFunc", row);
- },
- /**
- * 清除多选框
- */
- clearMoreActive() {
- this.allCheckData = [];
- this.$refs.pagerset.clearSelection();
- },
- openDialog(row) {
- this.$emit("openDialog", row);
- },
- sortMethods(a, b) {
- if (a.classGradeUserGoodsVoList && b.classGradeUserGoodsVoList) {
- return a.classGradeUserGoodsVoList.length >
- b.classGradeUserGoodsVoList.length
- ? -1
- : 1;
- } else {
- return a.sort > b.sort ? -1 : 1;
- }
- },
- sortChange(column) {
- this.$emit("sortChange", column);
- },
- openSpec(id) {
- this.$emit("openClassNum", id);
- },
- loadNode(node, resolve) {
- if (node.level === 0) {
- this.treeDatas.forEach((item) => {
- if (item.type === 1) {
- item.hasChildren = true;
- }
- if (item.type === 2) {
- item.hasChildren = true;
- }
- if (item.type === 3) {
- item.hasChildren = false;
- }
- });
- return resolve(this.treeDatas);
- } else {
- if (node.data.type === 1) {
- this.$api
- .inquireCourseListmodulechapter(node.data.menuId)
- .then((res) => {
- res.data.forEach((item) => {
- item.TypeId = 2 + "-" + item.chapterId;
- item.hasChildren = true;
- item.menuId = item.chapterId;
- item.type = 2;
- });
- return resolve(res.data);
- });
- }
- if (node.data.type === 2) {
- this.$api
- .inquireCoursechaptersectionlist(node.data.menuId)
- .then((res) => {
- res.data.forEach((item) => {
- item.TypeId = 3 + "-" + item.sectionId;
- item.type = 3;
- });
- return resolve(res.data);
- });
- }
- if (node.data.type === 3) {
- return resolve([]);
- }
- }
- },
- openBoxData(row) {
- this.$emit("openBoxFun", row);
- },
- timeStyle(column) {
- if (column.columnIndex === 0 && this.navText.firstColLeft) {
- return "text-align:left!important; padding-left: 40px;";
- }
- },
- //初始化
- initTR() {
- this.isIndeterminate = false;
- this.tableSet = [];
- this.$nextTick(() => {
- this.tableSet = JSON.parse(this.inittableSet);
- });
- },
- edit() {},
- selectAll(value) {
- this.allCheckData = value;
- },
- select(value) {
- this.allCheckData = value;
- },
- load(tree, treeNode, resolve) {
- this.$emit("load", tree, treeNode, resolve);
- },
- },
- };
- </script>
- <style lang="less">
- .el-table .info-row {
- background: #c9c9c9;
- }
- .open_style {
- cursor: pointer;
- color: blue;
- }
- .el-table .cell.el-tooltip {
- transition: all 0.3s;
- }
- .max-heightStyles {
- max-height: 500px;
- overflow-y: auto;
- }
- .overSty {
- white-space: nowrap;
- overflow-x: auto;
- &::-webkit-scrollbar {
- width: 14px;
- height: 14px;
- }
- &::-webkit-scrollbar-track,
- &::-webkit-scrollbar-thumb {
- border-radius: 999px;
- border: 5px solid transparent;
- }
- &::-webkit-scrollbar-track {
- box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2) inset;
- }
- &::-webkit-scrollbar-thumb {
- min-height: 20px;
- background-clip: content-box;
- box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.2) inset;
- }
- &::-webkit-scrollbar-corner {
- background: transparent;
- }
- }
- .slotPopper {
- padding: 0px !important;
- }
- </style>
- <style lang="less" scoped>
- #tableList {
- border-radius: 8px;
- }
- .goodsListStyle {
- cursor: pointer;
- color: blue;
- }
- .popoverDis {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- font-size: 14px;
- .checkboxHeader {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-left: 13px;
- padding-right: 15px;
- width: 100%;
- .initbtns {
- color: #47a6ff;
- cursor: pointer;
- }
- }
- .checkboxGroup {
- display: flex;
- flex-direction: column;
- width: 100%;
- .checkboxchild {
- width: 100%;
- justify-content: space-between;
- height: 40px;
- display: flex;
- align-items: center;
- padding: 0px 15px 0px 13px;
- transition: all 0.4s;
- &:hover {
- background-color: #ecf5ff;
- }
- &:hover .icon-right {
- display: flex;
- }
- .icon-right {
- display: flex;
- align-items: center;
- width: 30px;
- height: 30px;
- color: #666;
- font-size: 14px;
- display: none;
- i {
- cursor: pointer;
- margin: 0px 3px;
- &:hover {
- color: #47a6ff;
- }
- }
- }
- }
- }
- }
- /deep/.el-checkbox__input.is-checked + .el-checkbox__label {
- color: #666;
- }
- .imgboxsq {
- margin: 0 auto;
- height: 60px;
- max-height: 60px;
- .el_images {
- /deep/.el-image__inner {
- width: auto;
- }
- }
- }
- .imgHover {
- width: 100%;
- height: 100%;
- cursor: pointer;
- }
- .cvideo {
- transition: all 0.2s;
- color: #333;
- cursor: pointer;
- font-size: 30px;
- }
- .cvideo:hover {
- color: #47a6ff;
- }
- .ulAuto {
- display: flex;
- justify-content: center;
- align-items: center;
- & > ul {
- margin: 0px;
- }
- }
- .ulAutos {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .el-popover > ul {
- margin: 0px;
- }
- .dis_sdt {
- display: flex;
- align-items: flex-end;
- ul {
- margin: 0px;
- li {
- text-align: left;
- }
- }
- }
- .jumpStys {
- color: blue;
- cursor: pointer;
- }
- .zdyBoxStyle {
- display: flex;
- align-items: center;
- justify-content: center;
- .zdyBtnstyle {
- padding: 4px 16px;
- border-radius: 4px;
- border: 1px solid #666;
- color: #666;
- cursor: pointer;
- }
- .goodsActiveStyle {
- color: #fff;
- background-color: #409eff;
- border-color: #409eff;
- }
- }
- .liSYTS {
- padding: 10px;
- margin-bottom: 16px;
- background: #eee;
- width: 96%;
- }
- .overBoxs {
- max-height: 500px;
- overflow-y: auto;
- }
- </style>
|