|
|
@@ -499,16 +499,17 @@ let ration_glj = {
|
|
|
};
|
|
|
ration_glj.prototype.getGLJDataPaging = function (condition, cb) {
|
|
|
gljOprObj.loadingPagination = true;
|
|
|
- let property = projectObj.project.projectInfo.property;
|
|
|
- let engineerID = property.engineering_id;
|
|
|
+ const property = projectObj.project.projectInfo.property;
|
|
|
+ const engineerID = property.engineering_id;
|
|
|
CommonAjax.post('/rationGlj/getGLJDataPaging', {engineerID, condition}, function (data) {
|
|
|
gljOprObj.curPageTotal = data.total;
|
|
|
data.complementaryGLJs.forEach(glj => {
|
|
|
glj.isComplementary = true;
|
|
|
});
|
|
|
- let gljType = condition.type === gljOprObj.pagingType.stdGLJ
|
|
|
+ const gljType = condition.type === gljOprObj.pagingType.stdGLJ
|
|
|
? 'stdGLJ'
|
|
|
: 'complementaryGLJs';
|
|
|
+ const newData = data[gljType];
|
|
|
if (condition.init) {
|
|
|
gljOprObj.treeData = data.treeData;
|
|
|
gljOprObj.distTypeTree = gljOprObj.getComboData(data.distTypeTree);
|
|
|
@@ -516,19 +517,26 @@ let ration_glj = {
|
|
|
gljOprObj.complementaryGLJs = data.complementaryGLJs;
|
|
|
gljOprObj.AllRecode = [...gljOprObj.stdGLJ, ...gljOprObj.complementaryGLJs];*/
|
|
|
}
|
|
|
+ // 获取的数据从0开始,说明需要重置当前页面数据(点击了分类树、搜索等等)
|
|
|
if (condition.index === 0) {
|
|
|
gljOprObj.stdGLJ = data.stdGLJ;
|
|
|
gljOprObj.complementaryGLJs = data.complementaryGLJs;
|
|
|
gljOprObj.AllRecode = [...gljOprObj.stdGLJ, ...gljOprObj.complementaryGLJs];
|
|
|
gljOprObj.gljLibSheetData = gljOprObj.AllRecode;
|
|
|
} else {
|
|
|
- gljOprObj[gljType].splice(condition.index, 0, ...data[gljType]);
|
|
|
- gljOprObj.AllRecode.splice(condition.index, 0, ...data[gljType]);
|
|
|
+ gljOprObj[gljType].splice(condition.index, 0, ...newData);
|
|
|
+ gljOprObj.AllRecode.splice(condition.index, 0, ...newData);
|
|
|
}
|
|
|
- let tReg = /^[+\d]{1,}(?:\.{0}\d{2}|\d+)/
|
|
|
- console.log(gljOprObj.AllRecode);
|
|
|
+ // 根据缓存选中数据,设置人材机是否选中
|
|
|
+ newData.forEach(item => {
|
|
|
+ const connectKey = gljOprObj.getIndex(item, gljLibKeyArray);
|
|
|
+ const cacheItem = gljOprObj.selectedList.find(selItem => selItem.connectKey === connectKey);
|
|
|
+ if (cacheItem) {
|
|
|
+ item.select = 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
// 设置人材机类型名称
|
|
|
- gljOprObj.setTypeName(gljOprObj.distTypeTree.comboDatas, data[gljType]);
|
|
|
+ gljOprObj.setTypeName(gljOprObj.distTypeTree.comboDatas, newData);
|
|
|
if (data.priceProperties && data.priceProperties.length > 0) {
|
|
|
let tmp = _.find(data.priceProperties, {region: property.region, taxModel: parseInt(property.taxType)});
|
|
|
if (tmp) {
|
|
|
@@ -712,19 +720,27 @@ let ration_glj = {
|
|
|
|
|
|
|
|
|
ration_glj.prototype.addGLJByLib = function (GLJSelection, ration, callback) {
|
|
|
- let me=this,gljList = [];
|
|
|
- let allGLJ = gljOprObj.AllRecode;
|
|
|
+ const me = this,
|
|
|
+ gljList = [],
|
|
|
+ allGLJ = gljOprObj.selectedList;
|
|
|
GLJSelection.sort();
|
|
|
- _.forEach(GLJSelection, function (g) {
|
|
|
+ GLJSelection.forEach(selKey => {
|
|
|
+ const glj = allGLJ.find(item => item.connectKey === selKey);
|
|
|
+ if (glj) {
|
|
|
+ const rationGLJ = me.getAddDataByStd(glj, ration.ID, ration.billsItemID, ration.projectID);
|
|
|
+ gljList.push(rationGLJ);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*_.forEach(GLJSelection, function (g) {
|
|
|
let glj = _.find(allGLJ, function (item) {
|
|
|
let i_key = gljOprObj.getIndex(item, gljLibKeyArray);
|
|
|
return i_key == g;
|
|
|
});
|
|
|
let ration_glj = me.getAddDataByStd(glj,ration.ID,ration.billsItemID,ration.projectID);
|
|
|
gljList.push(ration_glj);
|
|
|
- });
|
|
|
+ });*/
|
|
|
$.bootstrapLoading.start();
|
|
|
- CommonAjax.post("/rationGlj/addGLJ", gljList, callback, function () {
|
|
|
+ CommonAjax.post('/rationGlj/addGLJ', gljList, callback, function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
|
};
|