index.vue 12.7 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">
4 5
      <el-form :inline="true" :model="form" onsubmit="return false;">
        <el-form-item >
qzhxx's avatar
qzhxx committed
6 7
          <el-input
            placeholder="请输入版权方名称"
8
            v-model="form.nameOrCode"
qzhxx's avatar
qzhxx committed
9 10 11 12
            @keyup.enter.native="Search"
            clearable
          ></el-input>
        </el-form-item>
13
        <el-form-item >
qzhxx's avatar
qzhxx committed
14
          <el-date-picker
qzhxx's avatar
qzhxx committed
15
            value-format="yyyy-MM-dd"
qzhxx's avatar
qzhxx committed
16 17 18 19 20 21 22 23
            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
          <div class="btn-group">
qzhxx's avatar
qzhxx committed
25 26
            <el-button type="primary" @click="Search">查询</el-button>
            <el-button @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
      <div class="page-tip">
        <span class="page-tip-title">页面说明:</span>
qzhxx's avatar
qzhxx committed
32
        <span class="page-tips">可对视频版权方信息进行筛选、修改及删除。可新建版权方信息</span>
qzhxx's avatar
qzhxx committed
33
      </div>
qzhxx's avatar
qzhxx committed
34
    </div>
qzhxx's avatar
qzhxx committed
35 36 37 38 39 40 41
    <div class="table-content">
      <div class="btn-group">
        <el-button type="primary" @click="addPermis()">新建版权方</el-button>
      </div>
      <div class="party-table">
        <el-table
          border
qzhxx's avatar
qzhxx committed
42 43
          style="width: 100%;height:100%"
          height="100%"
qzhxx's avatar
qzhxx committed
44 45 46 47
          ref="multipleTable"
          :data="tableData"
          @selection-change="handleSelectionChange"
        >
48 49 50 51 52
          <el-table-column type="index" width="120" label="序号">
            <template slot-scope="scope">
              <span>{{ (page.currentPage - 1) * 10 + scope.$index + 1 }}</span>
            </template>
          </el-table-column>
53
          <el-table-column show-overflow-tooltip label="版权方名称" prop="name"></el-table-column>
qzhxx's avatar
qzhxx committed
54
          <el-table-column show-overflow-tooltip label="视频分类" prop="videoContentCatNames"></el-table-column>
55
          <el-table-column label="创建时间" prop="createTime"></el-table-column>
qzhxx's avatar
qzhxx committed
56 57 58
          <el-table-column label="版权方有效期" prop="expireDateEnd" width="200">
            <template slot-scope="scope">{{scope.row.expireDateStart}}{{scope.row.expireDateEnd}}</template>
          </el-table-column>
59
          <el-table-column show-overflow-tooltip label="备注" prop="remarks"></el-table-column>
qzhxx's avatar
qzhxx committed
60 61
          <el-table-column label="操作" header-align="center" align="center">
            <template slot-scope="scope" width="220">
qzhxx's avatar
qzhxx committed
62
              <div class="table-btn-group">
qzhxx's avatar
qzhxx committed
63 64 65 66 67 68 69 70 71 72 73
                <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>
              </div>
qzhxx's avatar
qzhxx committed
74 75 76 77
            </template>
          </el-table-column>
        </el-table>
      </div>
qzhxx's avatar
qzhxx committed
78
      <div class="partyt-pagination">
qzhxx's avatar
qzhxx committed
79 80 81 82
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="page.currentPage"
          :page-size="page.pageSize"
qzhxx's avatar
qzhxx committed
83
          layout="prev, pager, next, jumper"
qzhxx's avatar
qzhxx committed
84 85
          :total="page.total"
        ></el-pagination>
qzhxx's avatar
qzhxx committed
86
      </div>
qzhxx's avatar
qzhxx committed
87
    </div>
qzhxx's avatar
qzhxx committed
88 89 90 91 92
  </div>
