|
@@ -22,27 +22,26 @@
|
|
import checkMapAdd from "./components/checkMapAdd.vue";
|
|
import checkMapAdd from "./components/checkMapAdd.vue";
|
|
import checkPlan from "./components/checkPlan.vue";
|
|
import checkPlan from "./components/checkPlan.vue";
|
|
import situationPreview from "./components/situationPreview.vue";
|
|
import situationPreview from "./components/situationPreview.vue";
|
|
-
|
|
|
|
- const normalBtnGroup = [
|
|
|
|
- {id: 'pre', label: '上一步'},
|
|
|
|
- {id: 'next', label: '下一步'}
|
|
|
|
- ];
|
|
|
|
- const btnGroupPlan1 = [
|
|
|
|
- {id: 'pre', label: '上一步'},
|
|
|
|
- {id: 'checkPlanCreate', label: '生成查核计划'}
|
|
|
|
- ];
|
|
|
|
- const btnGroupPlan2 = [
|
|
|
|
- {id: 'checkPlanCallback', label: '返回'},
|
|
|
|
- {id: 'next', label: '下一步'}
|
|
|
|
- ];
|
|
|
|
- const btnGroupSituationPreview = [
|
|
|
|
- {id: 'pre', label: '上一步'},
|
|
|
|
- {id: 'situationPreviewOK', label: '完成'}
|
|
|
|
- ];
|
|
|
|
|
|
+ import {
|
|
|
|
+ themeList,
|
|
|
|
+ normalBtnGroup,
|
|
|
|
+ btnGroupPlan1,
|
|
|
|
+ btnGroupPlan2,
|
|
|
|
+ btnGroupSituationPreview,
|
|
|
|
+ optionsHandle,
|
|
|
|
+ checkDep,
|
|
|
|
+ checkGroup,
|
|
|
|
+ editCondition,
|
|
|
|
+ editCheckRent,
|
|
|
|
+ editCheckMap,
|
|
|
|
+ editCheckPlan,
|
|
|
|
+ editSituationPreview
|
|
|
|
+ } from "./components/utils.js";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ saveType: 'POST',
|
|
options: [
|
|
options: [
|
|
{id: 'theme', title: '主题', component: theme},
|
|
{id: 'theme', title: '主题', component: theme},
|
|
{id: 'condition', title: '条件', component: condition, hint: '追踪条件'},
|
|
{id: 'condition', title: '条件', component: condition, hint: '追踪条件'},
|
|
@@ -80,20 +79,59 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ onLoad:function({id,type}){
|
|
|
|
+ this.saveType = type ? type : 'POST';
|
|
|
|
+ if(id) {
|
|
|
|
+ this.dispatch('detialConfig',{id}).then((data)=>{
|
|
|
|
+ if(data) {
|
|
|
|
+ const {topic} = data;
|
|
|
|
+ let theme = themeList[Number(topic)],
|
|
|
|
+ condition = editCondition(data),
|
|
|
|
+ editConfig = {};
|
|
|
|
+ this.myCommit('theme', theme); // 主题
|
|
|
|
+ if(type === 'PUT') { // 编辑
|
|
|
|
+ let checkRent = editCheckRent(data),
|
|
|
|
+ checkMap = editCheckMap(data),
|
|
|
|
+ checkPlan = editCheckPlan(data),
|
|
|
|
+ situationPreview = editSituationPreview(data);
|
|
|
|
+ this.myCommit('checkPlan', checkPlan); // 查核计划
|
|
|
|
+ this.myCommit('situationPreview', situationPreview); // 预览
|
|
|
|
+ editConfig = {
|
|
|
|
+ theme,
|
|
|
|
+ condition,
|
|
|
|
+ checkRent,
|
|
|
|
+ checkMap,
|
|
|
|
+ checkPlan,
|
|
|
|
+ situationPreview
|
|
|
|
+ };
|
|
|
|
+ } else { // 复制创建
|
|
|
|
+ this.myCommit('condition', condition); // 条件
|
|
|
|
+ editConfig = {
|
|
|
|
+ theme,
|
|
|
|
+ condition,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ this.myCommit('editConfig', editConfig);
|
|
|
|
+ // 回到第一步或者第三步
|
|
|
|
+ this.myCommit('stepActive', type === 'PUT' ? 0 : 2);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
save: function() {
|
|
save: function() {
|
|
const {sitName,preDay,preH,startDay} = this.situationPreview;
|
|
const {sitName,preDay,preH,startDay} = this.situationPreview;
|
|
const {dateObj,checkedItem,checkList} = this.checkPlan;
|
|
const {dateObj,checkedItem,checkList} = this.checkPlan;
|
|
- const {depType, options} = this.condition;
|
|
|
|
- if(!sitName) {
|
|
|
|
|
|
+ const {depType, options, conditionIds} = this.condition;
|
|
|
|
+ if(!sitName || sitName.length < 2) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '温馨提示',
|
|
title: '温馨提示',
|
|
- content: `情境名称不能为空!`,
|
|
|
|
|
|
+ content: `情境名称不能为空也不能少于2个字!`,
|
|
showCancel: false
|
|
showCancel: false
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.dispatch('save', {
|
|
|
|
|
|
+ this.dispatch(`save${this.saveType}`, {
|
|
name: sitName,
|
|
name: sitName,
|
|
topic: this.theme.id,
|
|
topic: this.theme.id,
|
|
checkPlanStartDate: dateObj.start,
|
|
checkPlanStartDate: dateObj.start,
|
|
@@ -102,9 +140,9 @@
|
|
remindPlanHour: preH,
|
|
remindPlanHour: preH,
|
|
remindCheckDay: startDay,
|
|
remindCheckDay: startDay,
|
|
depType,
|
|
depType,
|
|
- filterCondition: this.optionsHandle(options),
|
|
|
|
- checkGroup: this.checkGroup(),
|
|
|
|
- checkDep: this.checkDep(),
|
|
|
|
|
|
+ filterCondition: optionsHandle(options, conditionIds),
|
|
|
|
+ checkGroup: checkGroup(this.checkRent),
|
|
|
|
+ checkDep: checkDep(this.checkMap.list),
|
|
planConfig: {
|
|
planConfig: {
|
|
frequency: checkedItem.value,
|
|
frequency: checkedItem.value,
|
|
day: checkedItem.model,
|
|
day: checkedItem.model,
|
|
@@ -193,39 +231,6 @@
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- /**
|
|
|
|
- * 构造条件提交结果
|
|
|
|
- */
|
|
|
|
- optionsHandle: function(arr) {
|
|
|
|
- let options = [...arr].map((item)=>{
|
|
|
|
- return {
|
|
|
|
- ...item,
|
|
|
|
- selectFlag: this.condition.conditionIds.includes(item.id),
|
|
|
|
- child: this.optionsHandle(item.child)
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- return options;
|
|
|
|
- },
|
|
|
|
- checkDep: function() {
|
|
|
|
- const {list} = this.checkMap;
|
|
|
|
- return list.map((item, i)=>{
|
|
|
|
- return {
|
|
|
|
- ...item,
|
|
|
|
- sort: i+1,
|
|
|
|
- enableFlag: item.status === 'disable' ? false : true,
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- checkGroup: function() {
|
|
|
|
- const {list, checkedItem} = this.checkRent;
|
|
|
|
- let _list = [...list].map((ntem)=>{
|
|
|
|
- return {
|
|
|
|
- ...ntem,
|
|
|
|
- selectFlag: ntem.id === checkedItem.id ? true : false
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- return _list;
|
|
|
|
- },
|
|
|
|
myCommit: function(key, data) {
|
|
myCommit: function(key, data) {
|
|
this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
|
|
this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
|
|
},
|
|
},
|