situationPreview.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <template>
  2. <view class="situation-preview">
  3. <tm-modal v-if="modalVisible" @click="modalClickHandle">
  4. <view class="conditionReview">
  5. <view class="conditionReviewContent">
  6. <view class="list" v-for="(item,index) in resultLists" :key="index" >{{`${item.name}: ${item.value}`}}</view>
  7. </view>
  8. </view>
  9. </tm-modal>
  10. <view class="title">情境预览</view>
  11. <view class="box1">
  12. <view class="row1">
  13. <view class="top">
  14. <text>主题:{{theme.title}}</text>
  15. <view @click="goMapList">
  16. <text>查看查核地图</text>
  17. <image src="../../../static/icon-blueMore.png"></image>
  18. </view>
  19. </view>
  20. <view class="conditionDetailBtn" @click="showCondition" v-if="this.theme.id ==0">
  21. 条件详情
  22. <image src="../../../static/icon-blueMore.png"></image>
  23. </view>
  24. <view class="list" v-if="this.theme.id !=0">
  25. <text v-for="(item, index) in list" :key="index">{{item.name}}</text>
  26. </view>
  27. </view>
  28. <view class="row2">
  29. <view class="item">
  30. <text>查核组</text>
  31. <text>{{checkRent.checkedItem.name}}</text>
  32. </view>
  33. <view class="item">
  34. <text>组长</text>
  35. <text>{{checkRent.checkedItem.groupManagerName}}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="box2">
  40. <view class="situationType" @click="selectSituationType">
  41. <text>情境类型</text>
  42. <text class="typeValue">{{situationTypeName}}</text>
  43. <image class="arrowRight" src="../../../static/incon-more.png" mode=""></image>
  44. </view>
  45. <view class="input-wrap">
  46. <view>情境名称</view>
  47. <input maxlength="16" v-model="situationPreview.sitName" placeholder="限2~16个中文、英文或数字" />
  48. </view>
  49. <view class="input-wrap">
  50. <view>情境描述</view>
  51. <textarea maxlength="300" rows="" v-model="situationPreview.description" placeholder="限300字" />
  52. </view>
  53. </view>
  54. <view class="box2">
  55. <view>
  56. <text>计划开始前</text>
  57. <input v-model="situationPreview.preDay" placeholder="请输入" type="number" />
  58. <text>天的</text>
  59. <input v-model="situationPreview.preH" placeholder="请输入" type="number" />
  60. <text>时提醒</text>
  61. </view>
  62. <view>
  63. <text>启动</text>
  64. <input v-model="situationPreview.startDay" placeholder="请输入" type="number" />
  65. <text>天前提醒</text>
  66. </view>
  67. <view class="setIfShowNotApplicable" @click="setIfShowNotApplicable">
  68. <text>是否需要不适用场景</text>
  69. <image class="icon"
  70. :src="`/static/${situationPreview.showNotApplicable == 0 ? 'check-checkbox' : 'check-no'}.png`">
  71. </image>
  72. </view>
  73. <view class="setIfShowNotApplicable" @click="setIfCountNum">
  74. <text>是否统计小计</text>
  75. <image class="icon"
  76. :src="`/static/${situationPreview.showCountNum == 1 ? 'check-checkbox' : 'check-no'}.png`">
  77. </image>
  78. </view>
  79. <view v-if="ifShowTemplateSelector" class="situationType" @click="selectTemplateHandle">
  80. <text>分页模板</text>
  81. <text class="typeValue">{{situationPreview.templateName}}</text>
  82. <image class="arrowRight" src="../../../static/incon-more.png"></image>
  83. </view>
  84. <!--add by yfb 20230417-->
  85. <view class="pointsetType" @click="pointsetTypeHandle">
  86. <text>计分方式</text>
  87. <text class="typeValue">{{situationPreview.pointsetTypeName}}</text>
  88. <image class="arrowRight" src="../../../static/incon-more.png" mode=""></image>
  89. </view>
  90. <view v-if="ifShowSetTotal" class="pointsetTotal">
  91. <text>设置总分分值</text>
  92. <input v-model="situationPreview.preTotal" placeholder="请输入" type="number" />
  93. <text>分</text>
  94. </view>
  95. <!--end 20230417-->
  96. <!--add by yfb 20230615-->
  97. <view class="checkOrderSetType" @click="checkOrderSetTypeHandle">
  98. <text>快捷查核方式</text>
  99. <text class="typeValue">{{situationPreview.checkOrderSetTypeName}}</text>
  100. <image class="arrowRight" src="../../../static/incon-more.png" mode=""></image>
  101. </view>
  102. <!--end 20230615-->
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. mapState,
  109. mapMutations
  110. } from "vuex";
  111. export default {
  112. data() {
  113. return {
  114. modalVisible:false,
  115. ifShowTemplateSelector: false, //是否展示选择模版的选项
  116. ifShowSetTotal:false, //预设计分方式
  117. childContainer:[],
  118. resultLists:[],//创建情境选择的条件
  119. }
  120. },
  121. computed: {
  122. ...mapState({
  123. theme: state => state.creatingSituations.theme,
  124. condition: state => state.creatingSituations.condition,
  125. conditionCard: state => state.creatingSituations.conditionCard,
  126. checkRent: state => state.creatingSituations.checkRent,
  127. situationPreview: state => state.creatingSituations.situationPreview,
  128. situationTypeList: state => state.creatingSituations.situationTypeList,
  129. pointsetTypeList:state => state.creatingSituations.pointsetTypeList,
  130. checkOrderSetTypeList:state=>state.creatingSituations.checkOrderSetTypeList
  131. }),
  132. situationTypeName() {
  133. if (this.situationTypeList.length > 0 && this.situationPreview) {
  134. const temp = this.situationTypeList.filter(item => item.situationType == this.situationPreview
  135. .situationType);
  136. return temp.length > 0 ? temp[0].situationTypeName : null;
  137. }
  138. return null;
  139. },
  140. pointsetTypeName(){
  141. if (this.pointsetTypeList.length > 0 && this.situationPreview) {
  142. const temp = this.pointsetTypeList.filter(item => item.pointsetType == this.situationPreview
  143. .pointsetType);
  144. return temp.length > 0 ? temp[0].pointsetTypeName : null;
  145. }
  146. return null;
  147. },
  148. checkOrderSetTypeName(){
  149. if (this.checkOrderSetTypeList.length > 0 && this.situationPreview) {
  150. const temp = this.checkOrderSetTypeList.filter(item => item.checkOrderSetType == this.situationPreview
  151. .checkOrderSetType);
  152. return temp.length > 0 ? temp[0].checkOrderSetTypeName : null;
  153. }
  154. return null;
  155. },
  156. list: function() {
  157. const {
  158. conditionIds,
  159. options
  160. } = this.condition;
  161. let list = [];
  162. if(this.theme.id == 0){
  163. //个案情境
  164. let arr = this.condition.childContainer.reduce((cur,next)=>{
  165. return cur.concat(next.list)
  166. },[]);
  167. }
  168. this.loopOptions(options, conditionIds, list);
  169. return list;
  170. }
  171. },
  172. watch: {
  173. situationPreview(newVal) {
  174. if (newVal.situationType == 2) {
  175. //情境类型为分页时
  176. this.ifShowTemplateSelector = true;
  177. this.dispatch('getTemplates').then(res => {
  178. this.$store.commit('creatingSituations/comChangeState', {
  179. key: 'templateList',
  180. data: res
  181. });
  182. })
  183. } else {
  184. this.ifShowTemplateSelector = false;
  185. this.$store.commit('creatingSituations/comChangeState', {
  186. key: 'templateList',
  187. data: []
  188. });
  189. }
  190. if (newVal.pointsetType == 2){
  191. //情境类型为预设总分
  192. this.ifShowSetTotal=true;
  193. }else{
  194. //
  195. this.ifShowSetTotal=false;
  196. }
  197. }
  198. },
  199. methods: {
  200. ...mapMutations(['comChangeState']),
  201. modalClickHandle(){
  202. this.modalVisible = false;
  203. },
  204. showCondition(){
  205. const list = this.condition.childContainer.reduce((cur,next)=>{
  206. return cur.concat(next.list);
  207. },[]);
  208. const rebuildList = list.map(a=>{
  209. let tempA = {name:a.name,id:a.id,value:''};
  210. for (let i = 0; i < this.conditionCard.checkResults.length; i++) {
  211. if(this.conditionCard.checkResults[i].id == a.id){
  212. //匹配到结果
  213. tempA.value = `${tempA.value?tempA.value+',':tempA.value}${this.conditionCard.checkResults[i].value}`
  214. }
  215. }
  216. return tempA;
  217. })
  218. this.modalVisible = true;
  219. this.resultLists = rebuildList;
  220. //this.resultLists = this.conditionCard.checkResults;
  221. },
  222. selectSituationType() {
  223. // this.$refs.popup.open();
  224. this.$store.commit('creatingSituations/comChangeState', {
  225. key: 'popupType',
  226. data: 1
  227. });
  228. this.$store.commit('creatingSituations/comChangeState', {
  229. key: 'showPopupSelectorList',
  230. data: true
  231. });
  232. },
  233. selectTemplateHandle() {
  234. this.$store.commit('creatingSituations/comChangeState', {
  235. key: 'popupType',
  236. data: 2
  237. });
  238. this.$store.commit('creatingSituations/comChangeState', {
  239. key: 'showPopupSelectorList',
  240. data: true
  241. });
  242. },
  243. pointsetTypeHandle(){
  244. this.$store.commit('creatingSituations/comChangeState', {
  245. key: 'popupType',
  246. data: 3
  247. });
  248. this.$store.commit('creatingSituations/comChangeState', {
  249. key: 'showPopupSelectorList',
  250. data: true
  251. });
  252. },
  253. checkOrderSetTypeHandle(){
  254. this.$store.commit('creatingSituations/comChangeState', {
  255. key: 'popupType',
  256. data: 4
  257. });
  258. this.$store.commit('creatingSituations/comChangeState', {
  259. key: 'showPopupSelectorList',
  260. data: true
  261. });
  262. },
  263. loopOptions: function(arr, conditionIds, list) {
  264. arr.map((item) => {
  265. if (conditionIds.includes(item.id)) {
  266. list.push(item);
  267. }
  268. if (item.child&&item.child.length > 0) {
  269. this.loopOptions(item.child, conditionIds, list);
  270. }
  271. if (item.children&&item.children.length > 0) {
  272. this.loopOptions(item.children, conditionIds, list);
  273. }
  274. });
  275. },
  276. goMapList: function() {
  277. uni.navigateTo({
  278. url: '/pages/checkMapList/checkMapList'
  279. });
  280. },
  281. setIfShowNotApplicable() {
  282. const showNotApplicable = this.situationPreview.showNotApplicable;
  283. this.$store.commit('creatingSituations/comChangeState', {
  284. key: 'situationPreview',
  285. data: {
  286. ...this.situationPreview,
  287. showNotApplicable: showNotApplicable ? 0 : 1
  288. }
  289. });
  290. },
  291. setIfCountNum() {
  292. const showCountNum = this.situationPreview.showCountNum;
  293. this.$store.commit('creatingSituations/comChangeState', {
  294. key: 'situationPreview',
  295. data: {
  296. ...this.situationPreview,
  297. showCountNum: showCountNum ? 0 : 1
  298. }
  299. });
  300. },
  301. dispatch: function(key, data) {
  302. return this.$store.dispatch({
  303. type: 'creatingSituations/commActions',
  304. key,
  305. data
  306. });
  307. },
  308. }
  309. }
  310. </script>
  311. <style lang="less">
  312. .situation-preview {
  313. overflow: hidden;
  314. font-size: 22.5rpx;
  315. line-height: 33.75rpx;
  316. color: #292C33;
  317. .conditionReview {
  318. width: 80%;
  319. max-height: 70vh;
  320. margin:0 auto;
  321. margin-top: 20vh;
  322. padding:30rpx;
  323. border-radius: 18.75rpx;
  324. background-color: #fff;
  325. overflow-y: hidden;
  326. .conditionReviewContent {
  327. max-height: 70vh;
  328. overflow-y: scroll;
  329. padding-bottom: 25rpx;
  330. .list {
  331. height:50rpx;
  332. line-height: 50rpx;
  333. font-size: 22.5rpx;
  334. border-bottom: 0.63rpx solid #DADEE6;
  335. }
  336. }
  337. }
  338. .box1,
  339. .box2 {
  340. margin-bottom: 15rpx;
  341. padding: 25rpx;
  342. width: 100%;
  343. background-color: #fff;
  344. }
  345. .box1 {
  346. display: flex;
  347. flex-direction: column;
  348. .row1 {
  349. display: flex;
  350. flex-direction: column;
  351. margin-bottom: 35rpx;
  352. .top {
  353. display: flex;
  354. flex-direction: row;
  355. justify-content: space-between;
  356. margin-bottom: 6.25rpx;
  357. >text {
  358. font-size: 30rpx;
  359. line-height: 45rpx;
  360. }
  361. >view {
  362. display: flex;
  363. flex-direction: row;
  364. align-items: center;
  365. font-size: 20rpx;
  366. line-height: 30rpx;
  367. color: #3377FF;
  368. image {
  369. position: relative;
  370. top:1.25rpx;
  371. margin-left: 10rpx;
  372. width: 11.87rpx;
  373. height: 20rpx;
  374. }
  375. }
  376. }
  377. .conditionDetailBtn {
  378. text-align: right;
  379. font-size: 20rpx;
  380. line-height: 30rpx;
  381. color: #3377FF;
  382. image {
  383. margin-left: 10rpx;
  384. width: 11.87rpx;
  385. height: 20rpx;
  386. }
  387. }
  388. .list {
  389. overflow: hidden;
  390. display: flex;
  391. flex-direction: row;
  392. flex-wrap: nowrap;
  393. align-items: center;
  394. >text {
  395. margin-top: 6.25rpx;
  396. margin-right: 15rpx;
  397. border-radius: 5rpx;
  398. flex-wrap: wrap;
  399. padding: 2.5rpx 20.62rpx;
  400. font-size: 17.5rpx;
  401. line-height: 26.25rpx;
  402. color: #7A8499;
  403. background-color: #EBEFF7;
  404. // overflow: hidden;
  405. // text-overflow: ellipsis;
  406. white-space: nowrap;
  407. }
  408. // &::after {
  409. // position: relative;
  410. // top:1.25rpx;
  411. // content: '';
  412. // display: inline-block;
  413. // width: 18rpx;
  414. // height: 25rpx;
  415. // opacity: 0.8;
  416. // background: url('@/static/images/icon-more.png');
  417. // background-size:100% 100%;
  418. // }
  419. }
  420. }
  421. .row2 {
  422. display: flex;
  423. flex-direction: row;
  424. justify-content: center;
  425. align-items: center;
  426. .item {
  427. display: flex;
  428. flex-direction: column;
  429. width: 47.5%;
  430. text {
  431. overflow: hidden;
  432. white-space: nowrap;
  433. text-overflow: ellipsis;
  434. font-size: 25rpx;
  435. line-height: 37.5rpx;
  436. }
  437. text:first-child {
  438. margin-bottom: 4.37rpx;
  439. font-size: 17.5rpx;
  440. line-height: 26.25rpx;
  441. color: #666F80;
  442. }
  443. &:first-child {
  444. margin-right: 5%;
  445. border-right: 1px solid #DADEE6;
  446. }
  447. }
  448. }
  449. }
  450. .box2 {
  451. padding: 0;
  452. padding-left: 25rpx;
  453. >view {
  454. display: flex;
  455. flex-direction: row;
  456. align-items: center;
  457. border-bottom: 1px solid #DADEE6;
  458. height: 87.5rpx;
  459. color: #525866;
  460. >text {
  461. white-space: nowrap;
  462. color: #292C33;
  463. }
  464. >input {
  465. padding: 0 9.37rpx;
  466. width: 80rpx;
  467. height: 33.75rpx;
  468. font-size: 22.5rpx;
  469. line-height: 33.75rpx;
  470. text-align: center;
  471. }
  472. &:last-child {
  473. border-bottom: 0;
  474. }
  475. &.input-wrap {
  476. display: flex;
  477. flex-direction: row;
  478. &:last-child {
  479. align-items: flex-start;
  480. padding: 20rpx 0;
  481. height: 200rpx;
  482. }
  483. view {
  484. margin-right: 40rpx;
  485. white-space: nowrap;
  486. }
  487. input,
  488. textarea {
  489. padding: 0;
  490. padding-right: 25rpx;
  491. width: 100%;
  492. font-size: 22.5rpx;
  493. line-height: 33.75rpx;
  494. text-align: left;
  495. }
  496. textarea {
  497. height: 100%;
  498. }
  499. }
  500. }
  501. .setIfShowNotApplicable {
  502. display: flex;
  503. flex-direction: row;
  504. justify-content: space-between;
  505. .icon {
  506. width: 30rpx;
  507. height: 30rpx;
  508. margin-right: 25rpx;
  509. }
  510. }
  511. .situationType {
  512. position: relative;
  513. .typeValue {
  514. display: inline-block;
  515. margin-left: 40rpx;
  516. }
  517. .arrowRight {
  518. position: absolute;
  519. right: 20rpx;
  520. width: 15rpx;
  521. height: 25rpx;
  522. }
  523. }
  524. .pointsetType {
  525. position: relative;
  526. .typeValue {
  527. display: inline-block;
  528. margin-left: 40rpx;
  529. }
  530. .arrowRight {
  531. position: absolute;
  532. right: 20rpx;
  533. width: 15rpx;
  534. height: 25rpx;
  535. }
  536. }
  537. .checkOrderSetType {
  538. position: relative;
  539. .typeValue {
  540. display: inline-block;
  541. margin-left: 40rpx;
  542. }
  543. .arrowRight {
  544. position: absolute;
  545. right: 20rpx;
  546. width: 15rpx;
  547. height: 25rpx;
  548. }
  549. }
  550. }
  551. }
  552. </style>