situationPreview.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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. }
  126. }
  127. },
  128. methods: {
  129. ...mapMutations(['comChangeState']),
  130. selectSituationType(){
  131. // this.$refs.popup.open();
  132. this.$store.commit('creatingSituations/comChangeState',{key:'popupType',data:1});
  133. this.$store.commit('creatingSituations/comChangeState',{key:'showPopupSelectorList',data:true});
  134. },
  135. selectTemplateHandle(){
  136. this.$store.commit('creatingSituations/comChangeState',{key:'popupType',data:2});
  137. this.$store.commit('creatingSituations/comChangeState',{key:'showPopupSelectorList',data:true});
  138. },
  139. loopOptions: function(arr, conditionIds, list) {
  140. arr.map((item)=>{
  141. if(conditionIds.includes(item.id)) {
  142. list.push(item);
  143. }
  144. if(item.children.length > 0) {
  145. this.loopOptions(item.children, conditionIds, list);
  146. }
  147. });
  148. },
  149. goMapList: function() {
  150. uni.navigateTo({
  151. url: '/pages/checkMapList/checkMapList'
  152. });
  153. },
  154. setIfShowNotApplicable(){
  155. const showNotApplicable = this.situationPreview.showNotApplicable;
  156. this.$store.commit('creatingSituations/comChangeState',{key:'situationPreview',data:{...this.situationPreview,showNotApplicable:showNotApplicable?0:1}});
  157. },
  158. setIfCountNum(){
  159. const showCountNum = this.situationPreview.showCountNum;
  160. this.$store.commit('creatingSituations/comChangeState',{key:'situationPreview',data:{...this.situationPreview,showCountNum:showCountNum?0:1}});
  161. },
  162. dispatch: function(key, data) {
  163. return this.$store.dispatch({type: 'creatingSituations/commActions', key, data});
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="less">
  169. .situation-preview {
  170. overflow: hidden;
  171. font-size: 22.5rpx;
  172. line-height: 33.75rpx;
  173. color: #292C33;
  174. .box1,
  175. .box2 {
  176. margin-bottom: 15rpx;
  177. padding: 25rpx;
  178. width: 100%;
  179. background-color: #fff;
  180. }
  181. .box1 {
  182. display: flex;
  183. flex-direction: column;
  184. .row1 {
  185. display: flex;
  186. flex-direction: column;
  187. margin-bottom: 35rpx;
  188. .top {
  189. display: flex;
  190. flex-direction: row;
  191. justify-content: space-between;
  192. margin-bottom: 6.25rpx;
  193. >text {
  194. font-size: 30rpx;
  195. line-height: 45rpx;
  196. }
  197. >view {
  198. display: flex;
  199. flex-direction: row;
  200. align-items: center;
  201. font-size: 20rpx;
  202. line-height: 30rpx;
  203. color: #3377FF;
  204. image {
  205. margin-left: 10rpx;
  206. width: 11.87rpx;
  207. height: 20rpx;
  208. }
  209. }
  210. }
  211. .list {
  212. overflow: hidden;
  213. display: flex;
  214. flex-direction: row;
  215. flex-wrap: wrap;
  216. align-items: center;
  217. >text {
  218. margin-top: 6.25rpx;
  219. margin-right: 15rpx;
  220. border-radius: 5rpx;
  221. padding: 2.5rpx 20.62rpx;
  222. font-size: 17.5rpx;
  223. line-height: 26.25rpx;
  224. color: #7A8499;
  225. background-color: #EBEFF7;
  226. }
  227. }
  228. }
  229. .row2 {
  230. display: flex;
  231. flex-direction: row;
  232. justify-content: center;
  233. align-items: center;
  234. .item {
  235. display: flex;
  236. flex-direction: column;
  237. width: 47.5%;
  238. text {
  239. overflow: hidden;
  240. white-space: nowrap;
  241. text-overflow: ellipsis;
  242. font-size: 25rpx;
  243. line-height: 37.5rpx;
  244. }
  245. text:first-child {
  246. margin-bottom: 4.37rpx;
  247. font-size: 17.5rpx;
  248. line-height: 26.25rpx;
  249. color: #666F80;
  250. }
  251. &:first-child {
  252. margin-right: 5%;
  253. border-right: 1px solid #DADEE6;
  254. }
  255. }
  256. }
  257. }
  258. .box2 {
  259. padding: 0;
  260. padding-left: 25rpx;
  261. >view {
  262. display: flex;
  263. flex-direction: row;
  264. align-items: center;
  265. border-bottom: 1px solid #DADEE6;
  266. height: 87.5rpx;
  267. color: #525866;
  268. >text {
  269. white-space: nowrap;
  270. color: #292C33;
  271. }
  272. >input {
  273. padding: 0 9.37rpx;
  274. width: 80rpx;
  275. height: 33.75rpx;
  276. font-size: 22.5rpx;
  277. line-height: 33.75rpx;
  278. text-align: center;
  279. }
  280. &:last-child {
  281. border-bottom: 0;
  282. }
  283. &.input-wrap {
  284. display: flex;
  285. flex-direction: row;
  286. &:last-child {
  287. align-items: flex-start;
  288. padding: 20rpx 0;
  289. height: 200rpx;
  290. }
  291. view {
  292. margin-right: 40rpx;
  293. white-space: nowrap;
  294. }
  295. input, textarea {
  296. padding: 0;
  297. padding-right: 25rpx;
  298. width: 100%;
  299. font-size: 22.5rpx;
  300. line-height: 33.75rpx;
  301. text-align: left;
  302. }
  303. textarea {
  304. height: 100%;
  305. }
  306. }
  307. }
  308. .setIfShowNotApplicable {
  309. display: flex;
  310. flex-direction: row;
  311. justify-content: space-between;
  312. .icon {
  313. width: 30rpx;
  314. height: 30rpx;
  315. margin-right: 25rpx;
  316. }
  317. }
  318. .situationType {
  319. position: relative;
  320. .typeValue {
  321. display: inline-block;
  322. margin-left: 40rpx;
  323. }
  324. .arrowRight {
  325. position: absolute;
  326. right:20rpx;
  327. width: 15rpx;
  328. height: 25rpx;
  329. }
  330. }
  331. }
  332. }
  333. </style>