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

qzhxx's avatar
qzhxx committed
352 353 354 355 356 357 358 359
              },
              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
// @import "../../../../style/common";
// @import "../../style/list";
qzhxx's avatar
qzhxx committed
427 428
@import "../../../../style/table.less";
@import "../../../../style/pagination.less";
qzhxx's avatar
qzhxx committed
429
</style>