dialog_main.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!--steps3的左侧-->
  2. <template>
  3. <div class="steps3-dialog-main">
  4. <select-one @check="typeCheck" :renderData="typeArr" :isSelected="true" isCheckInfo="EquipmentMarkStandardized" infosKey="EquipmentType" :name="'原始点位描述中识别的设备类型'"></select-one>
  5. <select-one @check="paramCheck" :renderData="identifyArr" infosKey="ownMess" :name="'已标准化的设备标识'"></select-one>
  6. <div class="own-collape">
  7. <ident-collape v-if="!isNull" ref="ident" @saved="resetTwo" :renderData="identDataArr"></ident-collape>
  8. <div v-else class="h100">
  9. <div class="own-table-view">
  10. <handsontable-component ref="handsontable"></handsontable-component>
  11. <div class="center">
  12. <el-button type="primary" @click="saveData">保存</el-button>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import selectOne from "@/components/config_point/select_one"
  21. import {
  22. getStandType,
  23. queryPoint,
  24. updatePoint,
  25. getStandParam,
  26. getNullofParam
  27. } from "@/fetch/point_http"
  28. import tempCollape from "./3_temps"
  29. import identCollape from "./3_identify"
  30. import {
  31. mapGetters,
  32. mapActions
  33. } from "vuex";
  34. import handsontableComponent from "@/components/common/handsontable"
  35. export default {
  36. name: "updateParam",
  37. data() {
  38. return {
  39. activeName: '1',
  40. typeArr: [],
  41. identifyArr: [],
  42. KeyEquipmentType: "",
  43. identDataArr: [],
  44. isNull: false,
  45. paramData: {},
  46. Typs: {}
  47. }
  48. },
  49. computed: {
  50. ...mapGetters("project", [
  51. "projectId",
  52. "datasourceId",
  53. "protocolType"
  54. ])
  55. },
  56. created() {
  57. this.getData()
  58. },
  59. mounted() {},
  60. methods: {
  61. getData(){
  62. getStandType({
  63. data: {
  64. DataSourceId: this.datasourceId
  65. },
  66. type: this.protocolType
  67. },res => {
  68. this.typeArr = res.Content
  69. })
  70. },
  71. resetTwo(){
  72. console.log("触发回调")
  73. this.getParamList(this.Typs)
  74. },
  75. typeCheck(item){
  76. console.log(item,"item")
  77. this.getParamList(item)
  78. },
  79. paramCheck(param){
  80. this.paramData = param
  81. if(!!param.EquipmentMark && param.EquipmentMark == "空"){
  82. //空查询分组信息
  83. getNullofParam({
  84. data: {
  85. DataSourceId: this.datasourceId,
  86. KeyEquipmentType: this.KeyEquipmentType
  87. },
  88. type: this.protocolType
  89. },res =>{
  90. console.log(res)
  91. this.isNull = false
  92. this.identDataArr = res.Content
  93. })
  94. }else{
  95. //不是空的情况查询点位列表
  96. console.log(param)
  97. queryPoint({
  98. data: {
  99. Filters: {
  100. equipmentMark: param.EquipmentMark,
  101. KeyEquipmentType: param.EquipmentType,
  102. Used: true
  103. },
  104. PageNumber: 1,
  105. PageSize: 100
  106. },
  107. type: this.protocolType
  108. },res => {
  109. this.isNull = true
  110. this.identDataArr = res.Content
  111. let allData = this.identDataArr,data = {
  112. data: allData,
  113. colHeaders: ['设备标识','原始点位描述','位置标签','备注'],
  114. columns: [
  115. {
  116. data: 'EquipmentMark'
  117. },
  118. {
  119. data: 'Description',
  120. readOnly:true,
  121. },
  122. {
  123. data: 'LocationFlag',
  124. readOnly:true,
  125. },
  126. {
  127. data: 'Remarks',
  128. readOnly:true,
  129. }
  130. ],
  131. maxRows: allData.length,
  132. }
  133. if(this.protocolType == 'knx'){
  134. data.colHeaders.splice(2,0,'原始点位地址')
  135. data.columns.splice(2,0,{
  136. data: 'GroupAddress',
  137. readOnly: true
  138. })
  139. }
  140. if(this.protocolType == 'modbus-tcp'){
  141. data.colHeaders.splice(2,0,'原始点位地址')
  142. data.columns.splice(2,0,{
  143. data: 'RegistersAddress',
  144. readOnly: true
  145. })
  146. }
  147. console.log(this.activeName,this.$refs.handsontable)
  148. this.$nextTick(_ => {
  149. this.$refs.handsontable.init(data)
  150. })
  151. })
  152. }
  153. },
  154. saveData(){
  155. console.log(this.identDataArr,222)
  156. },
  157. //通过type获取param的list
  158. getParamList(item){
  159. this.Typs = item
  160. console.log(item)
  161. this.KeyEquipmentType = item.EquipmentType
  162. getStandParam({
  163. data: {
  164. DataSourceId: this.datasourceId,
  165. KeyEquipmentType: item.EquipmentType
  166. },
  167. type: this.protocolType
  168. },res => {
  169. console.log(res,"res")
  170. this.identifyArr = res.Content.map(item => {
  171. item.ownMess = item.EquipmentMark + '(涉及原始点位:' + item.PointCount + ')'
  172. return item
  173. })
  174. })
  175. }
  176. },
  177. components: {
  178. selectOne,
  179. handsontableComponent,
  180. tempCollape,
  181. identCollape
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .steps3-dialog-main {
  187. height: 400px;
  188. .own-table-view{
  189. height: calc(100% - 50px);
  190. }
  191. .own-collape {
  192. border: 1px solid #ccc;
  193. float: right;
  194. width: calc(100% - 520px);
  195. height: 340px;
  196. position: relative;
  197. }
  198. }
  199. </style>