changeRea.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <!--
  2. changeRea 厂商
  3. -->
  4. <template>
  5. <el-dialog title="关联资产" :visible.sync="dialog.changeRea" width="800px">
  6. <div>
  7. <div id="changeRea">
  8. <div class="title-search" style="margin-bottom: 10px;">
  9. <floor-cascader @change="changeFloor"></floor-cascader>
  10. <el-input placeholder="输入本地名称或本地编码查询" v-model="search" size="small" style="width:250px;marginLeft:30px;"
  11. clearable></el-input>
  12. <el-button @click="getPropertyData" size="small">查找</el-button>
  13. </div>
  14. <!-- <div>
  15. <floor-cascader @change="changeFloor"></floor-cascader>
  16. </div> -->
  17. <el-radio-group v-model="radio" style="width:100%;">
  18. <el-table :data="tableData" style="width: 100%" height="300px">
  19. <el-table-column label="资产名称" show-overflow-tooltip>
  20. <template slot-scope="scope">
  21. <el-radio :label="scope.row.id" :ref="scope.row.id" :value="scope.row.localName || scope.row.name">
  22. {{ scope.row.localName }}
  23. </el-radio>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="本地编码">
  27. <template slot-scope="scope">{{ scope.row.localId }}</template>
  28. </el-table-column>
  29. <el-table-column prop="name" label="所在楼层">
  30. <template slot-scope="scope">
  31. {{
  32. scope.row.building ? scope.row.building.localName ? scope.row.building.localName : '' : ''
  33. }}-{{ scope.row.floor ? scope.row.floor.localName ? scope.row.floor.localName : '' : '' }}
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="设备族">
  37. <template slot-scope="scope">
  38. {{ scope.row.equipFamilyList[0].familyName }}
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="安装位置">
  42. <template slot-scope="scope">
  43. {{ scope.row.infos ? scope.row.infos.installLocation ? scope.row.infos.installLocation : "--" : "--" }}
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. </el-radio-group>
  48. <my-pagination :page="page" @change="changed" style="margin-top:10px;"></my-pagination>
  49. <div class="footer">
  50. <el-button type="primary" @click="clickTrue" style="display:block;margin: 10px auto 0;">确 定</el-button>
  51. </div>
  52. </div>
  53. </div>
  54. </el-dialog>
  55. </template>
  56. <script>
  57. import myPagination from "@/components/ledger/components/lib/myPagination";
  58. // import { queryProperty } from "@/api/scan/request"
  59. import ScanController from "@/controller/ScanController";
  60. import floorCascader from "@/components/ledger/components/lib/floorCascader";
  61. import { mapGetters, mapActions } from "vuex"
  62. export default {
  63. components: {
  64. myPagination,
  65. floorCascader
  66. },
  67. props: {
  68. dialog: {
  69. type: Object,
  70. default: function () {
  71. return {
  72. changeRea: true
  73. };
  74. }
  75. },
  76. category: {
  77. type: Object,
  78. default: function () {
  79. return {}
  80. }
  81. }
  82. },
  83. data() {
  84. return {
  85. search: "", //搜索文案
  86. radio: "",
  87. tableData: [],
  88. page: {
  89. size: 50,
  90. sizes: [10, 30, 50, 100, 150, 200],
  91. total: 0,
  92. currentPage: 1
  93. },
  94. mess: {},
  95. codeListCode: [],
  96. };
  97. },
  98. computed: {
  99. ...mapGetters("layout", ["projectId", "secret", "userId"])
  100. },
  101. mounted() {
  102. },
  103. methods: {
  104. //确认选择
  105. clickTrue() {
  106. if (this.radio) {
  107. this.$emit('changeProperty', { propertyId: this.radio, linkEquipLocalName: this.$refs[this.radio].value });
  108. this.dialog.changeRea = false;
  109. } else {
  110. this.$message("请先选择资产")
  111. }
  112. },
  113. //所在建筑楼层修改
  114. changeFloor(val) {
  115. this.mess = {
  116. buildId: val[0] || "",
  117. floorId: val[1] || ""
  118. }
  119. this.getPropertyData()
  120. },
  121. //分页修改
  122. changed() {
  123. this.getPropertyData()
  124. },
  125. //弹窗显示时
  126. changePage() {
  127. this.page = {
  128. size: 50,
  129. sizes: [10, 30, 50, 100],
  130. total: 0,
  131. currentPage: 1
  132. }
  133. this.getPropertyData()
  134. },
  135. //查询表数据
  136. getPropertyData() {
  137. let param = {
  138. cascade: [
  139. {
  140. name: "equipFamilyList",
  141. projection: ["family", "familyName"]
  142. },
  143. {
  144. name: "building",
  145. projection: ["localName", "name", "id"]
  146. },
  147. {
  148. name: "floor",
  149. projection: ["localName", "name", "id"]
  150. }
  151. ],
  152. filters: `equipId isNull;family="${this.category.assetType}"`,
  153. pageNumber: this.page.currentPage,
  154. pageSize: this.page.size
  155. }
  156. //建筑id
  157. if (this.mess.buildId == "noKnow") {
  158. param.filters += `;buildingId isNull`
  159. } else if (this.mess.buildId && this.mess.buildId != "all") {
  160. param.filters += `;buildingId='${this.mess.buildId}'`
  161. }
  162. //楼层id
  163. if (this.mess.floorId == "noKnow") {
  164. param.filters += `;floorId isNull`
  165. } else if (this.mess.floorId && this.mess.floorId != "all") {
  166. param.filters += `;floorId='${this.mess.floorId}'`
  167. }
  168. //名称和编码
  169. if (this.search) {
  170. param.filters += `;name contain '${this.search}' || localName contain '${this.search}' || localId contain '${this.search}'`
  171. }
  172. ScanController.queryProperty(param, res => {
  173. this.tableData = res.content
  174. this.page.total = res.total
  175. })
  176. }
  177. },
  178. watch: {
  179. dialog: {
  180. deep: true,
  181. handler: function () {
  182. if (this.dialog.changeRea) {
  183. this.changePage()
  184. this.radio = ""
  185. }
  186. }
  187. }
  188. }
  189. };
  190. </script>
  191. <style lang="less">
  192. #changeRea {
  193. .el-table thead {
  194. tr {
  195. th {
  196. background-color: #f5f7fa;
  197. }
  198. }
  199. }
  200. }
  201. </style>