index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div id="dynamicdata">
  3. <!-- 按钮及提示 -->
  4. <div class="text-right">
  5. <span>最后一次执行时间:{{lastUpdateTime}}</span>
  6. <el-button size="medium" @click="apply">按对应规则自动设定动态参数信息点</el-button>
  7. <el-button size="medium" type="primary" @click="toAddRelation">填充对应规则</el-button>
  8. </div>
  9. <!-- tab分页 -->
  10. <el-tabs v-model="curType">
  11. <el-tab-pane
  12. v-for="(item) in typeList"
  13. :key="item.Name"
  14. :label="item.Name+'('+item.Rcount+'/'+item.Sum+')'"
  15. :name="item.Name"
  16. ></el-tab-pane>
  17. </el-tabs>
  18. <!-- 查询条件 -->
  19. <div class="query-area">
  20. <el-form ref="form" :model="form" :inline="true">
  21. <el-row>
  22. <el-col :span="4">
  23. <el-form-item>
  24. <el-input
  25. placeholder="请输入设备标识关键字"
  26. v-model="form.EquipmentMark"
  27. class="input-with-select"
  28. >
  29. <el-button slot="append" icon="el-icon-search"></el-button>
  30. </el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="5">
  34. <el-form-item label="数据源">
  35. <el-select
  36. v-model="form.Datasource"
  37. multiple
  38. collapse-tags
  39. style="margin-left: 10px;"
  40. placeholder="全部"
  41. filterable
  42. >
  43. <el-option v-for="item in sourceList" :key="item" :label="item" :value="item"></el-option>
  44. </el-select>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="7">
  48. <el-form-item label="数字字典设备类型">
  49. <el-select
  50. v-model="form.SubTypeName"
  51. multiple
  52. collapse-tags
  53. style="margin-left: 10px;"
  54. placeholder="全部"
  55. filterable
  56. >
  57. <el-option v-for="item in DynEquipList" :key="item" :label="item" :value="item"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="6">
  62. <el-form-item label="位置标签">
  63. <el-select
  64. v-model="form.LocationFlag"
  65. multiple
  66. collapse-tags
  67. style="margin-left: 10px;"
  68. placeholder="全部"
  69. filterable
  70. >
  71. <el-option v-for="item in LocFlagList" :key="item" :label="item" :value="item"></el-option>
  72. </el-select>
  73. </el-form-item>
  74. </el-col>
  75. </el-row>
  76. </el-form>
  77. </div>
  78. <!-- 列表区域 -->
  79. <div class="table-area">
  80. <el-table :data="tableData" style="width: 100%" height="100%" v-show="1">
  81. <el-table-column label="点位表中出现的所有设备">
  82. <el-table-column prop="EquipmentMark" label="设备标识">
  83. <template slot-scope="scope">
  84. <el-tooltip :content="scope.row.EquipmentMark" placement="top">
  85. <span>{{scope.row.EquipmentMark}}</span>
  86. </el-tooltip>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="LocationFlag" label="位置标签">
  90. <template slot-scope="scope">
  91. <el-tooltip :content="scope.row.LocationFlag.toString()" placement="top">
  92. <span>{{scope.row.LocationFlag.toString()}}</span>
  93. </el-tooltip>
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="Datasource" label="数据源">
  97. <template slot-scope="scope">
  98. <el-tooltip :content="scope.row.Datasource" placement="top">
  99. <span>{{scope.row.Datasource}}</span>
  100. </el-tooltip>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="SubTypeName" label="数字字典设备类型">
  104. <template slot-scope="scope">
  105. <el-tooltip :content="scope.row.SubTypeName" placement="top">
  106. <span>{{scope.row.SubTypeName}}</span>
  107. </el-tooltip>
  108. </template>
  109. </el-table-column>
  110. </el-table-column>
  111. <el-table-column label="对应物理世界中的设备实例">
  112. <el-table-column prop="ObjectID" label="对应的设备实例">
  113. <template slot-scope="scope">
  114. <el-tooltip :content="scope.row.ObjectID" placement="top">
  115. <span>{{scope.row.ObjectID}}</span>
  116. </el-tooltip>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="FloorLocalName" label="实例所在建筑楼层">
  120. <template slot-scope="scope">
  121. <el-tooltip :content="scope.row.FloorLocalName" placement="top">
  122. <span>{{scope.row.FloorLocalName}}</span>
  123. </el-tooltip>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="RoomLocalName" label="实例所在业务空间">
  127. <template slot-scope="scope">
  128. <el-tooltip :content="scope.row.RoomLocalName" placement="top">
  129. <span>{{scope.row.RoomLocalName}}</span>
  130. </el-tooltip>
  131. </template>
  132. </el-table-column>
  133. </el-table-column>
  134. <el-table-column prop="action" label="操作">
  135. <template slot-scope="scope">
  136. <el-button
  137. size="mini"
  138. @click="handleDelete(scope.$index, scope.row)"
  139. type="danger"
  140. plain
  141. :disabled="scope.row.Related=='False'"
  142. >清除对应</el-button>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. </div>
  147. <!-- 分页 -->
  148. <el-pagination
  149. class="fr"
  150. v-show="tableData && tableData.length"
  151. @size-change="handleSizeChange"
  152. @current-change="handleCurrentChange"
  153. :current-page="page.pageNumber"
  154. :page-sizes="page.pageSizes"
  155. :page-size="page.pageSize"
  156. layout="total, sizes, prev, pager, next, jumper"
  157. :total="page.total"
  158. ></el-pagination>
  159. <!-- 应用规则弹窗 -->
  160. <apply-rules-dialog ref="apply"></apply-rules-dialog>
  161. <!-- 清除对应关系弹窗 -->
  162. <del-relation-dialog ref="del"></del-relation-dialog>
  163. </div>
  164. </template>
  165. <script>
  166. import tools from "@/utils/tools";
  167. import { mapGetters, mapActions } from "vuex";
  168. import applyRulesDialog from "@/components/point/dynamicdata/applyRulesDialog";
  169. import delRelationDialog from "@/components/point/dynamicdata/delRelationDialog";
  170. import {
  171. dynamicClashConfirm,
  172. dynamicDataSource,
  173. dynamicDynEquipList,
  174. dynamicExecute,
  175. dynamicLocFlagList,
  176. dynamicPromptmessage,
  177. dynamicPromptobjs,
  178. dynamicQuery,
  179. dynamicQueryPoint,
  180. dynamicDeleteRelation,
  181. dynamicPointTypeList
  182. } from "@/api/scan/request";
  183. export default {
  184. computed: {
  185. ...mapGetters("layout", ["projectId"])
  186. },
  187. data() {
  188. return {
  189. curType: "1", //当前所在tab页
  190. typeList: [], //tab页list
  191. sourceList: [], //数据源
  192. DynEquipList: [], //数据字典设备类型
  193. LocFlagList: [], //位置标签
  194. tableData: [], //列表数据
  195. page: {
  196. pageSize: 50,
  197. pageSizes: [10, 20, 50, 100],
  198. pageNumber: 1,
  199. total: 0
  200. },
  201. form: {}, //查询条件
  202. lastUpdateTime: "" //最后更新时间
  203. };
  204. },
  205. components: {
  206. applyRulesDialog,
  207. delRelationDialog
  208. },
  209. created() {
  210. let date = new Date();
  211. this.lastUpdateTime = `${date.getFullYear()}-${date.getMonth() +
  212. 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
  213. this.init();
  214. },
  215. mounted() {},
  216. methods: {
  217. //获取查询条件-
  218. init() {
  219. let param = { Related: true };
  220. //对象类型
  221. dynamicPointTypeList(param, res => {
  222. if (res.Result == "success") {
  223. this.typeList = res.Content;
  224. if (this.typeList.length) {
  225. this.curType = this.typeList[0].Name;
  226. this.getTableData();
  227. }
  228. }
  229. });
  230. //数据源
  231. dynamicDataSource(param, res => {
  232. if (res.Result == "success") {
  233. this.sourceList = res.Content;
  234. }
  235. });
  236. //数据字典
  237. dynamicDynEquipList(param, res => {
  238. if (res.Result == "success") {
  239. this.DynEquipList = res.Content;
  240. }
  241. });
  242. // 位置标签
  243. dynamicLocFlagList(param, res => {
  244. if (res.Result == "success") {
  245. this.LocFlagList = res.Content;
  246. }
  247. });
  248. //获取提示信息
  249. dynamicPromptmessage({},res=>{
  250. if(res.Result == 'success'){
  251. }
  252. })
  253. },
  254. //执行对应结果
  255. apply() {
  256. // dynamicExecute()
  257. // let date = new Date();
  258. // this.lastUpdateTime = `${date.getFullYear()}-${date.getMonth() +
  259. // 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
  260. // this.$message.success("应用成功");
  261. this.$refs.apply.showDialog();
  262. },
  263. //清除对应关系
  264. handleDelete(index, row) {
  265. this.$refs.del.showDialog(row);
  266. },
  267. //改变pagesize
  268. handleSizeChange(pageSize) {
  269. this.page.pageSize = pageSize;
  270. this.getTableData();
  271. },
  272. //改变pageno
  273. handleCurrentChange(pageNo) {
  274. this.page.pageNumber = pageNo;
  275. this.getTableData();
  276. },
  277. //跳转至填充对应规则
  278. toAddRelation() {
  279. this.$router.push({ name: "addRelation" });
  280. },
  281. //获取表格数据
  282. getTableData() {
  283. let param = {
  284. PageNumber: this.page.pageNumber,
  285. PageSize: this.page.pageSize,
  286. TypeName: this.curType
  287. };
  288. //处理查询条件(目前只是单个查,需后台支持)
  289. if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
  290. param.EquipmentMark = this.form.EquipmentMark;
  291. }
  292. if (this.form.SubTypeName.length) {
  293. param.SubTypeName = this.form.SubTypeName.toString();
  294. }
  295. if (this.form.LocationFlag.length) {
  296. param.LocationFlag = this.form.LocationFlag.toString();
  297. }
  298. if (this.form.Datasource.length) {
  299. param.Datasource = this.form.Datasource.toString();
  300. }
  301. // 查询对应关系(P1)
  302. dynamicQuery(param, res => {
  303. if (res.Result == "success") {
  304. this.tableData = res.Content;
  305. this.page.total = res.Total;
  306. }
  307. });
  308. }
  309. },
  310. watch: {
  311. projectId() {
  312. this.init();
  313. }
  314. }
  315. };
  316. </script>
  317. <style lang="scss" scoped>
  318. #dynamicdata {
  319. overflow: hidden;
  320. height: 100%;
  321. background-color: #fff;
  322. padding: 10px;
  323. position: relative;
  324. /deep/ .text-right {
  325. text-align: right;
  326. }
  327. .table-area {
  328. width: calc(100% - 2px);
  329. height: calc(100% - 215px);
  330. td div {
  331. white-space: nowrap;
  332. text-overflow: ellipsis;
  333. overflow: hidden;
  334. }
  335. }
  336. .fr {
  337. padding-top: 10px;
  338. float: right;
  339. }
  340. }
  341. </style>