|
@@ -33,6 +33,7 @@ ProjectGLJ.prototype.loadData = function () {
|
|
self.isLoading = true;
|
|
self.isLoading = true;
|
|
},
|
|
},
|
|
success: function(response) {
|
|
success: function(response) {
|
|
|
|
+ self.isLoading = false;
|
|
if (response.err === 1) {
|
|
if (response.err === 1) {
|
|
let msg = response.msg !== undefined && response.msg !== '' ? response.msg : '读取工料机数据失败!';
|
|
let msg = response.msg !== undefined && response.msg !== '' ? response.msg : '读取工料机数据失败!';
|
|
alert(msg);
|
|
alert(msg);
|
|
@@ -75,10 +76,57 @@ ProjectGLJ.prototype.getDataByCode = function (code) {
|
|
/**
|
|
/**
|
|
* 修改工料机数据
|
|
* 修改工料机数据
|
|
*
|
|
*
|
|
- * @param {String} code
|
|
|
|
|
|
+ * @param {Number} id
|
|
* @param {Object} data
|
|
* @param {Object} data
|
|
* @return {boolean}
|
|
* @return {boolean}
|
|
*/
|
|
*/
|
|
-ProjectGLJ.prototype.updateData = function(code, data) {
|
|
|
|
|
|
+ProjectGLJ.prototype.updateData = function(id, data) {
|
|
|
|
+ let result = false;
|
|
|
|
+ if (this.datas === null) {
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let gljList = this.datas.gljList;
|
|
|
|
+ if (gljList === undefined) {
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 查找对应的index
|
|
|
|
+ let index = -1;
|
|
|
|
+ for(let tmp in gljList) {
|
|
|
|
+ if (gljList[tmp].id === id) {
|
|
|
|
+ index = tmp;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (index < 0) {
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 修改数据
|
|
|
|
+ for(let tmpIndex in data) {
|
|
|
|
+ if(tmpIndex.indexOf('_price') >= 0) {
|
|
|
|
+ // 修改unit_price中的对象
|
|
|
|
+ this.datas.gljList[index]['unit_price'][tmpIndex] = data[tmpIndex];
|
|
|
|
+ } else {
|
|
|
|
+ this.datas.gljList[index][tmpIndex] = data[tmpIndex];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 加载缓存数据到spread
|
|
|
|
+ *
|
|
|
|
+ * @return {void}
|
|
|
|
+ */
|
|
|
|
+ProjectGLJ.prototype.loadCacheData = function() {
|
|
|
|
+ // 加载工料机数据
|
|
|
|
+ let data = this.datas === null ? null : this.datas;
|
|
|
|
+ if (data === null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
|
|
|
|
+ projectGLJSheet.setData(jsonData);
|
|
|
|
+};
|