guhongwei 2 年之前
父節點
當前提交
93125aaa4f
共有 5 個文件被更改,包括 476 次插入0 次删除
  1. 15 0
      src/router/module/app.js
  2. 4 0
      src/store/index.js
  3. 131 0
      src/views/app/scene/data/add.vue
  4. 170 0
      src/views/app/scene/data/index.vue
  5. 156 0
      src/views/app/scene/type/index.vue

+ 15 - 0
src/router/module/app.js

@@ -34,4 +34,19 @@ export default [
     meta: { title: '信息管理', is_filter: false },
     component: () => import('@/views/app/appapk/add.vue'),
   },
+  {
+    path: '/app/scene/type',
+    meta: { title: '视频场景分类', is_filter: false },
+    component: () => import('@/views/app/scene/type/index.vue'),
+  },
+  {
+    path: '/app/scene/data',
+    meta: { title: '视频场景信息', is_filter: false },
+    component: () => import('@/views/app/scene/data/index.vue'),
+  },
+  {
+    path: '/app/scene/data/add',
+    meta: { title: '信息管理', is_filter: false },
+    component: () => import('@/views/app/scene/data/add.vue'),
+  },
 ];

+ 4 - 0
src/store/index.js

@@ -21,6 +21,8 @@ import appbasic from '@common/src/store/app/appbasic';
 import appbanner from '@common/src/store/app/appbanner';
 import hotlink from '@common/src/store/app/hotlink';
 import appapk from '@common/src/store/app/appapk';
+import scenetype from '@common/src/store/app/scenetype';
+import scenedata from '@common/src/store/app/scenedata';
 
 Vue.use(Vuex);
 
@@ -45,5 +47,7 @@ export default new Vuex.Store({
     appbanner,
     hotlink,
     appapk,
+    scenetype,
+    scenedata,
   },
 });

+ 131 - 0
src/views/app/scene/data/add.vue