</template>
<script>
export default {
  data() {
qzhxx's avatar
qzhxx committed
93 94 95 96 97 98 99
    var checkIsNull = (rule, value, callback) => {
      if (value) {
        if (value.trim() == "") {
          callback(new Error("不允许只输入空格"));
        } else {
          callback();
        }
qzhxx's avatar
qzhxx committed
100 101
      }
    };
qzhxx's avatar
qzhxx committed
102
    return {
qzhxx's avatar
qzhxx committed
103
      value1: "",
qzhxx's avatar
qzhxx committed
104 105 106 107 108 109
      page: { currentPage: 1, pageSize: 10, total: 0 },
      tableData: [],
      FormVisible: false,
      FormVisible1: false,
      formLabelWidth: "100px",
      form: {
110
        nameOrCode: "",
qzhxx's avatar
qzhxx committed
111
        ownerType: "VIDEO_CONTENT"
qzhxx's avatar
qzhxx committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
      },
      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
148
  },
qzhxx's avatar
qzhxx committed
149 150 151
  computed: {},
  mounted() {
    this.onSearch();
152
    // this.getPermis();
qzhxx's avatar
qzhxx committed
153
  },
qzhxx's avatar
qzhxx committed
154
  components: {},
qzhxx's avatar
qzhxx committed
155
  methods: {
qzhxx's avatar
qzhxx committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    // 渲染父级权限
    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(
        {
186 187
          url: "copyrightOwner/getPageList",
          method: "post",
qzhxx's avatar
qzhxx committed
188 189
          authType: this.backToken
        },
190 191
        vm.$qs.stringify(param)
        // param
qzhxx's avatar
qzhxx committed
192 193
      )
        .then(res => {
qzhxx's avatar
qzhxx committed
194
          let data = res.data.data;
qzhxx's avatar
qzhxx committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
          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
214
    // 重置
qzhxx's avatar
qzhxx committed
215
    Reset() {
qzhxx's avatar
qzhxx committed
216
      // this.$refs["form"].resetFields();
qzhxx's avatar
qzhxx committed
217
      this.form = { ownerType: "VIDEO_CONTENT" };
qzhxx's avatar
qzhxx committed
218
      this.value1 = []
qzhxx's avatar
qzhxx committed
219
      this.Search();
qzhxx's avatar
qzhxx committed
220
    },
qzhxx's avatar
qzhxx committed
221 222 223 224 225 226
    Search() {
      let _this = this;
      _this.page.currentPage = 1;
      let searchObj = {
        _index: 1,
        _size: _this.page.pageSize,
227
        nameOrCode: _this.form.nameOrCode,
qzhxx's avatar
qzhxx committed
228 229 230
        ownerType: "VIDEO_CONTENT",
        startDate: this.value1 ? this.value1[0] : "",
        endDate: this.value1 ? this.value1[1] : ""
qzhxx's avatar
qzhxx committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 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
      };
      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
293 294
      });
    },
qzhxx's avatar
qzhxx committed
295 296 297 298
    // 编辑关闭
    close() {
      this.FormVisible = false;
      this.$refs["editform"].resetFields();
qzhxx's avatar
qzhxx committed
299
    },
qzhxx's avatar
qzhxx committed
300 301 302 303 304 305 306
    // 新增关闭
    close1() {
      this.FormVisible1 = false;
      for (let key in this.permisform) {
        this.permisform[key] = null;
      }
      this.$refs["permisform"].resetFields();
qzhxx's avatar
qzhxx committed
307
    },
qzhxx's avatar
qzhxx committed
308 309 310 311
    // 编辑弹框
    openEdit(row) {
      this.$router.push({
        path: "videoCopyrightUpdate",
qzhxx's avatar
qzhxx committed
312
        query: { type: "Update", id: row.id }
qzhxx's avatar
qzhxx committed
313 314 315 316 317 318 319 320 321 322
      });
      // 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
323
    },
qzhxx's avatar
qzhxx committed
324
    // 删除
qzhxx's avatar
qzhxx committed
325
    handleDelete(row) {
qzhxx's avatar
qzhxx committed
326 327 328 329 330 331 332
      let _this = this;
      this.$confirm("此操作将永久删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
qzhxx's avatar
qzhxx committed
333 334 335 336 337 338 339 340
          _this
            .$https({
              method: "delete",
              url: "copyrightOwner/delete/" + row.id,
              authType: this.backToken
            })
            .then(
              res => {
qzhxx's avatar
qzhxx committed
341
              if(res.data.resultCode === "200"){
qzhxx's avatar
qzhxx committed
342
                this.$message({ type: "success", message: "删除成功!" });
qzhxx's avatar
qzhxx committed
343
                _this.Search();
qzhxx's avatar
qzhxx committed
344 345 346 347 348 349 350 351 352
              }else{
                this.$message({ type: "error", message: res.data.message });
              }
                // this.$message({ type: "success", message: "删除成功!" });
                // this.msgInfo = {
                //   type: "wait",
                //   des: `删除申请已提交,待审核…`,
                // };

qzhxx's avatar
qzhxx committed
353 354 355 356 357 358 359 360
              },
              error => {
                this.$message({
                  type: "fail",
                  message: "删除失败!" + error.response.data
                });
              }
            );
qzhxx's avatar
qzhxx committed
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 419
        })
        .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
420 421 422 423 424
    }
  }
};
</script>

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