|
@@ -1,37 +1,41 @@
|
|
|
<template>
|
|
|
<el-dialog title="配置集成工具库" :visible.sync="dialogTableVisible" width="70%">
|
|
|
<el-button type="default" style="margin-bottom: 20px" @click="handleEdit">添加协议</el-button>
|
|
|
- <el-table :data="gridData" border :header-cell-style="{background:'#F3F4F7'}">
|
|
|
+ <el-table :data="gridData" border height="500" :header-cell-style="{background:'#F3F4F7'}">
|
|
|
<el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
|
|
|
- <el-table-column property="name" label="协议类型" show-overflow-tooltip align="center"></el-table-column>
|
|
|
- <el-table-column property="name" label="名称" show-overflow-tooltip align="center"></el-table-column>
|
|
|
+ <el-table-column property="Type" label="协议类型" show-overflow-tooltip align="center"></el-table-column>
|
|
|
+ <el-table-column property="Name" label="名称" show-overflow-tooltip align="center"></el-table-column>
|
|
|
<el-table-column property="address" label="软件" align="center" width="80">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" @click="handleDown(scope.$index,scope.row)">下载</el-button>
|
|
|
+ <template slot-scope="scope" v-if="scope.row.Application">
|
|
|
+ <el-button type="text" download @click="handleDown(scope.$index,scope.row,'Application')">下载</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column property="date" label="特殊说明" align="center"></el-table-column>
|
|
|
- <el-table-column property="name" label="适用厂家" align="center"></el-table-column>
|
|
|
- <el-table-column property="address" label="使用说明" align="center" width="80">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" @click="handleDown(scope.$index,scope.row)">下载</el-button>
|
|
|
+ <el-table-column property="Remark" label="特殊说明" align="center"></el-table-column>
|
|
|
+ <el-table-column property="Scope" label="适用厂家" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.Scope || '通用厂家'}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column property="Manual" label="使用说明" align="center" width="80">
|
|
|
+ <template slot-scope="scope" v-if="scope.row.Manual">
|
|
|
+ <el-button type="text" download @click="handleDown(scope.$index,scope.row,'Manual')">下载</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column property="address" label="配置示例" align="center" width="80">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" @click="handleDown(scope.$index,scope.row)">下载</el-button>
|
|
|
+ <template slot-scope="scope" v-if="scope.row.Eg">
|
|
|
+ <el-button type="text" download @click="handleDown(scope.$index,scope.row,'Eg')">下载</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column property="address" label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button @click="handleEdit(scope.$index, scope.row)">编辑
|
|
|
</el-button>
|
|
|
- <el-popconfirm
|
|
|
+ <!-- <el-popconfirm
|
|
|
title="这是一段内容确定删除吗?"
|
|
|
@onConfirm="handleDelete(scope.$index, scope.row)"
|
|
|
- >
|
|
|
+ > -->
|
|
|
<el-button slot="reference" type="danger" >删除</el-button>
|
|
|
- </el-popconfirm>
|
|
|
+ <!-- </el-popconfirm> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -41,53 +45,54 @@
|
|
|
:visible.sync="innerVisible"
|
|
|
append-to-body>
|
|
|
<el-form :model="form">
|
|
|
- <el-form-item label="协议类型">
|
|
|
- <el-select v-model="form.ProtocolType" filterable @change="handleChangeProtocolType"
|
|
|
+ <el-form-item label="协议类型" v-if="this.title=='添加协议'">
|
|
|
+ <el-select v-model="form.Type" filterable @change="handleChangeProtocolType"
|
|
|
placeholder="请选择">
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label"
|
|
|
:value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="协议类型" v-if="this.title=='编辑协议'">
|
|
|
+ <el-input v-model="form.Type" autocomplete="off" disabled style="width: 220px"/>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="协议名称">
|
|
|
- <el-input v-model="form.name" autocomplete="off" placeholder="请输入协议名称,必须唯一" style="width: 220px"/>
|
|
|
+ <el-input v-model="form.Name" autocomplete="off" placeholder="请输入协议名称,必须唯一" style="width: 220px"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="上传软件版本">
|
|
|
- <upload-files
|
|
|
- v-model="form.copyright"
|
|
|
- :readOnly="false"
|
|
|
- :isShow="1"
|
|
|
- :keys-arr="[]"
|
|
|
- :show-file-list="false"
|
|
|
- @change="changeItem"/>
|
|
|
+ <el-upload
|
|
|
+ action="String"
|
|
|
+ :on-change="changeItem1"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <span style="padding-left:20px;" v-if="file1">文件名:{{file1}}</span>
|
|
|
+ </el-upload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="特殊说明">
|
|
|
- <el-input type="textarea" v-model="form.data1" :autosize="{ minRows: 4, maxRows: 4}" style="width: 220px"/>
|
|
|
+ <el-input type="textarea" v-model="form.Renark" :autosize="{ minRows: 4, maxRows: 4}" style="width: 220px"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="适用厂家">
|
|
|
- <el-input type="textarea" v-model="form.data2" :autosize="{ minRows: 4, maxRows: 4}" style="width: 220px"/>
|
|
|
+ <el-input type="textarea" v-model="form.Scope" :autosize="{ minRows: 4, maxRows: 4}" style="width: 220px"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="使用说明">
|
|
|
- <upload-files
|
|
|
- v-model="form.see"
|
|
|
- :readOnly="false"
|
|
|
- :isShow="1"
|
|
|
- :keys-arr="[]"
|
|
|
- :show-file-list="false"
|
|
|
- @change="changeItem"/>
|
|
|
+ <el-upload
|
|
|
+ action="String"
|
|
|
+ :on-change="changeItem2"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ </el-upload><span style="padding-left:20px;" v-if="file2">文件名:{{file2}}</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="配置实例">
|
|
|
- <upload-files
|
|
|
- v-model="form.new"
|
|
|
- :readOnly="false"
|
|
|
- :isShow="1"
|
|
|
- :keys-arr="[]"
|
|
|
- :show-file-list="false"
|
|
|
- @change="changeItem"/>
|
|
|
+ <el-form-item label="配置示例">
|
|
|
+ <el-upload
|
|
|
+ action="String"
|
|
|
+ :on-change="changeItem3"
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ </el-upload><span style="padding-left:20px;" v-if="file3">文件名:{{file3}}</span>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="innerVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary">保 存</el-button>
|
|
|
+ <el-button type="primary" @click="save">保 存</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</el-dialog>
|
|
@@ -95,7 +100,7 @@
|
|
|
|
|
|
<script>
|
|
|
import uploadFiles from "@/components/business_space/lib/uploadFiles";
|
|
|
-
|
|
|
+ import {queryTxList,dowloadProtocol,addProtocol,updateProtocol,deleteProtocol,uploadProtocol} from "@/fetch/point_http"
|
|
|
export default {
|
|
|
name: "",
|
|
|
components: {uploadFiles},
|
|
@@ -130,6 +135,9 @@
|
|
|
see: '',
|
|
|
new: ''
|
|
|
},
|
|
|
+ file1:"",
|
|
|
+ file2:"",
|
|
|
+ file3:"",
|
|
|
options: [
|
|
|
{
|
|
|
value: 'modbus-tcp',
|
|
@@ -164,28 +172,112 @@
|
|
|
methods: {
|
|
|
show() {
|
|
|
this.dialogTableVisible = true
|
|
|
-
|
|
|
+ this.getTxOption()
|
|
|
},
|
|
|
- handleDown(index, row) {
|
|
|
-
|
|
|
+ getTxOption(object ){
|
|
|
+ let data = {
|
|
|
+ }
|
|
|
+ queryTxList(data,res=>{
|
|
|
+ console.log(res)
|
|
|
+ this.gridData = res.Content
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDown(index, row,name) {
|
|
|
+ let params
|
|
|
+ if(name=='Application'){
|
|
|
+ params = {
|
|
|
+ Property: 'Application',
|
|
|
+ ProtocolId: row.Id
|
|
|
+ }
|
|
|
+ }else if(name=='Manual'){
|
|
|
+ params = {
|
|
|
+ Property: 'Manual',
|
|
|
+ ProtocolId: row.Id
|
|
|
+ }
|
|
|
+ }else if(name=='Eg'){
|
|
|
+ params = {
|
|
|
+ Property: 'Eg',
|
|
|
+ ProtocolId: row.Id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dowloadProtocol(params,res=>{
|
|
|
+ })
|
|
|
},
|
|
|
handleEdit(index, row) {
|
|
|
this.innerVisible = true
|
|
|
if (row) {
|
|
|
this.title = '编辑协议'
|
|
|
+ this.form = row
|
|
|
} else {
|
|
|
this.title = '添加协议'
|
|
|
-
|
|
|
+ }
|
|
|
+ },
|
|
|
+ save(){
|
|
|
+ if(this.title = '添加协议'){
|
|
|
+ let params = this.form
|
|
|
+ addProtocol(params,res=>{
|
|
|
+ console.log(res)
|
|
|
+ if(res.Result=='success'){
|
|
|
+ this.innerVisible = false
|
|
|
+ this.getTxOption()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else if(this.title = '编辑协议'){
|
|
|
+ let params = this.form
|
|
|
+ updateProtocol(params,res=>{
|
|
|
+ if(res.Result=='success'){
|
|
|
+ this.innerVisible = false
|
|
|
+ this.getTxOption()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
handleDelete(index, row) {
|
|
|
console.log(row)
|
|
|
+ let params = {
|
|
|
+ idList:row.id
|
|
|
+ }
|
|
|
+ deleteProtocol(params,res=>{
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
handleChangeProtocolType(val) {
|
|
|
-
|
|
|
},
|
|
|
- changeItem(val) {
|
|
|
-
|
|
|
+ changeItem1(file, fileList) {
|
|
|
+ this.file1 = file.name
|
|
|
+ let formData = new FormData()
|
|
|
+ formData.append('multipartFile',file.raw)
|
|
|
+ formData.append('property','Application')
|
|
|
+ formData.append('protocolId',this.form.Id)
|
|
|
+ uploadProtocol(formData,res=>{
|
|
|
+ if(res.Result=='success'){
|
|
|
+ console.log('文件上传成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeItem2(file, fileList) {
|
|
|
+ this.file2 = file.name
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append('multipartFile',file.raw)
|
|
|
+ formData.append('property','Manual')
|
|
|
+ formData.append('protocolId',this.form.Id)
|
|
|
+ uploadProtocol(formData,res=>{
|
|
|
+ if(res.Result=='success'){
|
|
|
+ console.log('文件上传成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeItem3(file, fileList) {
|
|
|
+ this.file3 = file.name
|
|
|
+ let formData = new FormData()
|
|
|
+ formData.append('multipartFile',file.raw)
|
|
|
+ formData.append('property','Eg')
|
|
|
+ formData.append('protocolId',this.form.Id)
|
|
|
+ uploadProtocol(formData,res=>{
|
|
|
+ if(res.Result=='success'){
|
|
|
+ console.log('文件上传成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|