situationPreview.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="situation-preview">
  3. <uni-popup ref="popup" type="bottom" :maskClick="true" @change="onMaskChange">
  4. <tm-radio-group :list="situationTypeList" :defaultValue='situationPreview.situationType' :setting="{
  5. value: 'situationType',
  6. name: 'situationTypeName'
  7. }" :openkeys="[0]" @change="situationTypeChanged" />
  8. </uni-popup>
  9. <view class="title">情境预览</view>
  10. <view class="box1">
  11. <view class="row1">
  12. <view class="top">
  13. <text>主题:{{theme.title}}</text>
  14. <view @click="goMapList">
  15. <text>查看查核地图</text>
  16. <image src="../../../static/icon-blueMore.png"></image>
  17. </view>
  18. </view>
  19. <view class="list">
  20. <text v-for="(item, index) in list" :key="index">{{item.name}}</text>
  21. </view>
  22. </view>
  23. <view class="row2">
  24. <view class="item">
  25. <text>查核组</text>
  26. <text>{{checkRent.checkedItem.name}}</text>
  27. </view>
  28. <view class="item">
  29. <text>组长</text>
  30. <text>{{checkRent.checkedItem.groupManagerName}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="box2">
  35. <view class="situationType" @click="selectSituationType">
  36. <text>情境类型</text>
  37. <text class="typeValue">{{situationTypeName}}</text>
  38. <image class="arrowRight" src="../../../static/incon-more.png" mode=""></image>
  39. </view>
  40. <view class="input-wrap">
  41. <view>情境名称</view>
  42. <input maxlength="16"
  43. v-model="situationPreview.sitName"
  44. placeholder="限2~16个中文、英文或数字" />
  45. </view>
  46. <view class="input-wrap">
  47. <view>情境描述</view>
  48. <textarea maxlength="300"
  49. rows=""
  50. v-model="situationPreview.description"
  51. placeholder="限300字" />
  52. </view>
  53. </view>
  54. <view class="box2">
  55. <view>
  56. <text>计划开始前</text>
  57. <input v-model="situationPreview.preDay"
  58. placeholder="请输入"
  59. type="number" />
  60. <text>天的</text>
  61. <input v-model="situationPreview.preH"
  62. placeholder="请输入"
  63. type="number" />
  64. <text>时提醒</text>
  65. </view>
  66. <view>
  67. <text>启动</text>
  68. <input v-model="situationPreview.startDay"
  69. placeholder="请输入"
  70. type="number" />
  71. <text>天前提醒</text>
  72. </view>
  73. <view class="setIfShowNotApplicable" @click="setIfShowNotApplicable">
  74. <text>是否需要不适用场景</text>
  75. <image class="icon"
  76. :src="`/static/${situationPreview.showNotApplicable == 0 ? 'check-checkbox' : 'check-no'}.png`">
  77. </image>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import { mapState,mapMutations } from "vuex";
  84. export default {
  85. computed: {
  86. ...mapState({
  87. theme: state => state.creatingSituations.theme,
  88. condition: state => state.creatingSituations.condition,
  89. checkRent: state => state.creatingSituations.checkRent,
  90. situationPreview: state => state.creatingSituations.situationPreview,
  91. situationTypeList:state => state.creatingSituations.situationTypeList
  92. }),
  93. situationTypeName(){
  94. const temp = this.situationTypeList.filter(item=>item.situationType == this.situationPreview.situationType);
  95. return temp[0].situationTypeName;
  96. },
  97. list: function() {
  98. const { conditionIds, options } = this.condition;
  99. let list = [];
  100. this.loopOptions(options, conditionIds, list);
  101. return list;
  102. }
  103. },
  104. methods: {
  105. ...mapMutations(['comChangeState']),
  106. situationTypeChanged(type,name){
  107. // console.log({type,name});
  108. this.$store.commit('creatingSituations/comChangeState',{key:'situationPreview',data:{...this.situationPreview,situationType:type}});
  109. },
  110. selectSituationType(){
  111. this.$refs.popup.open();
  112. },
  113. onMaskChange(){
  114. },
  115. loopOptions: function(arr, conditionIds, list) {
  116. arr.map((item)=>{
  117. if(conditionIds.includes(item.id)) {
  118. list.push(item);
  119. }
  120. if(item.children.length > 0) {
  121. this.loopOptions(item.children, conditionIds, list);
  122. }
  123. });
  124. },
  125. goMapList: function() {
  126. uni.navigateTo({
  127. url: '/pages/checkMapList/checkMapList'
  128. });
  129. },
  130. setIfShowNotApplicable(){
  131. const showNotApplicable = this.situationPreview.showNotApplicable;
  132. this.$store.commit('creatingSituations/comChangeState',{key:'situationPreview',data:{...this.situationPreview,showNotApplicable:showNotApplicable?0:1}});
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="less">
  138. .situation-preview {
  139. overflow: hidden;
  140. font-size: 22.5rpx;
  141. line-height: 33.75rpx;
  142. color: #292C33;
  143. .box1,
  144. .box2 {
  145. margin-bottom: 15rpx;
  146. padding: 25rpx;
  147. width: 100%;
  148. background-color: #fff;
  149. }
  150. .box1 {
  151. display: flex;
  152. flex-direction: column;
  153. .row1 {
  154. display: flex;
  155. flex-direction: column;
  156. margin-bottom: 35rpx;
  157. .top {
  158. display: flex;
  159. flex-direction: row;
  160. justify-content: space-between;
  161. margin-bottom: 6.25rpx;
  162. >text {
  163. font-size: 30rpx;
  164. line-height: 45rpx;
  165. }
  166. >view {
  167. display: flex;
  168. flex-direction: row;
  169. align-items: center;
  170. font-size: 20rpx;
  171. line-height: 30rpx;
  172. color: #3377FF;
  173. image {
  174. margin-left: 10rpx;
  175. width: 11.87rpx;
  176. height: 20rpx;
  177. }
  178. }
  179. }
  180. .list {
  181. overflow: hidden;
  182. display: flex;
  183. flex-direction: row;
  184. flex-wrap: wrap;
  185. align-items: center;
  186. >text {
  187. margin-top: 6.25rpx;
  188. margin-right: 15rpx;
  189. border-radius: 5rpx;
  190. padding: 2.5rpx 20.62rpx;
  191. font-size: 17.5rpx;
  192. line-height: 26.25rpx;
  193. color: #7A8499;
  194. background-color: #EBEFF7;
  195. }
  196. }
  197. }
  198. .row2 {
  199. display: flex;
  200. flex-direction: row;
  201. justify-content: center;
  202. align-items: center;
  203. .item {
  204. display: flex;
  205. flex-direction: column;
  206. width: 47.5%;
  207. text {
  208. overflow: hidden;
  209. white-space: nowrap;
  210. text-overflow: ellipsis;
  211. font-size: 25rpx;
  212. line-height: 37.5rpx;
  213. }
  214. text:first-child {
  215. margin-bottom: 4.37rpx;
  216. font-size: 17.5rpx;
  217. line-height: 26.25rpx;
  218. color: #666F80;
  219. }
  220. &:first-child {
  221. margin-right: 5%;
  222. border-right: 1px solid #DADEE6;
  223. }
  224. }
  225. }
  226. }
  227. .box2 {
  228. padding: 0;
  229. padding-left: 25rpx;
  230. >view {
  231. display: flex;
  232. flex-direction: row;
  233. align-items: center;
  234. border-bottom: 1px solid #DADEE6;
  235. height: 87.5rpx;
  236. color: #525866;
  237. >text {
  238. white-space: nowrap;
  239. color: #292C33;
  240. }
  241. >input {
  242. padding: 0 9.37rpx;
  243. width: 80rpx;
  244. height: 33.75rpx;
  245. font-size: 22.5rpx;
  246. line-height: 33.75rpx;
  247. text-align: center;
  248. }
  249. &:last-child {
  250. border-bottom: 0;
  251. }
  252. &.input-wrap {
  253. display: flex;
  254. flex-direction: row;
  255. &:last-child {
  256. align-items: flex-start;
  257. padding: 20rpx 0;
  258. height: 200rpx;
  259. }
  260. view {
  261. margin-right: 40rpx;
  262. white-space: nowrap;
  263. }
  264. input, textarea {
  265. padding: 0;
  266. padding-right: 25rpx;
  267. width: 100%;
  268. font-size: 22.5rpx;
  269. line-height: 33.75rpx;
  270. text-align: left;
  271. }
  272. textarea {
  273. height: 100%;
  274. }
  275. }
  276. }
  277. .setIfShowNotApplicable {
  278. display: flex;
  279. flex-direction: row;
  280. justify-content: space-between;
  281. .icon {
  282. width: 30rpx;
  283. height: 30rpx;
  284. margin-right: 25rpx;
  285. }
  286. }
  287. .situationType {
  288. position: relative;
  289. .typeValue {
  290. display: inline-block;
  291. margin-left: 40rpx;
  292. }
  293. .arrowRight {
  294. position: absolute;
  295. right:20rpx;
  296. width: 15rpx;
  297. height: 25rpx;
  298. }
  299. }
  300. }
  301. }
  302. </style>