| | |
| | | <el-col :span="6" style="padding-left: 20px;text-align: left;">数采配置</el-col> |
| | | <el-col :span="18" style="text-align: right;"> |
| | | <el-button size="small" type="primary" @click="fileConfiguration">文件配置</el-button> |
| | | <el-button size="small" type="primary" @click="addItem">检验项新增</el-button> |
| | | <el-button size="small" @click="$parent.closeDataVue()"> |
| | | <span style="color: #3A7BFA;">返回</span> |
| | | </el-button> |
| | |
| | | <div class="table"> |
| | | <el-table :data="tableList.slice((page.current - 1) * page.size,page.current * page.size)" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | tooltip-effect="dark" height="100%" :span-method="spanMethod"> |
| | | tooltip-effect="dark" height="100%"> |
| | | <el-table-column type="index" label="序号" align="center" width="65"></el-table-column> |
| | | <el-table-column prop="deviceName" align="center" min-width="100" label="设备名称"></el-table-column> |
| | | <el-table-column prop="fileType" align="center" label="文件后缀"></el-table-column> |
| | | <el-table-column prop="collectUrl" align="center" min-width="100" show-overflow-tooltip |
| | | label="采集地址"></el-table-column> |
| | | <el-table-column prop="storageUrl" align="center" min-width="100" show-overflow-tooltip |
| | | label="存储地址"></el-table-column> |
| | | <el-table-column prop="ip" align="center" label="IP地址" min-width="100"></el-table-column> |
| | | <el-table-column prop="sample" align="center" label="检验对象" show-overflow-tooltip |
| | | min-width="150"></el-table-column> |
| | | <el-table-column prop="inspectionItemClass" align="center" label="检验项分类" min-width="120"></el-table-column> |
| | |
| | | </el-row> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="数采配置" :visible.sync="dialogVisible4" width="400px"> |
| | | <el-dialog title="文件配置" :visible.sync="dialogVisible4" width="400px"> |
| | | <div class="search_thing" style="margin-bottom: 14px;"> |
| | | <div class="search_label"> |
| | | <span style="color:red;margin-right: 4px;">*</span>IP: |
| | |
| | | </el-row> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="添加检验项" :visible.sync="dialogVisible5" width="1000px"> |
| | | <lims-table :tableData="tableData5" :column="column5" |
| | | :isSelection="true" :handleSelectionChange="selectMethod" |
| | | height="540" :page="page5" :tableLoading="tableLoading5" |
| | | @pagination="pagination5"></lims-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogVisible5 = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitForm5" :loading="loading5">保 存</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | queryDataAcquisitionConfiguration, |
| | | saveDataAcquisitionConfiguration, |
| | | deleteDataAcquisitionConfiguration, |
| | | getDeviceById, |
| | | saveDeviceFileConfiguration, |
| | | queryProductConfiguration, |
| | | getNoConfigProduct, |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | export default { |
| | | name: "dataAcquisitionConfig", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {}, |
| | | components: {limsTable}, |
| | | props: { |
| | | deviceId: { |
| | | type: Number, |
| | | default: () => [] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | }, |
| | | data() { |
| | | // 这里存放数据 |
| | |
| | | ] |
| | | } |
| | | }, |
| | | deleteList: [] |
| | | deleteList: [], |
| | | tableData5: [], |
| | | column5: [ |
| | | {label: '样品名称', prop: 'sample'}, |
| | | {label: '检验项分类', prop: 'inspectionItemClass'}, |
| | | {label: '检验项', prop: 'inspectionItem'}, |
| | | {label: '检验子项', prop: 'inspectionItemSubclass'}, |
| | | ], |
| | | page5: { |
| | | total:0, |
| | | size:20, |
| | | current:1 |
| | | }, |
| | | tableLoading5: false, |
| | | dialogVisible5: false, |
| | | loading5: false, |
| | | multipleSelection: [] |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | }, |
| | | // 方法集合 |
| | | methods: { |
| | | getIndexWithAlphabet(index) { |
| | | const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| | | const letterIndex = index % 26; |
| | | return alphabet.charAt(letterIndex) + (index + 1); |
| | | }, |
| | | rowspan(spanArr, position, spanName) { |
| | | this.tableList.forEach((item, index) => { |
| | | if (index === 0) { |
| | | spanArr.push(1); |
| | | position = 0; |
| | | } else { |
| | | if ( |
| | | this.tableList[index][spanName] === |
| | | this.tableList[index - 1][spanName] |
| | | ) { |
| | | spanArr[position] += 1; |
| | | spanArr.push(0); |
| | | } else { |
| | | spanArr.push(1); |
| | | position = index; |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | spanMethod({ row, column, rowIndex, columnIndex }) { |
| | | // 一般的合并行 |
| | | if ( |
| | | this.spanConfig != undefined && |
| | | this.spanConfig.rows && |
| | | this.spanConfig.rows.length > 0 |
| | | ) { |
| | | let i = null; |
| | | let obj = this.spanConfig.rows.find((item, index) => { |
| | | i = index; |
| | | return item.index == columnIndex; |
| | | }); |
| | | if (obj) { |
| | | const _row = this.spanList[i].arr[rowIndex]; |
| | | const _col = _row > 0 ? 1 : 0; |
| | | return { |
| | | rowspan: _row, |
| | | colspan: _col |
| | | }; |
| | | } |
| | | } |
| | | // 特殊的合并行 |
| | | if ( |
| | | this.spanConfig != undefined && |
| | | this.spanConfig.special && |
| | | this.spanConfig.special.main && |
| | | this.spanConfig.special.rows && |
| | | this.spanConfig.special.rows.length > 0 |
| | | ) { |
| | | let i = null; |
| | | let obj = this.spanConfig.special.rows.find((item, index) => { |
| | | i = index; |
| | | return item.index == columnIndex; |
| | | }); |
| | | if (obj) { |
| | | const _row = this.specialSpanList[i].arr[rowIndex]; |
| | | const _col = _row > 0 ? 1 : 0; |
| | | return { |
| | | rowspan: _row, |
| | | colspan: _col |
| | | }; |
| | | } |
| | | } |
| | | }, |
| | | fileConfiguration() { |
| | | this.dialogVisible4 = true; |
| | | if (this.tableList[0]) { |
| | | this.$set(this.configForm, "fileType", this.tableList[0].fileType); |
| | | this.$set(this.configForm, "collectUrl", this.tableList[0].collectUrl); |
| | | this.$set(this.configForm, "storageUrl", this.tableList[0].storageUrl); |
| | | this.$set(this.configForm, "ip", this.tableList[0].ip); |
| | | this.$set( |
| | | this.configForm, |
| | | "entrustCode", |
| | | this.tableList[0].entrustCode |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "sampleCode", |
| | | this.tableList[0].sampleCode |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "dbFileName", |
| | | this.tableList[0].dbFileName |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "fiberOpticRibbon", |
| | | this.tableList[0].fiberOpticRibbon |
| | | ) |
| | | } |
| | | }, |
| | | // 查询列表 |
| | | init() { |
| | | queryDataAcquisitionConfiguration({ deviceId: this.deviceId, isDevice: false }).then(res => { |
| | | queryDataAcquisitionConfiguration({ deviceId: this.deviceId }).then(res => { |
| | | this.tableList = res.data; |
| | | this.tableList.forEach(i => { |
| | | let isIncludes = false |
| | |
| | | if (!isIncludes && i.formula) { |
| | | i.formula = i.formula.slice(1, -1) |
| | | } |
| | | i.sample = i.sample |
| | | .replace(/"/g, "") |
| | | .replace(/],/g, ";") |
| | | .replace(/\[/g, "") |
| | | .replace(/]/g, ""); |
| | | }); |
| | | if (this.tableList[0]) { |
| | | this.$set(this.configForm, "fileType", this.tableList[0].fileType); |
| | | this.$set( |
| | | this.configForm, |
| | | "collectUrl", |
| | | this.tableList[0].collectUrl |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "storageUrl", |
| | | this.tableList[0].storageUrl |
| | | ); |
| | | this.$set(this.configForm, "ip", this.tableList[0].ip); |
| | | this.$set( |
| | | this.configForm, |
| | | "entrustCode", |
| | | this.tableList[0].entrustCode |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "sampleCode", |
| | | this.tableList[0].sampleCode |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "dbFileName", |
| | | this.tableList[0].dbFileName |
| | | ); |
| | | this.$set( |
| | | this.configForm, |
| | | "fiberOpticRibbon", |
| | | this.tableList[0].fiberOpticRibbon |
| | | ) |
| | | } |
| | | // 一般的合并行 |
| | | if ( |
| | | this.spanConfig != undefined && |
| | | this.spanConfig.rows && |
| | | this.spanConfig.rows.length > 0 |
| | | ) { |
| | | this.spanList = []; |
| | | this.spanConfig.rows.forEach((item, index) => { |
| | | this.spanList.push({ |
| | | arr: [], |
| | | position: 0 |
| | | }); |
| | | this.rowspan( |
| | | this.spanList[index].arr, |
| | | this.spanList[index].position, |
| | | item.name |
| | | ); |
| | | }); |
| | | } |
| | | // 特殊的合并行 |
| | | if ( |
| | | this.spanConfig != undefined && |
| | | this.spanConfig.special && |
| | | this.spanConfig.special.main && |
| | | this.spanConfig.special.rows && |
| | | this.spanConfig.special.rows.length > 0 |
| | | ) { |
| | | this.specialSpanList = []; |
| | | this.spanConfig.special.rows.forEach((item, index) => { |
| | | this.specialSpanList.push({ |
| | | arr: [], |
| | | position: 0 |
| | | }); |
| | | this.rowspan( |
| | | this.specialSpanList[index].arr, |
| | | this.specialSpanList[index].position, |
| | | this.spanConfig.special.main |
| | | ); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | getIndexWithAlphabet(index) { |
| | | const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| | | const letterIndex = index % 26; |
| | | return alphabet.charAt(letterIndex) + (index + 1); |
| | | }, |
| | | // 打开新增检验项弹框 |
| | | addItem () { |
| | | this.dialogVisible5 = true; |
| | | this.getList5() |
| | | }, |
| | | getList5() { |
| | | this.tableLoading5 = true; |
| | | getNoConfigProduct({deviceId: this.deviceId, ...this.page5 }).then(res => { |
| | | this.tableLoading5 = false; |
| | | this.tableData5 = res.data.records |
| | | this.page5.total = res.data.total |
| | | }).catch(err => { |
| | | this.tableLoading5 = false; |
| | | }) |
| | | }, |
| | | pagination5 (page) { |
| | | this.page5.size = page.limit |
| | | this.getList5() |
| | | }, |
| | | // 表格选择方法 |
| | | selectMethod(val) { |
| | | this.multipleSelection = val |
| | | }, |
| | | // 提交新增检验项 |
| | | submitForm5 () { |
| | | this.loading5 = true; |
| | | saveDataAcquisitionConfiguration({ |
| | | deviceId: this.deviceId, |
| | | dataConfigList: this.multipleSelection, |
| | | }).then(res => { |
| | | this.loading5 = false; |
| | | this.dialogVisible5 = false; |
| | | this.init(); |
| | | this.$message.success("添加成功"); |
| | | }).catch(err => { |
| | | this.loading5 = false; |
| | | }) |
| | | }, |
| | | // 打开文件配置弹框 |
| | | fileConfiguration() { |
| | | this.dialogVisible4 = true; |
| | | this.getInfo() |
| | | }, |
| | | // 查询文件配置信息 |
| | | getInfo() { |
| | | getDeviceById({deviceId: this.deviceId}).then(res => { |
| | | this.$set(this.configForm, "fileType", res.data.fileType); |
| | | this.$set(this.configForm, "collectUrl", res.data.collectUrl); |
| | | this.$set(this.configForm, "storageUrl", res.data.storageUrl); |
| | | this.$set(this.configForm, "ip", res.data.ip); |
| | | this.$set(this.configForm, "entrustCode", res.data.entrustCode); |
| | | this.$set(this.configForm, "sampleCode", res.data.sampleCode); |
| | | this.$set(this.configForm, "dbFileName", res.data.dbFileName); |
| | | this.$set(this.configForm, "fiberOpticRibbon", res.data.fiberOpticRibbon) |
| | | }) |
| | | }, |
| | | // 提交文件配置 |
| | | submitForm4() { |
| | | const obj = Object.assign({ |
| | | deviceId: this.deviceId, |
| | |
| | | collectUrl: this.configForm.collectUrl, |
| | | storageUrl: this.configForm.storageUrl, |
| | | ip: this.configForm.ip, |
| | | isDevice: true, |
| | | entrustCode: this.configForm.entrustCode, |
| | | sampleCode: this.configForm.sampleCode, |
| | | dbFileName: this.configForm.dbFileName, |
| | | fiberOpticRibbon: this.configForm.fiberOpticRibbon |
| | | }); |
| | | this.upLoad4 = true; |
| | | saveDataAcquisitionConfiguration({ deviceId: this.deviceId, ...obj }).then(res => { |
| | | saveDeviceFileConfiguration({ deviceId: this.deviceId, ...obj }).then(res => { |
| | | if (res.code == 200) { |
| | | // this.tableList = res.data; |
| | | this.dialogVisible4 = false; |
| | | this.init(); |
| | | this.$message.success("操作成功"); |
| | |
| | | this.upLoad4 = false; |
| | | }); |
| | | }, |
| | | // 打开数采配置弹框 |
| | | dataConfig(row) { |
| | | this.configForm = { |
| | | deviceId: row.deviceId, |
| | |
| | | inspectionItemClass: row.inspectionItemClass, |
| | | }; |
| | | this.dialogVisible3 = true; |
| | | queryDataAcquisitionConfiguration({ |
| | | queryProductConfiguration({ |
| | | deviceId: this.deviceId, |
| | | inspectionItem: row.inspectionItem.trim(), |
| | | isDevice: true, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 提交数采配置 |
| | | submitForm3() { |
| | | this.$refs.configForm.validate(valid => { |
| | | // 表单校验 |