index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. // 列表模型块组件
  2. <template>
  3. <div class="listModalComponent" :class="(active && readonly)?'active':null" @click="ckeckModal">
  4. <div class="preview" @mouseout="mouseout" :style="`backgroundImage:url(${items.url?items.url:''})`">
  5. <!-- <img :src="items.url?items.url:''" alt=""> -->
  6. <div class="more" v-show="!readonly" >
  7. <Poptip trigger="click" placement="bottom-end" :width="100" ref="poptip" @mouseout.native.stop="">
  8. <span class="dot"></span>
  9. <span class="dot"></span>
  10. <span class="dot"></span>
  11. <ul slot="content" class="options">
  12. <li @click="releaseProcess" v-if="items.status === 0 || items.status === 2">发布流程</li>
  13. <li @click="editingProcess" v-if="items.status === 0">编辑流程</li>
  14. <li @click="copyProcess" v-if="items.status === 0 || items.status === 2 ">复制流程</li>
  15. <li @click="deleteProcess" v-if="items.status === 0 || items.status === 2 ">删除流程</li>
  16. <li @click="stopProcess" v-if="items.status === 1">停用流程</li>
  17. <li @click="previewProcess">预览</li>
  18. </ul>
  19. </Poptip>
  20. </div>
  21. </div>
  22. <div class="info">
  23. <p class="infoTitle">{{items.name}}</p>
  24. <p>
  25. <span class="creatTime">创建时间:{{items.createTime}}</span>
  26. </p>
  27. <span class="status" :class="statusClass">{{statusName}}</span>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import {DispatchEvent} from '@/utils/dispatchEvent.js'
  33. import { mapMutations } from 'vuex';
  34. import {
  35. setPublish,
  36. setUnpublish,
  37. setCopy,
  38. delRemove
  39. } from '@/api/modeler.js'
  40. export default {
  41. name:'listModalComponent',
  42. props:{
  43. items:{
  44. type:Object,
  45. default () {
  46. return {
  47. name:'模型名称',
  48. url:'', //缩略图base64数据
  49. createTime:'2019-03-18',
  50. status:1, //已发布是1 未发布是2
  51. }
  52. }
  53. },
  54. readonly:{
  55. type:Boolean,
  56. default: false
  57. }
  58. },
  59. data () {
  60. return {
  61. active:false
  62. }
  63. },
  64. computed:{
  65. statusName () {
  66. let str = ''
  67. switch (this.items.status) {
  68. case -1:
  69. str = '已删除';
  70. break;
  71. case 0:
  72. str = '未发布';
  73. break;
  74. case 1:
  75. str = '已发布';
  76. break;
  77. case 2:
  78. str = '已停用';
  79. break;
  80. case 3:
  81. str = '草稿';
  82. break;
  83. }
  84. return str
  85. },
  86. statusClass () {
  87. return [{
  88. 'published':this.items.status === 1,
  89. 'notRelease':this.items.status === 0,
  90. 'stop':this.items.status === 2
  91. }]
  92. }
  93. },
  94. watch:{
  95. readonly () {
  96. this.active = false
  97. }
  98. },
  99. methods:{
  100. ...mapMutations(['currentChange','changeKeepAliveArray']),
  101. mouseout () {
  102. this.$refs.poptip.handleClose()
  103. },
  104. releaseProcess () { //发布流程
  105. this.$refs.poptip.handleClose()
  106. setPublish({id:this.items.id}).then((res) => {
  107. if(res.resultCode === 0){
  108. if(typeof this.items.event.queryLists === 'function'){
  109. this.items.event.queryLists()
  110. }
  111. }else{
  112. this.$Modal.fcWarning({
  113. title:'警告',
  114. content:res.resultMsg,
  115. mask:true
  116. })
  117. }
  118. })
  119. },
  120. editingProcess () { //编辑流程
  121. this.$refs.poptip.handleClose()
  122. // this.changeKeepAliveArray(['modeler'])
  123. this.$router.push({ path: `/tool/activiti/TemplateManagementNew/${this.items.id}` })
  124. // this.currentChange({
  125. // path:'/tool/activiti/modeler'
  126. // });
  127. },
  128. deleteProcess () { //删除流程
  129. this.$refs.poptip.handleClose()
  130. delRemove({id:this.items.id}).then((res) => {
  131. if(typeof this.items.event.queryLists === 'function'){
  132. this.items.event.queryLists()
  133. }
  134. })
  135. },
  136. stopProcess () { //停用流程
  137. this.$refs.poptip.handleClose()
  138. setUnpublish({id:this.items.id}).then((res) => {
  139. if(typeof this.items.event.queryLists === 'function'){
  140. this.items.event.queryLists()
  141. }
  142. })
  143. },
  144. copyProcess () { //复制流程
  145. this.$refs.poptip.handleClose()
  146. setCopy({id:this.items.id}).then((res) => {
  147. if(res.resultCode === 0){
  148. // this.changeKeepAliveArray(['modeler'])
  149. this.$router.push({ path: `/tool/activiti/TemplateManagementNew/${res.data.id}` })
  150. // this.currentChange({
  151. // path:'/tool/activiti/modeler'
  152. // });
  153. }else{
  154. this.$Modal.fcError({
  155. title:'错误',
  156. content:res.resultMsg,
  157. onOk: () => {
  158. }
  159. })
  160. }
  161. })
  162. },
  163. previewProcess () { //预览流程
  164. this.$refs.poptip.handleClose()
  165. // this.changeKeepAliveArray(['modeler'])
  166. this.$router.push({ path: `/tool/activiti/TemplateManagementNew/${this.items.id}/1` })
  167. // this.currentChange({
  168. // path:'/tool/activiti/modeler'
  169. // });
  170. },
  171. ckeckModal () { //选择流程
  172. if(this.readonly){
  173. this.active = !this.active
  174. DispatchEvent('modalClick',{
  175. detail:{
  176. items:this.items,
  177. value:this.active
  178. }
  179. })
  180. }
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" >
  186. .listModalComponent{
  187. height:220px;
  188. background:rgba(255,255,255,1);
  189. box-shadow:0px 1px 5px 0px rgba(0,0,0,0.1)!important;
  190. border-radius:4px;
  191. cursor: pointer;
  192. display: flex;
  193. flex-direction: column;
  194. border-radius:4px;
  195. position: relative;
  196. &.active{
  197. border: 1px solid #5982E7;
  198. }
  199. .info{
  200. height: 62px;
  201. padding: 10px 0 8px 12px;
  202. position: relative;
  203. .infoTitle{
  204. height: 20px;
  205. font-size: 15px;
  206. font-family: PingFangSC-Medium;
  207. font-weight: 500;
  208. color: #515a6e;
  209. line-height: 20px;
  210. margin-bottom: 6px;
  211. }
  212. >p:last-child{
  213. display: flex;
  214. align-items: center;
  215. justify-content: space-between;
  216. span{
  217. font-size:12px;
  218. font-family:PingFangSC-Regular;
  219. font-weight:400;
  220. color:rgba(81,90,110,1);
  221. line-height:16px;
  222. }
  223. }
  224. span.status{
  225. position: absolute;
  226. right: 0;
  227. bottom: 8px;
  228. width:75px;
  229. height:24px;
  230. background:#B4B4B4;
  231. border-radius:12px 0px 0px 12px;
  232. color: white;
  233. text-align: center;
  234. line-height: 24px;
  235. font-size:12px;
  236. font-family:PingFangSC-Regular,PingFang SC;
  237. font-weight:400;
  238. &.published{
  239. background:rgba(9, 161, 85, 1)
  240. }
  241. &.notRelease{
  242. background:#B4B4B4
  243. }
  244. &.stop{
  245. background: #ED4014;
  246. }
  247. }
  248. }
  249. .preview{
  250. flex: 1;
  251. border-radius:4px 4px 0px 0px;
  252. overflow: hidden;
  253. text-align: center;
  254. background-size: contain;
  255. background-repeat: no-repeat;
  256. background-position: center;
  257. img{
  258. // width: 100%;
  259. height: 100%;
  260. }
  261. &:hover{
  262. // transform: translateY(-4px);
  263. img{
  264. }
  265. .more{
  266. display: block;
  267. }
  268. }
  269. .more{
  270. width: 40px;
  271. height: 24px;
  272. position: absolute;
  273. top: 12px;
  274. right: 12px;
  275. background: white;
  276. box-shadow:0px 1px 5px 0px rgba(0,0,0,0.1);
  277. border-radius:4px;
  278. display: flex;
  279. align-items: center;
  280. justify-content: center;
  281. display: none;
  282. .burgeon-poptip{
  283. width: 100%;
  284. height: 100%;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. .burgeon-poptip-body{
  289. padding: 5px 0;
  290. }
  291. .burgeon-poptip-rel{
  292. display: flex;
  293. width: 100%;
  294. height: 100%;
  295. align-items: center;
  296. justify-content: center;
  297. }
  298. .burgeon-poptip-popper{
  299. min-width: auto;
  300. }
  301. }
  302. .dot{
  303. width: 4px;
  304. height: 4px;
  305. background: rgba(51, 51, 51, 1);
  306. border-radius: 50%;
  307. display: inline-block;
  308. margin-right: 4px;
  309. &:last-child{
  310. margin-right: 0;
  311. }
  312. }
  313. .options{
  314. li{
  315. height: 29px;
  316. display: flex;
  317. align-items: center;
  318. padding-left: 16px;
  319. font-size:12px;
  320. font-family:PingFangSC-Regular;
  321. font-weight:400;
  322. color:rgba(81,90,110,1);
  323. &:hover{
  324. background: rgba(243, 243, 243, 1);
  325. }
  326. }
  327. }
  328. }
  329. }
  330. &:hover{
  331. transform: translateY(-4px);
  332. }
  333. }
  334. </style>