|
@@ -0,0 +1,108 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <c-search :is_search="true" :fields="fields" @search="btSearch">
|
|
|
+ <template #is_use>
|
|
|
+ <el-option v-for="i in is_useList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
|
|
|
+ </template>
|
|
|
+ </c-search>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <c-button @toAdd="toAdd"></c-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="thr">
|
|
|
+ <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @edit="toEdit" @del="toDel"> </data-table>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { is_use } from '@common/src/layout/site';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('test');
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ // 查询
|
|
|
+ searchInfo: {},
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ fields: [
|
|
|
+ { label: '序号', options: { type: 'index' } },
|
|
|
+ { label: '名称', model: 'name', isSearch: true },
|
|
|
+ { label: '视频流', model: 'path', isSearch: true },
|
|
|
+ { label: '排序', model: 'sort', isSearch: true },
|
|
|
+
|
|
|
+ {
|
|
|
+ label: '是否启用',
|
|
|
+ model: 'is_use',
|
|
|
+ type: 'select',
|
|
|
+ format: (i) => {
|
|
|
+ let data = this.is_useList.find((r) => r.dict_value == i);
|
|
|
+ if (data) return data.dict_label;
|
|
|
+ else return '暂无';
|
|
|
+ },
|
|
|
+ isSearch: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ opera: [
|
|
|
+ { label: '修改', method: 'edit' },
|
|
|
+ { label: '删除', method: 'del', confirm: true, type: 'danger' },
|
|
|
+ ],
|
|
|
+ is_useList: is_use,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['query', 'update', 'delete']),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ btSearch(query) {
|
|
|
+ this.$set(this, `searchInfo`, query);
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ // 添加
|
|
|
+ toAdd() {
|
|
|
+ this.$router.push({ path: '/tvadmin/add' });
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ toEdit({ data }) {
|
|
|
+ this.$router.push({ path: '/tvadmin/add', query: { id: data._id } });
|
|
|
+ },
|
|
|
+ // 删除信息
|
|
|
+ async toDel({ data }) {
|
|
|
+ let res = await this.delete(data.id);
|
|
|
+ if (this.$checkRes(res, `刪除信息成功`, `${res.errmsg}`)) this.search();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ test: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {},
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|