situationPreview.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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. </view>
  97. </view>
  98. </template>
  99. <script>
  100. import {
  101. mapState,
  102. mapMutations
  103. } from "vuex";
  104. export default {
  105. data() {
  106. return {
  107. modalVisible:false,
  108. ifShowTemplateSelector: false, //是否展示选择模版的选项
  109. ifShowSetTotal:false,
  110. childContainer:[],
  111. resultLists:[],//创建情境选择的条件
  112. }
  113. },
  114. computed: {
  115. ...mapState({
  116. theme: state => state.creatingSituations.theme,
  117. condition: state => state.creatingSituations.condition,
  118. conditionCard: state => state.creatingSituations.conditionCard,
  119. checkRent: state => state.creatingSituations.checkRent,
  120. situationPreview: state => state.creatingSituations.situationPreview,
  121. situationTypeList: state => state.creatingSituations.situationTypeList,
  122. pointsetTypeList:state => state.creatingSituations.pointsetTypeList
  123. }),
  124. situationTypeName() {
  125. if (this.situationTypeList.length > 0 && this.situationPreview) {
  126. const temp = this.situationTypeList.filter(item => item.situationType == this.situationPreview
  127. .situationType);
  128. return temp.length > 0 ? temp[0].situationTypeName : null;
  129. }
  130. return null;
  131. },
  132. pointsetTypeName(){
  133. if (this.pointsetTypeList.length > 0 && this.situationPreview) {
  134. const temp = this.pointsetTypeList.filter(item => item.situationType == this.situationPreview
  135. .pointsetType);
  136. return temp.length > 0 ? temp[0].pointsetTypeName : null;
  137. }
  138. return null;
  139. },
  140. list: function() {
  141. const {
  142. conditionIds,
  143. options
  144. } = this.condition;
  145. let list = [];
  146. if(this.theme.id == 0){
  147. //个案情境
  148. let arr = this.condition.childContainer.reduce((cur,next)=>{
  149. return cur.concat(next.list)
  150. },[]);
  151. }
  152. this.loopOptions(options, conditionIds, list);
  153. return list;
  154. }
  155. },
  156. watch: {
  157. situationPreview(newVal) {
  158. if (newVal.situationType == 2) {
  159. //情境类型为分页时
  160. this.ifShowTemplateSelector = true;
  161. this.dispatch('getTemplates').then(res => {
  162. this.$store.commit('creatingSituations/comChangeState', {
  163. key: 'templateList',
  164. data: res
  165. });
  166. })
  167. } else {
  168. this.ifShowTemplateSelector = false;
  169. this.$store.commit('creatingSituations/comChangeState', {
  170. key: 'templateList',
  171. data: []
  172. });
  173. }
  174. if (newVal.pointsetType == 2){
  175. //情境类型为预设总分
  176. this.ifShowSetTotal=true;
  177. }else{
  178. //
  179. this.ifShowSetTotal=false;
  180. }
  181. }
  182. },
  183. methods: {
  184. ...mapMutations(['comChangeState']),
  185. modalClickHandle(){
  186. this.modalVisible = false;
  187. },
  188. showCondition(){
  189. const list = this.condition.childContainer.reduce((cur,next)=>{
  190. return cur.concat(next.list);
  191. },[]);
  192. const rebuildList = list.map(a=>{
  193. let tempA = {name:a.name,id:a.id,value:''};
  194. for (let i = 0; i < this.conditionCard.checkResults.length; i++) {
  195. if(this.conditionCard.checkResults[i].id == a.id){
  196. //匹配到结果
  197. tempA.value = `${tempA.value?tempA.value+',':tempA.value}${this.conditionCard.checkResults[i].value}`
  198. }
  199. }
  200. return tempA;
  201. })
  202. this.modalVisible = true;
  203. this.resultLists = rebuildList;
  204. //this.resultLists = this.conditionCard.checkResults;
  205. },
  206. selectSituationType() {
  207. // this.$refs.popup.open();
  208. this.$store.commit('creatingSituations/comChangeState', {
  209. key: 'popupType',
  210. data: 1
  211. });
  212. this.$store.commit('creatingSituations/comChangeState', {
  213. key: 'showPopupSelectorList',
  214. data: true
  215. });
  216. },
  217. selectTemplateHandle() {
  218. this.$store.commit('creatingSituations/comChangeState', {
  219. key: 'popupType',
  220. data: 2
  221. });
  222. this.$store.commit('creatingSituations/comChangeState', {
  223. key: 'showPopupSelectorList',
  224. data: true
  225. });
  226. },
  227. pointsetTypeHandle(){
  228. this.$store.commit('creatingSituations/comChangeState', {
  229. key: 'popupType',
  230. data: 3
  231. });
  232. this.$store.commit('creatingSituations/comChangeState', {
  233. key: 'showPopupSelectorList',
  234. data: true
  235. });
  236. },
  237. loopOptions: function(arr, conditionIds, list) {
  238. arr.map((item) => {
  239. if (conditionIds.includes(item.id)) {
  240. list.push(item);
  241. }
  242. if (item.child&&item.child.length > 0) {
  243. this.loopOptions(item.child, conditionIds, list);
  244. }
  245. if (item.children&&item.children.length > 0) {
  246. this.loopOptions(item.children, conditionIds, list);
  247. }
  248. });
  249. },
  250. goMapList: function() {
  251. uni.navigateTo({
  252. url: '/pages/checkMapList/checkMapList'
  253. });
  254. },
  255. setIfShowNotApplicable() {
  256. const showNotApplicable = this.situationPreview.showNotApplicable;
  257. this.$store.commit('creatingSituations/comChangeState', {
  258. key: 'situationPreview',
  259. data: {
  260. ...this.situationPreview,
  261. showNotApplicable: showNotApplicable ? 0 : 1
  262. }
  263. });
  264. },
  265. setIfCountNum() {
  266. const showCountNum = this.situationPreview.showCountNum;
  267. this.$store.commit('creatingSituations/comChangeState', {
  268. key: 'situationPreview',
  269. data: {
  270. ...this.situationPreview,
  271. showCountNum: showCountNum ? 0 : 1
  272. }
  273. });
  274. },
  275. dispatch: function(key, data) {
  276. return this.$store.dispatch({
  277. type: 'creatingSituations/commActions',
  278. key,
  279. data
  280. });
  281. },
  282. }
  283. }
  284. </script>
  285. <style lang="less">
  286. .situation-preview {
  287. overflow: hidden;
  288. font-size: 22.5rpx;
  289. line-height: 33.75rpx;
  290. color: #292C33;
  291. .conditionReview {
  292. width: 80%;
  293. max-height: 70vh;
  294. margin:0 auto;
  295. margin-top: 20vh;
  296. padding:30rpx;
  297. border-radius: 18.75rpx;
  298. background-color: #fff;
  299. overflow-y: hidden;
  300. .conditionReviewContent {
  301. max-height: 70vh;
  302. overflow-y: scroll;
  303. padding-bottom: 25rpx;
  304. .list {
  305. height:50rpx;
  306. line-height: 50rpx;
  307. font-size: 22.5rpx;
  308. border-bottom: 0.63rpx solid #DADEE6;
  309. }
  310. }
  311. }
  312. .box1,
  313. .box2 {
  314. margin-bottom: 15rpx;
  315. padding: 25rpx;
  316. width: 100%;
  317. background-color: #fff;
  318. }
  319. .box1 {
  320. display: flex;
  321. flex-direction: column;
  322. .row1 {
  323. display: flex;
  324. flex-direction: column;
  325. margin-bottom: 35rpx;
  326. .top {
  327. display: flex;
  328. flex-direction: row;
  329. justify-content: space-between;
  330. margin-bottom: 6.25rpx;
  331. >text {
  332. font-size: 30rpx;
  333. line-height: 45rpx;
  334. }
  335. >view {
  336. display: flex;
  337. flex-direction: row;
  338. align-items: center;
  339. font-size: 20rpx;
  340. line-height: 30rpx;
  341. color: #3377FF;
  342. image {
  343. position: relative;
  344. top:1.25rpx;
  345. margin-left: 10rpx;
  346. width: 11.87rpx;
  347. height: 20rpx;
  348. }
  349. }
  350. }
  351. .conditionDetailBtn {
  352. text-align: right;
  353. font-size: 20rpx;
  354. line-height: 30rpx;
  355. color: #3377FF;
  356. image {
  357. margin-left: 10rpx;
  358. width: 11.87rpx;
  359. height: 20rpx;
  360. }
  361. }
  362. .list {
  363. overflow: hidden;
  364. display: flex;
  365. flex-direction: row;
  366. flex-wrap: nowrap;
  367. align-items: center;
  368. >text {
  369. margin-top: 6.25rpx;
  370. margin-right: 15rpx;
  371. border-radius: 5rpx;
  372. flex-wrap: wrap;
  373. padding: 2.5rpx 20.62rpx;
  374. font-size: 17.5rpx;
  375. line-height: 26.25rpx;
  376. color: #7A8499;
  377. background-color: #EBEFF7;
  378. // overflow: hidden;
  379. // text-overflow: ellipsis;
  380. white-space: nowrap;
  381. }
  382. // &::after {
  383. // position: relative;
  384. // top:1.25rpx;
  385. // content: '';
  386. // display: inline-block;
  387. // width: 18rpx;
  388. // height: 25rpx;
  389. // opacity: 0.8;
  390. // background: url('@/static/images/icon-more.png');
  391. // background-size:100% 100%;
  392. // }
  393. }
  394. }
  395. .row2 {
  396. display: flex;
  397. flex-direction: row;
  398. justify-content: center;
  399. align-items: center;
  400. .item {
  401. display: flex;
  402. flex-direction: column;
  403. width: 47.5%;
  404. text {
  405. overflow: hidden;
  406. white-space: nowrap;
  407. text-overflow: ellipsis;
  408. font-size: 25rpx;
  409. line-height: 37.5rpx;
  410. }
  411. text:first-child {
  412. margin-bottom: 4.37rpx;
  413. font-size: 17.5rpx;
  414. line-height: 26.25rpx;
  415. color: #666F80;
  416. }
  417. &:first-child {
  418. margin-right: 5%;
  419. border-right: 1px solid #DADEE6;
  420. }
  421. }
  422. }
  423. }
  424. .box2 {
  425. padding: 0;
  426. padding-left: 25rpx;
  427. >view {
  428. display: flex;
  429. flex-direction: row;
  430. align-items: center;
  431. border-bottom: 1px solid #DADEE6;
  432. height: 87.5rpx;
  433. color: #525866;
  434. >text {
  435. white-space: nowrap;
  436. color: #292C33;
  437. }
  438. >input {
  439. padding: 0 9.37rpx;
  440. width: 80rpx;
  441. height: 33.75rpx;
  442. font-size: 22.5rpx;
  443. line-height: 33.75rpx;
  444. text-align: center;
  445. }
  446. &:last-child {
  447. border-bottom: 0;
  448. }
  449. &.input-wrap {
  450. display: flex;
  451. flex-direction: row;
  452. &:last-child {
  453. align-items: flex-start;
  454. padding: 20rpx 0;
  455. height: 200rpx;
  456. }
  457. view {
  458. margin-right: 40rpx;
  459. white-space: nowrap;
  460. }
  461. input,
  462. textarea {
  463. padding: 0;
  464. padding-right: 25rpx;
  465. width: 100%;
  466. font-size: 22.5rpx;
  467. line-height: 33.75rpx;
  468. text-align: left;
  469. }
  470. textarea {
  471. height: 100%;
  472. }
  473. }
  474. }
  475. .setIfShowNotApplicable {
  476. display: flex;
  477. flex-direction: row;
  478. justify-content: space-between;
  479. .icon {
  480. width: 30rpx;
  481. height: 30rpx;
  482. margin-right: 25rpx;
  483. }
  484. }
  485. .situationType {
  486. position: relative;
  487. .typeValue {
  488. display: inline-block;
  489. margin-left: 40rpx;
  490. }
  491. .arrowRight {
  492. position: absolute;
  493. right: 20rpx;
  494. width: 15rpx;
  495. height: 25rpx;
  496. }
  497. }
  498. .pointsetType {
  499. position: relative;
  500. .typeValue {
  501. display: inline-block;
  502. margin-left: 40rpx;
  503. }
  504. .arrowRight {
  505. position: absolute;
  506. right: 20rpx;
  507. width: 15rpx;
  508. height: 25rpx;
  509. }
  510. }
  511. }
  512. }
  513. </style>