@@ -0,0 +1,131 @@
+<template>
+  <div id="add">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="24" class="one">
+          <c-search :is_title="true" :is_back="true" @toBack="toBack"></c-search>
+        </el-col>
+        <el-col :span="24" class="two">
+          <data-form :fields="fields" :form="form" :rules="{}" @save="toSave" :span="24">
+            <template #type_id>
+              <el-option v-for="i in typeList" :key="i._id" :label="i.title" :value="i._id"></el-option>
+            </template>
+            <template #is_scene>
+              <el-option v-for="i in isnoList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #img_url="{ item }">
+              <c-upload v-model="form[item.model]" url="/files/projectadmin/imgurl/upload" accept="" listType="text" :limit="1"></c-upload>
+            </template>
+            <template #is_use>
+              <el-option v-for="i in isuseList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('scenedata');
+const { mapActions: scenetype } = createNamespacedHelpers('scenetype');
+const { mapActions: dictdata } = createNamespacedHelpers('dictdata');
+export default {
+  name: 'add',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      fields: [
+        { label: '分类', model: 'type_id', type: 'select' },
+        { label: '名称', model: 'title' },
+        { label: '图片', model: 'img_url', custom: true },
+        { label: '排序', model: 'sort', type: 'number' },
+        { label: '是否推荐', model: 'is_scene', type: 'select' },
+        { label: '是否启用', model: 'is_use', type: 'select' },
+      ],
+      form: {},
+      // 类型
+      typeList: [],
+      // 字典
+      // 是否启用
+      isuseList: [],
+      // 是否
+      isnoList: [],
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['fetch', 'create', 'update']),
+    ...scenetype({ sQuery: 'query' }),
+    ...dictdata({ dQuery: 'query' }),
+    async search() {
+      let form = {};
+      if (this.id) {
+        let res = await this.fetch(this.id);
+        if (this.$checkRes(res)) {
+          form = res.data;
+        }
+      } else {
+        if (this.type_id) form.type_id = this.type_id;
+      }
+      this.$set(this, `form`, form);
+    },
+    // 保存信息
+    async toSave({ data }) {
+      let res;
+      if (data.id) res = await this.update(data);
+      else res = await this.create(data);
+      if (this.$checkRes(res, `维护信息成功`, res.errmsg)) this.toBack();
+    },
+    // 字典
+    async searchOther() {
+      let res;
+      // 类型
+      res = await this.sQuery();
+      if (this.$checkRes(res)) {
+        this.$set(this, `typeList`, res.data);
+      }
+      // 是否启用
+      res = await this.dQuery({ type: 'is_use' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isuseList`, res.data);
+      }
+      // 是否
+      res = await this.dQuery({ type: 'is_no' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isnoList`, res.data);
+      }
+    },
+    // 返回
+    toBack() {
+      window.history.go('-1');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+    type_id() {
+      return this.$route.query.type_id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 170 - 0
src/views/app/scene/data/index.vue

@@ -0,0 +1,170 @@
+<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 #type_id>
+              <el-option v-for="i in typeList" :key="i._id" :label="i.title" :value="i._id"></el-option>
+            </template>
+            <template #is_scene>
+              <el-option v-for="i in isnoList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #is_use>
+              <el-option v-for="i in isuseList" :key="i._id" :label="i.label" :value="i.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 { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('scenedata');
+const { mapActions: scenetype } = createNamespacedHelpers('scenetype');
+const { mapActions: dictdata } = createNamespacedHelpers('dictdata');
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      // 查询
+      searchInfo: {},
+      fields: [
+        { label: '序号', options: { type: 'index' } },
+        {
+          label: '分类',
+          model: 'type_id',
+          type: 'select',
+          format: (i) => {
+            let data = this.typeList.find((r) => r._id == i);
+            if (data) return data.title;
+            else return '暂无';
+          },
+          isSearch: true,
+        },
+        { label: '名称', model: 'title', isSearch: true },
+        { label: '排序', model: 'sort' },
+        {
+          label: '是否推荐',
+          model: 'is_scene',
+          type: 'select',
+          format: (i) => {
+            let data = this.isnoList.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+          isSearch: true,
+        },
+        {
+          label: '是否启用',
+          model: 'is_use',
+          type: 'select',
+          format: (i) => {
+            let data = this.isuseList.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+          isSearch: true,
+        },
+      ],
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
+      ],
+      list: [],
+      total: 0,
+      // 类型
+      typeList: [],
+      // 字典
+      // 是否启用
+      isuseList: [],
+      // 是否
+      isnoList: [],
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'delete', 'create', 'update']),
+    ...scenetype({ sQuery: 'query' }),
+    ...dictdata({ dQuery: 'query' }),
+    // 查询信息
+    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: '/app/scene/data/add', query: { type_id: this.type_id } });
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$router.push({ path: '/app/scene/data/add', query: { id: data._id } });
+    },
+    async toDel({ data }) {
+      let res = await this.delete(data._id);
+      if (this.$checkRes(res, '删除信息成功', res.errmsg)) this.search();
+    },
+    // 字典表
+    async searchOther() {
+      let res;
+      // 类型
+      res = await this.sQuery();
+      if (this.$checkRes(res)) {
+        this.$set(this, `typeList`, res.data);
+      }
+      // 是否启用
+      res = await this.dQuery({ type: 'is_use' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isuseList`, res.data);
+      }
+      // 是否
+      res = await this.dQuery({ type: 'is_no' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isnoList`, res.data);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    type_id() {
+      return this.$route.query.type_id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    '$route.query': {
+      deep: true,
+      immediate: true,
+      handler(val) {
+        if (val.type_id) {
+          this.$set(this.searchInfo, `type_id`, val.type_id);
+        }
+      },
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 156 - 0
src/views/app/scene/type/index.vue

@@ -0,0 +1,156 @@
+<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 isuseList" :key="i._id" :label="i.label" :value="i.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" @view="toView"> </data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+    <c-dialog :dialog="dialog" @toClose="toClose">
+      <template v-slot:info>
+        <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
+          <data-form :fields="formFields" :form="form" :rules="{}" @save="toSave" :span="24">
+            <template #is_use>
+              <el-option v-for="i in isuseList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-form>
+        </el-col>
+      </template>
+    </c-dialog>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('scenetype');
+const { mapActions: dictdata } = createNamespacedHelpers('dictdata');
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      // 查询
+      searchInfo: {},
+      fields: [
+        { label: '序号', options: { type: 'index' } },
+        { label: '名称', model: 'title', isSearch: true },
+        { label: '排序', model: 'sort' },
+        {
+          label: '是否启用',
+          model: 'is_use',
+          type: 'select',
+          format: (i) => {
+            let data = this.isuseList.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+          isSearch: true,
+        },
+      ],
+      opera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
+        { label: '场景信息', method: 'view' },
+      ],
+      list: [],
+      total: 0,
+      // 字典
+      // 是否启用
+      isuseList: [],
+      // 弹框
+      dialog: { title: '信息管理', show: false, type: '' },
+      form: {},
+      formFields: [
+        { label: '名称', model: 'title' },
+        { label: '排序', model: 'sort', type: 'number' },
+        { label: '是否启用', model: 'is_use', type: 'select' },
+      ],
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'delete', 'create', 'update']),
+    ...dictdata({ dQuery: 'query' }),
+    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.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 修改
+    toEdit({ data }) {
+      this.$set(this, `form`, data);
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+    // 保存
+    async toSave({ data }) {
+      let res;
+      if (data._id) res = await this.update(data);
+      else res = await this.create(data);
+      if (this.$checkRes(res, '维护信息成功', res.errmsg)) this.toClose();
+    },
+    // 关闭弹框
+    toClose() {
+      this.form = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+      this.search();
+    },
+    async toDel({ data }) {
+      let res = await this.delete(data._id);
+      if (this.$checkRes(res, '删除信息成功', res.errmsg)) this.search();
+    },
+    // 场景信息
+    toView({ data }) {
+      this.$router.push({ path: '/app/scene/data', query: { type_id: data._id } });
+    },
+    // 字典表
+    async searchOther() {
+      let res;
+      // 是否启用
+      res = await this.dQuery({ type: 'is_use' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isuseList`, res.data);
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>