123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <!--steps3的左侧-->
- <template>
- <div class="steps3-dialog-main">
- <select-one @check="typeCheck" :renderData="typeArr" :isSelected="true" isCheckInfo="EquipmentMarkStandardized" infosKey="EquipmentType" :name="'原始点位描述中识别的设备类型'"></select-one>
- <select-one @check="paramCheck" :renderData="identifyArr" infosKey="ownMess" :name="'已标准化的设备标识'"></select-one>
- <div class="own-collape">
- <ident-collape v-if="!isNull" ref="ident" @saved="resetTwo" :renderData="identDataArr"></ident-collape>
- <div v-else class="h100">
- <div class="own-table-view">
- <handsontable-component ref="handsontable"></handsontable-component>
- <div class="center">
- <el-button type="primary" @click="saveData">保存</el-button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import selectOne from "@/components/config_point/select_one"
- import {
- getStandType,
- queryPoint,
- updatePoint,
- getStandParam,
- getNullofParam
- } from "@/fetch/point_http"
- import tempCollape from "./3_temps"
- import identCollape from "./3_identify"
- import {
- mapGetters,
- mapActions
- } from "vuex";
- import handsontableComponent from "@/components/common/handsontable"
- export default {
- name: "updateParam",
- data() {
- return {
- activeName: '1',
- typeArr: [],
- identifyArr: [],
- KeyEquipmentType: "",
- identDataArr: [],
- isNull: false,
- paramData: {},
- Typs: {}
- }
- },
- computed: {
- ...mapGetters("project", [
- "projectId",
- "datasourceId",
- "protocolType"
- ])
- },
- created() {
- this.getData()
- },
- mounted() {},
- methods: {
- getData() {
- getStandType({
- data: {
- DataSourceId: this.datasourceId
- },
- type: this.protocolType
- }, res => {
- this.typeArr = res.Content
- })
- },
- resetTwo() {
- console.log("触发回调")
- this.getData()
- // this.getParamList(this.Typs)
- },
- typeCheck(item) {
- console.log(item, "item")
- this.getParamList(item)
- },
- paramCheck(param) {
- this.paramData = param
- if (!!param.EquipmentMark && param.EquipmentMark == "空") {
- //空查询分组信息
- getNullofParam({
- data: {
- DataSourceId: this.datasourceId,
- KeyEquipmentType: this.KeyEquipmentType
- },
- type: this.protocolType
- }, res => {
- console.log(res)
- this.isNull = false
- this.identDataArr = res.Content
- })
- } else {
- //不是空的情况查询点位列表
- console.log(param)
- queryPoint({
- data: {
- Filters: {
- equipmentMark: param.EquipmentMark,
- KeyEquipmentType: param.EquipmentType,
- Used: true
- },
- PageNumber: 1,
- PageSize: 100
- },
- type: this.protocolType
- }, res => {
- this.isNull = true
- this.identDataArr = res.Content
- let headers = {
- "modbus-tcp": [{
- InfoPointName: "*slave_id",
- InfoPointCode: "SlaveId",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*registers_address ",
- InfoPointCode: "RegistersAddress",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*registers_quality",
- InfoPointCode: "RegistersQuality",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*convert_type",
- InfoPointCode: "ConvertType",
- InputMode: "select",
- DataSource: [{
- Code: "1",
- Name: "位"
- },
- {
- Code: "2",
- Name: "单字"
- }, {
- Code: "3",
- Name: "双字"
- }, {
- Code: "4",
- Name: "四字"
- }
- ],
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*翻转规则",
- InfoPointCode: "RevertRule",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- }
- ],
- "bacnet-ip": [{
- InfoPointName: "*device_id",
- InfoPointCode: "DeviceId",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*instance_number",
- InfoPointCode: "InstanceNumber",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*data_type",
- InfoPointCode: "DataType",
- DataSource: [{
- Code: "analogInput",
- Name: "analogInput"
- },
- {
- Code: "analogOutput",
- Name: "analogOutput"
- },
- {
- Code: "analogValue",
- Name: "analogValue"
- },
- {
- Code: "binaryInput",
- Name: "binaryInput"
- },
- {
- Code: "binaryOutput",
- Name: "binaryOutput"
- },
- {
- Code: "binaryValue",
- Name: "binaryValue"
- },
- {
- Code: "multiStateInput",
- Name: "multiStateInput"
- },
- {
- Code: "multiStateOutput",
- Name: "multiStateOutput"
- },
- {
- Code: "multiStateValue",
- Name: "multiStateValue"
- }
- ],
- InputMode: "select",
- Visible: true,
- FirstTag: ""
- }
- ],
- "opc": [{
- InfoPointName: "*item",
- InfoPointCode: "Item",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- }],
- "knx": [{
- InfoPointName: "*group_address",
- InfoPointCode: "GroupAddress",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- }],
- "mqtt": [{
- InfoPointName: "*topic",
- InfoPointCode: "Topic",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- }],
- "amqp": [{
- InfoPointName: "*exchange",
- InfoPointCode: "Exchange",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*type",
- InfoPointCode: "Type",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- },
- {
- InfoPointName: "*routing_key ",
- InfoPointCode: "RoutingKey",
- InputMode: "B1",
- Visible: true,
- FirstTag: ""
- }
- ]
- }
- let allData = this.identDataArr,
- data = {
- data: allData,
- colHeaders: [],
- columns: [],
- maxRows: allData.length,
- }
- headers[this.protocolType].map(item => {
- data.columns.push({
- data: item.InfoPointCode,
- readOnly: true,
- })
- data.colHeaders.push(item.InfoPointName)
- })
- data.columns.splice(0, 0, {
- data: 'Description',
- readOnly: true
- })
- data.columns.splice(0, 0, {
- data: 'EquipmentMark'
- })
- data.colHeaders.splice(0, 0, '原始点位描述')
- data.colHeaders.splice(0, 0, '设备标识')
- data.columns.push({
- data: 'LocationFlag',
- readOnly: true
- })
- data.columns.push({
- data: 'Remarks',
- readOnly: true
- })
- data.colHeaders.push('位置标签')
- data.colHeaders.push('备注')
- this.$nextTick(_ => {
- this.$refs.handsontable.init(data)
- })
- })
- }
- },
- saveData() {
- console.log(this.identDataArr, 222)
- let data = this.identDataArr.map(item => {
- return {
- EquipmentMark: !!item.EquipmentMark ? item.EquipmentMark : null,
- Id: item.Id,
- }
- })
- updatePoint({
- data: {
- Content: data
- },
- type: this.protocolType
- }, res => {
- this.$message.success("保存成功")
- this.resetTwo()
- })
- },
- //通过type获取param的list
- getParamList(item) {
- this.Typs = item
- console.log(item)
- this.KeyEquipmentType = item.EquipmentType
- getStandParam({
- data: {
- DataSourceId: this.datasourceId,
- KeyEquipmentType: item.EquipmentType
- },
- type: this.protocolType
- }, res => {
- console.log(res, "res")
- this.identifyArr = res.Content.map(item => {
- item.ownMess = item.EquipmentMark + '(涉及原始点位:' + item.PointCount + ')'
- return item
- })
- })
- }
- },
- components: {
- selectOne,
- handsontableComponent,
- tempCollape,
- identCollape
- }
- }
- </script>
- <style lang="scss" scoped>
- .steps3-dialog-main {
- height: 400px;
- .own-table-view {
- height: calc(100% - 50px);
- }
- .own-collape {
- border: 1px solid #ccc;
- float: right;
- width: calc(100% - 490px);
- height: 340px;
- position: relative;
- }
- }
- </style>
|