selleck - 分子庫入庫 instock-js

來源:互聯網
上載者:User

標籤:

// Generated by CoffeeScript 1.10.0var Model, model,  bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };model = null;$(function() {  var dropZone;  model = new Model();  ko.applyBindings(model);  dropZone = document.getElementById(‘drop-zone‘);  dropZone.addEventListener(‘dragenter‘, model.stopPropagation);  dropZone.addEventListener(‘dragover‘, model.stopPropagation);  return dropZone.addEventListener(‘drop‘, model.processDrop);});Model = (function() {  function Model() {    this.inStock = bind(this.inStock, this);    this.processDrop = bind(this.processDrop, this);  }  Model.prototype.racks = ko.observableArray();  Model.prototype.cat = ‘‘;  Model.prototype.stopPropagation = function(e) {    e.stopPropagation();    return e.preventDefault();  };  Model.prototype.processDrop = function(e) {    var file, reader;    this.stopPropagation(e);    file = e.dataTransfer.files[0];    if (file.name.match(/^S\d{4}.*\.csv$/i)) {      $(‘#fileInfo‘).text(file.name);      this.cat = file.name.substring(0, 5).toUpperCase();      reader = new FileReader();      reader.onload = (function(_this) {        return function() {          var hasNoRead, i, j, len, len1, plate, plateRow, rack, ref;          rack = new CodeLibRack();          rack.loadFromCsv(reader.result);          _this.racks.removeAll();          _this.racks.push(rack);          hasNoRead = false;          ref = rack.plates;          for (i = 0, len = ref.length; i < len; i++) {            plateRow = ref[i];            for (j = 0, len1 = plateRow.length; j < len1; j++) {              plate = plateRow[j];              if (‘No Read‘ === plate.code) {                hasNoRead = true;              }            }          }          return $(‘#inStockButton‘).prop(‘disabled‘, hasNoRead);        };      })(this);      return reader.readAsText(file);    } else {      $(‘#fileInfo‘).text(‘invalid file‘);      $(‘#inStockButton‘).prop(‘disabled‘, true);      return this.racks.removeAll();    }  };  Model.prototype.inStock = function() {    var codes, i, j, len, len1, plate, plateRow, racks, ref;    codes = [];    racks = ko.mapping.toJS(this.racks);    if (racks.length) {      ref = racks[0].plates;      for (i = 0, len = ref.length; i < len; i++) {        plateRow = ref[i];        for (j = 0, len1 = plateRow.length; j < len1; j++) {          plate = plateRow[j];          if (plate.code.match(/^\d+$/)) {            codes.push(plate.code);          }        }      }      return $.postJSON(‘doInStock.jhtml‘, {        cat: this.cat,        codes: codes      }).done((function(_this) {        return function(json) {          if (json.error) {            return alert(json.error);          } else {            return alert(‘上傳成功‘);          }        };      })(this));    }  };  return Model;})();

 

selleck - 分子庫入庫 instock-js

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.