|
@ -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{ |
|
|