123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <template>
- <div class="view-find-word">
- <div class="saga-border" style="position:relative;">
- <p class="center">请从下面的原始点位描述中选择"{{type == 'type' ? "设备类型" : "设备参数"}}"关键字</p>
- <div style="position:absolute;top: 0;right: 20px;">
- <el-switch
- @change="changeType(type)"
- v-model="isSwitch">
- </el-switch>
- AI辅助
- </div>
- <div class="h10"></div>
- <div>
- <cut-string v-if="!!Description" :string="Description" :closedStr="closedStr" ref="cutString"></cut-string>
- <p v-else class="center">已处理到最后一条</p>
- </div>
- <div class="h10"></div>
- <div class="center">
- <el-button type="primary" :disabled="!Description" @click="noWatch">此条无法识别</el-button>
- <el-button type="primary" :disabled="!Description" @click="getCutString">继续发现关键字</el-button>
- </div>
- <div class="h10"></div>
- </div>
- <div class="h10"></div>
- <div class="find-data">
- <div class="left-view saga-border">
- <doughnut v-if="!!sum" :sum="sum" type="left" :name="dataName" width="200" height="200" :renderData="echartsData"></doughnut>
- <div v-else class="center">
- <i class="iconwushuju iconfont"></i>
- 暂无数据
- </div>
- </div>
- <div class="right-view saga-border">
- <div class="find-tags" v-for="(tag,index) in tagList" :key="index">
- <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>
- {{type == 'type' ? (tag.EquipmentType + "(" + tag.PointCount + ")") : (tag.EquipmentParameter + "(" + tag.PointCount + ")")}}
- </el-tag>
- </div>
- </div>
- </div>
- <my-dialog :dialogVisible="reNameDialog" @confirm="reNameConfirm" :footer="footer" @cancel="cancel" title="重命名" :isAppendBody="true">
- <h3 class="center">{{name}}</h3>
- <el-input v-model="newName" placeholder="请输入新名称"></el-input>
- </my-dialog>
- </div>
- </template>
- <script>
- import cutString from "@/components/config_point/cut_string"
- import doughnut from "@/components/echarts/doughnut"
- import myDialog from "@/components/el_pack/dialog"
- import {
- findKeysWord,
- findKeysWordType,
- queryDataSourceCount,
- queryEqTypeList,
- queryEqParamList,
- renameType,
- renameParam,
- setParamTer,
- setTypeTer,
- delParamTer,
- delTypeTer,
- updatePoint
- } from "@/fetch/point_http"
- import {
- mapGetters,
- mapActions
- } from "vuex";
- export default {
- props: {
- type: {
- type: String,
- default: "type",
- }
- },
- computed: {
- ...mapGetters("project", [
- "projectId",
- "datasourceId",
- "protocolType"
- ])
- },
- components: {
- cutString,
- doughnut,
- myDialog
- },
- data() {
- return {
- title: "",
- Description: "",
- echartsData: [],
- sum: 0,
- tagList: [],
- reNameDialog: false,
- name: "",
- newName: "",
- footer: {
- cancel: "取消",
- confirm: "确定"
- },
- Id: "",
- dataName: "",
- isSwitch: false,
- closedStr: "",
- }
- },
- created() {},
- mounted() {},
- methods: {
-
- getCutString() {
-
- if (!this.$refs.cutString.getData()) {
- this.$message.error("请确定当前有选择关键字")
- return false
- }
- let setNameFun;
- if (this.type == "type") {
- setNameFun = setTypeTer
- } else {
- setNameFun = setParamTer
- }
- setNameFun({
- data: {
- DataSourceId: this.datasourceId,
- Key: this.$refs.cutString.getData()
- },
- type: this.protocolType
- }, res => {
- this.$message.success("添加成功")
- this.changeType()
- })
- },
-
- cancel() {
- this.reNameDialog = false
- },
-
- closeTag(tag) {
-
- let delFun;
- if (this.type == "type") {
- delFun = delTypeTer
- } else {
- delFun = delParamTer
- }
- let param = {
- data: {
- DataSourceId: this.datasourceId,
- Key: this.type == "type" ? tag : tag
- },
- type: this.protocolType
- }
- this.$confirm("你确定删除该标签?").then(_ => {
- this.delAjax(param, delFun)
- }).catch(_ => {
- })
- },
- delAjax(param, fun) {
- fun(param, res => {
- this.$message.success("删除标签成功")
- this.changeType()
- })
- },
-
- changeName(tag) {
- this.reNameDialog = true
- this.newName = ""
- if (this.type == "type") {
- this.name = tag
- } else {
- this.name = tag
- }
- },
-
- reNameConfirm() {
- let reNameFun;
- if (this.type == "type") {
- reNameFun = renameType
- } else {
- reNameFun = renameParam
- }
- reNameFun({
- data: {
- DataSourceId: this.datasourceId,
- KeyNew: this.newName,
- KeyOld: this.name
- },
- type: this.protocolType
- }, res => {
- this.$message.success("修改成功")
- this.changeType()
- this.cancel()
- })
- },
-
- changeType(type) {
- let queryFun
- this.type = !!type ? type : this.type
- if (this.type == "type") {
- queryFun = findKeysWordType
- } else {
- queryFun = findKeysWord
- }
- queryFun({
- data: {
- DataSourceId: this.datasourceId,
- ProjectId: this.projectId,
- Ai: this.isSwitch
- },
- type: this.protocolType
- }, res => {
- if (!!res.Content.length) {
- this.Description = res.Content[0].Description
-
- if(this.type == "type"){
- this.closedStr = res.Content[0].KeyEquipmentParameter || ''
- }else{
- this.closedStr = res.Content[0].KeyEquipmentType || ''
- }
- this.Id = res.Content[0].PointId
-
- this.$nextTick(_ => {
- this.$refs.cutString.clear()
- })
- } else {
- this.Description = ""
- }
- })
- this.getDataForSource()
- this.getbeenFoundList()
- },
-
- getDataForSource() {
- queryDataSourceCount({
- Filters: {
- Id: this.datasourceId
- }
- }, res => {
- let data = res.Content[0]
- this.dataName = res.Content[0].Name
- this.echartsData = [{
- name: "无法识别:" + (this.type != 'type' ? data.Equipmentparameterignorestandard : data.Equipmenttypeignorestandard),
- value: (this.type != 'type' ? data.Equipmentparameterignorestandard : data.Equipmenttypeignorestandard)
- },
- {
- name: "未识别:" + (this.type != 'type' ? data.Equipmentparameternotstandard : data.Equipmenttypenotstandard),
- value: (this.type != 'type' ? data.Equipmentparameternotstandard : data.Equipmenttypenotstandard)
- },
- {
- name: "已识别:" + (this.type != 'type' ? data.Equipmentparameterstandard : data.Equipmenttypestandard),
- value: (this.type != 'type' ? data.Equipmentparameterstandard : data.Equipmenttypestandard)
- }
- ]
- this.sum = data.Used
- })
- },
-
- getbeenFoundList() {
- let getListFetch;
- if (this.type == "type") {
- getListFetch = queryEqTypeList
- } else {
- getListFetch = queryEqParamList
- }
-
- getListFetch({
- data: {
- ProjectId: this.projectId,
- DataSourceId: this.datasourceId
- },
- type: this.protocolType
- }, res => {
-
- this.tagList = res.Content
- })
- },
- noWatch(){
- console.log()
- let param = {
- data: {
- Content: [
- {
- Id: this.Id,
- [this.type == 'type' ? 'IgnoreKeyEquipmentType' : 'IgnoreKeyEquipmentParameter']: true
- }
- ]
- },
- type: this.protocolType
- }
- updatePoint(param,res => {
- console.log(res)
- this.$message.success("设置无法识别成功")
- this.changeType()
- })
- }
- },
- watch:{
- }
- }
- </script>
- <style lang="scss" scoped>
- .view-find-word {
- .find-data {
- height: 300px;
- .left-view {
- width: 300px;
- height: 300px;
- display: inline-block;
- }
- .right-view {
- width: calc(100% - 305px);
- padding: 5px;
- box-sizing: border-box;
- height: 300px;
- overflow-y: auto;
- float: right;
- }
- }
- .h10 {
- height: 10px;
- }
- .find-tags {
- display: inline-block;
- margin: 8px;
- }
- }
- </style>
|