creatingSituations.vue 25 KB

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