checkMap.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="check-map">
  3. <view class="title">请对查核地图进行配置</view>
  4. <view class="list">
  5. <view class="item"
  6. v-for="(item, index) in list"
  7. :class="{disable: item.status === 'disable'}"
  8. @click="detail(item)"
  9. :key="index">
  10. <view class="title-wrap">
  11. <text>{{item.name}}</text>
  12. <view>
  13. <image src="../../../static/icon-map.png"></image>
  14. <text>{{item.deptClassName}}</text>
  15. </view>
  16. </view>
  17. <view class="content">
  18. <text>包含{{item.pointCount}}个查核要点,{{item.itemCount}}个查核项目</text>
  19. <text>
  20. <text v-for="(point, c) in item.pointList" :key="c">
  21. {{point.name}};
  22. </text>
  23. </text>
  24. </view>
  25. <view class="btn-group">
  26. <view class="btn"
  27. v-for="(btn, index) in btnGroupArr"
  28. @click="btnClick($event, btn.id)"
  29. :key="index">
  30. <image :src="`../../static/icon-${btn.id}${item.status === 'disable'
  31. ? 'dis' : ''}.png`"></image>
  32. <text>{{btn.label}}</text>
  33. </view>
  34. <view class="btn">
  35. <image :src="`../../static/icon-${creatIcon(item.status)['icon']}.png`">
  36. </image>
  37. <text>{{ creatIcon(item.status)['label'] }}</text>
  38. </view>
  39. </view>
  40. <view class="add-img-wrap" v-if="item.status === 'add'">
  41. <image src="../../../static/top-img.png"></image>
  42. <text>新增项</text>
  43. </view>
  44. <view class="dis-img-wrap" v-if="item.status === 'disable'">
  45. <image src="../../../static/disable-img.png"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import { mapState } from "vuex";
  53. import {_stopPropagation} from "../../../utils/compatible.js";
  54. const btnGroupArr = [
  55. {id: 'add', label: '新增'},
  56. {id: 'shang', label: '上移'},
  57. {id: 'xia', label: '下移'},
  58. ];
  59. export default {
  60. data() {
  61. return {
  62. btnGroupArr,
  63. list: [
  64. {status: 'normal'},
  65. {status: 'add'},
  66. {status: 'disable'},
  67. ]
  68. }
  69. },
  70. computed: {
  71. ...mapState({
  72. checkMap: state => state.creatingSituations.checkMap,
  73. checkRent: state => state.creatingSituations.checkRent,
  74. condition: state => state.creatingSituations.condition,
  75. })
  76. },
  77. created:function(){
  78. if(this.checkMap.list.length === 0) {
  79. const {points} = this.checkRent.checkedItem;
  80. if(!points) return;
  81. let checkPointIds = points.map(({id})=> id);
  82. console.log(checkPointIds)
  83. this.$store.dispatch({
  84. type: 'creatingSituations/commActions',
  85. key: 'checkDeptList',
  86. data: {
  87. depType: this.condition.depType,
  88. checkPointIds,
  89. }
  90. }).then((data)=> {
  91. if(data) this.myCommit('list', data);
  92. });
  93. }
  94. },
  95. methods: {
  96. creatIcon: function(status) {
  97. let obj = {icon: 'jinyong', label: '禁用'};
  98. switch(status) {
  99. case 'add':
  100. obj = {icon: 'del', label: '删除'};
  101. break;
  102. case 'disable':
  103. obj = {icon: 'qiyong', label: '启用'};
  104. break;
  105. }
  106. return obj;
  107. },
  108. detail: function(item) {
  109. this.$store.commit({
  110. type: 'creatingSituations/comChangeState',
  111. key: 'showCheckMapDetail',
  112. data: true
  113. });
  114. },
  115. btnClick: function(e, id) {
  116. _stopPropagation(e);
  117. switch(id) {
  118. case 'add':
  119. this.$store.commit({
  120. type: 'creatingSituations/comChangeState',
  121. key: 'showCheckMapAdd',
  122. data: true
  123. });
  124. break;
  125. }
  126. },
  127. /**
  128. * 更新condition数据
  129. * @param {Object} key 要更新的属性
  130. * @param {Object} value 值
  131. */
  132. myCommit: function(key, value) {
  133. let data = {...this.checkMap};
  134. data[key] = value;
  135. this.$store.commit({
  136. type: 'creatingSituations/comChangeState',
  137. key: 'checkMap',
  138. data
  139. });
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="less">
  145. .check-map {
  146. .list {
  147. overflow: hidden;
  148. padding: 0 25rpx;
  149. .item {
  150. position: relative;
  151. overflow: hidden;
  152. margin-bottom: 25rpx;
  153. border-radius: 5rpx;
  154. padding-top: 16.25rpx;
  155. padding-bottom: 0;
  156. width: 100%;
  157. background-color: #fff;
  158. box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
  159. .title-wrap {
  160. display: flex;
  161. flex-direction: row;
  162. align-items: center;
  163. padding: 0 25rpx;
  164. >text {
  165. font-size: 35rpx;
  166. line-height: 52.5rpx;
  167. color: #292C33;
  168. }
  169. >view {
  170. display: flex;
  171. flex-direction: row;
  172. align-items: center;
  173. margin-left: 20rpx;
  174. border-radius: 17.5rpx;
  175. height: 35rpx;
  176. font-size: 17.5rpx;
  177. line-height: 35rpx;
  178. color: #8F9BB3;
  179. background-color: #EDF2FA;
  180. image {
  181. width: 35rpx;
  182. height: 35rpx;
  183. }
  184. text {
  185. padding-left: 10rpx;
  186. padding-right: 20rpx;
  187. }
  188. }
  189. }
  190. .content {
  191. display: flex;
  192. flex-direction: column;
  193. padding: 11.25rpx 25rpx 20rpx;
  194. text {
  195. overflow: hidden;
  196. white-space: nowrap;
  197. text-overflow: ellipsis;
  198. font-size: 20rpx;
  199. line-height: 30rpx;
  200. color: #666F80;
  201. &:first-child {
  202. margin-bottom: 5rpx;
  203. font-weight: bold;
  204. color: #292C33;
  205. }
  206. }
  207. }
  208. .btn-group {
  209. display: flex;
  210. flex-direction: row;
  211. padding: 15rpx 0;
  212. width: 100%;
  213. height: 77.5rpx;
  214. background-color: #FAFBFC;
  215. .btn {
  216. display: flex;
  217. flex-direction: column;
  218. align-items: center;
  219. justify-content: center;
  220. border-right: 1px solid #DADEE6;
  221. flex: 1;
  222. font-size: 17.5rpx;
  223. line-height: 26.25rpx;
  224. color: #7A8599;
  225. &:last-child {
  226. border-right: 0;
  227. }
  228. image {
  229. width: 25rpx;
  230. height: 25rpx;
  231. }
  232. }
  233. }
  234. .dis-img-wrap,
  235. .add-img-wrap {
  236. position: absolute;
  237. top: 18.75rpx;
  238. right: 18.75rpx;
  239. width: 93.75rpx;
  240. height: 93.75rpx;
  241. image {
  242. width: 100%;
  243. height: 100%;
  244. }
  245. }
  246. .add-img-wrap {
  247. top: 0;
  248. right: 0;
  249. width: 100rpx;
  250. height: 35rpx;
  251. text {
  252. position: absolute;
  253. top: 4.37rpx;
  254. left: 28.75rpx;
  255. font-size: 17.5rpx;
  256. line-height: 26.25rpx;
  257. color: #fff;
  258. }
  259. }
  260. &.disable {
  261. .title-wrap {
  262. >text, >view {
  263. color: #B8BECC;
  264. }
  265. }
  266. .content {
  267. text {
  268. color: #B8BECC;
  269. }
  270. }
  271. .btn-group {
  272. .btn {
  273. color: #B8BECC;
  274. &:last-child {
  275. color: #7A8599;
  276. }
  277. }
  278. }
  279. }
  280. }
  281. }
  282. }
  283. </style>