Kaynağa Gözat

添加产品页面

lex-xin 3 yıl önce
ebeveyn
işleme
d5e60cf6e1

+ 5 - 1
src/router/index.js

@@ -466,7 +466,11 @@ export const asyncRoutes = {
   // 监控规则设置
   monitorManager:()=>import('@/views/monitorManager'),
   // 课程参数设置
-  baseRulesClassSetting:()=>import('@/views/baseRulesClassSetting')
+  baseRulesClassSetting:()=>import('@/views/baseRulesClassSetting'),
+  // 产品管理
+  productManager: () => import('@/views/platformManager/productManger'),
+  // 服务管理
+  serviceManager: () => import('@/views/platformManager/serviceManager')
 }
 
 export default router

+ 0 - 0
src/views/platformManager/productManger/api.js


+ 186 - 0
src/views/platformManager/productManger/index.vue

@@ -0,0 +1,186 @@
+<template>
+  <div class="m-container">
+    <h2>
+      <div class="squrt"></div>
+      产品管理
+    </h2>
+    <save-form
+      :inline="true"
+      class="searchForm"
+      ref="searchForm"
+      @submit="search"
+      @reset="reset"
+      size="small"
+      :saveKey="'platformProductManager'"
+      :model.sync="searchForm"
+    >
+      <el-form-item :rules="[]">
+        <el-input v-model="searchForm.search" placeholder="产品名称"></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button native-type="submit" type="danger">搜索</el-button>
+        <el-button native-type="reset" type="primary">重置</el-button>
+      </el-form-item>
+    </save-form>
+    <el-button size="small" style="margin-bottom: 20px;" type="primary" v-permission="'organizationCourseDurationSettings/insert'" @click="openProduct('create')" icon="el-icon-plus">添加</el-button>
+    <!-- 列表 -->
+    <div class="tableWrap">
+      <el-table
+        :data="tableList"
+        size="small"
+        :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+      >
+        <el-table-column align="center" prop="organ.name" label="编号">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          prop="classGroupTypeName"
+          label="产品名称"
+        >
+          <template slot-scope="scope">
+            <div>
+              {{ scope.row.courseType | coursesType }}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="产品描述" prop="duration">
+        </el-table-column>
+        <el-table-column align="center" label="操作">
+          <template slot-scope="scope">
+            <el-button
+              @click="resetCourseTime(scope.row)"
+              v-permission="'organizationCourseDurationSettings/update'"
+              type="text"
+              size="small"
+              >修改</el-button
+            >
+            <el-button
+              @click="resetCourseTime(scope.row)"
+              v-permission="'organizationCourseDurationSettings/update'"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+       :saveKey="'platformProductManager'"
+        sync
+        :total.sync="pageInfo.total"
+        :page.sync="pageInfo.page"
+        :limit.sync="pageInfo.limit"
+        :page-sizes="pageInfo.page_size"
+        @pagination="getList"
+      />
+    </div>
+    <el-dialog
+      :title="isAdd ? '新增网管课设置' : '修改网管课设置'"
+      class="courseMask"
+      width="500px"
+      :visible.sync="courseVisible"
+    >
+      <operationModel
+        ref="operationModel"
+        :activeRow="activeRow"
+        v-if="courseVisible"
+        :organList="selects.branchs"
+        :courseType="courseType"
+        @close="close"
+      />
+      <div slot="footer" class="dialog-footer">
+        <el-button size="small" @click="courseVisible = false">取 消</el-button>
+        <el-button size="small" type="primary" @click="submitInfo">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import pagination from "@/components/Pagination/index";
+import { musicCourseType } from "@/utils/searchArray";
+import { getOrganizationCourseDurationSettings,delOrganizationCourseDurationSettings } from "@/api/specialSetting";
+import operationModel from "./operationModel";
+const initSearch = {
+  search: null
+};
+export default {
+  components: { pagination, operationModel },
+  data() {
+    return {
+      tableList: [],
+      pageInfo: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50], // 选择限制显示条数
+      },
+      searchForm: { ...initSearch },
+      courseType: musicCourseType,
+      isAdd: true,
+      courseVisible: false,
+      activeRow: null,
+    };
+  },
+  mounted() {
+    this.$store.dispatch("setBranchs");
+    this.getList();
+  },
+  methods: {
+    async getList() {
+      try {
+        const res = await getOrganizationCourseDurationSettings({
+          ...this.searchForm,
+          page: this.pageInfo.page,
+          rows: this.pageInfo.limit,
+        });
+        this.pageInfo.total = res.data.total;
+        this.tableList = res.data.rows;
+      } catch (e) {}
+    },
+    search() {
+      this.pageInfo.page = 1;
+      this.$refs.searchForm.save(this.searchForm);
+      this.$refs.searchForm.save(this.pageInfo, "page");
+      this.getList();
+    },
+    reset() {
+      this.searchForm = { ...initSearch };
+      this.search();
+    },
+    resetCourseTime(row) {
+      this.isAdd = false;
+      this.activeRow = row;
+      this.courseVisible = true;
+    },
+    submitInfo() {
+      const str = this.isAdd ? "create" : "update";
+      this.$refs.operationModel.submitInfo(str);
+    },
+    close() {
+      this.courseVisible = false;
+      this.getList();
+    },
+    openProduct() {
+      this.isAdd = true;
+      this.activeRow = null;
+      this.courseVisible = true;
+    },
+    async delCourseTime(row) {
+      this.$confirm("是否删除?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then( async() => {
+        try{
+         const res =   await delOrganizationCourseDurationSettings({ id:row.id})
+         this.$message.success('删除成功')
+         this.getList()
+        }catch{}
+      });
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 241 - 0
src/views/platformManager/productManger/operationModel.vue

@@ -0,0 +1,241 @@
+<template>
+  <div>
+    <el-form :model="auditionForm" ref="auditionForm" size="small">
+      <el-form-item
+        label="分部"
+        prop="organId"
+        :label-width="formLabelWidth"
+        :rules="[{ required: true, message: '产品名称', trigger: 'blur' }]"
+      >
+        <el-input clearable placeholder="请输入产品名称" v-model="courseType" />
+      </el-form-item>
+      <el-form-item
+        label="产品描述"
+        prop="courseType"
+        :label-width="formLabelWidth"
+        :rules="[
+          { required: true, message: '请输入产品描述', trigger: 'blur' },
+        ]"
+      >
+        <el-input clearable type="textarea" placeholder="请输入产品描述" v-model="courseType" />
+      </el-form-item>
+      <el-alert
+          title="产品权限"
+          type="info"
+          :closable="false"
+          class="vipMsg"
+        ></el-alert>
+      <el-form-item label="搜索">
+        <el-input style="width:210px"
+                  v-model.trim="seachRoleValue"></el-input>
+        <el-button style="margin-left: 10px"
+                    type="danger"
+                    @click="seachRoles">搜索</el-button>
+        <el-button type="primary"
+                    @click="onReSetRole">重置</el-button>
+      </el-form-item>
+      <el-form-item label="基本权限">
+        <el-checkbox :indeterminate="isIndeterminate"
+                      @change="onCheckAll"
+                      v-model.trim="checkAll">全选</el-checkbox>
+
+        <el-tree :data="data"
+                  show-checkbox
+                  node-key="id"
+                  @check="onTreeCheck"
+                  :filter-node-method="filterNode"
+                  ref="tree"
+                  accordion
+                  highlight-current
+                  :default-checked-keys="result.menuIds"
+                  :props="defaultProps">
+          <div slot-scope="{ node, data }">
+            {{ node.label }}
+            <el-tag v-if="data.type == 1"
+                    size="mini"
+                    effect="dark">按钮</el-tag>
+          </div>
+        </el-tree>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+<script>
+import { resetOrganizationCourseDurationSettings,addOrganizationCourseDurationSettings } from "@/api/specialSetting";
+import { getSilder } from '@/api/silder'
+export default {
+  props: ["activeRow", "organList", "courseType"],
+  data() {
+    return {
+      auditionForm: {
+        organId: "",
+        courseType: "",
+        timer: [],
+        id: "",
+      },
+      inputVisible: false,
+      formLabelWidth: "80px",
+      
+    };
+  },
+  mounted() {
+    this.lookSilder()
+  },
+  methods: {
+    async submitInfo(str) {
+      console.log(str);
+      this.$refs.auditionForm.validate(async (_) => {
+        if (_) {
+          if (str == "update") {
+            try {
+              const res = await resetOrganizationCourseDurationSettings({
+                organId: this.auditionForm.organId,
+                duration: this.dynamicTags.join(","),
+                courseType: this.auditionForm.courseType,
+                id: this.auditionForm.id,
+              });
+                this.$message.success("修改成功");
+                this.$emit('close')
+            } catch {}
+          }else if(str == "create"){
+                   try {
+              const res = await addOrganizationCourseDurationSettings({
+                organId: this.auditionForm.organId,
+                duration: this.dynamicTags.join(","),
+                courseType: this.auditionForm.courseType,
+              });
+                this.$message.success("新建成功");
+                this.$emit('close')
+            } catch {}
+          }
+        }
+      });
+
+    },
+    async lookSilder () {
+      let silderList = await getSilder({ hid: 0 })
+      let tempData = []
+      if (silderList.code == 200) {
+        this.silderList = silderList.data
+        tempData = this.setTableData(silderList.data)
+        this.data = tempData
+        // console.log(this.data)
+      }
+      // console.log(this.pageType)
+      if (this.pageType == 'update') {
+        let roleInfo = await getRoleInfo({ id: this.id })
+        if (roleInfo.code == 200) {
+          let roleData = roleInfo.data
+          // 是否是全部选中
+          this.checkAll = roleData.menuIds.length >= this.slideCount
+          // 是否是半选
+          this.isIndeterminate = roleData.menuIds.length > 0 && roleData.menuIds.length < this.slideCount
+          let tSplice = this.getParent(roleData.menuIds, tempData)
+          roleData.menuIds = tSplice
+          this.result = roleData
+        }
+      } else {
+        this.onReSet()
+      }
+    },
+    onTreeCheck () {
+      let checkTree = this.$refs.tree.getCheckedKeys()
+      this.checkAll = checkTree.length >= this.slideCount
+      this.isIndeterminate = checkTree.length > 0 && checkTree.length < this.slideCount
+    },
+    onCheckAll (val) {
+      if (val) {
+        // 先去掉半选
+        this.isIndeterminate = false
+        this.$refs.tree.setCheckedNodes(this.data)
+      } else {
+        this.$refs.tree.setCheckedNodes([])
+      }
+    },
+
+    //递归获取到所有的为子级的ID
+    getParent (checkIds, data) {
+      let removeIds = JSON.parse(JSON.stringify(checkIds))
+      this.getAllChildIds(data)
+      let tempAllChildIds = this.allChildIds
+      for (let i = checkIds.length; i > 0; i--) {
+        if (!tempAllChildIds.includes(checkIds[i - 1])) {
+          removeIds.splice(i - 1, 1)
+        }
+      }
+      return removeIds
+    },
+    getAllChildIds (data) {
+      // 获取所有最子集编号
+      let child = this.allChildIds
+      let tempList = []
+      data.forEach((item, index) => {
+        let temp = []
+        if (item.children && item.children.length > 0) {
+          temp = this.getAllChildIds(item.children)
+        } else {
+          child.push(item.id)
+        }
+      })
+    },
+    setTableData (result) {
+      let list = []
+      list = result.map(res => {
+        let tempList = {}
+        tempList = {
+          id: res.id,
+          name: res.name,
+          label: res.name,
+          type: res.type,
+          path: res.path,
+          permission: res.permission,
+          icon: res.icon,
+          parentId: res.parentId
+        }
+        this.slideCount++
+        if (res.sysMenus && res.sysMenus.length > 0) {
+          tempList.children = this.setTableData(res.sysMenus)
+        }
+        return tempList
+      })
+      return list
+    },
+    onReSet () {
+      this.$refs.tree.setCheckedNodes([])
+      this.result = {
+        roleName: null,
+        roleDesc: null,
+      }
+      this.checkAll = false
+    },
+    onCancel () {
+      this.$store.dispatch('delVisitedViews', this.$route)
+      this.$router.push({
+        path: '/parameter/adminManager',
+        query: {
+          page: this.$route.query.page
+        }
+      })
+    },
+    seachRoles () {
+       this.$refs.tree.filter(this.seachRoleValue);
+    },
+    filterNode(value, data) {
+      console.log(data)
+        if (!value) return true;
+        return data.label.indexOf(value) !== -1;
+      },
+    onReSetRole () {
+      this.seachRoleValue = ''
+      this.data = this.setTableData(this.silderList)
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.courseMask {
+  .el-tag.el-tag--info {
+    margin-right: 4px;
+  }
+}
+</style>

+ 0 - 0
src/views/platformManager/serviceManager/index.vue