index.vue 13.3 KB
Newer Older
qzhxx's avatar
qzhxx committed
1
<template>
qzhxx's avatar
qzhxx committed
2
  <div class="listPage H100">
qzhxx's avatar
qzhxx committed
3
    <div class="search-container">
qzhxx's avatar
qzhxx committed
4 5 6 7 8
      <el-form :inline="true" :model="form" class="search-form" onsubmit="return false;">
        <el-form-item label="版权方名称">
          <el-input
            size="mini"
            placeholder="请输入版权方名称"
9
            v-model="form.nameOrCode"
qzhxx's avatar
qzhxx committed
10 11 12 13
            @keyup.enter.native="Search"
            clearable
          ></el-input>
        </el-form-item>
qzhxx's avatar
qzhxx committed
14
        <el-form-item label="版权方有效期">
qzhxx's avatar
qzhxx committed
15 16 17 18 19 20 21 22 23
          <el-date-picker
            v-model="value1"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
qzhxx's avatar
qzhxx committed
24 25
          <div class="btn-group">
            <el-button size="mini" type="primary" class="btn_form_search" @click="Search">查询</el-button>
qzhxx's avatar
qzhxx committed
26
            <el-button size="mini" class="btn_form_search" @click="Reset">重置</el-button>
qzhxx's avatar
qzhxx committed
27
          </div>
qzhxx's avatar
qzhxx committed
28 29
        </el-form-item>
      </el-form>
qzhxx's avatar
qzhxx committed
30 31 32 33
      <div class="page-tip">
        <span class="page-tip-title">页面说明:</span>
        <span class="page-tips">展示所有单位的互动频次统计图及统计表格</span>
      </div>
qzhxx's avatar
qzhxx committed
34
    </div>
qzhxx's avatar
qzhxx committed
35 36 37 38 39 40 41 42 43 44 45 46 47
    <div class="table-content">
      <div class="btn-group">
        <el-button type="primary" @click="addPermis()">新建版权方</el-button>
      </div>
      <div class="party-table">
        <el-table
          border
          style="width: 100%;height:100%" height="100%"
          ref="multipleTable"
          :data="tableData"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="index" width="120" label="序号"></el-table-column>
48 49 50 51 52
          <el-table-column show-overflow-tooltip label="版权方名称" prop="name"></el-table-column>
          <el-table-column show-overflow-tooltip label="视频分类" prop="assetTypeNames"></el-table-column>
          <el-table-column label="创建时间" prop="createTime"></el-table-column>
          <el-table-column label="版权方有效期" prop="expireDateEnd"></el-table-column>
          <el-table-column show-overflow-tooltip label="备注" prop="remarks"></el-table-column>
qzhxx's avatar
qzhxx committed
53 54
          <el-table-column label="操作" header-align="center" align="center">
            <template slot-scope="scope" width="220">
qzhxx's avatar
qzhxx committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
              <div class="table-btn-group">
                        <el-tooltip content="修改" placement="top">
                            <el-button circle  @click="openEdit(scope.row)">
                                <i class="icon-table icon-edit"></i>
                            </el-button>
                        </el-tooltip>
                        <el-tooltip content="删除" placement="top">
                            <el-button circle  @click="handleDelete(scope.row)">
                                <i class="icon-table icon-del"></i>
                            </el-button>
                        </el-tooltip>
                  
                         <!-- <el-tooltip content="禁用" placement="top">
                            <el-button 
                             circle 
                             :disabled="scope.row.status == 2 || scope.row.statusName == '待审核' "
                             @click="handleOperate(scope.row,'disable')">
                                <i class="icon-table icon-disable"></i>
                            </el-button>
                        </el-tooltip>
                       <el-tooltip content="激活" placement="top">
                            <el-button 
                             circle 
                             :disabled="scope.row.status == 1"
                             @click="handleOperate(scope.row,'enable')">
                                <i class="icon-table icon-enable"></i>
                            </el-button>
                        </el-tooltip>
                        <el-tooltip content="审核详情" placement="top">
                            <el-button 
                             circle
                             @click="handleOperate(scope.row,'examine')">
                                <i class="icon-table icon-detail"></i>
                            </el-button>
                        </el-tooltip> -->
                    </div>
qzhxx's avatar
qzhxx committed
91 92 93 94 95
            </template>
          </el-table-column>
        </el-table>
      </div>
       <div class="partyt-pagination">
qzhxx's avatar
qzhxx committed
96 97 98 99 100 101
        <el-pagination
          small
          background
          @current-change="handleCurrentChange"
          :current-page="page.currentPage"
          :page-size="page.pageSize"
qzhxx's avatar
qzhxx committed
102
          layout="prev, pager, next, jumper"
qzhxx's avatar
qzhxx committed
103 104 105 106
          :total="page.total"
        ></el-pagination>
        </div>
    </div>
qzhxx's avatar
qzhxx committed
107 108 109 110 111
  </div>
