index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <div class="airportInfo scroll-y">
  3. <div class="wrap">
  4. <MinHeader
  5. :is-auth="true"
  6. :is-statuser="true"
  7. @addForm="addServiceHandler"
  8. >
  9. <template #header>
  10. <div class="status flex-wrap">
  11. <div class="manageTitle">服务管理</div>
  12. <div class="status0"><span class="icon"></span>启动</div>
  13. <div class="status2"><span class="icon"></span>异常</div>
  14. <div class="status1"><span class="icon"></span>停止</div>
  15. </div>
  16. </template>
  17. </MinHeader>
  18. <div class="app-containers">
  19. <DataTable
  20. :is-Status="true"
  21. :table-header="tableColumns"
  22. :table-data="tableData"
  23. :table-btn-group="tableBtnGroup"
  24. btn-group-width="310px"
  25. :table-property="{ rowKey: 'ID' }"
  26. @btn-click="btnClickHandler"
  27. />
  28. </div>
  29. <Dialog
  30. :width="serviceDialogWidth"
  31. :flag="serviceDialogVisible"
  32. :type="type"
  33. :del-name="delName"
  34. :msg-title="msgTitle"
  35. @delRest="delCancelHandler"
  36. >
  37. <el-form
  38. ref="serviceForm"
  39. class="service-form"
  40. :model="serviceForm"
  41. :rules="serviceFormRules"
  42. label-position="right"
  43. label-width="82px"
  44. size="mini"
  45. >
  46. <el-row :gutter="36" type="flex">
  47. <el-col :span="12">
  48. <el-form-item label="服务名称" prop="serviceName">
  49. <el-input
  50. v-model="serviceForm.serviceName"
  51. placeholder="请输入服务名称"
  52. clearable
  53. />
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="12">
  57. <el-form-item
  58. label="前序输出编号"
  59. label-width="114px"
  60. prop="serviceOutputID"
  61. >
  62. <el-input
  63. v-model="serviceForm.serviceOutputID"
  64. placeholder="请输入前序输出编号"
  65. clearable
  66. />
  67. </el-form-item>
  68. </el-col>
  69. <el-col :span="12">
  70. <el-form-item label="类型" prop="serviceType">
  71. <el-select v-model="serviceForm.serviceType" clearable>
  72. <el-option :value="1" label="管理前端" />
  73. <el-option :value="2" label="管理后端" />
  74. <el-option :value="3" label="业务前端" />
  75. <el-option :value="4" label="业务后端" />
  76. </el-select>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="12">
  80. <el-form-item label-width="14px">
  81. <el-radio-group v-model="serviceForm.isAsynchronous">
  82. <el-radio :label="1">同步</el-radio>
  83. <el-radio :label="0">异步</el-radio>
  84. </el-radio-group>
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="12">
  88. <div class="flex">
  89. <el-form-item label="数据来源" prop="dataSourceID">
  90. <el-select v-model="serviceForm.dataSourceID" clearable>
  91. <el-option
  92. v-for="dataSource in dataSourceList"
  93. :key="dataSource.dataSourceID"
  94. :value="dataSource.dataSourceID"
  95. :label="dataSource.dataSourceName"
  96. />
  97. </el-select>
  98. </el-form-item>
  99. <el-button
  100. type="primary"
  101. size="small"
  102. style="height: 28px; line-height: 0px"
  103. @click="addDataSourceHandler"
  104. >新增</el-button
  105. >
  106. </div>
  107. </el-col>
  108. <el-col :span="12">
  109. <el-form-item
  110. label="数据来源对象"
  111. label-width="114px"
  112. prop="sourceObjectName"
  113. >
  114. <el-input
  115. v-model="serviceForm.sourceObjectName"
  116. placeholder="请输入数据来源对象名称"
  117. clearable
  118. />
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="12">
  122. <el-form-item label="服务描述" prop="serviceDescribe">
  123. <el-input
  124. v-model="serviceForm.serviceDescribe"
  125. placeholder="请输入描述"
  126. clearable
  127. />
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="12">
  131. <el-form-item
  132. label="生命周期ID键名"
  133. prop="lifeCycleCol"
  134. label-width="114px"
  135. >
  136. <el-input
  137. v-model="serviceForm.lifeCycleCol"
  138. placeholder="请输入生命周期ID键名"
  139. clearable
  140. />
  141. </el-form-item>
  142. </el-col>
  143. <el-col :span="24">
  144. <el-form-item label="取值规则" prop="computingMethod">
  145. <el-input
  146. v-model="serviceForm.computingMethod"
  147. placeholder="请输入取值规则"
  148. type="textarea"
  149. :autosize="{ minRows: 4, maxRows: 4 }"
  150. resize="none"
  151. clearable
  152. />
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="24">
  156. <el-form-item label="检测规则" prop="validationExpression">
  157. <el-input
  158. v-model="serviceForm.validationExpression"
  159. placeholder="请输入检测规则"
  160. type="textarea"
  161. :autosize="{ minRows: 4, maxRows: 4 }"
  162. resize="none"
  163. clearable
  164. />
  165. </el-form-item>
  166. </el-col>
  167. <el-col :span="8">
  168. <el-form-item label="启动时间" prop="startTime">
  169. <el-date-picker
  170. v-model="serviceForm.startTime"
  171. type="datetime"
  172. format="yyyy-MM-dd HH:mm"
  173. value-format="yyyy-MM-dd HH:mm"
  174. placeholder="请选择启动时间"
  175. />
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="8">
  179. <el-form-item label="停止时间" prop="stopTime">
  180. <el-date-picker
  181. v-model="serviceForm.stopTime"
  182. type="datetime"
  183. format="yyyy-MM-dd HH:mm"
  184. value-format="yyyy-MM-dd HH:mm"
  185. placeholder="请选择停止时间"
  186. />
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="8">
  190. <el-form-item
  191. label="失败重试次数"
  192. prop="retryCount"
  193. label-width="100px"
  194. >
  195. <el-input
  196. v-model="serviceForm.retryCount"
  197. type="number"
  198. placeholder="请输入重试次数"
  199. clearable
  200. />
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="8">
  204. <el-form-item label="循环次数" prop="loopCount">
  205. <el-input
  206. v-model="serviceForm.loopCount"
  207. type="number"
  208. placeholder="请输入循环次数"
  209. clearable
  210. />
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="8">
  214. <el-form-item label="循环频率" prop="frequencyCount">
  215. <el-input
  216. v-model="serviceForm.frequencyCount"
  217. type="number"
  218. placeholder="请输入循环频率"
  219. clearable
  220. />
  221. </el-form-item>
  222. </el-col>
  223. <el-col :span="8">
  224. <el-form-item
  225. label="循环频率单位"
  226. prop="frequencyUnit"
  227. label-width="100px"
  228. >
  229. <el-select v-model="serviceForm.frequencyUnit" clearable>
  230. <el-option label="天" :value="24 * 60 * 60 * 1000" />
  231. <el-option label="小时" :value="60 * 60 * 1000" />
  232. <el-option label="分钟" :value="60 * 1000" />
  233. <el-option label="秒" :value="1000" />
  234. <el-option label="毫秒" :value="1" />
  235. </el-select>
  236. </el-form-item>
  237. </el-col>
  238. <el-col :span="12">
  239. <el-form-item
  240. label="日志存储位置"
  241. label-width="100px"
  242. prop="logDataSourceID"
  243. >
  244. <el-select v-model="serviceForm.logDataSourceID">
  245. <el-option
  246. v-for="dataSource in dataSourceList"
  247. :key="dataSource.dataSourceID"
  248. :value="dataSource.dataSourceID"
  249. :label="dataSource.dataSourceName"
  250. />
  251. </el-select>
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="12">
  255. <el-form-item
  256. label="日志过滤条件"
  257. label-width="100px"
  258. prop="logList"
  259. >
  260. <el-input
  261. v-model="serviceForm.logList"
  262. placeholder="请输入日志过滤条件"
  263. clearable
  264. />
  265. </el-form-item>
  266. </el-col>
  267. </el-row>
  268. </el-form>
  269. </Dialog>
  270. <Dialog
  271. type="add"
  272. width="600px"
  273. :flag="dataSourceDialogVisible"
  274. msg-title="新增数据来源"
  275. @delRest="delCancelHandler"
  276. ></Dialog>
  277. </div>
  278. </div>
  279. </template>
  280. <script setup lang="ts">
  281. import DataTable from '@/components/tableTemp/index.vue'
  282. import MinHeader from '@/components/minheader/index.vue'
  283. import Dialog from '@/components/dialog/index.vue'
  284. interface DataSource {
  285. dataSourceID: string
  286. dataSourceName: string
  287. }
  288. // 表格
  289. const tableColumns = ref([])
  290. const tableData = ref<any[]>([])
  291. const tableBtnGroup = [
  292. {
  293. name: '查看',
  294. className: 'editBtn',
  295. param: 1,
  296. },
  297. {
  298. name: '编辑',
  299. className: 'editBtn',
  300. param: 2,
  301. },
  302. {
  303. name: '停止',
  304. className: 'editBtn',
  305. param: 3,
  306. },
  307. {
  308. name: '删除',
  309. className: 'delBtn',
  310. param: 4,
  311. },
  312. ]
  313. const btnClickHandler = (rowIndex: number, row: Object, param: number) => {}
  314. // 新增/删除-弹窗
  315. const serviceDialogVisible = ref(false) // 弹窗开关
  316. const type = ref('del') // 弹窗类型是否删除
  317. const serviceDialogWidth = computed(() =>
  318. type.value === 'del' ? '600px' : '878px'
  319. )
  320. const delName = ref('') // 删除对象名
  321. const msgTitle = '新增服务管理' // 新增弹窗-标题
  322. const addServiceHandler = () => {
  323. type.value = 'add'
  324. serviceDialogVisible.value = true
  325. }
  326. const delCancelHandler = () => {}
  327. // 新增服务-表单
  328. const serviceForm = reactive({
  329. serviceName: '',
  330. serviceOutputID: null,
  331. serviceType: null,
  332. dataSourceID: null,
  333. sourceObjectName: '',
  334. lifeCycleCol: '',
  335. isAsynchronous: 1,
  336. threads: null,
  337. datatype: null,
  338. computingMethod: '',
  339. validationExpression: '',
  340. startTime: null,
  341. stopTime: null,
  342. retryCount: null,
  343. loopCount: null,
  344. frequencyCount: null,
  345. frequencyUnit: null,
  346. serviceDescribe: '',
  347. logDataSourceID: null,
  348. logList: '',
  349. })
  350. const serviceFormRules = {
  351. serviceName: [
  352. {
  353. required: true,
  354. message: '请输入服务名称',
  355. trigger: ['change', 'blur'],
  356. },
  357. ],
  358. }
  359. const dataSourceList = ref<DataSource[]>([])
  360. // 新增数据来源-弹窗
  361. const dataSourceDialogVisible = ref(false)
  362. const addDataSourceHandler = () => {}
  363. // 新增数据来源-表单
  364. </script>
  365. <style lang="scss" scoped>
  366. .app-containers {
  367. height: calc(100vh - 180px);
  368. }
  369. .icon {
  370. width: 14px;
  371. height: 14px;
  372. background: #2d67e3;
  373. border-radius: 2px;
  374. display: inline-block;
  375. vertical-align: middle;
  376. margin-right: 10px;
  377. position: relative;
  378. top: -2px;
  379. }
  380. .status0,
  381. .status2 {
  382. margin-right: 28px;
  383. position: relative;
  384. top: 5px;
  385. }
  386. .status1 {
  387. position: relative;
  388. top: 5px;
  389. .icon {
  390. background-color: #afb4bf;
  391. }
  392. }
  393. .status2 {
  394. .icon {
  395. background-color: #eb2f3b;
  396. }
  397. }
  398. .service-form:deep {
  399. display: flex;
  400. flex-wrap: wrap;
  401. > .el-row {
  402. flex-wrap: wrap;
  403. > .el-col .el-form-item {
  404. margin-bottom: 20px;
  405. .el-form-item__label {
  406. padding-right: 16px;
  407. }
  408. .el-input,
  409. .el-select {
  410. width: 100%;
  411. }
  412. .el-input__inner,
  413. .el-textarea__inner {
  414. padding-left: 8px;
  415. }
  416. .el-date-editor {
  417. .el-input__prefix,
  418. .el-input__suffix {
  419. right: 5px;
  420. left: unset;
  421. font-size: 16px;
  422. color: #101116;
  423. .el-input__suffix-inner {
  424. font-size: 16px;
  425. }
  426. }
  427. &.value-not-null:hover .el-input__prefix {
  428. display: none;
  429. }
  430. }
  431. }
  432. }
  433. label,
  434. span,
  435. button,
  436. input,
  437. optgroup,
  438. select,
  439. textarea {
  440. font-family: Helvetica, Microsoft YaHei;
  441. font-size: 14px;
  442. font-weight: 400;
  443. }
  444. label {
  445. color: #303133;
  446. }
  447. input {
  448. color: #101116;
  449. &::-webkit-outer-spin-button,
  450. &::-webkit-inner-spin-button {
  451. -webkit-appearance: none !important;
  452. &[type='number'] {
  453. -moz-appearance: textfield !important;
  454. }
  455. }
  456. .el-radio {
  457. font-weight: 400;
  458. }
  459. }
  460. }
  461. </style>