situationPreview.vue 8.7 KB

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