|
|
@@ -1,6 +1,9 @@
|
|
|
<template>
|
|
|
<view class="creatingSituations">
|
|
|
|
|
|
+ <!-- 页面内静态挂载的确认弹窗,统一跨端样式与交互 -->
|
|
|
+ <AppConfirm ref="AppConfirm" />
|
|
|
+
|
|
|
<uni-popup ref="popup" type="bottom" :maskClick="true" @change="popupChangehandle">
|
|
|
<tm-radio-group v-if="popupType==1" :list="situationTypeList" :defaultValue='situationPreview.situationType'
|
|
|
:setting="{
|
|
|
@@ -12,17 +15,17 @@
|
|
|
:setting="{
|
|
|
value: 'id',
|
|
|
name: 'name'
|
|
|
- }" :openkeys="[0]" @change="templateTypeChanged" />
|
|
|
+ }" :openkeys="[0]" @change="templateTypeChanged" />
|
|
|
|
|
|
<tm-radio-group v-if="popupType==3" :list="pointsetTypeList" :defaultValue='situationPreview.pointsetType'
|
|
|
:setting="{
|
|
|
value: 'pointsetType',
|
|
|
name: 'pointsetTypeName'
|
|
|
- }" :openkeys="[0]" @change="pointsetTypeChanged" />
|
|
|
- <tm-radio-group v-if="popupType==4" :list="checkOrderSetTypeList" :defaultValue='situationPreview.checkOrderSetType'
|
|
|
- :setting="{
|
|
|
- value: 'checkOrderSetType',
|
|
|
- name: 'checkOrderSetTypeName'
|
|
|
+ }" :openkeys="[0]" @change="pointsetTypeChanged" />
|
|
|
+ <tm-radio-group v-if="popupType==4" :list="checkOrderSetTypeList" :defaultValue='situationPreview.checkOrderSetType'
|
|
|
+ :setting="{
|
|
|
+ value: 'checkOrderSetType',
|
|
|
+ name: 'checkOrderSetTypeName'
|
|
|
}" :openkeys="[0]" @change="checkOrderSetTypeChanged" />
|
|
|
</uni-popup>
|
|
|
|
|
|
@@ -114,14 +117,17 @@
|
|
|
import {
|
|
|
dateHandle
|
|
|
} from "../../utils/dateHandle.js";
|
|
|
+ import AppConfirm from '@/components/app-confirm/app-confirm.vue'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
isPlanSet: false, //自查督查负责人操作计划设置
|
|
|
saveType: 'POST',
|
|
|
- editID: '',
|
|
|
+ editID: '',
|
|
|
errMsg:'',
|
|
|
+ fromImprove: false, // 是否从“去完善”进入
|
|
|
+ systemSituationType: null, // 系统情境类型:0个案 1普通 2自查督查
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -143,26 +149,26 @@
|
|
|
zhinengDepartments:state=>state.creatingSituations.zhinengDepartments,
|
|
|
typeList:state=>state.creatingSituations.typeList,
|
|
|
checkPerson:state=>state.creatingSituations.checkPerson,
|
|
|
- conditionCard: state => state.creatingSituations.conditionCard,
|
|
|
- pointsetTypeList:state=>state.creatingSituations.pointsetTypeList ,//add by yfb 20230417
|
|
|
- situationCheckOrder:state=>state.creatingSituations.situationCheckOrder, //add by yfb 20230609
|
|
|
+ conditionCard: state => state.creatingSituations.conditionCard,
|
|
|
+ pointsetTypeList:state=>state.creatingSituations.pointsetTypeList ,//add by yfb 20230417
|
|
|
+ situationCheckOrder:state=>state.creatingSituations.situationCheckOrder, //add by yfb 20230609
|
|
|
checkOrderSetTypeList:state=>state.creatingSituations.checkOrderSetTypeList
|
|
|
}),
|
|
|
situationTypeName() {
|
|
|
const temp = this.situationTypeList.filter(item => item.situationType == this.situationPreview
|
|
|
.situationType);
|
|
|
return temp[0].situationTypeName;
|
|
|
- },
|
|
|
- pointsetTypeName(){
|
|
|
- const temp = this.pointsetTypeList.filter(item => item.pointsetType == this.situationPreview
|
|
|
- .pointsetType);
|
|
|
- return temp[0].pointsetTypeName;
|
|
|
- },
|
|
|
- checkOrderSetTypeName(){
|
|
|
- const temp = this.checkOrderSetTypeList.filter(item => item.checkOrderSetType == this.situationPreview
|
|
|
- .checkOrderSetType);
|
|
|
- console.log('2023061502',temp,this.checkOrderSetTypeList);
|
|
|
- return temp[0].checkOrderSetTypeName;
|
|
|
+ },
|
|
|
+ pointsetTypeName(){
|
|
|
+ const temp = this.pointsetTypeList.filter(item => item.pointsetType == this.situationPreview
|
|
|
+ .pointsetType);
|
|
|
+ return temp[0].pointsetTypeName;
|
|
|
+ },
|
|
|
+ checkOrderSetTypeName(){
|
|
|
+ const temp = this.checkOrderSetTypeList.filter(item => item.checkOrderSetType == this.situationPreview
|
|
|
+ .checkOrderSetType);
|
|
|
+ console.log('2023061502',temp,this.checkOrderSetTypeList);
|
|
|
+ return temp[0].checkOrderSetTypeName;
|
|
|
},
|
|
|
botmBtnGroup: function() {
|
|
|
if(this.stepActive === 0){
|
|
|
@@ -304,41 +310,45 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onLoad: function({
|
|
|
+ onLoad: function({
|
|
|
id,
|
|
|
type,
|
|
|
actTarget,
|
|
|
situationId,
|
|
|
themeName, //情境名
|
|
|
- systemSituationType, //系统情境类型 0 个案 1 普通 2自查督查
|
|
|
- //situationCheckOrder, //查核快捷方式类型 1:分类类型;2:全表类型
|
|
|
+ systemSituationType, //系统情境类型 0 个案 1 普通 2自查督查
|
|
|
+ from, // 来源标识:improve 表示从“去完善”进入
|
|
|
+ //situationCheckOrder, //查核快捷方式类型 1:分类类型;2:全表类型
|
|
|
|
|
|
- }) {
|
|
|
+ }) {
|
|
|
this.errMsg='';
|
|
|
- this.dispatch('getDictionary').then(res => {
|
|
|
- //获取后处理pointset类型
|
|
|
- let tmp= res.PointSet.map((item)=>{
|
|
|
- return {
|
|
|
- pointsetType: parseInt(item.itemCode),
|
|
|
- pointsetTypeName: item.itemName,
|
|
|
- }
|
|
|
- });
|
|
|
- this.myCommit('pointsetTypeList', tmp);
|
|
|
- this.situationPreview.pointsetTypeName=tmp[0].pointsetTypeName;
|
|
|
-
|
|
|
- let checkOrdertmp=res.CheckOrder.map((item)=>{
|
|
|
- return {
|
|
|
- checkOrderSetType:parseInt(item.itemCode),
|
|
|
- checkOrderSetTypeName:item.itemName,
|
|
|
- }
|
|
|
- });
|
|
|
- this.myCommit('checkOrderSetTypeList',checkOrdertmp);
|
|
|
- this.situationPreview.checkOrderSetTypeName=checkOrdertmp[0].checkOrderSetTypeName;
|
|
|
-
|
|
|
- });
|
|
|
+ this.dispatch('getDictionary').then(res => {
|
|
|
+ //获取后处理pointset类型
|
|
|
+ let tmp= res.PointSet.map((item)=>{
|
|
|
+ return {
|
|
|
+ pointsetType: parseInt(item.itemCode),
|
|
|
+ pointsetTypeName: item.itemName,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.myCommit('pointsetTypeList', tmp);
|
|
|
+ this.situationPreview.pointsetTypeName=tmp[0].pointsetTypeName;
|
|
|
+
|
|
|
+ let checkOrdertmp=res.CheckOrder.map((item)=>{
|
|
|
+ return {
|
|
|
+ checkOrderSetType:parseInt(item.itemCode),
|
|
|
+ checkOrderSetTypeName:item.itemName,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.myCommit('checkOrderSetTypeList',checkOrdertmp);
|
|
|
+ this.situationPreview.checkOrderSetTypeName=checkOrdertmp[0].checkOrderSetTypeName;
|
|
|
+
|
|
|
+ });
|
|
|
|
|
|
this.isPlanSet = actTarget == 'planSet';
|
|
|
this.situationId = situationId;
|
|
|
+ this.fromImprove = (from === 'improve');
|
|
|
+ this.systemSituationType = (typeof systemSituationType !== 'undefined' && systemSituationType !== null)
|
|
|
+ ? Number(systemSituationType) : this.systemSituationType;
|
|
|
|
|
|
|
|
|
this.saveType = type ? type : 'POST';
|
|
|
@@ -347,7 +357,9 @@
|
|
|
|
|
|
this.myCommit('theme', {
|
|
|
...this.theme,
|
|
|
- id: systemSituationType, title:themeName, des: null,
|
|
|
+ id: systemSituationType, title:themeName, des: null,
|
|
|
+ // 自查督查非计划设置走 MULTI 流程
|
|
|
+ type: this.isPlanSet ? this.theme.type : 'MULTI',
|
|
|
situationId:situationId,
|
|
|
}); // 设置为自查督查
|
|
|
|
|
|
@@ -359,50 +371,89 @@
|
|
|
|
|
|
this.dispatch('getSituationTypes').then(res => {
|
|
|
this.myCommit('situationTypeList', res);
|
|
|
- });
|
|
|
-
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
if (id) {
|
|
|
this.editID = 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,
|
|
|
- };
|
|
|
+ const apiKey = (from === 'improve' && Number(systemSituationType) === 2)
|
|
|
+ ? 'getFunctionSituationConfig'
|
|
|
+ : 'detialConfig';
|
|
|
+ this.dispatch(apiKey, { id }).then((data) => {
|
|
|
+ if (!data) return;
|
|
|
+ // from=improve 且 systemSituationType==2 时使用的新接口:自查督查专用回显
|
|
|
+ if (apiKey === 'getFunctionSituationConfig') {
|
|
|
+ // 1) 主题:确保为自查督查,并回填情境名与id
|
|
|
+ const themeUpdate = {
|
|
|
+ ...this.theme,
|
|
|
+ id: 2,
|
|
|
+ title: data.situationName || this.theme.title,
|
|
|
+ situationId: this.situationId || id
|
|
|
+ };
|
|
|
+ this.myCommit('theme', themeUpdate);
|
|
|
+ // 2) 条件:直接使用后端返回的筛选条件ID集合
|
|
|
+ const conditionIds = Array.isArray(data.filterCodes) ? data.filterCodes : [];
|
|
|
+ this.myCommit('condition', { ...this.condition, conditionIds });
|
|
|
+ // 3) 计划日期:将“YYYY年MM月DD日”转为“YYYY-MM-DD”
|
|
|
+ const normalizeCnDate = (s) => {
|
|
|
+ try { return String(s || '').replace(/年|月/g, '-').replace(/日/g, ''); } catch (e) { return s; }
|
|
|
+ };
|
|
|
+ const start = data.checkPlanStartDate ? normalizeCnDate(data.checkPlanStartDate) : this.checkPlan.dateObj.start;
|
|
|
+ const end = data.checkPlanEndDate ? normalizeCnDate(data.checkPlanEndDate) : this.checkPlan.dateObj.end;
|
|
|
+ this.myCommit('checkPlan', { ...this.checkPlan, dateObj: { ...this.checkPlan.dateObj, start, end } });
|
|
|
+ // 4) 预览名称:可选
|
|
|
+ if (data.situationName) {
|
|
|
+ this.myCommit('situationPreview', { ...this.situationPreview, sitName: data.situationName });
|
|
|
}
|
|
|
- this.myCommit('editConfig', editConfig);
|
|
|
- // 回到第一步或者第三步
|
|
|
- this.myCommit('stepActive', type === 'PUT' ? 0 : 2);
|
|
|
+ // 5) MULTI 流程的类型与职能科室回显
|
|
|
+ const filterCodes = Array.isArray(data.filterCodes) ? data.filterCodes : [];
|
|
|
+ const functionCodes = Array.isArray(data.functionCodes) ? data.functionCodes : [];
|
|
|
+ // 类型列表
|
|
|
+ this.dispatch('getTypeLists', { filter: 0 }).then((typeListData) => {
|
|
|
+ if (Array.isArray(typeListData)) {
|
|
|
+ const checkedItems = typeListData.filter(v => filterCodes.includes(v.id));
|
|
|
+ this.$store.commit({ type: 'creatingSituations/comChangeState', key: 'typeList', data: { list: typeListData, checkedItems } });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 职能科室列表
|
|
|
+ this.dispatch('getZhinengDepartments').then((deptData) => {
|
|
|
+ if (Array.isArray(deptData)) {
|
|
|
+ const list = deptData;
|
|
|
+ // 预选项需要包含 employees 字段,供预览展示
|
|
|
+ const checkedItems = list
|
|
|
+ .filter(v => functionCodes.includes(v.id))
|
|
|
+ .map(v => ({
|
|
|
+ id: v.id,
|
|
|
+ name: v.name,
|
|
|
+ employees: Array.isArray(v.employeeList) ? v.employeeList.map(e => e.employeeName).join(',') : ''
|
|
|
+ }));
|
|
|
+ this.$store.commit({ type: 'creatingSituations/comChangeState', key: 'zhinengDepartments', data: { list, checkedItems } });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 编辑模式回到第一步
|
|
|
+ this.myCommit('stepActive', 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 原有接口:出参与保存入参一致,走通用回显
|
|
|
+ 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);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
@@ -427,27 +478,27 @@
|
|
|
templateName: item.name
|
|
|
}
|
|
|
});
|
|
|
- },
|
|
|
- pointsetTypeChanged(type, name) {
|
|
|
- // console.log({type,name});
|
|
|
- this.$store.commit('creatingSituations/comChangeState', {
|
|
|
- key: 'situationPreview',
|
|
|
- data: {
|
|
|
- ...this.situationPreview,
|
|
|
- pointsetType: type,
|
|
|
- pointsetTypeName:name.pointsetTypeName
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- checkOrderSetTypeChanged(type, name){
|
|
|
- this.$store.commit('creatingSituations/comChangeState', {
|
|
|
- key: 'situationPreview',
|
|
|
- data: {
|
|
|
- ...this.situationPreview,
|
|
|
- checkOrderSetType: type,
|
|
|
- checkOrderSetTypeName:name.checkOrderSetTypeName
|
|
|
- }
|
|
|
- });
|
|
|
+ },
|
|
|
+ pointsetTypeChanged(type, name) {
|
|
|
+ // console.log({type,name});
|
|
|
+ this.$store.commit('creatingSituations/comChangeState', {
|
|
|
+ key: 'situationPreview',
|
|
|
+ data: {
|
|
|
+ ...this.situationPreview,
|
|
|
+ pointsetType: type,
|
|
|
+ pointsetTypeName:name.pointsetTypeName
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ checkOrderSetTypeChanged(type, name){
|
|
|
+ this.$store.commit('creatingSituations/comChangeState', {
|
|
|
+ key: 'situationPreview',
|
|
|
+ data: {
|
|
|
+ ...this.situationPreview,
|
|
|
+ checkOrderSetType: type,
|
|
|
+ checkOrderSetTypeName:name.checkOrderSetTypeName
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
zichaduchaSave: function() {
|
|
|
let data = {
|
|
|
@@ -458,7 +509,18 @@
|
|
|
filterCodes:this.typeList.checkedItems.map(v=>v.id),
|
|
|
permission:1
|
|
|
}
|
|
|
- this.dispatch(`addDuchazichaSituation`, data).then((data) => {
|
|
|
+ // 去完善编辑:统一走 updateSituationData(pfmFunctionSituation)
|
|
|
+ if (this.fromImprove) {
|
|
|
+ const payload = this.buildUpdatePayload({ pfmData: data });
|
|
|
+ this.dispatch('updateSituationData', payload).then((ok) => {
|
|
|
+ if (ok) {
|
|
|
+ this.clearData();
|
|
|
+ uni.navigateTo({ url: '/pages/situationsCenter/situationsCenter' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.dispatch(`addDuchazichaSituation`, data).then((data) => {
|
|
|
if (data) {
|
|
|
// 保存成功先清空数据
|
|
|
this.clearData();
|
|
|
@@ -474,25 +536,36 @@
|
|
|
name:this.theme.title,
|
|
|
topic: this.theme.id,
|
|
|
id:this.situationId,
|
|
|
- num: this.checkPlan.checkList.length,
|
|
|
- checkPlanEndDate:`${this.checkPlan.dateObj.end} 23:59`,
|
|
|
- checkPlanStartDate:`${this.checkPlan.dateObj.start} 00:00`,
|
|
|
- day:this.checkPlan.dateObj.dayNum,
|
|
|
+ num: this.checkPlan.checkList.length || 1,
|
|
|
+ checkPlanEndDate:`${(this.checkPlan.dateObj.end || this.checkPlan.dateObj.start)}${(this.checkPlan.dateObj.end || this.checkPlan.dateObj.start) ? ' 23:59' : ''}`,
|
|
|
+ checkPlanStartDate:`${this.checkPlan.dateObj.start}${this.checkPlan.dateObj.start ? ' 00:00' : ''}`,
|
|
|
+ day:this.checkPlan.dateObj.dayNum || 1,
|
|
|
employeeList:this.checkPerson.checkedItems,
|
|
|
filterCondition:this.condition.checkedItems,
|
|
|
- frequency:this.checkPlan.checkedItem.value,
|
|
|
- planList: [...this.checkPlan.checkList].map((date, i) => {
|
|
|
+ frequency:this.checkPlan.checkedItem && this.checkPlan.checkedItem.value ? this.checkPlan.checkedItem.value : 2,
|
|
|
+ planList: (this.checkPlan.checkList.length > 0 ? [...this.checkPlan.checkList] : [this.checkPlan.dateObj.start]).map((date, i) => {
|
|
|
return {
|
|
|
startDate:`${date} 00:00`,
|
|
|
endDate: `${dateHandle.getNewData(date, this.checkPlan.checkedItem.model - 1)} 23:59`
|
|
|
}
|
|
|
}),
|
|
|
- filterDepartments:this.checkMap.list.map(item=>item.departmentId),
|
|
|
- scoreType:this.situationPreview.pointsetType, //add by yfb 20230417
|
|
|
- customScore:this.situationPreview.preTotal,
|
|
|
+ filterDepartments:this.checkMap.list.map(item=>item.departmentId),
|
|
|
+ scoreType:this.situationPreview.pointsetType, //add by yfb 20230417
|
|
|
+ customScore:this.situationPreview.preTotal,
|
|
|
checkOrder:this.situationPreview.checkOrderSetType
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 自查督查从“去完善”进入统一走 updateSituationData
|
|
|
+ if (this.fromImprove) {
|
|
|
+ const payload = this.buildUpdatePayload({ pfmData: param });
|
|
|
+ this.dispatch('updateSituationData', payload).then((ok) => {
|
|
|
+ if (ok) {
|
|
|
+ this.clearData();
|
|
|
+ uni.navigateTo({ url: '/pages/situationsCenter/situationsCenter' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.dispatch(`saveZichaduchaPlan`, param).then((data) => {
|
|
|
if (data) {
|
|
|
// 保存成功先清空数据
|
|
|
@@ -503,7 +576,7 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- save: function() {
|
|
|
+ save: async function() {
|
|
|
const {
|
|
|
sitName,
|
|
|
preDay,
|
|
|
@@ -513,9 +586,9 @@
|
|
|
situationType,
|
|
|
showNotApplicable,
|
|
|
showCountNum,
|
|
|
- pageTemplateId,
|
|
|
- pointsetType,
|
|
|
- preTotal,
|
|
|
+ pageTemplateId,
|
|
|
+ pointsetType,
|
|
|
+ preTotal,
|
|
|
checkOrderSetType
|
|
|
} = this.situationPreview;
|
|
|
const {
|
|
|
@@ -529,56 +602,7 @@
|
|
|
conditionIds
|
|
|
} = this.condition;
|
|
|
|
|
|
- if (!sitName || sitName.length < 2) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `情境名称不能为空也不能少于2个字!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (preDay > 31) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `提醒天数不得大于31天!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (preH > 24) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `提醒天数不得大于24小时!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (preDay != null && !/^\d+$/.test(preDay)) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `提醒天数不能是小数!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (preH != null && !/^\d+$/.test(preH)) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `提醒小时不能是小数!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if(pointsetType==2){
|
|
|
- if (preTotal<0) {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `设置总分部能为负数!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ // 放宽校验:不再阻断保存
|
|
|
|
|
|
let data = {
|
|
|
description,
|
|
|
@@ -595,31 +619,45 @@
|
|
|
situationType: situationType,
|
|
|
pageTemplateId: pageTemplateId,
|
|
|
filterCondition:optionsHandle(options, conditionIds),
|
|
|
+ // 最小必填兜底:若未选择查核组,默认选中列表首项
|
|
|
checkGroup: checkGroup(this.checkRent),
|
|
|
checkDep: checkDep(this.checkMap.list),
|
|
|
planConfig: {
|
|
|
- frequency: checkedItem.value,
|
|
|
- day: checkedItem.model,
|
|
|
- startDate: dateObj.start,
|
|
|
- endDate: dateObj.end,
|
|
|
- num: checkList.length
|
|
|
+ frequency: (checkedItem && checkedItem.value) ? checkedItem.value : this.checkPlan.checkedItem.value,
|
|
|
+ day: (checkedItem && checkedItem.model) ? checkedItem.model : this.checkPlan.checkedItem.model,
|
|
|
+ startDate: dateObj.start || this.checkPlan.dateObj.start,
|
|
|
+ endDate: dateObj.end || (dateObj.start ? dateHandle.getNewData(dateObj.start, (checkedItem && checkedItem.model ? checkedItem.model : this.checkPlan.checkedItem.model) - 1) : ''),
|
|
|
+ num: (checkList && checkList.length) ? checkList.length : 1
|
|
|
},
|
|
|
- planList: [...checkList].map((date, i) => {
|
|
|
+ // 最小必填兜底:若计划为空,给出最小 1 条基于 start 的计划
|
|
|
+ planList: (checkList.length > 0 ? [...checkList] : [dateObj.start || this.checkPlan.dateObj.start]).map((date, i) => {
|
|
|
return {
|
|
|
startDate: date,
|
|
|
endDate: dateHandle.getNewData(date, checkedItem.model - 1)
|
|
|
}
|
|
|
- }),
|
|
|
- scoreType:pointsetType,
|
|
|
- customScore:parseInt(preTotal),
|
|
|
- remingpreTotal:parseInt(preTotal),
|
|
|
- remindpointsetType:pointsetType,
|
|
|
- checkOrder:parseInt(checkOrderSetType)
|
|
|
+ }),
|
|
|
+ scoreType:pointsetType,
|
|
|
+ customScore:parseInt(preTotal),
|
|
|
+ remingpreTotal:parseInt(preTotal),
|
|
|
+ remindpointsetType:pointsetType,
|
|
|
+ checkOrder:parseInt(checkOrderSetType || this.situationPreview.checkOrderSetType)
|
|
|
};
|
|
|
+ // 编辑保存:从“去完善”进入时统一走 updateSituationData
|
|
|
+ if (this.saveType === 'PUT' && this.fromImprove) {
|
|
|
+ const payload = this.buildUpdatePayload({ normalData: data });
|
|
|
+ this.dispatch('updateSituationData', payload).then((ok) => {
|
|
|
+ if (ok) {
|
|
|
+ this.clearData();
|
|
|
+ uni.navigateTo({ url: '/pages/situationsCenter/situationsCenter' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (this.saveType === 'PUT') {
|
|
|
data.id = this.editID;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.dispatch(`save${this.saveType}`, data).then((data) => {
|
|
|
if (data) {
|
|
|
// 保存成功先清空数据
|
|
|
@@ -630,7 +668,18 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- changeStep: function(id) {
|
|
|
+ // 统一构造“去完善”编辑保存 payload
|
|
|
+ buildUpdatePayload({ normalData = null, pfmData = null }) {
|
|
|
+ const situationId = this.situationId || this.editID;
|
|
|
+ const situationType = this.systemSituationType != null ? this.systemSituationType : this.theme.id;
|
|
|
+ return {
|
|
|
+ situationId,
|
|
|
+ situationType,
|
|
|
+ situationReq: normalData || null,
|
|
|
+ pfmFunctionSituation: pfmData || null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ changeStep: async function(id) {
|
|
|
// console.log({id,'stepActive':this.stepActive,'this.options':this.options});
|
|
|
switch (id) {
|
|
|
case 'goback':
|
|
|
@@ -648,20 +697,11 @@
|
|
|
break;
|
|
|
case 'next': // 下一步
|
|
|
if (this.stepActive < this.options.length)
|
|
|
- this.nextHandle(this.stepActive);
|
|
|
+ await this.nextHandle(this.stepActive);
|
|
|
break;
|
|
|
case 'checkPlanCreate': // 生成查核计划
|
|
|
-
|
|
|
- if (this.checkPlan.checkList.length === 0 && this.checkPlan.dateObj.dayNum < 1) {
|
|
|
- uni.showModal({
|
|
|
- title: '错误提示',
|
|
|
- content: '查核频次必须大于或等于1!',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('checkPlanCreate');
|
|
|
- this.myCommit('showCheckPlan1', false);
|
|
|
- }
|
|
|
+ // 放宽校验:不再阻断,直接进入生成视图
|
|
|
+ this.myCommit('showCheckPlan1', false);
|
|
|
break;
|
|
|
case 'checkPlanCallback': // 生成查核计划-返回
|
|
|
this.myCommit('showCheckPlan1', true);
|
|
|
@@ -684,129 +724,33 @@
|
|
|
/**
|
|
|
* 处理【下一步】逻辑
|
|
|
*/
|
|
|
- nextHandle: function(stepActive) {
|
|
|
- console.log({stepActive,'themeType':this.themeType})
|
|
|
- let flage = false;
|
|
|
- if (this.themeType == 'NORMAL') {
|
|
|
- //非督查+自查
|
|
|
- switch (stepActive) {
|
|
|
- case 1:
|
|
|
- if(this.theme.id == 0){
|
|
|
- //创建个案情境
|
|
|
- flage = this.conditionErrHandler(this.checkCondition(this.condition),1);
|
|
|
- }else{
|
|
|
- flage = this.errorHandle(this.condition.conditionIds.length > 0, 1);
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- const {
|
|
|
- points
|
|
|
- } = this.checkRent.checkedItem;
|
|
|
- let condition = this.checkRent.checkedItem.id !== null && points;
|
|
|
- flage = this.errorHandle(condition, 2);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- flage = this.errorHandle(!this.dataIsNull, 3);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- const {
|
|
|
- checkList
|
|
|
- } = this.checkPlan;
|
|
|
- flage = this.errorHandle(checkList.length > 0, 4);
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- this.dispatch('getSituationTypes').then(res => {
|
|
|
- console.log({
|
|
|
- res
|
|
|
- });
|
|
|
- });
|
|
|
- this.dispatch('getDictionary').then(res => {
|
|
|
- console.log({
|
|
|
- res
|
|
|
- });
|
|
|
- });
|
|
|
- break;
|
|
|
- default:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if (this.themeType == 'MULTI') {
|
|
|
- //管理员创建 督查+自查
|
|
|
- switch (stepActive) {
|
|
|
- case 1:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- default:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(this.isPlanSet){
|
|
|
- //职能科室负责人 督查+自查 计划设置
|
|
|
- switch (stepActive) {
|
|
|
- case 1:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- default:
|
|
|
- flage = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (flage) {
|
|
|
- this.myCommit('needReload', true);
|
|
|
- this.myCommit('stepActive', stepActive + 1);
|
|
|
- }
|
|
|
+ nextHandle: async function(stepActive) {
|
|
|
+ // 放宽校验:所有步骤直接进入下一步
|
|
|
+ this.myCommit('needReload', true);
|
|
|
+ this.myCommit('stepActive', stepActive + 1);
|
|
|
},
|
|
|
/**
|
|
|
* 错误处理,满足条件返回true
|
|
|
* @param {Object} condition 条件
|
|
|
* @param {Object} index 当前下标
|
|
|
*/
|
|
|
- errorHandle: function(conditionflag, index) {
|
|
|
+ errorHandle: async function(conditionflag, index) {
|
|
|
|
|
|
if (conditionflag) {
|
|
|
return true;
|
|
|
} else {
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: index === 3 ? '查核地图不能为空' : `请先选择${this.options[index].hint}!`,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
+ await this.$refs.AppConfirm.open({ title: '温馨提示', content: index === 3 ? '查核地图不能为空' : `请先选择${this.options[index].hint}!`, showCancel: false });
|
|
|
return false;
|
|
|
}
|
|
|
- },
|
|
|
- conditionErrHandler:function (flag,index){
|
|
|
- const results=this.checkCondition(this.condition);
|
|
|
- //add by yfb 20230214 检查子选项选择情况
|
|
|
- if (!results.funFlag){
|
|
|
- uni.showModal({
|
|
|
- title: '温馨提示',
|
|
|
- content: `请先选择${this.options[1].hint},`+results.errMsg,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return false;
|
|
|
- }else
|
|
|
- return true;
|
|
|
+ },
|
|
|
+ conditionErrHandler: async function (flag,index){
|
|
|
+ const results=this.checkCondition(this.condition);
|
|
|
+ //add by yfb 20230214 检查子选项选择情况
|
|
|
+ if (!results.funFlag){
|
|
|
+ await this.$refs.AppConfirm.open({ title: '温馨提示', content: `请先选择${this.options[1].hint},`+results.errMsg, showCancel: false });
|
|
|
+ return false;
|
|
|
+ }else
|
|
|
+ return true;
|
|
|
},
|
|
|
myCommit: function(key, data) {
|
|
|
this.$store.commit({
|
|
|
@@ -839,79 +783,79 @@
|
|
|
},
|
|
|
checkCondition:function(condition,msg){
|
|
|
//console.log('测试',condition);
|
|
|
-
|
|
|
- let MasterTemp=condition.options.filter(item=>{
|
|
|
- if (item.required==1){
|
|
|
- let ichecked=false;
|
|
|
- //遍历所有子选项,关联主卡片
|
|
|
- let childCon=condition.childContainer.filter(cc=>{
|
|
|
- // console.log('childCondition',cc);
|
|
|
- // console.log('childid',cc.list[0].id);
|
|
|
- // console.log('item',item.id);
|
|
|
- //判断主卡片对应子项列表
|
|
|
- if (item.id==cc.list[0].parentId){
|
|
|
- let tmp=cc.list[0].child.filter(mi=>{
|
|
|
- return condition.conditionIds.includes(mi.id);//记录的选项中是否是子项中
|
|
|
- });
|
|
|
- //判断子项是否在已选列表内,即已选项中存在当前主卡片选项
|
|
|
- if (tmp.length>0)
|
|
|
- {
|
|
|
- ichecked=true;
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- //console.log('childCon',childCon);
|
|
|
- if (childCon.length<=0)
|
|
|
- return true;
|
|
|
- }
|
|
|
+
|
|
|
+ let MasterTemp=condition.options.filter(item=>{
|
|
|
+ if (item.required==1){
|
|
|
+ let ichecked=false;
|
|
|
+ //遍历所有子选项,关联主卡片
|
|
|
+ let childCon=condition.childContainer.filter(cc=>{
|
|
|
+ // console.log('childCondition',cc);
|
|
|
+ // console.log('childid',cc.list[0].id);
|
|
|
+ // console.log('item',item.id);
|
|
|
+ //判断主卡片对应子项列表
|
|
|
+ if (item.id==cc.list[0].parentId){
|
|
|
+ let tmp=cc.list[0].child.filter(mi=>{
|
|
|
+ return condition.conditionIds.includes(mi.id);//记录的选项中是否是子项中
|
|
|
+ });
|
|
|
+ //判断子项是否在已选列表内,即已选项中存在当前主卡片选项
|
|
|
+ if (tmp.length>0)
|
|
|
+ {
|
|
|
+ ichecked=true;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //console.log('childCon',childCon);
|
|
|
+ if (childCon.length<=0)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
});
|
|
|
- //判断主卡片
|
|
|
- if (MasterTemp.length>0){
|
|
|
- //console.log('123');
|
|
|
- // this.errMsg=MasterTemp[0].name+'未选择!';
|
|
|
- // return false;
|
|
|
- return {
|
|
|
- errMsg:MasterTemp[0].name+'未选择!',
|
|
|
- funFlag:false,
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //console.log('test_checkConditionCard',this.condition.CheckConditionCard);
|
|
|
- //判断子选项,根据存储的卡片信息进行判断,正常情况不过滤,只返回第一个搜索出的未选择项卡片
|
|
|
- const tmp=this.condition.CheckConditionCard.filter(cards=>{
|
|
|
- //必填项检查
|
|
|
- if (cards.required==1){
|
|
|
- // console.log('cards',cards);
|
|
|
- //查看该项下选项是否有选项
|
|
|
- const childlist= cards.child.filter(a=>{
|
|
|
- // console.log('child',a);
|
|
|
- return this.condition.conditionIds.includes(a.id);
|
|
|
- });
|
|
|
- // console.log('childlist',childlist);
|
|
|
- //返回未选择选项
|
|
|
- return childlist.length<=0;
|
|
|
- }
|
|
|
- });
|
|
|
- //console.log('tmp',tmp);
|
|
|
- //因为返回未选择项,则未选项列表有数据则返回错误
|
|
|
- if (tmp.length>0)
|
|
|
- {
|
|
|
- // this.errMsg=tmp[0].name+'未选择!';
|
|
|
- // return false;
|
|
|
- return {
|
|
|
- errMsg:'['+tmp[0].name+']未选择!',
|
|
|
- funFlag:false,
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- // return true;
|
|
|
- return {
|
|
|
- errMsg:'',
|
|
|
- funFlag:true,
|
|
|
- }
|
|
|
- }
|
|
|
+ //判断主卡片
|
|
|
+ if (MasterTemp.length>0){
|
|
|
+ //console.log('123');
|
|
|
+ // this.errMsg=MasterTemp[0].name+'未选择!';
|
|
|
+ // return false;
|
|
|
+ return {
|
|
|
+ errMsg:MasterTemp[0].name+'未选择!',
|
|
|
+ funFlag:false,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //console.log('test_checkConditionCard',this.condition.CheckConditionCard);
|
|
|
+ //判断子选项,根据存储的卡片信息进行判断,正常情况不过滤,只返回第一个搜索出的未选择项卡片
|
|
|
+ const tmp=this.condition.CheckConditionCard.filter(cards=>{
|
|
|
+ //必填项检查
|
|
|
+ if (cards.required==1){
|
|
|
+ // console.log('cards',cards);
|
|
|
+ //查看该项下选项是否有选项
|
|
|
+ const childlist= cards.child.filter(a=>{
|
|
|
+ // console.log('child',a);
|
|
|
+ return this.condition.conditionIds.includes(a.id);
|
|
|
+ });
|
|
|
+ // console.log('childlist',childlist);
|
|
|
+ //返回未选择选项
|
|
|
+ return childlist.length<=0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //console.log('tmp',tmp);
|
|
|
+ //因为返回未选择项,则未选项列表有数据则返回错误
|
|
|
+ if (tmp.length>0)
|
|
|
+ {
|
|
|
+ // this.errMsg=tmp[0].name+'未选择!';
|
|
|
+ // return false;
|
|
|
+ return {
|
|
|
+ errMsg:'['+tmp[0].name+']未选择!',
|
|
|
+ funFlag:false,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // return true;
|
|
|
+ return {
|
|
|
+ errMsg:'',
|
|
|
+ funFlag:true,
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//return true;
|
|
|
}
|
|
|
@@ -932,12 +876,13 @@
|
|
|
person,
|
|
|
planPreview,
|
|
|
taskPreview,
|
|
|
- conditionCard
|
|
|
+ conditionCard,
|
|
|
+ AppConfirm
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less">
|
|
|
+<style lang="less" scoped>
|
|
|
.creatingSituations {
|
|
|
width: 100%;
|
|
|
height: 100%;
|