deployNodeHome.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div class="nodeLnformation">
  3. <div class="nodeLnformation_head">
  4. <div class="manageTitle">节点信息维护</div>
  5. </div>
  6. <div class="nodeLnformation_content">
  7. <org-tree :dataList="dataList" :renderContent="renderContent" />
  8. </div>
  9. <!--删除弹框-->
  10. <Dialog :flag="removeDialogVisible">
  11. <div class="airportInfoDialog">
  12. <div class="Deltitle">删除源数据</div>
  13. <div class="content er">
  14. <div class="log">
  15. 是否确认删除{{ rmObj.AuthName }}?
  16. </div>
  17. </div>
  18. <div class="DelFoot right t30">
  19. <el-button size="medium" class="r25 r26" type="danger" @click="removeSubmit()">删除</el-button>
  20. <el-button size="medium" class="r26" @click="removeDialogVisible = false">取消</el-button>
  21. </div>
  22. </div>
  23. </Dialog>
  24. <!--新增/编辑-->
  25. <Dialog :flag="editDialogVisible" width="508px" :show-flag="true">
  26. <div class="airportInfoDialog dialog-public-background">
  27. <div class="title">{{ editDialogTitle }}</div>
  28. <div class="content">
  29. <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px" class="demo-ruleForm">
  30. <el-form-item label="节点名称" prop="protocolName">
  31. <el-input v-model="ruleForm.protocolName" size="medium" placeholder="请输入节点名称(必填)" />
  32. </el-form-item>
  33. <el-form-item label="跟踪节点标识符" prop="className">
  34. <el-input v-model="ruleForm.className" size="medium" placeholder="请输入跟踪节点标识符(必填)" />
  35. </el-form-item>
  36. <el-form-item label="跟踪节点描述" prop="filePath">
  37. <el-input v-model="ruleForm.filePath" size="medium" type="textarea" :rows="3" placeholder="请输入跟踪节点描述" />
  38. </el-form-item>
  39. </el-form>
  40. </div>
  41. <div class="foot center t30">
  42. <el-button size="medium" type="primary" class="r25 r26" @click="submitClickHandler()">提交</el-button>
  43. <el-button size="medium" class="r26" @click="resetForm('ruleForm')">取消</el-button>
  44. </div>
  45. </div>
  46. </Dialog>
  47. </div>
  48. </template>
  49. <script>
  50. import orgTree from '@/layout/components/OrgTree';
  51. import Dialog from '@/layout/components/Dialog/index.vue';
  52. export default {
  53. name: "NodeLnformation",
  54. components: { orgTree, Dialog },
  55. data () {
  56. return {
  57. dataList: {
  58. id: 0,
  59. AuthName: 'BSM',
  60. Type: 0,
  61. Desc: '行李源报文',
  62. children: [
  63. {
  64. AuthName: 'BSM',
  65. Type: 1,
  66. id: 1,
  67. Desc: '行李源报文',
  68. children: [
  69. {
  70. AuthName: 'BSM',
  71. Type: 2,
  72. id: 3,
  73. Desc: '行李源报文',
  74. },
  75. {
  76. AuthName: 'BSM',
  77. Type: 2,
  78. id: 4,
  79. Desc: '行李源报文',
  80. }
  81. ]
  82. },
  83. {
  84. AuthName: 'BSM',
  85. Type: 1,
  86. id: 2,
  87. Desc: '行李源报文',
  88. }
  89. ]
  90. },
  91. removeDialogVisible: false,
  92. editDialogVisible: false,
  93. rmObj: {
  94. protocolName: ''
  95. },
  96. editDialogTitle: '新增节点信息',
  97. ruleForm: {
  98. // 协议信息表单
  99. protocolId: null,
  100. protocolName: '',
  101. className: '',
  102. rmethodName: '',
  103. smethodName: '',
  104. filePath: ''
  105. },
  106. rules: {
  107. // 协议信息表单验证
  108. protocolName: [{ required: true, message: '请输入节点名称', trigger: 'blur' }],
  109. className: [{ required: true, message: '请输入跟踪节点标识符', trigger: 'blur' }],
  110. rmethodName: [{ required: true, message: '请输入读方法名', trigger: 'blur' }],
  111. smethodName: [{ required: true, message: '请输入写方法名', trigger: 'blur' }]
  112. }
  113. }
  114. },
  115. methods: {
  116. //渲染节点
  117. renderContent (h, data) {
  118. return (
  119. <div onClick={() => this.renderSub(data)} class="account-left-content-teams">
  120. <div class="team">
  121. <div class="list">
  122. <div class="flex info">
  123. <div class="name">
  124. <span>{data.AuthName}</span>
  125. <span onClick={(e) => this.onNodeEdit(data, e)} class="cap cap-edit icon"></span>
  126. </div>
  127. <div class="icon">
  128. <span
  129. v-show={data.Type === 0 || data.Type === 1}
  130. onClick={(e) => this.onNodeSub(data, e)}
  131. class="cap cap-sub"
  132. ></span>
  133. </div>
  134. </div>
  135. <div class="details">
  136. <div class="details-msg">
  137. {data.Desc}
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <div
  143. v-show={data.Type == 1 || data.Type >= 2}
  144. onClick={(e) => this.onNodeClick(data, e)}
  145. class="info-close"
  146. >
  147. <i
  148. class={[
  149. data.Type === 1 ? "close1" : data.Type > 2 ? "close2" : "",
  150. "icon",
  151. "el-icon-close",
  152. ]}
  153. ></i>
  154. </div>
  155. </div>
  156. );
  157. },
  158. onNodeClick (data, e) {
  159. e.stopPropagation();
  160. this.rmObj = data;
  161. this.removeDialogVisible = true;
  162. },
  163. renderSub (data) {
  164. console.log(data, 'click');
  165. },
  166. onNodeSub (data, e) {
  167. e.stopPropagation();
  168. this.editDialogTitle = '新增节点信息'
  169. this.editDialogVisible = true
  170. // const { Type } = data;
  171. // const obj = {
  172. // AuthName: "BSM",
  173. // Desc: "行李源报文",
  174. // Type: Type + 1,
  175. // children: []
  176. // }
  177. // if (data.children) {
  178. // data.children.push(obj);
  179. // } else {
  180. // data.children = [];
  181. // data.children.push(obj);
  182. // }
  183. },
  184. onNodeEdit (data, e) {
  185. e.stopPropagation();
  186. this.editDialogTitle = '编辑节点信息'
  187. this.editDialogVisible = true
  188. },
  189. // 新增/编辑-确认
  190. submitClickHandler () {
  191. this.$refs['ruleForm'].validate(valid => {
  192. if (valid) {
  193. if (this.ruleForm.protocolId) {
  194. this.addSubmit()
  195. } else {
  196. this.editSubmit()
  197. }
  198. this.resetForm('ruleForm')
  199. }
  200. })
  201. },
  202. // 重置
  203. resetForm (formName) {
  204. this.$refs[formName].resetFields()
  205. this.editDialogVisible = false
  206. },
  207. // 删除-弹框
  208. showRemoveDialog (item) {
  209. this.rmObj = item
  210. this.removeDialogVisible = true
  211. },
  212. // 确认删除
  213. removeSubmit () {
  214. this.removeDialogVisible = false
  215. this.$message.success('删除成功')
  216. },
  217. async addSubmit () {
  218. try {
  219. const res = await GeneralDataReception({
  220. serviceId: '1',
  221. dataContent: JSON.stringify(this.ruleForm)
  222. })
  223. if (res.code === 0) {
  224. this.$message.success(res.message ?? '成功')
  225. } else {
  226. this.$message.error(res.message ?? '失败')
  227. }
  228. } catch (error) {
  229. console.log('错误', error)
  230. }
  231. },
  232. async editSubmit () {
  233. try {
  234. const res = await GeneralDataReception({
  235. serviceId: '1',
  236. dataContent: JSON.stringify(this.ruleForm)
  237. })
  238. if (res.code === 0) {
  239. this.$message.success(res.message ?? '成功')
  240. } else {
  241. this.$message.error(res.message ?? '失败')
  242. }
  243. } catch (error) {
  244. console.log('错误', error)
  245. }
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="scss" scoped>
  251. .nodeLnformation {
  252. margin: 40px 0;
  253. }
  254. </style>