JD ACE VMS - vms.jd.com

12/7/2020, 6:06:10 PM

Versione datata 07/12/2020. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        JD ACE VMS - vms.jd.com
// @namespace   Violentmonkey Scripts
// @match       http://vms.jd.com/Integration/Apply
// @grant       none
// @version     1.0
// @author      tinymins
// @description 12/7/2020, 6:06:10 PM
// ==/UserScript==

$('#jacp_card_id').after('<button style="margin: 5px; height: 30px; transform: translateY(2px);">ACE</button>').next().click(() => {
  $("#apply_type").val(4).change();
  const d = new Date();
  d.setTime(d.getTime() + 86400e3 * 30);
  $("#expect_online_date").val(
    [d.getFullYear(), d.getMonth() + 1, d.getDate()]
      .map((a) => (a < 10 ? "0" + a : a))
      .join("-")
  );
  $("#version_server").val("0");
  $("#test_content").val("无");
  $("#module_id").val("73").change();
  $("#self_test").val(0);
  $("#modification_explanation").val("无");
  $("#affect_range").val("无");
  $('[name="degrade_switch_apply"][value="0"]+ins').click();
  $('[name="pressure_test"][value="0"]+ins').click();
  $("#interface_name").val("无");
  $("#test_data").val("无");
  $("#test_address").val("http://beta-ace.jd.com/launch/");
  $("#review_result").val(1).change();
  $("#request-memo").val("无");
  const fetch = (url) => {
    const a = new XMLHttpRequest();
    a.open("GET", url, !1);
    a.withCredentials = !0;
    a.send();
    return a.responseText;
  };
  const fix_erp_tags = async (id, erp) => {
    const data = await $.ajax(
      "http://vms.jd.com/user/get_user_base_info?keyword=" + erp
    ).then((a) => a.info.data.find(({ user_name }) => user_name === erp));
    $(
      `<input id="${id}-hide" type="hidden" value="${JSON.stringify([
        data,
      ]).replace(/"/g, "&quot;")}" />`
    ).insertAfter($("#" + id));
    query_erp("#" + id);
  };
  const card = JSON.parse(
    fetch(
      "http://jagile.jd.com/jacp/api/v1/bizSpaceCard/cardDetail?id=" +
        jacp_card_dom.val()
    )
  );
  const roles = JSON.parse(
    fetch(
      "http://jagile.jd.com/jacp/api/v1/bizConfig/space/kv/" + card.data.spaceId
    )
  ).data.reduce((a, b) => {
    if ((b.name + b.group + "").match(/测试/)) a[b.code] = 1;
    return a;
  }, {});
  fix_erp_tags("code-review-operator", "bihuiting");
  fix_erp_tags("product-operator", card.data.creator.erp);
  fix_erp_tags(
    "test-operator",
    (
      card.data.personHours.find((a) => roles[a.roleCode]) || {
        erp: "leixuepei",
      }
    ).erp
  );
})