Browse Source

优化基质管理

master
LiLongLong 5 months ago
parent
commit
456756636c
  1. 2
      .env
  2. 1
      src/components/SprayParam.vue
  3. 9
      src/services/globalCmd/cmdTypes.ts
  4. 10
      src/services/matrix/craft.ts
  5. 54
      src/views/debug/index.vue
  6. 171
      src/views/matrixCraft/index.vue
  7. 2
      src/views/matrixManage/add.vue
  8. 4
      vite.config.ts

2
.env

@ -1,3 +1,3 @@
VITE_API_HOST=192.168.1.130
VITE_API_HOST=192.168.1.140
VITE_API_PORT=8090 VITE_API_PORT=8090
VITE_WS_PATH=/ws VITE_WS_PATH=/ws

1
src/components/SprayParam.vue

@ -1,5 +1,6 @@
<template> <template>
<div class="wrapper grid grid-cols-[auto_150px_auto] gap-x-3 gap-y-4 text-base"> <div class="wrapper grid grid-cols-[auto_150px_auto] gap-x-3 gap-y-4 text-base">
<slot></slot>
<span class="self-center text-right text-primary font-medium">喷涂路线</span> <span class="self-center text-right text-primary font-medium">喷涂路线</span>
<div class="flex items-center gap-x-4 col-span-2"> <div class="flex items-center gap-x-4 col-span-2">
<img :src="selectCraft.routeType === 1 ? route_v : route_v2" alt="icon" @click="sprayDirection('v')" /> <img :src="selectCraft.routeType === 1 ? route_v : route_v2" alt="icon" @click="sprayDirection('v')" />

9
src/services/globalCmd/cmdTypes.ts

