find_keyword.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="view-find-word">
  3. <div class="saga-border">
  4. <p class="center">请从下面的原始点位描述中选择"{{type == 'type' ? "设备类型" : "设备参数"}}"关键字</p>
  5. <div class="h10"></div>
  6. <div>
  7. <cut-string v-if="!!Description" :string="Description" ref="cutString"></cut-string>
  8. <p v-else class="center">已处理到最后一条</p>
  9. </div>
  10. <div class="h10"></div>
  11. <div class="center">
  12. <el-button type="primary" :disabled="!Description" @click="noWatch">此条无法识别</el-button>
  13. <el-button type="primary" :disabled="!Description" @click="getCutString">继续发现关键字</el-button>
  14. </div>
  15. <div class="h10"></div>
  16. </div>
  17. <div class="h10"></div>
  18. <div class="find-data">
  19. <div class="left-view saga-border">
  20. <doughnut v-if="!!sum" :sum="sum" type="left" :name="dataName" width="200" height="200" :renderData="echartsData"></doughnut>
  21. <div v-else class="center">
  22. <i class="iconwushuju iconfont"></i>
  23. 暂无数据
  24. </div>
  25. </div>
  26. <div class="right-view saga-border">
  27. <div class="find-tags" v-for="(tag,index) in tagList" :key="index">
  28. <el-tag :key="type == 'type' ? tag.EquipmentType : tag.EquipmentParameter" @click="changeName(type == 'type' ? tag.EquipmentType : tag.EquipmentParameter)" @close="closeTag(type == 'type' ? tag.EquipmentType : tag.EquipmentParameter)" closable>
  29. {{type == 'type' ? (tag.EquipmentType + "(" + tag.PointCount + ")") : (tag.EquipmentParameter + "(" + tag.PointCount + ")")}}
  30. </el-tag>
  31. </div>
  32. </div>
  33. </div>
  34. <my-dialog :dialogVisible="reNameDialog" @confirm="reNameConfirm" :footer="footer" @cancel="cancel" title="重命名" :isAppendBody="true">
  35. <h3 class="center">{{name}}</h3>
  36. <el-input v-model="newName" placeholder="请输入新名称"></el-input>
  37. </my-dialog>
  38. </div>
  39. </template>
  40. <script>
  41. import cutString from "@/components/config_point/cut_string"
  42. import doughnut from "@/components/echarts/doughnut"
  43. import myDialog from "@/components/el_pack/dialog"
  44. import {
  45. findKeysWord,
  46. findKeysWordType,
  47. queryDataSourceCount,
  48. queryEqTypeList,
  49. queryEqParamList,
  50. renameType,
  51. renameParam,
  52. setParamTer,
  53. setTypeTer,
  54. delParamTer,
  55. delTypeTer,
  56. updatePoint
  57. } from "@/fetch/point_http"
  58. import {
  59. mapGetters,
  60. mapActions
  61. } from "vuex";
  62. export default {
  63. props: {
  64. type: {
  65. type: String,
  66. default: "type", //arguments or type
  67. }
  68. },
  69. computed: {
  70. ...mapGetters("project", [
  71. "projectId",
  72. "datasourceId",
  73. "protocolType"
  74. ])
  75. },
  76. components: {
  77. cutString,
  78. doughnut,
  79. myDialog
  80. },
  81. data() {
  82. return {
  83. title: "",
  84. Description: "",
  85. echartsData: [],
  86. sum: 0,
  87. tagList: [],
  88. reNameDialog: false,
  89. name: "",
  90. newName: "",
  91. footer: {
  92. cancel: "取消",
  93. confirm: "确定"
  94. },
  95. Id: "",
  96. dataName: ""
  97. }
  98. },
  99. created() {},
  100. mounted() {},
  101. methods: {
  102. //继续发现关键字
  103. getCutString() {
  104. // console.log(this.$refs.cutString.getData())
  105. if (!this.$refs.cutString.getData()) {
  106. this.$message.error("请确定当前有选择关键字")
  107. return false
  108. }
  109. let setNameFun;
  110. if (this.type == "type") {
  111. setNameFun = setTypeTer
  112. } else {
  113. setNameFun = setParamTer
  114. }
  115. setNameFun({
  116. data: {
  117. DataSourceId: this.datasourceId,
  118. Key: this.$refs.cutString.getData()
  119. },
  120. type: this.protocolType
  121. }, res => {
  122. this.$message.success("添加成功")
  123. this.changeType()
  124. })
  125. },
  126. //取消
  127. cancel() {
  128. this.reNameDialog = false
  129. },
  130. //关闭标签(删除)
  131. closeTag(tag) {
  132. // console.log(tag)
  133. let delFun;
  134. if (this.type == "type") {
  135. delFun = delTypeTer
  136. } else {
  137. delFun = delParamTer
  138. }
  139. let param = {
  140. data: {
  141. DataSourceId: this.datasourceId,
  142. Key: this.type == "type" ? tag : tag
  143. },
  144. type: this.protocolType
  145. }
  146. this.$confirm("你确定删除该标签?").then(_ => {
  147. this.delAjax(param, delFun)
  148. }).catch(_ => {
  149. })
  150. },
  151. delAjax(param, fun) {
  152. fun(param, res => {
  153. this.$message.success("删除标签成功")
  154. this.changeType()
  155. })
  156. },
  157. //点击事件,重命名
  158. changeName(tag) {
  159. this.reNameDialog = true
  160. this.newName = ""
  161. if (this.type == "type") {
  162. this.name = tag
  163. } else {
  164. this.name = tag
  165. }
  166. },
  167. //确定修改名字
  168. reNameConfirm() {
  169. let reNameFun;
  170. if (this.type == "type") {
  171. reNameFun = renameType
  172. } else {
  173. reNameFun = renameParam
  174. }
  175. reNameFun({
  176. data: {
  177. DataSourceId: this.datasourceId,
  178. KeyNew: this.newName,
  179. KeyOld: this.name
  180. },
  181. type: this.protocolType
  182. }, res => {
  183. this.$message.success("修改成功")
  184. this.changeType()
  185. this.cancel()
  186. })
  187. },
  188. //获取文字
  189. changeType(type) {
  190. let queryFun
  191. this.type = !!type ? type : this.type
  192. console.log(this.type)
  193. if (this.type == "type") {
  194. queryFun = findKeysWordType
  195. } else {
  196. queryFun = findKeysWord
  197. }
  198. queryFun({
  199. data: {
  200. DataSourceId: this.datasourceId,
  201. ProjectId: this.projectId
  202. },
  203. type: this.protocolType
  204. }, res => {
  205. console.log("Ressssssss",res)
  206. if (!!res.Content.length) {
  207. this.Description = res.Content[0].Description
  208. this.Id = res.Content[0].PointId
  209. } else {
  210. this.Description = ""
  211. }
  212. // console.log(res)
  213. })
  214. this.getDataForSource()
  215. this.getbeenFoundList()
  216. },
  217. //查询数据源数据
  218. getDataForSource() {
  219. queryDataSourceCount({
  220. Filters: {
  221. Id: this.datasourceId
  222. }
  223. }, res => {
  224. let data = res.Content[0]
  225. this.dataName = res.Content[0].Name
  226. this.echartsData = [{
  227. name: "无法识别:" + (this.type != 'type' ? data.Equipmentparameterignorestandard : data.Equipmenttypeignorestandard),
  228. value: (this.type != 'type' ? data.Equipmentparameterignorestandard : data.Equipmenttypeignorestandard)
  229. },
  230. {
  231. name: "未识别:" + (this.type != 'type' ? data.Equipmentparameternotstandard : data.Equipmenttypenotstandard),
  232. value: (this.type != 'type' ? data.Equipmentparameternotstandard : data.Equipmenttypenotstandard)
  233. },
  234. {
  235. name: "已识别:" + (this.type != 'type' ? data.Equipmentparameterstandard : data.Equipmenttypestandard),
  236. value: (this.type != 'type' ? data.Equipmentparameterstandard : data.Equipmenttypestandard)
  237. }
  238. ]
  239. this.sum = data.Sum
  240. })
  241. },
  242. //查询标签列表
  243. getbeenFoundList() {
  244. let getListFetch;
  245. if (this.type == "type") {
  246. getListFetch = queryEqTypeList
  247. } else {
  248. getListFetch = queryEqParamList
  249. }
  250. // console.log(getListFetch)
  251. getListFetch({
  252. data: {
  253. ProjectId: this.projectId,
  254. DataSourceId: this.datasourceId
  255. },
  256. type: this.protocolType
  257. }, res => {
  258. // console.log(res, 'getListFetch')
  259. this.tagList = res.Content
  260. })
  261. },
  262. noWatch(){
  263. console.log()
  264. let param = {
  265. data: {
  266. Content: [
  267. {
  268. Id: this.Id,
  269. [this.type == 'type' ? 'IgnoreKeyEquipmentType' : 'IgnoreKeyEquipmentParameter']: true
  270. }
  271. ]
  272. },
  273. type: this.protocolType
  274. }
  275. updatePoint(param,res => {
  276. console.log(res)
  277. this.$message.success("设置无法识别成功")
  278. this.changeType()
  279. })
  280. }
  281. },
  282. watch:{
  283. }
  284. }
  285. </script>
  286. <style lang="scss" scoped>
  287. .view-find-word {
  288. .find-data {
  289. height: 300px;
  290. .left-view {
  291. width: 300px;
  292. height: 300px;
  293. display: inline-block;
  294. }
  295. .right-view {
  296. width: calc(100% - 305px);
  297. padding: 5px;
  298. box-sizing: border-box;
  299. height: 300px;
  300. overflow-y: auto;
  301. float: right;
  302. }
  303. }
  304. .h10 {
  305. height: 10px;
  306. }
  307. .find-tags {
  308. display: inline-block;
  309. margin: 8px;
  310. }
  311. }
  312. </style>