creatingSituations.vue 27 KB

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