|
@@ -4,13 +4,14 @@
|
|
|
<el-aside width="320px">
|
|
<el-aside width="320px">
|
|
|
<div class="JKWTree-tree">
|
|
<div class="JKWTree-tree">
|
|
|
<h3>工序损耗管理</h3>
|
|
<h3>工序损耗管理</h3>
|
|
|
- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
|
|
|
|
|
|
+ <!-- <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree> -->
|
|
|
|
|
+ <el-tree :data="treeData" @node-click="handleNodeClick"></el-tree>
|
|
|
</div>
|
|
</div>
|
|
|
</el-aside>
|
|
</el-aside>
|
|
|
<el-container>
|
|
<el-container>
|
|
|
<el-main>
|
|
<el-main>
|
|
|
- <!-- <div class="gva-search-box">
|
|
|
|
|
- <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
|
|
|
|
|
|
+ <div class="gva-search-box">
|
|
|
|
|
+ <!-- <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
|
|
|
<el-form-item label="创建日期" prop="createdAt">
|
|
<el-form-item label="创建日期" prop="createdAt">
|
|
|
<template #label>
|
|
<template #label>
|
|
|
<span>
|
|
<span>
|
|
@@ -28,8 +29,15 @@
|
|
|
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
|
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
|
|
<el-button icon="refresh" @click="onReset">重置</el-button>
|
|
<el-button icon="refresh" @click="onReset">重置</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- </el-form>
|
|
|
|
|
- </div> -->
|
|
|
|
|
|
|
+ </el-form> -->
|
|
|
|
|
+ <div class="gva-btn-list">
|
|
|
|
|
+ <el-button type="primary" icon="upload" @click="addNextClick">增加同级科目</el-button>
|
|
|
|
|
+ <el-button type="primary" icon="plus" @click="editClick">修改</el-button>
|
|
|
|
|
+ <el-button type="primary" icon="upload" @click="delClick">删除</el-button>
|
|
|
|
|
+ <el-button type="primary" icon="plus" @click="addChildClick">增加子科目</el-button>
|
|
|
|
|
+ <!-- <el-button type="primary" icon="upload" @click="importClick">导出到excel</el-button> -->
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
<!-- <div class="gva-table-box">
|
|
<!-- <div class="gva-table-box">
|
|
|
<div class="gva-btn-list">
|
|
<div class="gva-btn-list">
|
|
|
<el-button type="primary" icon="upload" @click="">导出到excel</el-button>
|
|
<el-button type="primary" icon="upload" @click="">导出到excel</el-button>
|
|
@@ -78,18 +86,24 @@
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div> -->
|
|
</div> -->
|
|
|
- <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type==='create'?'添加':'修改'" destroy-on-close>
|
|
|
|
|
- <el-scrollbar height="500px">
|
|
|
|
|
- <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
|
|
|
|
|
- <el-form-item label="address字段:" prop="address" >
|
|
|
|
|
- <el-input v-model="formData.address" :clearable="true" placeholder="请输入address字段" />
|
|
|
|
|
|
|
+ <el-dialog v-model="dialogFormVisible" style="width: 600px;" :before-close="closeDialog" :title="`当前编码:${code}`" destroy-on-close>
|
|
|
|
|
+ <el-scrollbar height="200px">
|
|
|
|
|
+ <el-form :model="formData" :inline="true" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
|
|
|
|
|
+ <el-form-item label="编号:" prop="code" >
|
|
|
|
|
+ <el-input v-model="formData.code" style="width: 400px;" :clearable="true"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="image字段:" prop="image" >
|
|
|
|
|
- <el-input v-model="formData.image" :clearable="true" placeholder="请输入image字段" />
|
|
|
|
|
|
|
+ <el-form-item label="名称:" prop="name" >
|
|
|
|
|
+ <el-input v-model="formData.name" style="width: 400px;" :clearable="true"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="name字段:" prop="name" >
|
|
|
|
|
- <el-input v-model="formData.name" :clearable="true" placeholder="请输入name字段" />
|
|
|
|
|
|
|
+ <el-form-item label="基本损耗:" prop="sys_rate0" >
|
|
|
|
|
+ <el-input v-model="formData.sys_rate0" style="width: 145px;" :clearable="true"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="损耗率:" prop="sys_rate1" >
|
|
|
|
|
+ <el-input v-model="formData.sys_rate1" style="width: 145px;" :clearable="true"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="备注机型:" prop="remark" >
|
|
|
|
|
+ <el-input v-model="formData.remark" style="width: 400px;" :clearable="true"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</el-scrollbar>
|
|
</el-scrollbar>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
@@ -100,8 +114,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <el-dialog v-model="detailShow" style="width: 800px" lock-scroll :before-close="closeDetailShow" :title="`当前编码:${processData.sys_bh}`" destroy-on-close>
|
|
|
|
|
- <el-scrollbar height="550px">
|
|
|
|
|
|
|
+ <el-dialog v-model="detailShow" style="width: 600px" lock-scroll :before-close="closeDetailShow" :title="`当前编码:${processData.sys_bh}`" destroy-on-close>
|
|
|
|
|
+ <el-scrollbar height="200px">
|
|
|
<el-descriptions column="1" border>
|
|
<el-descriptions column="1" border>
|
|
|
<el-descriptions-item label="编号">
|
|
<el-descriptions-item label="编号">
|
|
|
{{ processData.sys_bh }}
|
|
{{ processData.sys_bh }}
|
|
@@ -152,7 +166,11 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import {
|
|
import {
|
|
|
getProcessLoss,
|
|
getProcessLoss,
|
|
|
- getProcess
|
|
|
|
|
|
|
+ getProcess,
|
|
|
|
|
+ getProcessCode,
|
|
|
|
|
+ getProcessAdd,
|
|
|
|
|
+ getProcessEdit,
|
|
|
|
|
+ getProcessDel
|
|
|
} from '@/api/mes/job'
|
|
} from '@/api/mes/job'
|
|
|
import {
|
|
import {
|
|
|
createCompany,
|
|
createCompany,
|
|
@@ -175,11 +193,14 @@ defineOptions({
|
|
|
const treeData=ref([])
|
|
const treeData=ref([])
|
|
|
const Process = async() => {
|
|
const Process = async() => {
|
|
|
const getProcesss = await getProcess()
|
|
const getProcesss = await getProcess()
|
|
|
- console.log(getProcesss.data)
|
|
|
|
|
|
|
+ // console.log(getProcesss.data)
|
|
|
if (getProcesss.code === 0) {
|
|
if (getProcesss.code === 0) {
|
|
|
|
|
|
|
|
const transformedData = getProcesss.data.map(item => ({
|
|
const transformedData = getProcesss.data.map(item => ({
|
|
|
label: item.sys_mc,
|
|
label: item.sys_mc,
|
|
|
|
|
+ params: {
|
|
|
|
|
+ code: item.sys_bh,
|
|
|
|
|
+ },
|
|
|
children: item.child.map(sysItem => ({
|
|
children: item.child.map(sysItem => ({
|
|
|
label: sysItem.sys_mc,
|
|
label: sysItem.sys_mc,
|
|
|
params: {
|
|
params: {
|
|
@@ -201,7 +222,7 @@ const Process = async() => {
|
|
|
}))
|
|
}))
|
|
|
})),
|
|
})),
|
|
|
}));
|
|
}));
|
|
|
- console.log(transformedData)
|
|
|
|
|
|
|
+ // console.log(transformedData)
|
|
|
treeData.value = transformedData
|
|
treeData.value = transformedData
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -235,13 +256,17 @@ const handleNodeClick = async(node,check) => {
|
|
|
// sys_bh.value = node.params.code;
|
|
// sys_bh.value = node.params.code;
|
|
|
// getDetails();
|
|
// getDetails();
|
|
|
// }
|
|
// }
|
|
|
- console.log(node,check);
|
|
|
|
|
|
|
+ code.value=node.params.code
|
|
|
|
|
+ // console.log(code.value);
|
|
|
|
|
+ // console.log(node,check);
|
|
|
}
|
|
}
|
|
|
// 自动化生成的字典(可能为空)以及字段
|
|
// 自动化生成的字典(可能为空)以及字段
|
|
|
const formData = ref({
|
|
const formData = ref({
|
|
|
- address: '',
|
|
|
|
|
- image: '',
|
|
|
|
|
|
|
+ code: '',
|
|
|
name: '',
|
|
name: '',
|
|
|
|
|
+ sys_rate0: 0.000,
|
|
|
|
|
+ sys_rate1: 0.0000,
|
|
|
|
|
+ remark: '',
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const processData = ref({})
|
|
const processData = ref({})
|
|
@@ -279,7 +304,77 @@ const searchInfo = ref({})
|
|
|
// label: 'sys_mc'
|
|
// label: 'sys_mc'
|
|
|
// };
|
|
// };
|
|
|
const sys_bh = ref()
|
|
const sys_bh = ref()
|
|
|
|
|
+const code = ref()
|
|
|
|
|
+const newcode = ref()
|
|
|
|
|
+const addNextClick = async() => {
|
|
|
|
|
+ if(code.value==undefined){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ const getProcessCodes = await getProcessCode({code:code.value,same_item:1,child_item:0})
|
|
|
|
|
+ if (getProcessCodes.code === 0) {
|
|
|
|
|
+ if(getProcessCodes.data.length<=3){
|
|
|
|
|
+ switch(getProcessCodes.data.length){
|
|
|
|
|
+ case 1:newcode.value=`00${getProcessCodes.data}`
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:newcode.value=`0${getProcessCodes.data}`
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ newcode.value=getProcessCodes.data
|
|
|
|
|
+ }
|
|
|
|
|
+ formData.value.code=newcode.value
|
|
|
|
|
+ openDialog()
|
|
|
|
|
+ // console.log(newcode.value)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+const addChildClick = async() => {
|
|
|
|
|
+ if(code.value==undefined){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ const getProcessCodes = await getProcessCode({code:code.value,same_item:0,child_item:1})
|
|
|
|
|
+ if (getProcessCodes.code === 0) {
|
|
|
|
|
+ formData.value.code=getProcessCodes.data
|
|
|
|
|
+ openDialog()
|
|
|
|
|
+ // console.log(newcode.value)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+const editClick = async() => {
|
|
|
|
|
+ const ProcessDetail = await getProcessLoss({code:code.value})
|
|
|
|
|
+ // console.log(ProcessDetail)
|
|
|
|
|
+ if (ProcessDetail.code === 0) {
|
|
|
|
|
+ formData.value.code=ProcessDetail.data[0].sys_bh
|
|
|
|
|
+ formData.value.name=ProcessDetail.data[0].sys_mc
|
|
|
|
|
+ formData.value.sys_rate0=ProcessDetail.data[0].sys_rate0
|
|
|
|
|
+ formData.value.sys_rate1=ProcessDetail.data[0].sys_rate1
|
|
|
|
|
+ formData.value.remark=ProcessDetail.data[0].remark
|
|
|
|
|
+ }
|
|
|
|
|
+ type.value = 'update'
|
|
|
|
|
+ dialogFormVisible.value = true
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(newcode.value)
|
|
|
|
|
+}
|
|
|
|
|
+const delClick = async() => {
|
|
|
|
|
+ ElMessageBox.confirm('确定要删除吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ ProcessDel()
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+const ProcessDel = async() => {
|
|
|
|
|
+ const getProcessDels = await getProcessDel({ code: code.value })
|
|
|
|
|
+ if (getProcessDels.code === 0) {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ message: '删除成功'
|
|
|
|
|
+ })
|
|
|
|
|
+ Process()
|
|
|
|
|
+ // delRes.value=1
|
|
|
|
|
+ // console.log(delRes.value)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
// 重置
|
|
// 重置
|
|
|
const onReset = () => {
|
|
const onReset = () => {
|
|
|
searchInfo.value = {}
|
|
searchInfo.value = {}
|
|
@@ -441,7 +536,12 @@ const getDetails = async () => {
|
|
|
// getProcessLosss.data[0].forEach(function(i,index){
|
|
// getProcessLosss.data[0].forEach(function(i,index){
|
|
|
// console.log(i)
|
|
// console.log(i)
|
|
|
// })
|
|
// })
|
|
|
- processData.value=getProcessLosss.data[0]
|
|
|
|
|
|
|
+ processData.value=getProcessLosss.data[0];
|
|
|
|
|
+ // formData.value.code=getProcessLosss.data[0].sys_bh
|
|
|
|
|
+ // formData.value.name=getProcessLosss.data[0].sys_mc
|
|
|
|
|
+ // formData.value.sys_rate0=getProcessLosss.data[0].sys_rate0
|
|
|
|
|
+ // formData.value.sys_rate1=getProcessLosss.data[0].sys_rate1
|
|
|
|
|
+ // formData.value.remark=getProcessLosss.data[0].remark
|
|
|
openDetailShow()
|
|
openDetailShow()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -450,16 +550,18 @@ const getDetails = async () => {
|
|
|
const closeDetailShow = () => {
|
|
const closeDetailShow = () => {
|
|
|
detailShow.value = false
|
|
detailShow.value = false
|
|
|
formData.value = {
|
|
formData.value = {
|
|
|
- address: '',
|
|
|
|
|
- image: '',
|
|
|
|
|
- name: '',
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ code: '',
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ sys_rate0: 0.000,
|
|
|
|
|
+ sys_rate1: 0.0000,
|
|
|
|
|
+ remark: '',
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
// 打开弹窗
|
|
// 打开弹窗
|
|
|
const openDialog = () => {
|
|
const openDialog = () => {
|
|
|
- // type.value = 'create'
|
|
|
|
|
|
|
+ type.value = 'create'
|
|
|
dialogFormVisible.value = true
|
|
dialogFormVisible.value = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -467,9 +569,11 @@ const openDialog = () => {
|
|
|
const closeDialog = () => {
|
|
const closeDialog = () => {
|
|
|
dialogFormVisible.value = false
|
|
dialogFormVisible.value = false
|
|
|
formData.value = {
|
|
formData.value = {
|
|
|
- address: '',
|
|
|
|
|
- image: '',
|
|
|
|
|
|
|
+ code: '',
|
|
|
name: '',
|
|
name: '',
|
|
|
|
|
+ sys_rate0: 0.000,
|
|
|
|
|
+ sys_rate1: 0.0000,
|
|
|
|
|
+ remark: '',
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 弹窗确定
|
|
// 弹窗确定
|
|
@@ -479,13 +583,13 @@ const enterDialog = async () => {
|
|
|
let res
|
|
let res
|
|
|
switch (type.value) {
|
|
switch (type.value) {
|
|
|
case 'create':
|
|
case 'create':
|
|
|
- res = await createCompany(formData.value)
|
|
|
|
|
|
|
+ res = await getProcessAdd(formData.value)
|
|
|
break
|
|
break
|
|
|
case 'update':
|
|
case 'update':
|
|
|
- res = await updateCompany(formData.value)
|
|
|
|
|
|
|
+ res = await getProcessEdit(formData.value)
|
|
|
break
|
|
break
|
|
|
default:
|
|
default:
|
|
|
- res = await createCompany(formData.value)
|
|
|
|
|
|
|
+ res = await getProcessAdd(formData.value)
|
|
|
break
|
|
break
|
|
|
}
|
|
}
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
@@ -494,7 +598,8 @@ const enterDialog = async () => {
|
|
|
message: '创建/更改成功'
|
|
message: '创建/更改成功'
|
|
|
})
|
|
})
|
|
|
closeDialog()
|
|
closeDialog()
|
|
|
- getTableData()
|
|
|
|
|
|
|
+ Process()
|
|
|
|
|
+ // getTableData()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|