阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

334 lines
9.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="process-dep-container">
  3. <div class="head-container">
  4. <div class="head-left">
  5. <el-button size="mini" @click="handleDeloy">
  6. <i class="iconfont icon-xinzeng" />
  7. 部署
  8. </el-button>
  9. <el-button size="mini" :disabled="selectedItem.length===0 || (selectedItem.length !== 0 && selectedItem[0].suspensionState === 1)" @click="activateHandle(1)">
  10. <i class="iconfont icon-jihuo" />
  11. 激活
  12. </el-button>
  13. <el-button size="mini" :disabled="selectedItem.length===0 || (selectedItem.length !== 0 && selectedItem[0].suspensionState === 2)" @click="activateHandle(2)">
  14. <i class="iconfont icon-guaqi" />
  15. 挂起
  16. </el-button>
  17. <el-button size="mini" :disabled="selectedItem.length===0" @click="downloadModel(selectedItem[0])">
  18. <i class="iconfont icon-daochu" />
  19. 导出
  20. </el-button>
  21. </div>
  22. <div class="head-right">
  23. <el-select v-model="query.suspensionState" clearable size="small" placeholder="状态" class="filter-item" style="width: 100px" @change="queryState">
  24. <i slot="prefix" class="iconfont icon-zhuangtai" />
  25. <el-option v-for="item in enabledTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
  26. </el-select>
  27. </div>
  28. </div>
  29. <div class="process-dep-main">
  30. <ul class="process-list">
  31. <li v-for="(item,index) in flowableList" :key="index" :class="isActive === index ? 'active-li': ''" @click="selectProcess(item,index)">
  32. <p>{{ item.deployName }}</p>
  33. <i class="iconfont icon-shezhi" style="font-size: 16px;color: #0348f3; margin-right: 6px;" @click="settingModle(item.modelId)" />
  34. <span :class="item.suspensionState === 1 ? 'process-on': 'process-off'" />
  35. </li>
  36. </ul>
  37. <div v-if="isHasModel" class="process-info">
  38. <div class="process-info-txt">
  39. <div class="info-left">
  40. <p>当前版本
  41. <el-select v-model="versionNew" style="width:70px;" @change="selectVersion">
  42. <el-option
  43. v-for="item in versionOptions"
  44. :key="item.value"
  45. :label="item.label"
  46. :value="item.value"
  47. />
  48. </el-select>
  49. </p>
  50. <p>部署时间<span>{{ modelInfo.deploymentTime | parseTime }}</span></p>
  51. </div>
  52. <div class="info-right ">
  53. <p>运行中<span>{{ modelInfo.runCount }}</span></p>
  54. <p>已完成<span>{{ modelInfo.completeCount }}</span></p>
  55. </div>
  56. </div>
  57. <div class="process-info-img">
  58. <img :src="srcImg" alt="" :onerror="defaultImg">
  59. </div>
  60. </div>
  61. </div>
  62. <eForm ref="mform" @refresh="getList" />
  63. </div>
  64. </template>
  65. <script>
  66. import { FetchInitFlowAll, FetchSuspendActivate, FetchAllByKey, FetchLeadingOutModelXml, FetchFindFolwImgByModelId } from '@/api/system/flowable'
  67. import { downloadFile } from '@/utils/index'
  68. import eForm from './module/form'
  69. export default {
  70. name: 'ProcessDeployment',
  71. components: { eForm },
  72. data() {
  73. return {
  74. flowableList: [],
  75. query: {
  76. suspensionState: null
  77. },
  78. isActive: -1,
  79. isHasModel: false,
  80. selectedItem: [],
  81. modelInfo: {},
  82. allVersionModel: [],
  83. versionOptions: [],
  84. versionNew: null,
  85. exportVisible: false,
  86. activateName: '',
  87. srcImg: null,
  88. enabledTypeOptions: [
  89. { key: null, display_name: '全部' },
  90. { key: 1, display_name: '启用' },
  91. { key: 2, display_name: '挂起' }
  92. ],
  93. defaultImg: 'this.src="' + require('@/assets/images/system/default-img.jpg') + '"'
  94. }
  95. },
  96. mounted() {
  97. this.getList()
  98. },
  99. methods: {
  100. getList(suspensionState) {
  101. this.selectedItem = []
  102. this.isActive = -1
  103. this.isHasModel = false
  104. FetchInitFlowAll({ 'suspensionState': suspensionState }).then((res) => {
  105. this.flowableList = res
  106. }).catch(err => {
  107. console.log(err)
  108. })
  109. },
  110. queryState(val) {
  111. this.getList(val)
  112. },
  113. selectProcess(item, index) {
  114. this.selectedItem = []
  115. this.selectedItem.push(item)
  116. this.isActive = index
  117. this.isHasModel = true
  118. this.modelInfo = item
  119. FetchAllByKey({ 'key': item.modelKey }).then(res => {
  120. this.allVersionModel = res
  121. this.versionOptions = res.map(item => {
  122. const json = {}
  123. json.value = item.version
  124. json.label = item.version
  125. return json
  126. })
  127. this.versionNew = item.version
  128. }).catch((err) => {
  129. console.log(err)
  130. })
  131. FetchFindFolwImgByModelId({ 'processDefinitionId': item.procdefId }).then((res) => {
  132. this.srcImg = 'data:image/jpeg;base64,' + res
  133. }).catch(err => {
  134. console.log(err)
  135. })
  136. },
  137. selectVersion(val) {
  138. this.allVersionModel.filter((item, index) => {
  139. if (item.version === val) {
  140. this.modelInfo = item
  141. }
  142. })
  143. },
  144. handleDeloy() {
  145. this.$refs.mform.uploadVisible = true
  146. if (this.isActive !== -1) {
  147. this.$refs.mform.form.name = this.selectedItem[0].deployName
  148. }
  149. },
  150. activateHandle(type) {
  151. if (type === 1) {
  152. this.activateName = '激活'
  153. } else {
  154. this.activateName = '挂起'
  155. }
  156. this.$confirm('此操作将' + this.activateName + '“' + this.selectedItem[0].deployName + '”' + '<span>你是否还要继续?</span>', '提示', {
  157. confirmButtonText: '继续',
  158. cancelButtonText: '取消',
  159. type: 'warning',
  160. dangerouslyUseHTMLString: true
  161. }).then(() => {
  162. const params = {
  163. 'procdefId': this.selectedItem[0].procdefId,
  164. 'type': type
  165. }
  166. FetchSuspendActivate(params).then(res => {
  167. if (res === 'SUCCESS') {
  168. this.getList()
  169. }
  170. }).catch((err) => {
  171. console.log(err)
  172. })
  173. }).catch(() => {
  174. })
  175. },
  176. settingModle(modelId) {
  177. console.log('modelId', modelId)
  178. this.$emit('handleTab', 3, modelId)
  179. },
  180. downloadModel(data) {
  181. this.$confirm('此操作将导出所选数据' + '<span>你是否还要继续?</span>', '提示', {
  182. confirmButtonText: '继续',
  183. cancelButtonText: '取消',
  184. type: 'warning',
  185. dangerouslyUseHTMLString: true
  186. }).then(() => {
  187. const params = {
  188. 'deployId': data.deployId
  189. }
  190. const name = data.modelName
  191. FetchLeadingOutModelXml(params).then(result => {
  192. downloadFile(result, name, 'xml')
  193. }).catch(() => {
  194. this.$message({ message: '下载失败,请检查好网络后重新下载', type: 'error', offset: 8 })
  195. })
  196. }).catch(() => {
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style lang='scss' scoped>
  203. [data-theme=dark] .process-dep-main{
  204. background-color: transparent;
  205. border-top: 1px solid #113d72;
  206. .process-list{
  207. box-shadow: 5px 2px 10px 1px rgba(15,164,222,.16);
  208. li{
  209. &.active-li,
  210. &:hover{
  211. background: linear-gradient(90deg, rgba(59, 160, 255, 0) 0%, rgba(42,112,177,0.3) 43%, rgba(51, 156, 255, 0) 100%);
  212. }
  213. }
  214. }
  215. }
  216. [data-theme=light] .process-dep-main{
  217. background-color: #F5F5F5;
  218. border: 1px solid #E6E8ED;
  219. .process-list{
  220. background-color: #fff;
  221. box-shadow: 4px 0px 4px 0px rgba(0,0,0,0.04);
  222. li{
  223. color: #0C0E1E;
  224. &.active-li,
  225. &:hover{
  226. background-color: #E8F2FF;
  227. }
  228. }
  229. }
  230. .process-info-txt{
  231. color: #0C0E1E;
  232. span{
  233. color: #545B65;
  234. }
  235. }
  236. }
  237. [data-theme=light] .head-container{
  238. margin: 20px 0 !important;
  239. }
  240. .process-dep-container{
  241. min-height: calc(100vh - 300px);
  242. }
  243. .head-container{
  244. display: flex;
  245. justify-content: space-between;
  246. .head-left{
  247. width: 342px;
  248. padding: 0 10px;
  249. display: flex;
  250. justify-content: space-between;
  251. ::v-deep .el-button--mini{
  252. padding: 7px;
  253. }
  254. }
  255. .head-right{
  256. flex: 1;
  257. display: flex;
  258. justify-content: flex-end;
  259. }
  260. .filter-item{
  261. margin-right: 0;
  262. }
  263. }
  264. .process-dep-main{
  265. display: flex;
  266. justify-content: flex-start;
  267. height: calc(100vh - 283px);
  268. .process-list{
  269. width: 342px;
  270. li{
  271. display: flex;
  272. justify-content: space-between;
  273. align-items: center;
  274. padding: 0 16px;
  275. font-size: 14px;
  276. height: 40px;
  277. line-height: 40px;
  278. cursor: pointer;
  279. p{
  280. flex: 1;
  281. }
  282. span{
  283. display: block;
  284. width: 9px;
  285. height: 9px;
  286. border-radius: 50%;
  287. &.process-on{
  288. background-color: #3FE246;
  289. }
  290. &.process-off{
  291. background-color: #ED4A41;
  292. }
  293. }
  294. }
  295. }
  296. .process-info{
  297. flex: 1;
  298. padding:10px 30px;
  299. .process-info-txt{
  300. display: flex;
  301. justify-content: space-between;
  302. font-size: 14px;
  303. line-height: 30px;
  304. margin-bottom: 10px;
  305. .info-left{
  306. width: 50%;
  307. }
  308. .info-right{
  309. width: 50%;
  310. text-align: right;
  311. }
  312. }
  313. .process-info-img{
  314. height: calc(100vh - 374px);
  315. background-color: #fff;
  316. border: 1px solid #E6E8ED;
  317. overflow: hidden;
  318. & img{
  319. display: block;
  320. width: 100%;
  321. }
  322. }
  323. }
  324. }
  325. </style>