Commit d5176562 authored by liwei's avatar liwei

语音部署指令位置页面和语音指令页面开发,以及AI无人站换热站搜索框改造

parent c6775349
...@@ -2,7 +2,7 @@ import httpTwo from '../httpTwo' ...@@ -2,7 +2,7 @@ import httpTwo from '../httpTwo'
export const getVoiceCommandsData = (item) => { export const getVoiceCommandsData = (item) => {
return httpTwo.get(`/busVoiceCommands/list?page=${item.page}&rows=${item.pageSize}&stationId=${item.stationId}&ipAddress=${item.ipAddress}&macAddress=${item.macAddress}&startTime=${item.startTime}&endTime=${item.endTime}`) return httpTwo.get(`/busVoiceCommands/list?page=${item.page}&rows=${item.rows}&stationId=${item.stationId}&ipAddress=${item.ipAddress}&macAddress=${item.macAddress}&startTime=${item.startTime}&endTime=${item.endTime}`)
} }
export const addVoiceCommands = (item) => { export const addVoiceCommands = (item) => {
...@@ -18,5 +18,5 @@ export const updateVoiceCommands = (item) => { ...@@ -18,5 +18,5 @@ export const updateVoiceCommands = (item) => {
} }
export const exportVoiceCommands = (item) => { export const exportVoiceCommands = (item) => {
return httpTwo.get(`/busVoiceCommands/export`) return httpTwo.get(`/busVoiceCommands/export?stationId=${item.stationId}&ipAddress=${item.ipAddress}&macAddress=${item.macAddress}&startTime=${item.startTime}&endTime=${item.endTime}`,'','',{responseType:'blob'})
} }
...@@ -3,7 +3,7 @@ import axios from "axios"; ...@@ -3,7 +3,7 @@ import axios from "axios";
export const getVoiceCommandsLocationData = (item) => { export const getVoiceCommandsLocationData = (item) => {
return httpTwo.get(`/busVoiceCommandsLocation/list?page=${item.page}&rows=${item.pageSize}&stationId=${item.stationId}&ipAddress=${item.ipAddress}&macAddress=${item.macAddress}`) return httpTwo.get(`/busVoiceCommandsLocation/list?page=${item.page}&rows=${item.rows}&stationId=${item.stationId}&ipAddress=${item.ipAddress}&macAddress=${item.macAddress}`)
} }
export const addVoiceCommandsLocation = (item) => { export const addVoiceCommandsLocation = (item) => {
...@@ -17,3 +17,7 @@ export const deleteVoiceCommandsLocation = (id) => { ...@@ -17,3 +17,7 @@ export const deleteVoiceCommandsLocation = (id) => {
export const updateVoiceCommandsLocation = (item) => { export const updateVoiceCommandsLocation = (item) => {
return httpTwo.put(`/busVoiceCommandsLocation/update/${item.businessId}`,item) return httpTwo.put(`/busVoiceCommandsLocation/update/${item.businessId}`,item)
} }
export const getVoiceCommandsLocationDetail = (id) => {
return httpTwo.get(`/busVoiceCommandsLocation/detail/${id}`)
}
...@@ -218,24 +218,34 @@ function getSupplys(){ ...@@ -218,24 +218,34 @@ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -262,8 +272,8 @@ onMounted(() => { ...@@ -262,8 +272,8 @@ onMounted(() => {
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -157,24 +157,34 @@ function getSupplys(){ ...@@ -157,24 +157,34 @@ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -197,8 +207,8 @@ getSupplys(); ...@@ -197,8 +207,8 @@ getSupplys();
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -165,24 +165,34 @@ function getSupplys(){ ...@@ -165,24 +165,34 @@ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -205,8 +215,8 @@ getSupplys(); ...@@ -205,8 +215,8 @@ getSupplys();
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -182,24 +182,34 @@ function getSupplys(){ ...@@ -182,24 +182,34 @@ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -222,8 +232,8 @@ getSupplys(); ...@@ -222,8 +232,8 @@ getSupplys();
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -182,24 +182,34 @@ function getSupplys(){ ...@@ -182,24 +182,34 @@ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -222,8 +232,8 @@ getSupplys(); ...@@ -222,8 +232,8 @@ getSupplys();
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -3,7 +3,8 @@ import {reactive, ref} from "vue"; ...@@ -3,7 +3,8 @@ import {reactive, ref} from "vue";
import zhCn from "element-plus/dist/locale/zh-cn.mjs" import zhCn from "element-plus/dist/locale/zh-cn.mjs"
import axios from "axios"; import axios from "axios";
import store from "../../store"; import store from "../../store";
import {getVoiceCommandsLocationData,deleteVoiceCommandsLocation,addVoiceCommandsLocation,updateVoiceCommandsLocation} from "../../api/AIStation/VoiceCommandLocation"; import {getVoiceCommandsLocationData,deleteVoiceCommandsLocation,addVoiceCommandsLocation,updateVoiceCommandsLocation,getVoiceCommandsLocationDetail} from "../../api/AIStation/VoiceCommandLocation";
import { ElMessage } from 'element-plus';
// 查询条件 // 查询条件
const queryParams = ref({ const queryParams = ref({
...@@ -14,10 +15,10 @@ const queryParams = ref({ ...@@ -14,10 +15,10 @@ const queryParams = ref({
//供热站详情数据 //供热站详情数据
const singleDetails = ref({ const singleDetails = ref({
stationName: '供热站1',//换热站名称 stationName: '',//换热站名称
code: '1',//编号 code: '',//编号
ipAddress: '192.168.11.11', ipAddress: '',
macAddress: 'A2-B2-C2-D2-02-2C', macAddress: '',
}) })
//新增或修改表单参数 //新增或修改表单参数
...@@ -32,20 +33,12 @@ const addOrUpdateForm = ref({ ...@@ -32,20 +33,12 @@ const addOrUpdateForm = ref({
//列表数据 //列表数据
const voiceCommandLocationData = ref([ const voiceCommandLocationData = ref([
{ {
businessId: '1', businessId: '',
stationId: 'e1289fbe-9d71-4426-a500-d3024a8c84c1', stationId: '',
code: '1111', code: '',
stationName: '换热站1', stationName: '',
macAddress: 'A1-B1-C1-D1-01-1C', macAddress: '',
ipAddress: '192.168.11.1', ipAddress: '',
},
{
businessId: '2',
stationId: 'b6216c70-d0c0-465f-8019-594dfa954a7c',
code: '222',
stationName: '换热站2',
macAddress: 'A2-B2-C2-D2-02-2C',
ipAddress: '192.168.11.2',
} }
]) ])
...@@ -55,7 +48,7 @@ const props = { multiple: true, emitPath: false } ...@@ -55,7 +48,7 @@ const props = { multiple: true, emitPath: false }
//换热站列表 //换热站列表
const options = ref([]) const options = ref([])
// 分页 // 分页
const Page = reactive({total: 0, pageSize: 20, page: 1}); const Page = reactive({total: 0, rows: 20, page: 1});
// 详情弹窗 // 详情弹窗
const detailOpen = ref(false) const detailOpen = ref(false)
//新增 修改弹窗 //新增 修改弹窗
...@@ -69,7 +62,7 @@ function loadData(){ ...@@ -69,7 +62,7 @@ function loadData(){
console.log('调用了LoadData') console.log('调用了LoadData')
const item = { const item = {
page: Page.page, page: Page.page,
pageSize: Page.pageSize, rows: Page.rows,
stationId: queryParams.value.stationId, stationId: queryParams.value.stationId,
ipAddress: queryParams.value.ipAddress, ipAddress: queryParams.value.ipAddress,
macAddress: queryParams.value.macAddress, macAddress: queryParams.value.macAddress,
...@@ -78,22 +71,40 @@ function loadData(){ ...@@ -78,22 +71,40 @@ function loadData(){
//查询数据 //查询数据
getVoiceCommandsLocationData(item).then(res => { getVoiceCommandsLocationData(item).then(res => {
voiceCommandLocationData.value = res.rows voiceCommandLocationData.value = res.rows
Page.rows = res.pageSize
Page.total = res.total
}) })
} }
const handleFormData = async () => { const handleFormData = async () => {
//在options.value中查找出value值等于addOrUpdateForm.value.stationId的label
const option = options.value.find(item => item.stationId === addOrUpdateForm.value.stationId);
console.log('option:',option)
const item = { const item = {
businessId: addOrUpdateForm.value.businessId, businessId: addOrUpdateForm.value.businessId,
stationId: addOrUpdateForm.value.stationId, stationId: addOrUpdateForm.value.stationId,
code: addOrUpdateForm.value.code, code: addOrUpdateForm.value.code,
ipAddress: addOrUpdateForm.value.ipAddress, ipAddress: addOrUpdateForm.value.ipAddress,
macAddress: addOrUpdateForm.value.macAddress, macAddress: addOrUpdateForm.value.macAddress,
stationName: option.stationName,
supplyId: option.supplyId,
unitId: option.unitId,
flag: '1',
delflag: '0'
} }
if (addOrUpdateForm.value.businessId === ''){ if (addOrUpdateForm.value.businessId === ''){
console.log('走新增-----') console.log('走新增-----')
//新增 调新增的接口 //新增 调新增的接口
addVoiceCommandsLocation(item).then(res => { addVoiceCommandsLocation(item).then(res => {
if (res.code === 1){
//mac和ip重复 提示一个警告信息
ElMessage({
message: '当前mac和ip地址已重复,请重新输入',
type: 'warning'
});
}else{
dialogFormVisible.value = false dialogFormVisible.value = false
}
}).catch((err) => { }).catch((err) => {
console.log('err:',err) console.log('err:',err)
dialogFormVisible.value = false dialogFormVisible.value = false
...@@ -103,7 +114,15 @@ const handleFormData = async () => { ...@@ -103,7 +114,15 @@ const handleFormData = async () => {
} else { } else {
console.log('走修改---') console.log('走修改---')
updateVoiceCommandsLocation(item).then(res => { updateVoiceCommandsLocation(item).then(res => {
if (res.code === 1){
//mac和ip重复 提示一个警告信息
ElMessage({
message: '当前mac和ip地址已重复,请重新输入',
type: 'warning'
});
} else{
dialogFormVisible.value = false dialogFormVisible.value = false
}
}).catch((err) => { }).catch((err) => {
console.log('err:',err) console.log('err:',err)
dialogFormVisible.value = false dialogFormVisible.value = false
...@@ -132,12 +151,14 @@ const tableBodyClass = data => { // 表体样式 ...@@ -132,12 +151,14 @@ const tableBodyClass = data => { // 表体样式
// 分页大小改变时触发 // 分页大小改变时触发
const handleSizeChange = (val) => { const handleSizeChange = (val) => {
Page.pageSize = val; Page.rows = val;
loadData()
}; };
// 当前页改变时触发 // 当前页改变时触发
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
Page.page = val; Page.page = val;
loadData()
}; };
//详情按钮触发 //详情按钮触发
...@@ -162,9 +183,14 @@ function handleAddButton(row) { ...@@ -162,9 +183,14 @@ function handleAddButton(row) {
//修改按钮触发 //修改按钮触发
function handleUpdateButton(row) { function handleUpdateButton(row) {
addOrUpdateForm.value = row getVoiceCommandsLocationDetail(row.businessId).then(res => {
addOrUpdateForm.value = res.data
formTitle.value = '修改' formTitle.value = '修改'
dialogFormVisible.value = true dialogFormVisible.value = true
}).catch((err) => {
console.log('err:',err)
dialogFormVisible.value = false
})
} }
//删除按钮 //删除按钮
...@@ -230,21 +256,32 @@ function getSupplys(){ ...@@ -230,21 +256,32 @@ function getSupplys(){
options.length = 0; options.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId === enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -268,8 +305,8 @@ getSupplys() ...@@ -268,8 +305,8 @@ getSupplys()
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -312,7 +349,7 @@ getSupplys() ...@@ -312,7 +349,7 @@ getSupplys()
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination v-model:current-page="Page.page" v-model:page-size="Page.pageSize" <el-pagination v-model:current-page="Page.page" v-model:page-size="Page.rows"
:page-sizes="[20, 30, 50, 100, 200, 300, 400]" :disabled="disabled" :page-sizes="[20, 30, 50, 100, 200, 300, 400]" :disabled="disabled"
layout="total, sizes, prev, pager, next, jumper" :total="Page.total" layout="total, sizes, prev, pager, next, jumper" :total="Page.total"
@size-change="handleSizeChange" @current-change="handleCurrentChange" class="pagination"/> @size-change="handleSizeChange" @current-change="handleCurrentChange" class="pagination"/>
...@@ -360,12 +397,12 @@ getSupplys() ...@@ -360,12 +397,12 @@ getSupplys()
<el-form-item label="换热站:"> <el-form-item label="换热站:">
<!-- <el-cascader :options="options" v-model="addOrUpdateForm.stationId" :props="props" collapse-tags clearable :show-all-levels="false"--> <!-- <el-cascader :options="options" v-model="addOrUpdateForm.stationId" :props="props" collapse-tags clearable :show-all-levels="false"-->
<!-- placeholder="请选择" style="min-width: 210px;" />--> <!-- placeholder="请选择" style="min-width: 210px;" />-->
<el-select v-model="addOrUpdateForm.stationId" placeholder="请选择"> <el-select v-model="addOrUpdateForm.stationId" placeholder="请选择" filterable clearable>
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -9,57 +9,32 @@ import {getVoiceCommandsData,deleteVoiceCommands,addVoiceCommands,updateVoiceCom ...@@ -9,57 +9,32 @@ import {getVoiceCommandsData,deleteVoiceCommands,addVoiceCommands,updateVoiceCom
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
const props = { multiple: true, emitPath: false } const props = { multiple: true, emitPath: false }
const stationId = ref();
const loading = ref(true); const loading = ref(true);
// 分页 // 分页
const Page = reactive({total: 0, pageSize: 20, page: 1}); const Page = reactive({page: 1, rows: 20, total: 0});
const VoiceCommandData = ref([ const VoiceCommandData = ref([
{ {
stationId: '1', stationName: '',
question: '播报天气预报', question: '',
answer: '今天天气晴朗', answer: '',
updateDate: '2023-02-01 12:00:00', updateDate: '',
macAddress: 'A1-B1-C1-D1-01-1C', macAddress: '',
ipAddress: '192.168.11.1', ipAddress: '',
result: '0' result: ''
},
{
stationId: '2',
question: '说一下用电量',
answer: '当前站电表抄表据和近三日用量',
updateDate: '2024-12-11 12:00:00',
macAddress: 'A2-B2-C2-D2-02-2C',
ipAddress: '192.168.11.2',
result: '1'
} }
]) ])
// 详情弹窗 // 详情弹窗
const detailOpen = ref(false) const detailOpen = ref(false)
const singleDetails = { const singleDetails = {
updateDate: '2023-02-11 12:00:00', updateDate: '',
stationId: '1', stationId: '',
result: '1', result: '',
question: '说一下用电量', question: '',
answer: '当前站电表抄表据和近三日用量', answer: '',
ipAddress: '192.168.11.2', ipAddress: '',
macAddress: 'A2-B2-C2-D2-02-2C', macAddress: '',
} }
// 供热站
const heatStationList = [
{
label: '行政区供热站',
value: 1
},
{
label: '东部供热站',
value: 2
},
{
label: '小王庄供热站',
value: 3
}
]
const queryParams = ref({ const queryParams = ref({
stationId: '', stationId: '',
...@@ -74,7 +49,7 @@ function loadData(){ ...@@ -74,7 +49,7 @@ function loadData(){
console.log('调用了LoadData') console.log('调用了LoadData')
const item = { const item = {
page: Page.page, page: Page.page,
pageSize: Page.pageSize, rows: Page.rows,
stationId: queryParams.value.stationId, stationId: queryParams.value.stationId,
startTime: queryParams.value.startTime, startTime: queryParams.value.startTime,
endTime: queryParams.value.endTime, endTime: queryParams.value.endTime,
...@@ -85,12 +60,31 @@ function loadData(){ ...@@ -85,12 +60,31 @@ function loadData(){
//查询数据 //查询数据
getVoiceCommandsData(item).then(res => { getVoiceCommandsData(item).then(res => {
VoiceCommandData.value = res.rows VoiceCommandData.value = res.rows
Page.rows = res.pageSize
Page.total = res.total
}) })
} }
loadData() loadData()
const handleExport = () => { const handleExport = () => {
console.log('导出:', queryParams.value); const item = {
stationId: queryParams.value.stationId,
startTime: queryParams.value.startTime,
endTime: queryParams.value.endTime,
ipAddress: queryParams.value.ipAddress,
macAddress: queryParams.value.macAddress,
}
exportVoiceCommands(item).then(res => {
const blob = new Blob([res])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '语音指令信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
}; };
// 重置 // 重置
...@@ -114,65 +108,39 @@ function getEnterprise(){ ...@@ -114,65 +108,39 @@ function getEnterprise(){
} }
} }
//获取换热机组列表
// function getSupplys(){
// loading.value = true;
// // tableData.length = 0;
// options.length = 0;
// stationId.length = 0;
// const result = store.getters.getEnterprise();
// if (result) {
// result.forEach(element=>{
// if(element.enterpriseId=== enterpriseId.value){
// if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
// element.serviceCenterList.forEach(center=>{
// let c = [];
// center.supplyList.forEach(supply => {
// let chi = [];
// supply.transferList.forEach(unit => {
// chi.push({ value: unit.unitId, label: unit.unitName });
// });
// c.push({ children: chi, label: supply.supplyName});
// });
// options.push({children: c, label: center.serviceCenterName});
// })
// }else{
// element.supplyList.forEach(element => {
// let chi = [];
// element.transferList.forEach(unit => {
// chi.push({ value: unit.unitId, label: unit.unitName });
// })
// options.push({ children: chi, label: element.supplyName});
// })
// }
// }
// });
// }
// // stationId.value.push(options[0].children[0].children[0].value);
// }
//获取换热机组列表 //获取换热机组列表
function getSupplys(){ function getSupplys(){
loading.value = true; loading.value = true;
// tableData.length = 0; // tableData.length = 0;
options.length = 0; options.length = 0;
stationId.length = 0;
const result = store.getters.getEnterprise(); const result = store.getters.getEnterprise();
if (result) { if (result) {
console.log('result:',result)
result.forEach(element=>{ result.forEach(element=>{
let allItems = [] let allItems = []
if(element.enterpriseId=== enterpriseId.value){ if(element.enterpriseId === enterpriseId.value){
if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){ if(element.enterpriseId === "9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()){
element.serviceCenterList.forEach(center=>{//遍历一级目录下的 element.serviceCenterList.forEach(center=>{//遍历一级目录下的
center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的 center.supplyList.forEach(supply => {//拿到一级目录下的然后遍历它二级目录下的
supply.transferList.forEach(unit => {//拿到 console.log('supply:',supply)
allItems.push({ value: unit.unitId, label: unit.unitName }) supply.stationList.forEach(station => {//拿到
let unitIdList = []
supply.transferList.forEach(unit => {
//unit的stationId等于station的stationId的话,就把这个unit的unitId添加到unitIdList中
if(unit.stationId === station.stationId){
unitIdList.push(unit.unitId)
}
})
//将unitIdList集合按逗号分隔成字符串
let unitId = unitIdList.join(',')
allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId,unitId: unitId})
}); });
}); });
}) })
}else{ }else{
element.supplyList.forEach(element => { element.supplyList.forEach(element => {
element.transferList.forEach(unit => { element.stationList.forEach(station => {
allItems.push({ value: unit.unitId, label: unit.unitName }) allItems.push({ stationId: station.stationId, stationName: station.stationName,supplyId: station.supplyId})
}) })
}) })
} }
...@@ -192,12 +160,14 @@ const tableBodyClass = data => { // 表体样式 ...@@ -192,12 +160,14 @@ const tableBodyClass = data => { // 表体样式
} }
// 分页大小改变时触发 // 分页大小改变时触发
const handleSizeChange = (val) => { const handleSizeChange = (val) => {
Page.pageSize = val; Page.rows = val;
loadData()
}; };
// 当前页改变时触发 // 当前页改变时触发
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
Page.page = val; Page.page = val;
loadData()
}; };
function handleDetail(row) { function handleDetail(row) {
...@@ -219,8 +189,8 @@ function handleDetail(row) { ...@@ -219,8 +189,8 @@ function handleDetail(row) {
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.stationName"
:value="item.value"> :value="item.stationId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -255,7 +225,7 @@ function handleDetail(row) { ...@@ -255,7 +225,7 @@ function handleDetail(row) {
<el-form-item> <el-form-item>
<el-button type="primary" @click="loadData()" class="add-search-btn">查询</el-button> <el-button type="primary" @click="loadData()" class="add-search-btn">查询</el-button>
<el-button type="primary" @click="resetSearch" class="add-search-btn">重置</el-button> <el-button type="primary" @click="resetSearch" class="add-search-btn">重置</el-button>
<el-button type="primary" @click="handleExport" class="add-search-btn">导出</el-button> <el-button type="primary" @click="handleExport()" class="add-search-btn">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -269,7 +239,7 @@ function handleDetail(row) { ...@@ -269,7 +239,7 @@ function handleDetail(row) {
:row-class-name="tableBodyClass" :row-class-name="tableBodyClass"
> >
<el-table-column type="index" label="序号" align="center" width="100"/> <el-table-column type="index" label="序号" align="center" width="100"/>
<el-table-column prop="stationId" align="center" label="换热站" sortable/> <el-table-column prop="stationName" align="center" label="换热站" sortable/>
<el-table-column prop="updateDate" align="center" width="180" label="触发时间" sortable/> <el-table-column prop="updateDate" align="center" width="180" label="触发时间" sortable/>
<el-table-column prop="question" align="center" label="提问"/> <el-table-column prop="question" align="center" label="提问"/>
<el-table-column prop="answer" align="center" label="回答"/> <el-table-column prop="answer" align="center" label="回答"/>
...@@ -291,7 +261,7 @@ function handleDetail(row) { ...@@ -291,7 +261,7 @@ function handleDetail(row) {
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination v-model:current-page="Page.page" v-model:page-size="Page.pageSize" <el-pagination v-model:current-page="Page.page" v-model:page-size="Page.rows"
:page-sizes="[20, 30, 50, 100, 200, 300, 400]" :small="small" :disabled="disabled" :page-sizes="[20, 30, 50, 100, 200, 300, 400]" :small="small" :disabled="disabled"
:background="background" layout="total, sizes, prev, pager, next, jumper" :total="Page.total" :background="background" layout="total, sizes, prev, pager, next, jumper" :total="Page.total"
@size-change="handleSizeChange" @current-change="handleCurrentChange" class="pagination"/> @size-change="handleSizeChange" @current-change="handleCurrentChange" class="pagination"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment