situationPreview.vue 12 KB

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