Browse Source

修复bug

master
LiLongLong 5 months ago
parent
commit
ffd2764286
  1. 5
      src/services/globalCmd/globalCmd.ts
  2. 10
      src/services/matrix/craft.ts
  3. 5
      src/services/matrix/manage.ts
  4. 34
      src/views/History.vue
  5. 62
      src/views/debug/index.vue
  6. 9
      src/views/matrixCraft/index.vue
  7. 15
      src/views/matrixManage/matrixList.vue

5
src/services/globalCmd/globalCmd.ts

@ -22,6 +22,7 @@ export function switchThreeWayValve(params: { type: string }) {
});
}
//氮气三路
export function controlValve(params: ControlValueType) {
const commandId = addTxnRecord({ ...params, category: "debug" });
@ -98,6 +99,10 @@ export function startDehumidify(params: { humidity: number }) {
return httpRequest<BaseResponse>({ url: "/api/cmd/startDehumidify", params, method: "POST" });
}
export function stopDehumidify() {
return httpRequest<BaseResponse>({ url: "/api/cmd/stopDehumidify", method: "POST" });
}
//停止电机
export function stopMotor(params: any) {

10
src/services/matrix/craft.ts

@ -34,10 +34,9 @@ export function updateCraft(params: CraftItem) {
});
}
export function delCraft(params:CraftItem){
export function delCraft(ids:string){
return httpRequest<BaseResponse<CraftItem[]>>({
url: `/api/matrixCraft/${params.id}`,
params: { ...params },
url: `/api/matrixCraft/${ids}`,
method: "DELETE",
});
}
@ -50,10 +49,9 @@ export function getHistoryList(params:{pageSize:number, pageNum:number}){
});
}
export function delHistoryLog(params:CraftItem){
export function delHistoryLog(ids:string){
return httpRequest<BaseResponse>({
url: `/api/log/${params.id}`,
params,
url: `/api/log/${ids}`,
method: "DELETE",
});
}

5
src/services/matrix/manage.ts

@ -26,10 +26,9 @@ export function updateMatrix(params:{name: string, id: number}){
});
}
export function del(params:{ids: number}){
export function del(ids:string){
return httpRequest<BaseResponse>({
url: `/api/matrix/${params.ids}`,
params: { ...params },
url: `/api/matrix/${ids}`,
method: "DELETE",
});
}

34
src/views/History.vue

@ -15,22 +15,17 @@
</el-table-column>
<el-table-column prop="height" label="喷涂高度" width="100" />
<el-table-column prop="nitrogenFlowVelocity" label="氮气流速" width="100" />
<el-table-column prop="nitrogenAirPressure" label="氮气气压" width="100" />
<el-table-column prop="matrixFlowVelocity" label="基质流速" width="100" />
<el-table-column prop="voltage" label="电压" width="100" />
<el-table-column prop="movementSpeed" label="移速" width="100" />
<el-table-column prop="space" label="行间距" width="100" />
<el-table-column prop="createTime" label="时间"/>
<el-table-column prop="space" label="行间距" width="80" />
<el-table-column prop="createTime" label="时间" width="200"/>
</el-table>
</div>
</main>
<footer class="footer" v-if="total">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
/>
<el-pagination background layout="prev, pager, next" :total="total" />
</footer>
</template>
<script lang="ts" setup>
@ -72,7 +67,20 @@
pageSize:10,
}
getHistoryList(params).then((res:any)=>{
tableData.value = res.data.list
let list = <any>[]
res.data.list.forEach((item:any)=>{
let { matrixInfo } = item
if(matrixInfo){
matrixInfo = JSON.parse(matrixInfo)
item ={
...item,
...matrixInfo
}
}
list.push(item)
})
tableData.value = list
total.value = res.data.total
})
}
@ -80,17 +88,17 @@
const historyTableRef = ref()
const onDel = () => {
const selectRows = historyTableRef.value.getSelectionRows()
if(selectRows.length !== 1){
ElMessage.error('请选择一条数据进行删除')
if(!selectRows.length){
ElMessage.error('请选择要删除的数据')
return;
}
const sel = selectRows[0]
const ids = selectRows.map((item:any) => item.id)
ElMessageBox.confirm('确认删除此条数据吗?','提示',{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(()=>{
delHistoryLog(sel).then(res => {
delHistoryLog(ids.join(',')).then(res => {
ElMessage.success("删除成功")
getLogList()
})

62
src/views/debug/index.vue

@ -11,26 +11,26 @@
<div class="axis">
<div class="w-[3rem]">X轴</div>
<input v-model="machineryForm.X" type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
<div class="ml-[10px] w-[3rem]">毫米</div>
<div class="flex ml-[10px]">
<div class="w-[3rem]">毫米</div>
<div class="flex">
<el-button type="primary" @click="onMoveMachinery('X')">移动</el-button>
<el-button type="primary" @click="onStopRotate('X')">停止</el-button>
</div>
</div>
<div class="axis ml-[15px]">
<div class="w-[3rem]">Y轴</div>
<div class="axis">
<div class="w-[4rem]">Y轴</div>
<input v-model="machineryForm.Y" type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
<div class="ml-[10px]">毫米</div>
<div class="flex ml-[10px]">
<div class=" w-[2.5rem]">毫米</div>
<div class="flex">
<el-button type="primary" @click="onMoveMachinery('Y')">移动</el-button>
<el-button type="primary" @click="onStopRotate('Y')">停止</el-button>
</div>
</div>
<div class="axis ml-[15px]">
Z轴
<div class="axis">
<div class="w-[3rem]">Z轴</div>
<input v-model="machineryForm.Z" type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
<div class="ml-[10px]">毫米</div>
<div class="flex ml-[10px]">
<div class="w-[2.5rem]">毫米</div>
<div class="flex">
<el-button type="primary" @click="onMoveMachinery('Z')">移动</el-button>
<el-button type="primary" @click="onStopRotate('Z')">停止</el-button>
</div>
@ -59,7 +59,7 @@
</el-col>
<el-col :span="20">
<div class="ml-[20px]">
<input v-model="syringeForm.rotationSpeed" placeholder='转速' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫米/
<input v-model="syringeForm.rotationSpeed" placeholder='转速' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫米/
</div>
<div class="mt-[10px] ml-[20px]">
<input v-model="syringeForm.time" placeholder='时间' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
@ -68,8 +68,9 @@
方向
<el-radio v-model="syringeForm.direction" value="0">后退</el-radio>
<el-radio v-model="syringeForm.direction" value="1">前进</el-radio>
<el-button type="primary" class="ml-[20px]" @click="onTurnOnSyringePump">开始</el-button>
<el-button type="primary" class="ml-[20px]" @click="onTurnOffSyringePump">关闭</el-button>
<br/>
<el-button type="primary" @click="onTurnOnSyringePump">开始</el-button>
<el-button type="primary" class="ml-[20px]" @click="onTurnOffSyringePump">停止</el-button>
</div>
</el-col>
</el-row>
@ -147,7 +148,7 @@
<div>
<el-button type="primary">急停</el-button>
<el-button type="primary" @click="onTurnOnLightPanel">开启照明灯</el-button>
<el-button type="primary" @click="onTurnOffLightPanel">关闭照明灯</el-button>
<el-button @click="onTurnOffLightPanel">关闭照明灯</el-button>
</div>
<el-divider />
<div>
@ -158,19 +159,28 @@
<el-divider />
<div>
<div>气压阀</div>
<div>
<el-button type="primary" @click="onControlValve('Cleaning')">打开清洗阀</el-button>
<el-button @click="onStopWash()">关闭清洗阀</el-button>
</div>
<div class="mt-[10px]">
<el-button type="primary" @click="onControlValve('Nozzle')">打开喷嘴阀</el-button>
<el-button type="primary" @click="onControlValve('Dehumidification')">打开除湿阀</el-button>
<el-button @click="onStopWork">关闭喷嘴</el-button>
</div>
<el-divider />
<div class="mt-[10px]">
<el-button type="primary">关闭电压控制器</el-button>
<el-button type="primary" @click="onControlValve('Dehumidification')">打开除湿阀</el-button>
<el-button @click="onStopDehumidify()">关闭除湿阀</el-button>
</div>
</div>
<el-divider />
<!-- <div class="mt-[10px]">
<el-button type="primary">关闭电压控制器</el-button>
</div> -->
<!-- <el-divider />
<div class="h-[13rem] bg-[#f4f4f4] p-[10px]">
<div>状态反馈区</div>
</div>
</div> -->
</div>
</div>
</div>
@ -282,6 +292,8 @@ import {
stopMotor,
turnOffLightPanel,
turnOnLightPanel,
stopWash,
stopDehumidify
} from "@/services/globalCmd/globalCmd";
const activeName = ref('debug')
const voltageValue = ref()
@ -355,6 +367,18 @@ import {
})
}
const onStopDehumidify = () =>{
stopDehumidify().then((res:any)=>{
success(res)
})
}
const onStopWash = () => {
stopWash({}).then((res:any) => {
success(res)
})
}
//
const onTurnOnHighVoltage = () => {
const params = <VoltageType>{
@ -491,8 +515,6 @@ import {
margin-left: 3.5rem;
margin-right: 3.5rem;
border-radius: 6px;
padding-left: 3.125rem;
padding-right: 3.125rem;
display: flex;
align-items: center;

9
src/views/matrixCraft/index.vue

@ -15,6 +15,7 @@
<el-select
v-model="searchForm.matrixId"
placeholder="选择基质"
no-data-text="无数据"
clearable
style="width: 120px">
<el-option
@ -165,17 +166,17 @@
const onDel = () => {
const selectRows = craftTableRef.value.getSelectionRows()
if(selectRows.length !== 1){
ElMessage.error('请选择一条数据进行编辑')
if(!selectRows.length){
ElMessage.error('请选择要删除的数据')
return;
}
const sel = selectRows[0]
const ids = selectRows.map((item:any) => item.id)
ElMessageBox.confirm('确认删除此条数据吗?','提示',{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(()=>{
delCraft(sel).then(res => {
delCraft(ids.join(',')).then(res => {
ElMessage.success("删除成功")
getCraftList()
})

15
src/views/matrixManage/matrixList.vue

@ -36,7 +36,10 @@
import type { MatrixItem } from './type'
import { ElMessage, ElMessageBox } from "element-plus";
import {getList, add, updateMatrix, del} from '@/services/matrix/manage'
import { useSettingStore } from "@/stores/setting";
import Add from './add.vue'
const settingStore = useSettingStore();
const addRef:any = ref()
const matrixList = ref<Array<MatrixItem>>([])
const loading = ref(false)
@ -58,6 +61,7 @@
getList(params).then(res => {
if(res.success){
const { list, total } = res.data;
settingStore.setMatrixList(list);
matrixList.value = list;
totalData.value = total
}
@ -65,9 +69,7 @@
loading.value = false;
})
}
const toggleSelection = (index:number) => {
matrixList.value[index].isSelected = !matrixList.value[index].isSelected;
}
const onAdd = () => {
addRef.value.showDialog('add')
}
@ -115,17 +117,16 @@
const onDel = ()=>{
const selectRows = matrixTableRef.value.getSelectionRows()
if(selectRows.length !== 1){
ElMessage.error('请选择一条数据进行编辑')
ElMessage.error('请选择要删除的数据')
return;
}
const item = selectRows[0]
const ids = item.id;
const ids = selectRows.map((item:any) => item.id)
ElMessageBox.confirm('确认删除此条数据吗?','提示',{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(()=>{
del({ids}).then(res => {
del(ids.join(',')).then(res => {
ElMessage.success("删除成功")
getMatrixList()
})

Loading…
Cancel
Save