|
@@ -31,30 +31,31 @@ module.exports = app => {
|
|
JsonFields.forEach(jf => { if(data[jf]) data[jf] = JSON.parse(data[jf]); });
|
|
JsonFields.forEach(jf => { if(data[jf]) data[jf] = JSON.parse(data[jf]); });
|
|
}
|
|
}
|
|
|
|
|
|
- async loadProjectColSet(id) {
|
|
|
|
- const result = await this.getDataById(id);
|
|
|
|
|
|
+ async loadProjectColSet(pid, spid) {
|
|
|
|
+ const result = await this.getDataByCondition({ pid, spid });
|
|
this._analysisData(result);
|
|
this._analysisData(result);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- async initProjectColSet(id) {
|
|
|
|
|
|
+ async initProjectColSet(pid, spid) {
|
|
const data = JSON.parse(JSON.stringify(ProjectSetting.defaultColSet));
|
|
const data = JSON.parse(JSON.stringify(ProjectSetting.defaultColSet));
|
|
JsonFields.forEach(jf => { if(data[jf]) data[jf] = JSON.stringify(data[jf]); });
|
|
JsonFields.forEach(jf => { if(data[jf]) data[jf] = JSON.stringify(data[jf]); });
|
|
- data.id = id;
|
|
|
|
|
|
+ data.pid = pid;
|
|
|
|
+ data.spid = spid;
|
|
await this.db.insert(this.tableName, data);
|
|
await this.db.insert(this.tableName, data);
|
|
}
|
|
}
|
|
|
|
|
|
- async getProjectColSet(id) {
|
|
|
|
- const curSet = await this.loadProjectColSet(id);
|
|
|
|
|
|
+ async getProjectColSet(pid, spid) {
|
|
|
|
+ const curSet = await this.loadProjectColSet(pid, spid);
|
|
if (curSet) return curSet;
|
|
if (curSet) return curSet;
|
|
- await this.initProjectColSet(id);
|
|
|
|
- return await this.loadProjectColSet(id);
|
|
|
|
|
|
+ await this.initProjectColSet(pid, spid);
|
|
|
|
+ return await this.loadProjectColSet(pid, spid);
|
|
}
|
|
}
|
|
|
|
|
|
- async setProjectColSet(id, colSetType, colSet) {
|
|
|
|
- const data = {id};
|
|
|
|
|
|
+ async setProjectColSet(pid, spid, colSetType, colSet) {
|
|
|
|
+ const data = {};
|
|
data[colSetType] = JSON.stringify(colSet);
|
|
data[colSetType] = JSON.stringify(colSet);
|
|
- await this.defaultUpdate(data);
|
|
|
|
|
|
+ await this.defaultUpdate(data, { where: { pid, spid } });
|
|
}
|
|
}
|
|
|
|
|
|
analysisColSetWithDefine(colSetDefine, colSet) {
|
|
analysisColSetWithDefine(colSetDefine, colSet) {
|