|
@@ -8,6 +8,7 @@ import PreviewContainer from '@containers/PreviewContainer';
|
|
import { ConfirmModal, Notify } from '@commonComp';
|
|
import { ConfirmModal, Notify } from '@commonComp';
|
|
import { changeVisible } from '@store/actions/tabTemplate';
|
|
import { changeVisible } from '@store/actions/tabTemplate';
|
|
import {getAllDataList,getAllDataStringList} from '@utils/tools';
|
|
import {getAllDataList,getAllDataStringList} from '@utils/tools';
|
|
|
|
+import { initItemList } from '@store/async-actions/tabTemplate';
|
|
import store from '@store';
|
|
import store from '@store';
|
|
|
|
|
|
|
|
|
|
@@ -150,7 +151,11 @@ class Operation extends Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
saveHis(type) {
|
|
saveHis(type) {
|
|
- let flg = this.getAllData()
|
|
|
|
|
|
+ let baseList = store.getState();
|
|
|
|
+ if(baseList.tabTemplate.items.length == 0){
|
|
|
|
+ store.dispatch(initItemList()); //获取模板列表
|
|
|
|
+ }
|
|
|
|
+ let flg = this.getAllData();
|
|
if(flg){
|
|
if(flg){
|
|
this.setState({
|
|
this.setState({
|
|
visible: true,
|
|
visible: true,
|
|
@@ -169,14 +174,16 @@ class Operation extends Component {
|
|
let jsonData = getAllDataList(baseList);
|
|
let jsonData = getAllDataList(baseList);
|
|
let jsonStr = getAllDataStringList(baseList);
|
|
let jsonStr = getAllDataStringList(baseList);
|
|
let whichSign = baseList.typeConfig.typeConfig;
|
|
let whichSign = baseList.typeConfig.typeConfig;
|
|
- let activeItemData = baseList.tabTemplate.activeItem;
|
|
|
|
- // let preview = (activeItemData.preview).split('-').join('');
|
|
|
|
-
|
|
|
|
|
|
+ let tmpLis = baseList.tabTemplate.items;
|
|
if (whichSign == 0) {
|
|
if (whichSign == 0) {
|
|
- if (activeItemData && JSON.stringify(activeItemData) != '{}' && (activeItemData.dataJson == JSON.stringify(jsonData)) && (JSON.stringify(jsonStr) == JSON.stringify(JSON.parse(activeItemData.preview)))) {
|
|
|
|
- Notify.info('该模板已保存');
|
|
|
|
- return false;
|
|
|
|
- }else if (
|
|
|
|
|
|
+ for(let i = 0;i <tmpLis.length;i++){
|
|
|
|
+ let dataStr = tmpLis[i].dataJson;
|
|
|
|
+ if(dataStr == JSON.stringify(jsonData)){
|
|
|
|
+ Notify.info('该模板已保存');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
JSON.stringify(jsonData.advice) == '{}' &&
|
|
JSON.stringify(jsonData.advice) == '{}' &&
|
|
jsonData.chief.length < 1 &&
|
|
jsonData.chief.length < 1 &&
|
|
jsonData.diag.length < 1 &&
|
|
jsonData.diag.length < 1 &&
|
|
@@ -193,10 +200,16 @@ class Operation extends Component {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
} else if(whichSign == 1) {
|
|
} else if(whichSign == 1) {
|
|
- if (activeItemData && JSON.stringify(activeItemData) != '{}' && (JSON.stringify(jsonStr) == JSON.stringify(JSON.parse(activeItemData.preview)))) {
|
|
|
|
- Notify.info('该模板已保存');
|
|
|
|
- return false;
|
|
|
|
- }else if (JSON.stringify(jsonData.advice) == '{}' &&
|
|
|
|
|
|
+ for(let i = 0;i <tmpLis.length;i++){
|
|
|
|
+ let dataStr = tmpLis[i].preview;
|
|
|
|
+ let jsStr = tmpLis[i].dataJson;
|
|
|
|
+ console.log(dataStr == JSON.stringify(jsonStr))
|
|
|
|
+ if(JSON.stringify(JSON.parse(dataStr)) == JSON.stringify(jsonStr) && jsStr == JSON.stringify(jsonData)){
|
|
|
|
+ Notify.info('该模板已保存');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (JSON.stringify(jsonData.advice) == '{}' &&
|
|
jsonStr.chief == '[]' &&
|
|
jsonStr.chief == '[]' &&
|
|
jsonStr.present == '[]' &&
|
|
jsonStr.present == '[]' &&
|
|
jsonStr.other == '[]' &&
|
|
jsonStr.other == '[]' &&
|