index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="video-setting">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-card class="box-card">
  6. <div slot="header">
  7. <span>{{ $t('process.processList') }}</span>
  8. </div>
  9. <from-render ref="req" v-model="req" :form-config="queryForm"></from-render>
  10. <el-table :data="tableList" v-loading="loading">
  11. <el-table-column :label="$t('process.generalProcess.serviceName')" prop="serviceName" width="300" />
  12. <el-table-column :label="$t('process.generalProcess.moduleName')" prop="moduleName" width="300" />
  13. <el-table-column :label="$t('process.generalProcess.codeName')" prop="name" />
  14. <el-table-column :label="$t('process.generalProcess.version')" align="center" width="120">
  15. <template slot-scope="scope">
  16. <span style="color: #409eff; cursor: pointer" @click="handleVersion(scope.row)">v{{ scope.row.versionNumber }}</span>
  17. </template>
  18. </el-table-column>
  19. <el-table-column :label="$t('operation')" align="center" width="100">
  20. <template slot-scope="scope">
  21. <el-button type="text" @click="handleNewVersion(scope.row)">{{ $t('process.generalProcess.newVersion') }}</el-button>
  22. </template>
  23. </el-table-column>
  24. </el-table>
  25. <pagination v-show="total > 0" :total="total" :page.sync="req.pageNum" :limit.sync="req.pageSize" @pagination="getList" />
  26. <el-dialog :title="$t('process.generalProcess.add')" :visible.sync="open" width="30%">
  27. <from-render ref="form" v-model="dialogParams" :form-config="dialogForm" :insideRules="dialogRules"></from-render>
  28. </el-dialog>
  29. <el-dialog :title="$t('process.generalProcess.change')" v-if="openChange" :visible.sync="openChange" width="30%">
  30. <div style="padding: 0 2vw">
  31. <el-form ref="rowData" :model="rowData" label-width="auto">
  32. <el-form-item label="业务服务">
  33. <span>{{ rowData.serviceName }}</span>
  34. </el-form-item>
  35. <el-form-item label="模块名称">
  36. <span>{{ rowData.moduleName }}</span>
  37. </el-form-item>
  38. <el-form-item label="流程名称">
  39. <span>{{ rowData.name }}</span>
  40. </el-form-item>
  41. <el-form-item label="切换版本">
  42. <el-select v-model="rowData.id" placeholder="请选择" style="width: 100%" size="small">
  43. <el-option v-for="item in versionList" :key="item.id" :label="item.name" :value="item.id" />
  44. </el-select>
  45. </el-form-item>
  46. </el-form>
  47. <div style="padding-top: 8px; text-align: center">
  48. <el-button size="mini" @click="openChange = false">取 消</el-button>
  49. <el-button type="primary" size="mini" @click="handleSubmit">确定</el-button>
  50. </div>
  51. </div>
  52. </el-dialog>
  53. </el-card>
  54. </el-col>
  55. </el-row>
  56. </div>
  57. </template>
  58. <script>
  59. import * as API from '@/api/process/processNode.js'
  60. import { getServiceNameList, processInfoList } from '@/api/process/generalProcess.js'
  61. import fromRender from '@/components/form-test/index.vue'
  62. export default {
  63. name: 'equipment-management',
  64. components: { fromRender },
  65. data() {
  66. return {
  67. req: {
  68. pageNum: 1,
  69. pageSize: 10,
  70. keyword: '',
  71. serviceName: '',
  72. },
  73. queryForm: {
  74. keyword: {
  75. label: this.$t('keyword'),
  76. span: 4,
  77. },
  78. serviceName: {
  79. span: 4,
  80. label: this.$t('process.generalProcess.serviceName'),
  81. type: 'select',
  82. data: [],
  83. keyName: 'id',
  84. labelName: 'name',
  85. },
  86. operation: {
  87. // 搜索按钮操作
  88. query: () => {
  89. this.req.pageNum = 1
  90. this.getList()
  91. },
  92. // 重置按钮操作
  93. reset: () => {
  94. this.$refs.req.reset()
  95. this.getList()
  96. },
  97. },
  98. otherButton: {
  99. list: [
  100. {
  101. name: this.$t('process.generalProcess.add'),
  102. methodsText: 'add',
  103. type: 'primary',
  104. add: () => {
  105. this.open = true
  106. },
  107. },
  108. ],
  109. },
  110. },
  111. tableList: [],
  112. total: 0,
  113. loading: false,
  114. open: false,
  115. title: '',
  116. dialogParams: {
  117. serviceName: '',
  118. processInfoId: '',
  119. name: '',
  120. },
  121. dialogForm: {
  122. loadingStatus: false,
  123. serviceName: {
  124. label: this.$t('process.generalProcess.serviceName'),
  125. type: 'select',
  126. data: [],
  127. keyName: 'id',
  128. labelName: 'name',
  129. change: (val) => {
  130. this.dialogParams.processInfoId = ''
  131. processInfoList({ serviceName: val }).then((res) => {
  132. this.dialogForm.processInfoId.data = res.data.data.map((item) => {
  133. return {
  134. id: item.id,
  135. name: item.moduleName,
  136. flowName: item.flowName,
  137. }
  138. })
  139. })
  140. },
  141. },
  142. processInfoId: {
  143. label: this.$t('process.generalProcess.moduleName'),
  144. type: 'select',
  145. data: [],
  146. keyName: 'id',
  147. labelName: 'name',
  148. change: (val) => {
  149. let data = this.dialogForm.processInfoId.data.filter((item) => item.id === val)
  150. if (data && data.length > 0) {
  151. this.dialogParams.name = data[0].flowName
  152. }
  153. },
  154. },
  155. name: {
  156. label: this.$t('process.generalProcess.flowName'),
  157. type: 'input',
  158. },
  159. otherButton: {
  160. align: 'center',
  161. list: [
  162. {
  163. name: this.$t('cancelText'),
  164. methodsText: 'cancel',
  165. cancel: () => {
  166. this.$refs.form.reset()
  167. this.open = false
  168. },
  169. },
  170. {
  171. name: this.$t('submitText'),
  172. methodsText: 'submit',
  173. type: 'primary',
  174. submit: () => {
  175. this.handleSubmit()
  176. },
  177. },
  178. ],
  179. },
  180. },
  181. dialogRules: {
  182. serviceName: [{ required: true, message: this.$t('process.generalProcess.serviceNameRules'), trigger: 'change' }],
  183. processInfoId: [{ required: true, message: this.$t('process.generalProcess.moduleNameRules'), trigger: 'blur' }],
  184. name: [{ required: true, message: this.$t('process.generalProcess.flowNameRules'), trigger: 'blur' }],
  185. },
  186. rowData: {},
  187. openChange: false,
  188. versionList: [],
  189. }
  190. },
  191. created() {
  192. this.getServiceName()
  193. },
  194. mounted() {
  195. this.getList()
  196. },
  197. watch: {},
  198. methods: {
  199. getServiceName() {
  200. getServiceNameList({}).then((res) => {
  201. const listData = []
  202. for (let i = 0; i < res.data.data.length; i++) {
  203. const element = res.data.data[i]
  204. listData.push({
  205. name: element,
  206. id: element,
  207. })
  208. }
  209. this.dialogForm.serviceName.data = listData
  210. this.queryForm.serviceName.data = listData
  211. })
  212. },
  213. getList() {
  214. this.loading = true
  215. API.processList({
  216. ...this.req,
  217. bindingTenantId: '000000',
  218. }).then(
  219. (res) => {
  220. this.total = res.data.data.total
  221. this.tableList = res.data.data.records
  222. this.loading = false
  223. },
  224. (err) => {
  225. console.log('processList: ' + err)
  226. this.loading = false
  227. },
  228. )
  229. },
  230. handleSubmit() {
  231. this.$refs.form.$refs['form'].validate((valid) => {
  232. if (valid) {
  233. this.dialogForm.loadingStatus = true
  234. API.processAdd({
  235. ...this.dialogParams,
  236. bindingTenantId: '000000',
  237. }).then(
  238. () => {
  239. this.msgSuccess(this.$t('addSuccess'))
  240. this.$refs.form.reset()
  241. this.open = false
  242. this.dialogForm.loadingStatus = false
  243. this.getList()
  244. },
  245. (err) => {
  246. console.log('processAdd: ' + err)
  247. this.dialogForm.loadingStatus = false
  248. },
  249. )
  250. }
  251. })
  252. },
  253. handleVersion(row) {
  254. this.rowData = JSON.parse(JSON.stringify(row))
  255. this.openChange = true
  256. API.processGetVersionByProcessInfoId({ bindingTenantId: '000000', processInfoId: row.processInfoId }).then((res) => {
  257. console.log(res)
  258. this.versionList = res.data.data.map((item) => {
  259. return {
  260. id: item.id,
  261. name: 'v' + item.versionNumber,
  262. }
  263. })
  264. })
  265. },
  266. handleNewVersion(row) {
  267. this.$router.push({
  268. path: '/nodeConfig',
  269. query: {
  270. id: row.id,
  271. processInfoId: row.processInfoId,
  272. },
  273. })
  274. },
  275. handleSubmit() {
  276. if (!this.rowData.id) {
  277. return this.msgInfo(this.$t('process.node.selectVersion'))
  278. }
  279. API.processEditVersion({ processInfoId: this.rowData.processInfoId, bindingTenantId: '000000', id: this.rowData.id }).then(() => {
  280. this.openChange = false
  281. this.msgSuccess(this.$t('process.node.switchSuccess'))
  282. this.getList()
  283. })
  284. },
  285. },
  286. }
  287. </script>
  288. <style lang="scss" scoped>
  289. .box-card {
  290. height: calc(100vh - 60px);
  291. overflow-y: auto;
  292. }
  293. ::v-deep {
  294. .el-form-item {
  295. margin-bottom: 8px;
  296. }
  297. }
  298. </style>