</template>
<script>
export default {
  data() {
qzhxx's avatar
qzhxx committed
112 113 114 115 116 117 118
    var checkIsNull = (rule, value, callback) => {
      if (value) {
        if (value.trim() == "") {
          callback(new Error("不允许只输入空格"));
        } else {
          callback();
        }
qzhxx's avatar
qzhxx committed
119 120
      }
    };
qzhxx's avatar
qzhxx committed
121
    return {
qzhxx's avatar
qzhxx committed
122
      value1: "",
qzhxx's avatar
qzhxx committed
123 124 125 126 127 128
      page: { currentPage: 1, pageSize: 10, total: 0 },
      tableData: [],
      FormVisible: false,
      FormVisible1: false,
      formLabelWidth: "100px",
      form: {
129
        nameOrCode: "",
qzhxx's avatar
qzhxx committed
130
        ownerType:'VIDEO_CONTENT'
qzhxx's avatar
qzhxx committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
      },
      editform: {
        menuName: "",
        menuUrl: "",
        parentId: "",
        sort: "",
        id: ""
      },
      permisform: {
        menuName: "",
        menuUrl: "",
        parentId: "",
        sort: ""
      },
      typeList: [],
      rules: {
        sort: [
          { required: true, message: "请输入顺序值", trigger: "change" },
          { pattern: /^(\d{1,5})?$/, message: "排序值为低于5位数的纯数字" }
        ],
        menuName: [
          { required: true, message: "请输入菜单名称", trigger: "change" },
          { max: 20, message: "不能超过20个字符", trigger: "change" },
          { validator: checkIsNull, trigger: "blur" }
        ],
        menuUrl: [
          { required: true, message: "请输入菜单地址", trigger: "change" },
          { validator: checkIsNull, trigger: "blur" }
        ],
        parentId: [
          { required: true, message: "请输入父级菜单", trigger: "change" }
        ]
      },
      value: "",
      name: ""
    };
qzhxx's avatar
qzhxx committed
167
  },
qzhxx's avatar
qzhxx committed
168 169 170
  computed: {},
  mounted() {
    this.onSearch();
171
    // this.getPermis();
qzhxx's avatar
qzhxx committed
172
  },
qzhxx's avatar
qzhxx committed
173
  components: {},
qzhxx's avatar
qzhxx committed
174
  methods: {
qzhxx's avatar
qzhxx committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
    // 渲染父级权限
    getPermis() {
      let vm = this;
      vm.$https({
        method: "get",
        url: "menu/getRoleMenu?roleId=" + sessionStorage.getItem("roleId"),
        authType: this.backToken
      }).then(
        res => {
          let data = res.data;
          vm.typeList = data.map((e, i) => {
            return {
              id: e.id,
              name:
                e.menuName.indexOf("-") == -1
                  ? e.menuName
                  : e.menuName.split("-")[1]
            };
          });
        },
        error => {
          console.log(error);
        }
      );
    },
    // 获得数据接口
    getTableData(param) {
      let vm = this;
      vm.$https(
        {
205 206
          url: "copyrightOwner/getPageList",
          method: "post",
qzhxx's avatar
qzhxx committed
207 208
          authType: this.backToken
        },
209 210
        vm.$qs.stringify(param)
        // param
qzhxx's avatar
qzhxx committed
211 212
      )
        .then(res => {
qzhxx's avatar
qzhxx committed
213
          let data = res.data.data;
qzhxx's avatar
qzhxx committed
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
          vm.page.pageSize = data.size;
          vm.page.total = data.total;
          vm.tableData = data.records;
        })
        .catch(function(err) {
          console.log(err);
        });
    },
    // 分页
    handleCurrentChange(val) {
      let _this = this;
      _this.page.currentPage = val;
      _this.onSearch();
    },
    onSearch() {
      let _this = this;
      let param = _this.getSearchQuery();
      _this.getTableData(param);
    },
qzhxx's avatar
qzhxx committed
233 234 235
    // 重置
    Reset(){
      // this.$refs["form"].resetFields();
qzhxx's avatar
qzhxx committed
236
      this.form = { ownerType:'VIDEO_CONTENT'}
qzhxx's avatar
qzhxx committed
237 238
      this.Search()
    },
qzhxx's avatar
qzhxx committed
239 240 241 242 243 244
    Search() {
      let _this = this;
      _this.page.currentPage = 1;
      let searchObj = {
        _index: 1,
        _size: _this.page.pageSize,
245
        nameOrCode: _this.form.nameOrCode,
qzhxx's avatar
qzhxx committed
246
        ownerType:'VIDEO_CONTENT'
qzhxx's avatar
qzhxx committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
      };
      this.getTableData(searchObj);
    },
    // // 获取当前查询参数
    getSearchQuery() {
      let _this = this;
      let searchObj = {
        _index: _this.page.currentPage,
        _size: _this.page.pageSize
      };
      for (let key in _this.form) {
        if (_this.form[key]) {
          searchObj[key] = _this.form[key];
        }
      }
      return searchObj;
    },
    // 添加
    addPermis() {
      this.$router.push({ path: "videoCopyrightAdd", query: { type: "add" } });
      // $('.el-dialog__title').html('新建');
      // this.FormVisible1 = true;
    },
    // 添加权限
    permisSave() {
      let _this = this;
      _this.$refs.permisform.validate(valid => {
        if (valid) {
          _this
            .$https(
              { url: "menu/add", method: "post", authType: this.backToken },
              _this.$qs.stringify(_this.permisform)
            )
            .then(
              res => {
                if (res.data.status == 200 || res.data.status == 201) {
                  _this.$message({
                    type: "success",
                    message: res.data.message
                  });
                  //跳回用户列表
                  _this.onSearch();
                  _this.FormVisible1 = false;
                  for (let key in _this.permisform) {
                    _this.permisform[key] = null;
                  }
                  _this.$refs["permisform"].resetFields();
                } else {
                  _this.$message({
                    type: "error",
                    message: res.data.message
                  });
                }
              },
              error => {
                _this.$message({
                  type: "error",
                  message: error
                });
              }
            );
        }
qzhxx's avatar
qzhxx committed
309 310
      });
    },
qzhxx's avatar
qzhxx committed
311 312 313 314
    // 编辑关闭
    close() {
      this.FormVisible = false;
      this.$refs["editform"].resetFields();
qzhxx's avatar
qzhxx committed
315
    },
qzhxx's avatar
qzhxx committed
316 317 318 319 320 321 322
    // 新增关闭
    close1() {
      this.FormVisible1 = false;
      for (let key in this.permisform) {
        this.permisform[key] = null;
      }
      this.$refs["permisform"].resetFields();
qzhxx's avatar
qzhxx committed
323
    },
qzhxx's avatar
qzhxx committed
324 325 326 327
    // 编辑弹框
    openEdit(row) {
      this.$router.push({
        path: "videoCopyrightUpdate",
328
        query: { type: "Update" ,id :row.id}
qzhxx's avatar
qzhxx committed
329 330 331 332 333 334 335 336 337 338
      });
      // alert('编辑')
      // $('.el-dialog__title').html('编辑');
      // let  _this=this;
      // //成功之后清除数据
      // for (let key in this.editform) {
      //   _this.editform[key]=null;
      // }
      // _this.editform= Object.assign({}, row);
      // _this.FormVisible = true;
qzhxx's avatar
qzhxx committed
339
    },
qzhxx's avatar
qzhxx committed
340
    // 删除
qzhxx's avatar
qzhxx committed
341
    handleDelete(row) {
qzhxx's avatar
qzhxx committed
342 343 344 345 346 347 348
      let _this = this;
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
349 350 351 352 353 354 355 356 357 358 359
          _this.$https({
            method: 'delete',
            url: 'copyrightOwner/delete/'+ row.id,
            authType: this.backToken
          }).then((res) => {
              this.$message({type: 'success', message: '删除成功!'});
              _this.Search();
            }, (error) => {
              this.$message({type: 'fail', message: "删除失败!" + error.response.data});
            }
          )
qzhxx's avatar
qzhxx committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
        })
        .catch(() => {});
    },
    // 保存编辑信息
    submitForm() {
      let _this = this;
      _this.$refs.editform.validate(valid => {
        if (valid) {
          let searchObj = {};
          for (let key in _this.editform) {
            if (this.editform[key]) {
              searchObj[key] = _this.editform[key];
            }
          }
          let str = _this.editform.menuName;
          let index = str.lastIndexOf("-");
          str = str.substring(index + 1, str.length);
          searchObj.menuName = str;
          _this
            .$https(
              {
                url: "menu/edit",
                method: "put",
                authType: this.backToken
              },
              _this.$qs.stringify(searchObj)
            )
            .then(
              res => {
                if (res.data.status == 200 || res.data.status == 201) {
                  _this.$message({
                    type: "success",
                    message: res.data.message
                  });
                  _this.onSearch();
                  _this.FormVisible = false;
                  _this.$refs["editform"].resetFields();
                } else {
                  _this.$message({
                    type: "error",
                    message: res.data.message
                  });
                }
              },
              error => {
                _this.$message({
                  type: "error",
                  message: error
                });
              }
            );
        }
      });
    },

    // 批量操作
    handleSelectionChange(selection) {
      let _this = this;
      _this.selection = selection;
qzhxx's avatar
qzhxx committed
419 420 421 422 423
    }
  }
};
</script>

qzhxx's avatar
qzhxx committed
424
<style lang="less">
qzhxx's avatar
qzhxx committed
425 426 427 428
// @import "../../../../style/common";
// @import "../../style/list";
@import '../../../../style/table.less';
@import '../../../../style/pagination.less';
qzhxx's avatar
qzhxx committed
429
</style>