deviceEdit.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div id="deviceEdit" v-loading="isLoging">
  3. <el-dialog
  4. title="设备编辑"
  5. width="40%"
  6. top="2rem"
  7. :close-on-click-modal="false"
  8. :visible.sync="showDialog"
  9. :destroy-on-close="true"
  10. @close="close()"
  11. >
  12. <div id="shared" style="margin-top: 1rem;margin-right: 100px;">
  13. <el-form ref="form" :rules="rules" :model="form" label-width="140px" >
  14. <el-form-item label="设备编号" >
  15. <el-input v-model="form.deviceId" disabled></el-input>
  16. </el-form-item>
  17. <el-form-item label="设备名称" prop="name">
  18. <el-input v-model="form.name" clearable></el-input>
  19. </el-form-item>
  20. <!-- <el-form-item label="流媒体ID" prop="mediaServerId">-->
  21. <!-- <el-select v-model="form.mediaServerId" style="float: left; width: 100%" >-->
  22. <!-- <el-option key="auto" label="自动负载最小" value="null"></el-option>-->
  23. <!-- <el-option-->
  24. <!-- v-for="item in mediaServerList"-->
  25. <!-- :key="item.id"-->
  26. <!-- :label="item.id"-->
  27. <!-- :value="item.id">-->
  28. <!-- </el-option>-->
  29. <!-- </el-select>-->
  30. <!-- </el-form-item>-->
  31. <el-form-item label="字符集" prop="charset" >
  32. <el-select v-model="form.charset" style="float: left; width: 100%" >
  33. <el-option key="GB2312" label="GB2312" value="gb2312"></el-option>
  34. <el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="目录订阅周期" prop="subscribeCycleForCatalog" >
  38. <el-input v-model="form.subscribeCycleForCatalog" clearable></el-input>
  39. </el-form-item>
  40. <el-form-item>
  41. <div style="float: right;">
  42. <el-button type="primary" @click="onSubmit" >确认</el-button>
  43. <el-button @click="close">取消</el-button>
  44. </div>
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. </el-dialog>
  49. </div>
  50. </template>
  51. <script>
  52. import MediaServer from '../service/MediaServer'
  53. export default {
  54. name: "deviceEdit",
  55. props: {},
  56. computed: {},
  57. created() {},
  58. data() {
  59. return {
  60. listChangeCallback: null,
  61. showDialog: false,
  62. isLoging: false,
  63. hostNames:[],
  64. mediaServerList: [], // 滅体节点列表
  65. mediaServerObj : new MediaServer(),
  66. form: {},
  67. rules: {
  68. name: [{ required: true, message: "请输入名称", trigger: "blur" }]
  69. },
  70. };
  71. },
  72. methods: {
  73. openDialog: function (row, callback) {
  74. console.log(row)
  75. this.showDialog = true;
  76. this.listChangeCallback = callback;
  77. if (row != null) {
  78. this.form = row;
  79. }
  80. this.getMediaServerList();
  81. },
  82. getMediaServerList: function (){
  83. let that = this;
  84. that.mediaServerObj.getOnlineMediaServerList((data)=>{
  85. that.mediaServerList = data.data;
  86. })
  87. },
  88. onSubmit: function () {
  89. console.log("onSubmit");
  90. console.log(this.form);
  91. this.$axios({
  92. method: 'post',
  93. url:`/api/device/query/device/update/`,
  94. params: this.form
  95. }).then((res) => {
  96. console.log(res.data)
  97. if (res.data.code == 0) {
  98. this.listChangeCallback()
  99. }else {
  100. this.$message({
  101. showClose: true,
  102. message: res.data.msg,
  103. type: "error",
  104. });
  105. }
  106. }).catch(function (error) {
  107. console.log(error);
  108. });
  109. },
  110. close: function () {
  111. this.showDialog = false;
  112. this.$refs.form.resetFields();
  113. },
  114. },
  115. };
  116. </script>