creatingSituations.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. <template>
  2. <view class="creatingSituations">
  3. <uni-popup ref="popup" type="bottom" :maskClick="true" @change="popupChangehandle">
  4. <tm-radio-group v-if="popupType==1" :list="situationTypeList" :defaultValue='situationPreview.situationType'
  5. :setting="{
  6. value: 'situationType',
  7. name: 'situationTypeName'
  8. }" :openkeys="[0]" @change="situationTypeChanged" />
  9. <tm-radio-group v-if="popupType==2" :list="templateList" :defaultValue='situationPreview.pageTemplateId'
  10. :setting="{
  11. value: 'id',
  12. name: 'name'
  13. }" :openkeys="[0]" @change="templateTypeChanged" />
  14. <tm-radio-group v-if="popupType==3" :list="pointsetTypeList" :defaultValue='situationPreview.pointsetType'
  15. :setting="{
  16. value: 'pointsetType',
  17. name: 'pointsetTypeName'
  18. }" :openkeys="[0]" @change="pointsetTypeChanged" />
  19. </uni-popup>
  20. <check-map-detail v-if="showCheckMapDetail"></check-map-detail>
  21. <view v-else class="page-wrap" :style="{paddingBottom: stepActive !== 0 ? '75rpx' : 0}">
  22. <tm-steps class="tm-steps" :options="options" :active="stepActive"></tm-steps>
  23. <scroll-view scroll-y="true" class="component-wrap">
  24. <!-- <component :is="options[active].component"></component> -->
  25. <!-- 当流程下标为0且非职能科室负责人执行计划设置时展示 -->
  26. <theme v-if="stepActive==0&&!isPlanSet"></theme>
  27. <div v-if="theme.type == 'NORMAL'">
  28. <condition v-if="stepActive==1&&theme.id != 0"></condition>
  29. <!-- 个案情境条件 -->
  30. <conditionCard v-if="stepActive==1&&theme.id == 0"></conditionCard>
  31. <checkRent v-if="stepActive==2"></checkRent>
  32. <checkMap v-if="stepActive==3"></checkMap>
  33. <checkPlan v-if="stepActive==4"></checkPlan>
  34. <situationPreview v-if="stepActive==5"></situationPreview>
  35. </div>
  36. <div v-if="isPlanSet">
  37. <!--自查督查计划设置 -->
  38. <condition v-if="stepActive==0"></condition>
  39. <person v-if="stepActive==1"></person>
  40. <checkMap v-if="stepActive==2"></checkMap>
  41. <checkPlan v-if="stepActive==3"></checkPlan>
  42. <taskPreview v-if="stepActive==4"></taskPreview>
  43. </div>
  44. <!-- <div v-if="theme.type == 'MULTI'">
  45. <typeList v-if="stepActive==1"></typeList>
  46. <typeList v-if="stepActive==2" :isMultiMode="true"></typeList>
  47. <planPreview v-if="stepActive==3"></planPreview>
  48. </div> -->
  49. <div v-if="theme.type == 'MULTI'">
  50. <!--创建 自查+督查 -->
  51. <typeList v-if="stepActive==1"></typeList>
  52. <typeList v-if="stepActive==2" :isMultiMode="true"></typeList>
  53. <planPreview v-if="stepActive==3"></planPreview>
  54. </div>
  55. </scroll-view>
  56. <tm-simple-btn-group v-if="stepActive != 0 || isPlanSet" :options="botmBtnGroup" v-on:callback="changeStep">
  57. </tm-simple-btn-group>
  58. </view>
  59. <check-map-add v-if="showCheckMapAdd"></check-map-add>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. mapState
  65. } from "vuex";
  66. import theme from "./components/theme.vue";
  67. import condition from "./components/condition.vue";
  68. import checkRent from "./components/checkRent.vue";
  69. import checkMap from "./components/checkMap.vue";
  70. import checkMapDetail from "./components/checkMapDetail.vue";
  71. import checkMapAdd from "./components/checkMapAdd.vue";
  72. import checkPlan from "./components/checkPlan.vue";
  73. import situationPreview from "./components/situationPreview.vue";
  74. import typeList from "./components/type.vue"
  75. import planPreview from "./components/preview.vue"
  76. import taskPreview from "./components/taskPreview.vue"
  77. import person from "./components/person.vue"
  78. import conditionCard from "./components/conditionCard.vue";
  79. import {
  80. themeList,
  81. normalBtnGroup,
  82. btnGroupPlan1,
  83. btnGroupPlan2,
  84. btnGroupSituationPreview,
  85. optionsHandle,
  86. checkDep,
  87. firstStepBtnGroup,
  88. checkGroup,
  89. editCondition,
  90. editCheckRent,
  91. editCheckMap,
  92. editCheckPlan,
  93. checkPlanList,
  94. editSituationPreview
  95. } from "./components/utils.js";
  96. import {
  97. dateHandle
  98. } from "../../utils/dateHandle.js";
  99. export default {
  100. data() {
  101. return {
  102. isPlanSet: false, //自查督查负责人操作计划设置
  103. saveType: 'POST',
  104. editID: '',
  105. }
  106. },
  107. computed: {
  108. ...mapState({
  109. popupType: state => state.creatingSituations.popupType,
  110. showCheckMapDetail: state => state.creatingSituations.showCheckMapDetail,
  111. showCheckMapAdd: state => state.creatingSituations.showCheckMapAdd,
  112. showCheckPlan1: state => state.creatingSituations.showCheckPlan1,
  113. stepActive: state => state.creatingSituations.stepActive,
  114. theme: state => state.creatingSituations.theme,
  115. condition: state => state.creatingSituations.condition,
  116. checkRent: state => state.creatingSituations.checkRent,
  117. checkMap: state => state.creatingSituations.checkMap,
  118. checkPlan: state => state.creatingSituations.checkPlan,
  119. situationPreview: state => state.creatingSituations.situationPreview,
  120. templateList: state => state.creatingSituations.templateList,
  121. situationTypeList: state => state.creatingSituations.situationTypeList,
  122. showPopupSelectorList: state => state.creatingSituations.showPopupSelectorList,
  123. zhinengDepartments:state=>state.creatingSituations.zhinengDepartments,
  124. typeList:state=>state.creatingSituations.typeList,
  125. checkPerson:state=>state.creatingSituations.checkPerson,
  126. conditionCard: state => state.creatingSituations.conditionCard,
  127. pointsetTypeList:state=>state.creatingSituations.pointsetTypeList ,//add by yfb 20230417
  128. }),
  129. situationTypeName() {
  130. const temp = this.situationTypeList.filter(item => item.situationType == this.situationPreview
  131. .situationType);
  132. return temp[0].situationTypeName;
  133. },
  134. pointsetTypeName(){
  135. const temp = this.pointsetTypeList.filter(item => item.pointsetType == this.situationPreview
  136. .pointsetType);
  137. console.log('042702');
  138. console.log(temp);
  139. return temp[0].pointsetTypeName;
  140. },
  141. botmBtnGroup: function() {
  142. if(this.stepActive === 0){
  143. return firstStepBtnGroup;
  144. }
  145. if (this.stepActive === 4 && this.theme.id != 2) {
  146. if (this.showCheckPlan1) {
  147. return btnGroupPlan1;
  148. } else {
  149. return btnGroupPlan2;
  150. }
  151. } else if (this.stepActive === 5 || (this.stepActive === 3 && this.theme.type == 'MULTI')||(this.stepActive === 4&&this.theme.id == 2)) {
  152. //普通情境和自查督查
  153. return btnGroupSituationPreview;
  154. } else {
  155. return normalBtnGroup;
  156. }
  157. },
  158. dataIsNull() {
  159. let data = this.checkMap.list.filter((item) => item.status !== 'disable');
  160. return data.length === 0;
  161. },
  162. themeType() {
  163. //planSet 职能科室负责人操作计划设置
  164. return this.theme.type?this.theme.type:'planSet'
  165. },
  166. options() {
  167. if (this.theme.type == 'MULTI'&&!this.isPlanSet) {
  168. //管理员创建自查督查
  169. return [{
  170. id: 'theme',
  171. title: '主题',
  172. component: theme
  173. },
  174. {
  175. id: 'typeList',
  176. title: '类型',
  177. component: typeList,
  178. hint: '追踪条件'
  179. },
  180. {
  181. id: 'departmentList',
  182. title: '职能科室',
  183. component: typeList,
  184. hint: '查核组'
  185. },
  186. {
  187. id: 'checkRent',
  188. title: '预览',
  189. component: checkRent,
  190. hint: '查核组'
  191. },
  192. ]
  193. }
  194. if (this.isPlanSet) {
  195. //自查督查负责人操作计划设置流程集合
  196. return [
  197. {
  198. id: 'condition',
  199. title: '条件',
  200. component: condition,
  201. hint: '追踪条件'
  202. },
  203. {
  204. id: 'person',
  205. title: '人员',
  206. component: person,
  207. hint: '人员'
  208. },
  209. {
  210. id: 'checkMap',
  211. title: '地图',
  212. component: checkMap,
  213. hint: '地图'
  214. },
  215. {
  216. id: 'checkPlan',
  217. title: '计划',
  218. component: checkPlan,
  219. hint: '制定计划'
  220. },
  221. {
  222. id: 'situationPreview',
  223. title: '预览',
  224. component: situationPreview
  225. },
  226. ]
  227. }
  228. //普通情境流程
  229. return [{
  230. id: 'theme',
  231. title: '主题',
  232. component: theme
  233. },
  234. {
  235. id: 'condition',
  236. title: '条件',
  237. component: condition,
  238. hint: '追踪条件'
  239. },
  240. {
  241. id: 'checkRent',
  242. title: '查核组',
  243. component: checkRent,
  244. hint: '查核组'
  245. },
  246. {
  247. id: 'checkMap',
  248. title: '地图',
  249. component: checkMap,
  250. hint: '地图'
  251. },
  252. {
  253. id: 'checkPlan',
  254. title: '计划',
  255. component: checkPlan,
  256. hint: '制定计划'
  257. },
  258. {
  259. id: 'situationPreview',
  260. title: '预览',
  261. component: situationPreview
  262. },
  263. ]
  264. }
  265. },
  266. watch: {
  267. /**
  268. * @param {Boolen} newVal
  269. * @param {Boolen} oldVal
  270. */
  271. showPopupSelectorList: function(newVal, oldVal) {
  272. if (newVal) {
  273. this.$refs.popup.open();
  274. } else {
  275. this.$refs.popup.close();
  276. }
  277. }
  278. },
  279. onLoad: function({
  280. id,
  281. type,
  282. actTarget,
  283. situationId,
  284. themeName, //情境名
  285. systemSituationType, //系统情境类型 0 个案 1 普通 2自查督查
  286. }) {
  287. this.dispatch('getDictionary').then(res => {
  288. //获取后处理pointset类型
  289. let tmp= res.PointSet.map((item)=>{
  290. return {
  291. pointsetType: parseInt(item.itemCode),
  292. pointsetTypeName: item.itemName,
  293. }
  294. });
  295. this.myCommit('pointsetTypeList', tmp);
  296. this.situationPreview.pointsetTypeName=tmp[0].pointsetTypeName;
  297. });
  298. this.isPlanSet = actTarget == 'planSet';
  299. this.situationId = situationId;
  300. this.saveType = type ? type : 'POST';
  301. if(systemSituationType == 2){
  302. this.myCommit('theme', {
  303. ...this.theme,
  304. id: systemSituationType, title:themeName, des: null,
  305. situationId:situationId,
  306. }); // 设置为自查督查
  307. this.myCommit('checkPerson', {
  308. ...this.checkPerson,
  309. situationId:situationId
  310. }); // 自查督查时,人员获取需要适用情境筛选
  311. }
  312. this.dispatch('getSituationTypes').then(res => {
  313. this.myCommit('situationTypeList', res);
  314. });
  315. if (id) {
  316. this.editID = id;
  317. this.dispatch('detialConfig', {
  318. id
  319. }).then((data) => {
  320. if (data) {
  321. const {
  322. topic
  323. } = data;
  324. let theme = themeList[Number(topic)],
  325. condition = editCondition(data),
  326. editConfig = {};
  327. this.myCommit('theme', theme); // 主题
  328. if (type === 'PUT') { // 编辑
  329. let checkRent = editCheckRent(data),
  330. checkMap = editCheckMap(data),
  331. checkPlan = editCheckPlan(data),
  332. situationPreview = editSituationPreview(data);
  333. this.myCommit('checkPlan', checkPlan); // 查核计划
  334. this.myCommit('situationPreview', situationPreview); // 预览
  335. editConfig = {
  336. theme,
  337. condition,
  338. checkRent,
  339. checkMap,
  340. checkPlan,
  341. situationPreview
  342. };
  343. } else { // 复制创建
  344. this.myCommit('condition', condition); // 条件
  345. editConfig = {
  346. theme,
  347. condition,
  348. };
  349. }
  350. this.myCommit('editConfig', editConfig);
  351. // 回到第一步或者第三步
  352. this.myCommit('stepActive', type === 'PUT' ? 0 : 2);
  353. }
  354. });
  355. }
  356. },
  357. methods: {
  358. situationTypeChanged(type, name) {
  359. // console.log({type,name});
  360. this.$store.commit('creatingSituations/comChangeState', {
  361. key: 'situationPreview',
  362. data: {
  363. ...this.situationPreview,
  364. situationType: type
  365. }
  366. });
  367. },
  368. templateTypeChanged(type, item) {
  369. // console.log({type,item});
  370. this.$store.commit('creatingSituations/comChangeState', {
  371. key: 'situationPreview',
  372. data: {
  373. ...this.situationPreview,
  374. pageTemplateId: type,
  375. templateName: item.name
  376. }
  377. });
  378. },
  379. pointsetTypeChanged(type, name) {
  380. // console.log({type,name});
  381. this.$store.commit('creatingSituations/comChangeState', {
  382. key: 'situationPreview',
  383. data: {
  384. ...this.situationPreview,
  385. pointsetType: type,
  386. pointsetTypeName:name.pointsetTypeName
  387. }
  388. });
  389. },
  390. zichaduchaSave: function() {
  391. let data = {
  392. name:this.situationPreview.sitName,
  393. checkPlanStartDate:'',
  394. checkPlanEndDate:'',
  395. functionCodes:this.zhinengDepartments.checkedItems.map(v=>v.id),
  396. filterCodes:this.typeList.checkedItems.map(v=>v.id),
  397. permission:1
  398. }
  399. this.dispatch(`addDuchazichaSituation`, data).then((data) => {
  400. if (data) {
  401. // 保存成功先清空数据
  402. this.clearData();
  403. uni.navigateTo({
  404. url: '/pages/situationsCenter/situationsCenter'
  405. });
  406. }
  407. });
  408. },
  409. zichaduchaPlanSave(){
  410. //自查督查计划保存
  411. const param = {
  412. name:this.theme.title,
  413. topic: this.theme.id,
  414. id:this.situationId,
  415. num: this.checkPlan.checkList.length,
  416. checkPlanEndDate:`${this.checkPlan.dateObj.end} 23:59`,
  417. checkPlanStartDate:`${this.checkPlan.dateObj.start} 00:00`,
  418. day:this.checkPlan.dateObj.dayNum,
  419. employeeList:this.checkPerson.checkedItems,
  420. filterCondition:this.condition.checkedItems,
  421. frequency:this.checkPlan.checkedItem.value,
  422. planList: [...this.checkPlan.checkList].map((date, i) => {
  423. return {
  424. startDate:`${date} 00:00`,
  425. endDate: `${dateHandle.getNewData(date, this.checkPlan.checkedItem.model - 1)} 23:59`
  426. }
  427. }),
  428. filterDepartments:this.checkMap.list.map(item=>item.departmentId),
  429. scoreType:this.situationPreview.pointsetType, //add by yfb 20230417
  430. customScore:this.situationPreview.preTotal
  431. }
  432. this.dispatch(`saveZichaduchaPlan`, param).then((data) => {
  433. if (data) {
  434. // 保存成功先清空数据
  435. this.clearData();
  436. uni.navigateTo({
  437. url: '/pages/situationsCenter/situationsCenter'
  438. });
  439. }
  440. });
  441. },
  442. save: function() {
  443. const {
  444. sitName,
  445. preDay,
  446. preH,
  447. startDay,
  448. description,
  449. situationType,
  450. showNotApplicable,
  451. showCountNum,
  452. pageTemplateId,
  453. pointsetType,
  454. preTotal
  455. } = this.situationPreview;
  456. const {
  457. dateObj,
  458. checkedItem,
  459. checkList
  460. } = this.checkPlan;
  461. const {
  462. depType,
  463. options,
  464. conditionIds
  465. } = this.condition;
  466. if (!sitName || sitName.length < 2) {
  467. uni.showModal({
  468. title: '温馨提示',
  469. content: `情境名称不能为空也不能少于2个字!`,
  470. showCancel: false
  471. });
  472. return;
  473. }
  474. if (preDay > 31) {
  475. uni.showModal({
  476. title: '温馨提示',
  477. content: `提醒天数不得大于31天!`,
  478. showCancel: false
  479. });
  480. return;
  481. }
  482. if (preH > 24) {
  483. uni.showModal({
  484. title: '温馨提示',
  485. content: `提醒天数不得大于24小时!`,
  486. showCancel: false
  487. });
  488. return;
  489. }
  490. if (preDay != null && !/^\d+$/.test(preDay)) {
  491. uni.showModal({
  492. title: '温馨提示',
  493. content: `提醒天数不能是小数!`,
  494. showCancel: false
  495. });
  496. return;
  497. }
  498. if (preH != null && !/^\d+$/.test(preH)) {
  499. uni.showModal({
  500. title: '温馨提示',
  501. content: `提醒小时不能是小数!`,
  502. showCancel: false
  503. });
  504. return;
  505. }
  506. if(pointsetType==2){
  507. if (preTotal<0) {
  508. uni.showModal({
  509. title: '温馨提示',
  510. content: `设置总分部能为负数!`,
  511. showCancel: false
  512. });
  513. return;
  514. }
  515. }
  516. let data = {
  517. description,
  518. name: sitName,
  519. topic: this.theme.id,
  520. checkPlanStartDate: dateObj.start,
  521. checkPlanEndDate: dateObj.end,
  522. remindPlanDay: preDay,
  523. remindPlanHour: preH,
  524. remindCheckDay: startDay,
  525. depType,
  526. showNotApplicable: showNotApplicable,
  527. subtotal: showCountNum,
  528. situationType: situationType,
  529. pageTemplateId: pageTemplateId,
  530. filterCondition:optionsHandle(options, conditionIds),
  531. checkGroup: checkGroup(this.checkRent),
  532. checkDep: checkDep(this.checkMap.list),
  533. planConfig: {
  534. frequency: checkedItem.value,
  535. day: checkedItem.model,
  536. startDate: dateObj.start,
  537. endDate: dateObj.end,
  538. num: checkList.length
  539. },
  540. planList: [...checkList].map((date, i) => {
  541. return {
  542. startDate: date,
  543. endDate: dateHandle.getNewData(date, checkedItem.model - 1)
  544. }
  545. }),
  546. scoreType:pointsetType,
  547. customScore:parseInt(preTotal),
  548. remingpreTotal:parseInt(preTotal),
  549. remindpointsetType:pointsetType
  550. };
  551. if (this.saveType === 'PUT') {
  552. data.id = this.editID;
  553. }
  554. this.dispatch(`save${this.saveType}`, data).then((data) => {
  555. if (data) {
  556. // 保存成功先清空数据
  557. this.clearData();
  558. uni.navigateTo({
  559. url: '/pages/situationsCenter/situationsCenter'
  560. });
  561. }
  562. });
  563. },
  564. changeStep: function(id) {
  565. // console.log({id,'stepActive':this.stepActive,'this.options':this.options});
  566. switch (id) {
  567. case 'goback':
  568. uni.navigateBack({
  569. delta: 1
  570. });
  571. break;
  572. case 'pre': // 上一步
  573. if (this.stepActive > 0){
  574. this.myCommit('needReload', false);
  575. this.myCommit('stepActive', this.stepActive - 1);
  576. }else {
  577. console.log({'this.stepActive':this.stepActive});
  578. }
  579. break;
  580. case 'next': // 下一步
  581. if (this.stepActive < this.options.length)
  582. this.nextHandle(this.stepActive);
  583. break;
  584. case 'checkPlanCreate': // 生成查核计划
  585. if (this.checkPlan.checkList.length === 0 && this.checkPlan.dateObj.dayNum < 1) {
  586. uni.showModal({
  587. title: '错误提示',
  588. content: '查核频次必须大于或等于1!',
  589. showCancel: false
  590. });
  591. } else {
  592. console.log('checkPlanCreate');
  593. this.myCommit('showCheckPlan1', false);
  594. }
  595. break;
  596. case 'checkPlanCallback': // 生成查核计划-返回
  597. this.myCommit('showCheckPlan1', true);
  598. break;
  599. case 'situationPreviewOK': // 完成
  600. if (this.theme.type == 'MULTI') {
  601. //自查督查
  602. this.zichaduchaSave();
  603. break;
  604. }
  605. if (this.theme.id == 2) {
  606. //自查督查
  607. this.zichaduchaPlanSave();
  608. break;
  609. }
  610. this.save();
  611. break;
  612. }
  613. },
  614. /**
  615. * 处理【下一步】逻辑
  616. */
  617. nextHandle: function(stepActive) {
  618. console.log({stepActive,'themeType':this.themeType})
  619. let flage = false;
  620. if (this.themeType == 'NORMAL') {
  621. //非督查+自查
  622. switch (stepActive) {
  623. case 1:
  624. if(this.theme.id == 0){
  625. //创建个案情境
  626. flage = this.errorHandle(this.condition.conditionIds.length >= this.conditionCard.requireds.length, 1);
  627. }else{
  628. flage = this.errorHandle(this.condition.conditionIds.length > 0, 1);
  629. }
  630. break;
  631. case 2:
  632. const {
  633. points
  634. } = this.checkRent.checkedItem;
  635. let condition = this.checkRent.checkedItem.id !== null && points;
  636. flage = this.errorHandle(condition, 2);
  637. break;
  638. case 3:
  639. flage = this.errorHandle(!this.dataIsNull, 3);
  640. break;
  641. case 4:
  642. const {
  643. checkList
  644. } = this.checkPlan;
  645. flage = this.errorHandle(checkList.length > 0, 4);
  646. break;
  647. case 5:
  648. this.dispatch('getSituationTypes').then(res => {
  649. console.log({
  650. res
  651. });
  652. });
  653. this.dispatch('getDictionary').then(res => {
  654. console.log({
  655. res
  656. });
  657. });
  658. break;
  659. default:
  660. flage = true;
  661. break;
  662. }
  663. }
  664. if (this.themeType == 'MULTI') {
  665. //管理员创建 督查+自查
  666. switch (stepActive) {
  667. case 1:
  668. flage = true;
  669. break;
  670. case 2:
  671. flage = true;
  672. break;
  673. case 3:
  674. flage = true;
  675. break;
  676. default:
  677. flage = true;
  678. break;
  679. }
  680. }
  681. if(this.isPlanSet){
  682. //职能科室负责人 督查+自查 计划设置
  683. switch (stepActive) {
  684. case 1:
  685. flage = true;
  686. break;
  687. case 2:
  688. flage = true;
  689. break;
  690. case 3:
  691. flage = true;
  692. break;
  693. default:
  694. flage = true;
  695. break;
  696. }
  697. }
  698. if (flage) {
  699. this.myCommit('needReload', true);
  700. this.myCommit('stepActive', stepActive + 1);
  701. }
  702. },
  703. /**
  704. * 错误处理,满足条件返回true
  705. * @param {Object} condition 条件
  706. * @param {Object} index 当前下标
  707. */
  708. errorHandle: function(conditionflag, index) {
  709. //add by yfb 20230214 检查子选项选择情况
  710. if (!this.checkCondition(this.condition)){
  711. uni.showModal({
  712. title: '温馨提示',
  713. content: `请先选择${this.options[1].hint}!`,
  714. showCancel: false
  715. });
  716. return false;
  717. }
  718. if (conditionflag) {
  719. return true;
  720. } else {
  721. uni.showModal({
  722. title: '温馨提示',
  723. content: index === 3 ? '查核地图不能为空' : `请先选择${this.options[index].hint}!`,
  724. showCancel: false
  725. });
  726. return false;
  727. }
  728. },
  729. myCommit: function(key, data) {
  730. this.$store.commit({
  731. type: 'creatingSituations/comChangeState',
  732. key,
  733. data
  734. });
  735. },
  736. dispatch: function(key, data) {
  737. return this.$store.dispatch({
  738. type: 'creatingSituations/commActions',
  739. key,
  740. data
  741. });
  742. },
  743. clearData: function() {
  744. checkPlanList[5].model = null;
  745. this.$store.commit({
  746. type: 'creatingSituations/setInit'
  747. });
  748. },
  749. popupChangehandle: function(data) {
  750. const {
  751. show
  752. } = data;
  753. this.$store.commit('creatingSituations/comChangeState', {
  754. key: 'showPopupSelectorList',
  755. data: show
  756. });
  757. },
  758. checkCondition:function(condition){
  759. //console.log('测试',condition);
  760. // for(var i=0;i<condition.conditionIds.length;i++){
  761. // // console.log('测试',condition.childContainer[i].list[0].id);
  762. // let tempdata=condition.options.filter((item) => item. == condition.conditionIds[i]);
  763. // console.log('选择项测试',tempdata);
  764. // }
  765. let checklist=condition.options.filter(item=>item.child.length>1);
  766. //console.log('带监测队列',checklist);
  767. //checklist.
  768. return true;
  769. }
  770. },
  771. destroyed() {
  772. this.clearData();
  773. },
  774. components: {
  775. checkMapDetail,
  776. checkMapAdd,
  777. theme,
  778. condition,
  779. checkRent,
  780. checkMap,
  781. checkPlan,
  782. situationPreview,
  783. typeList,
  784. person,
  785. planPreview,
  786. taskPreview,
  787. conditionCard
  788. }
  789. }
  790. </script>
  791. <style lang="less">
  792. .creatingSituations {
  793. width: 100%;
  794. height: 100%;
  795. background-color: #F5F6FA;
  796. .page-wrap {
  797. padding-bottom: 75rpx;
  798. width: 100%;
  799. height: 100%;
  800. .tm-steps {
  801. height: auto;
  802. }
  803. .component-wrap {
  804. padding-bottom: 87.5rpx;
  805. }
  806. }
  807. }
  808. </style>