Zentao Utils

7/27/2021, 4:53:18 PM

当前为 2021-07-29 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Zentao Utils
// @namespace   Violentmonkey Scripts
// @match       http://zentao.inovance.com/pro/*
// @grant       all
// @version     1.0
// @author      sbw <[email protected]>
// @description 7/27/2021, 4:53:18 PM
// ==/UserScript==


(function() {
  
  // 显示 alert 对话框
  function show_alert(message)
  {
    bootAlert(message);
  }
  
  // 显示对话框
  function show_dialog(title, content)
  {
    $('#dialog .modal-title').html(title);
    $('#dialog .modal-body').html(content);
  }
  
  // 获取当前项目中的模块分类
  function fetch_all_module()
  {
    
  }
  
  // 更新任务所属模块
  function update_jobs_module(e)
  {
    // 禁止默认的响应
    e.preventDefault();
    
    // 获取选中的任务列表
    $('#bugList tr').filter('.checked').each(function () {
      var id = $(this).find('.c-id input').val();
      var title = $(this).find('.text-left').attr('title');
      if (typeof(title) === "undefined") {
        title = $(this).find('.text-left > a').attr('title');
      }
    });
    
    var content = $("<div class='dropdown'><button class='btn' type='button' data-toggle='dropdown'>所属模块<span class='caret'></span></button><ul class=dropdown-menu></ul></div>");
    
    show_dialog('更新模块', content);
  }
  
  // 添加对话框
  $("body").append("<div class='modal fade' id='dialog'><div class='modal-dialog modal-sm'><div class='modal-content'><div class='modal-header'><h4 class='modal-title'></h4></div><div class='modal-body'></div><div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>关闭</button><button type='button' class='btn btn-primary'>保存</button></div></div></div></div>");
  
  // 添加模块修改按钮
  $('.table-actions').append('<button class="btn" id="update-module" data-toggle="modal" data-target="#dialog">所属模块</button>');
  // 点击的事件
  $('#update-module').click(update_jobs_module);
})();