index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="relation">
  3. <div class="header">
  4. <el-button class="el-icon-back" @click="goBack"></el-button>
  5. <el-button type="primary" @click="addRelation">添加关系</el-button>
  6. <el-button style="float: right" @click="updataExecl">上传Excel</el-button>
  7. </div>
  8. <el-row class="content">
  9. <el-col :span="12" class="object">
  10. <p>主对象</p>
  11. <span>类型:</span>
  12. <el-select
  13. v-model="mainObject"
  14. placeholder="请选择"
  15. style="margin-right: 10px"
  16. ></el-select>
  17. <AdmSearch />
  18. </el-col>
  19. <el-col :span="12" class="object">
  20. <p>从对象</p>
  21. <span>类型:</span>
  22. <el-select
  23. v-model="mainObject"
  24. placeholder="请选择"
  25. style="margin-right: 10px"
  26. ></el-select>
  27. <AdmSearch />
  28. </el-col>
  29. </el-row>
  30. <relationTable :tableHeader="tableHeader" />
  31. <addRelationDialog
  32. @closeAddRelation="addRelationValue = false"
  33. :addRelationValue="addRelationValue"
  34. :values="values"
  35. />
  36. <excelDialog :values="values" ref="excelDialog"></excelDialog>
  37. <editRelationDialog :values="values"></editRelationDialog>
  38. </div>
  39. </template>
  40. <script lang="ts">
  41. import { Component, Vue } from "vue-property-decorator";
  42. import { AdmSearch } from "./../../components";
  43. import relationTable from "./components/table";
  44. import tableHeader from "@/views/maintain/relationship/components/tableHeader";
  45. import addRelationDialog from "./components/addRelationDialog.vue";
  46. import editRelationDialog from "./components/editRelationDialog.vue";
  47. import excelDialog from "./components/excelDialog.vue";
  48. @Component({
  49. name: "relation",
  50. components: { AdmSearch, relationTable, addRelationDialog, excelDialog,editRelationDialog },
  51. })
  52. export default class extends Vue {
  53. mainObject = "";
  54. //表头数据
  55. tableHeader = [];
  56. // 是否添加关系
  57. addRelationValue: Boolean = false;
  58. // 传入tip需要得字段
  59. values: object = {
  60. relation_maintenance: "关系维护",
  61. optionTips: `请下载最新最新<${this.$route.query.relationTypeName}>数据进行手动维护`, //请下载最新最新 xxxx 数据进行手动维护
  62. currentNum: "当前关系数量:",
  63. download: "下载模板(含数据)",
  64. lastTime: `最后更新时间为:${this.$route.query.lastUpdate || ""}`, //最后更新时间为
  65. uploadTxt: "将Excel文件拖到此处,或<em>单击上传Excel文件<em>",
  66. uploadTips: "上传的Excel数据将完全覆盖当前关系表(关系表先前数据不会保留)",
  67. downloadFile: " 下载报告文件",
  68. back: "返回",
  69. done: "完成",
  70. addShip: "添加关系",
  71. editShip: "编辑关系",
  72. codeTip: "请填写主被控设备对象识别编码",
  73. deviceTip: "请填写主被控设备对象设备号",
  74. codeTitle: "识别编码对应:",
  75. mainObject: "主对象:",
  76. affiliatedObject: "从对象:",
  77. pleaseEnter: "请输入",
  78. pleaseEnterCode: "请输入识别编码",
  79. add: "添加",
  80. cancel: "取消",
  81. delete: "删除关系",
  82. };
  83. /////////////////////////////////////////
  84. // 方法
  85. /**
  86. * 返回页面上一级
  87. */
  88. goBack() {
  89. this.$router.go(-1);
  90. }
  91. /**
  92. * 上传 execl
  93. */
  94. updataExecl() {
  95. this.$refs.excelDialog.dialogExport = true;
  96. }
  97. /**
  98. * 添加关系
  99. */
  100. addRelation() {
  101. this.addRelationValue = true;
  102. }
  103. created() {
  104. let relationTypeName = this.$route.query.relationTypeName;
  105. this.tableHeader = tableHeader[relationTypeName];
  106. }
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .relation {
  111. background: #ffffff;
  112. height: 100%;
  113. .header {
  114. padding: 12px;
  115. overflow: hidden;
  116. border-bottom: 1px solid #e1e7ea;
  117. }
  118. .content {
  119. padding: 12px;
  120. .object {
  121. p {
  122. border-left: 7px solid #555555;
  123. text-indent: 10px;
  124. margin-bottom: 10px;
  125. }
  126. }
  127. }
  128. }
  129. </style>