@ -5,12 +5,13 @@ export type ControlType = {
isOpen: Boolean; isOpen: Boolean;
}; };
export type SyringeType = {
params: {
export type SyringeParams = {
rotationSpeed: number; rotationSpeed: number;
direction: string | number;
direction: string;
time: number; time: number;
};
}
export type SyringeType = {
params: SyringeParams;
}; };
export type PositionType = { export type PositionType = {
x1: number; x1: number;

10
src/services/matrix/craft.ts

@ -1,6 +1,6 @@
import type { WorkType } from "../globalCmd/cmdTypes"; import type { WorkType } from "../globalCmd/cmdTypes";
import httpRequest, { type BaseResponse } from "../httpRequest"; import httpRequest, { type BaseResponse } from "../httpRequest";
import type { CraftItem } from "./type";
import type { CraftItem } from "@/services/matrix/type";
export function getList(params: { pageSize: number; pageNum: number }) { export function getList(params: { pageSize: number; pageNum: number }) {
return httpRequest<BaseResponse>({ return httpRequest<BaseResponse>({
@ -33,3 +33,11 @@ export function updateCraft(params: CraftItem) {
method: "PUT", method: "PUT",
}); });
} }
export function delCraft(params:CraftItem){
return httpRequest<BaseResponse<CraftItem[]>>({
url: `/api/matrixCraft/${params.id}`,
params: { ...params },
method: "PUT",
});
}

54
src/views/debug/index.vue

@ -175,7 +175,15 @@
<el-radio :value="2">纵向</el-radio> <el-radio :value="2">纵向</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="mt-[20px]">
选择玻片
<el-radio-group v-model="axis.index">
<el-radio :value='0'>玻片1</el-radio>
<el-radio :value='1'>玻片2</el-radio>
<el-radio :value='2'>玻片3</el-radio>
<el-radio :value='3'>玻片4</el-radio>
</el-radio-group>
</div>
<div class="mt-[20px]"> <div class="mt-[20px]">
行间距 行间距
<input v-model="workForm.space" 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="workForm.space" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
@ -214,17 +222,19 @@
<div>起始坐标</div> <div>起始坐标</div>
<div> <div>
X:<input v-model="startAxis.x" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
Y:<input v-model="startAxis.y" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
X:<input v-model="axis.x1" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
Y:<input v-model="axis.y1" 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>
<div class="mt-[10px]">结束坐标</div> <div class="mt-[10px]">结束坐标</div>
<div class="flex"> <div class="flex">
X:<input v-model="endAxis.x" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
Y:<input v-model="endAxis.y" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
X:<input v-model="axis.x2" placeholder='' type="number" class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
Y:<input v-model="axis.y2" 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>
<div class="mt-[20px] text-center"> <div class="mt-[20px] text-center">
<el-button type="primary" class="ml-[10px] w-[100px]" @click="onStartWork">&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
<el-button type="primary" class="ml-[10px] w-[100px]" @click="onStartWork">开始喷涂</el-button>
<el-button type="primary" class="ml-[10px] w-[100px]" @click="onStopWork">结束喷涂</el-button>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -239,6 +249,7 @@
ControlNitrogen, ControlNitrogen,
MachineryType, MachineryType,
SyringeType, SyringeType,
SyringeParams,
VoltageType, VoltageType,
ControlValueType ControlValueType
} from '@/services/globalCmd/cmdTypes' } from '@/services/globalCmd/cmdTypes'
@ -251,14 +262,22 @@ import {
turnOnSyringePump, turnOnSyringePump,
turnOffSyringePump, turnOffSyringePump,
startWork, startWork,
stopWork,
rotate rotate
} from "@/services/globalCmd/globalCmd"; } from "@/services/globalCmd/globalCmd";
const activeName = ref('debug') const activeName = ref('debug')
const voltageValue = ref() const voltageValue = ref()
const syringeForm = ref<Record<string, string>>({})
const workForm = ref<Record<string, string>>({})
const startAxis = ref<any>({})
const endAxis = ref<any>({})
const syringeForm = ref<SyringeParams>({
rotationSpeed: 1,
time: 0,
direction:'1'
})
const workForm = ref<Record<string, any>>({
direction: 1,
})
const axis = ref<any>({
index: 0
})
const rotateForm = ref<Record<string, string>>({}) const rotateForm = ref<Record<string, string>>({})
let subscription:any let subscription:any
@ -333,9 +352,9 @@ import {
// SyringeType // SyringeType
const params = <SyringeType>{ const params = <SyringeType>{
params:{ params:{
rotationSpeed: 1,
direction: 2,
time: 3
rotationSpeed: syringeForm.value.rotationSpeed,
direction: syringeForm.value.direction,
time: syringeForm.value.time
} }
} }
turnOnSyringePump(params).then(res => { turnOnSyringePump(params).then(res => {
@ -354,8 +373,7 @@ import {
params:{ params:{
...workForm.value, ...workForm.value,
position:<any>[ position:<any>[
startAxis.value,
endAxis.value
axis.value,
] ]
} }
} }
@ -365,6 +383,12 @@ import {
}) })
} }
function onStopWork(){
stopWork().then(res => {
console.log('startWork-----', startWork)
})
}
const onRotate = () => { const onRotate = () => {
const params = { const params = {
params : { params : {

171
src/views/matrixCraft/index.vue

@ -1,45 +1,178 @@
<template> <template>
<main class="spurt_print"> <main class="spurt_print">
<div class="spurt_print_btn ml-[3rem]"> <div class="spurt_print_btn ml-[3rem]">
<el-button type="primary">新增工艺</el-button>
<el-button type="default">编辑</el-button>
<el-button>删除</el-button>
<el-button type="primary" @click='addCraft'>新增工艺</el-button>
<el-button @click="onEdit">编辑</el-button>
<el-button @click="onDel">删除</el-button>
</div> </div>
<div class="w-[90vw] ml-[3rem] mt-[2rem] h-[70vh]"> <div class="w-[90vw] ml-[3rem] mt-[2rem] h-[70vh]">
<el-table :data="tableData" stripe style="width: 100%">
<el-table-column prop="name" label="基质名称" width="180" />
<el-table-column prop="craftName" label="工艺名称" width="180" />
<el-table-column prop="line" label="喷涂路线" />
<el-table :data="tableData" stripe style="width: 100%" ref="craftTableRef">
<el-table-column type="selection" width="55" />
<el-table-column prop="matrixName" label="基质名称" width="100" />
<el-table-column prop="name" label="工艺名称"/>
<el-table-column prop="routeType" label="喷涂路线" width="100">
<template v-slot="scope">
{{scope.row.routeType == 1 ? '横向' : '竖向'}}
</template>
</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> </el-table>
</div> </div>
</main> </main>
<footer class="footer"> <footer class="footer">
<el-pagination class="pagination" layout="prev, pager, next" :total="50" />
<el-pagination class="pagination" layout="prev, pager, next" :total="total" />
</footer> </footer>
<el-dialog v-model="sprayVisible">
<div>
<div class="mt-[10px]">
<SprayParam :sprayParam='defaultSprayData' @save="onSaveCraft">
<span class="self-center text-right text-primary font-medium">基质名称</span>
<el-select
v-model="defaultSprayData.matrixId"
placeholder="选择"
style="width: 120px"
@change="onMatrixChange">
<el-option
v-for="item in settingStore.matrixList"
:key="item.id"
:label="item.name"
:value="item.id" />
</el-select>
<span class="self-center text-right text-primary font-medium"></span>
<span class="self-center text-right text-primary font-medium">工艺名称</span>
<input
type="text"
v-model.number="defaultSprayData.name"
class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center" />
<span class="self-center text-right text-primary font-medium"></span>
</SprayParam>
</div>
</div>
</el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { getList } from '@/services/matrix/craft'
import { ref, watch, onMounted } from 'vue'
import { getList, createCraft, updateCraft, delCraft} from '@/services/matrix/craft'
import { useSettingStore } from '@/stores/setting'
import SprayParam from '@/components/SprayParam.vue'
import type { CraftItem } from "@/services/matrix/type";
import type { WorkType } from "@/services/globalCmd/cmdTypes";
import { ElMessage, ElMessageBox } from "element-plus";
let total = ref()
const settingStore = useSettingStore()
let sprayVisible = ref(false)
let tableData = ref<any>([])
let operType = ref('add')
const defaultCraft: CraftItem = {
id: 1,
name: '',
matrixId: 0,
routeType: 1,
space: 0,
nitrogenFlowVelocity: 0,
nitrogenAirPressure: 0,
matrixFlowVelocity: 0,
voltage: 0,
needPower: false,
height: 0,
movementSpeed: 0,
position: [],
};
const defaultSprayData = ref<CraftItem>(defaultCraft);
onMounted(()=>{ onMounted(()=>{
tableData.value = settingStore.matrixList
getCraftList() getCraftList()
}) })
const tableData = [
{
craftName: '1',
name: '1',
line: '1',
}
]
//
//
const getCraftList = () => { const getCraftList = () => {
const params = { const params = {
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
} }
getList(params).then(res=>{
console.log('res====', res)
getList(params).then((res:any)=>{
tableData.value = res.data.list
total.value = res.data.total
})
}
const addCraft = () => {
sprayVisible.value = true;
operType.value = 'add'
}
const craftTableRef = ref()
const onEdit = () => {
const selectRows = craftTableRef.value.getSelectionRows()
if(selectRows.length !== 1){
ElMessage.error('请选择一条数据进行编辑')
return;
}
const sel = selectRows[0]
operType.value = 'edit'
defaultSprayData.value = sel
sprayVisible.value = true;
}
const onDel = () => {
const selectRows = craftTableRef.value.getSelectionRows()
if(selectRows.length !== 1){
ElMessage.error('请选择一条数据进行编辑')
return;
}
const sel = selectRows[0]
ElMessageBox.confirm('确认删除此条数据吗?','提示',{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}).then(()=>{
delCraft(sel).then(res => {
ElMessage.success("删除成功")
getCraftList()
})
}) })
} }
const onSaveCraft = (craftData:WorkType) => {
if(operType.value === 'add'){
//@ts-ignore
createCraft(craftData).then(res=>{
if(res.success){
ElMessage.success('新增成功')
getCraftList()
sprayVisible.value = false;
}
})
}else if(operType.value === 'edit'){
//@ts-ignore
updateCraft(craftData).then(res=>{
if(res.success){
ElMessage.success('编辑成功')
getCraftList()
sprayVisible.value = false;
}
})
}
}
function onMatrixChange(val: number) {
defaultSprayData.value.matrixId = val
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.el-button--primary{ .el-button--primary{

2
src/views/matrixManage/add.vue

@ -13,7 +13,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, defineExpose } from 'vue'
import { ref, defineExpose } from 'vue'
const emits = defineEmits(['save']) const emits = defineEmits(['save'])
const rules = ref({ const rules = ref({
name: [{ name: [{

4
vite.config.ts

@ -18,8 +18,8 @@ export default defineConfig({
port: 5175, port: 5175,
proxy: { proxy: {
"/api": { "/api": {
target: "http://192.168.1.130:8090",
// target: "http://localhost:8080",
// target: "http://192.168.1.130:8090",
target: "http://192.168.1.140:8090",
changeOrigin: true, changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ''), // rewrite: (path) => path.replace(/^\/api/, ''),
}, },

Loading…
Cancel
Save