接口更新,工艺模块
This commit is contained in:
parent
d86036d443
commit
b4c31b102c
@ -66,6 +66,23 @@ export function getProcessInfoList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function onSave(list) {
|
||||
return request({
|
||||
url: '/system/route/addRoute',
|
||||
method: 'post',
|
||||
data: list,
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error saving route:', error);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 删除工艺路线
|
||||
export function delRoute(id) {
|
||||
return request({
|
||||
|
||||
@ -42,3 +42,9 @@ export function delStockData(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
export function generateDoc() {
|
||||
return request({
|
||||
url: '/system/stockData/generateDoc', // 这个路径应该和你的后端接口路径一致
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
||||
@ -3,14 +3,19 @@ import clonedeep from "lodash.clonedeep";
|
||||
|
||||
const tableDrag = {
|
||||
bind(el, binding) {
|
||||
// 这里是定义了一个对象只接收value和arg
|
||||
const { value, arg } = binding;
|
||||
// 如果没有获取到元素节点
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
// 定义对象,如果没有的话为空
|
||||
const { elementSeletor, onEnd, ...config } = arg || {};
|
||||
// 三元表达式判断元素节点是否为空,不为空则选择到el中指定的节点
|
||||
const bindEls = elementSeletor ? el.querySelector(elementSeletor) : el;
|
||||
// 创建
|
||||
el.sortable = sortable.create(bindEls, {
|
||||
animation: 150,
|
||||
animation: 150,//动画时长设置 ms
|
||||
ghostClass: "blue-background-class",
|
||||
...config,
|
||||
handle: ".handle",
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
:data="detailsList" @selection-change="handleSelectionChange">
|
||||
:data="detailsList" border @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<!-- // <el-table-column label="id" align="center" prop="id" v-if="true"/>-->
|
||||
<el-table-column label="生产令号" align="center" prop="totalWeight"/>
|
||||
|
||||
@ -172,9 +172,9 @@
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-form :inline="true" :model="list" ref="ruleForm" size="mini" :rules="rules">
|
||||
<el-table v-if="showtable" v-loading="loading" row-key="id" ref="tree" v-drag:[config]="routeList"
|
||||
:tree-props="{ children: 'children' }" :data="routeList" stripe :row-class-name="tableRowClassName"
|
||||
<el-form :inline="true" :model="form" ref="ruleForm" size="mini" :rules="rules">
|
||||
<el-table v-if="showtable" v-loading="loading" row-key="id" ref="tree" v-drag:[config]="form.routeList"
|
||||
:tree-props="{ children: 'children' }" :data="form.routeList" stripe :row-class-name="tableRowClassName"
|
||||
:cell-style="columnStyle" border max-height="680px" @cell-click="cellhand" :default-expand-all="true"
|
||||
@selection-change="handleSelectionChange">
|
||||
|
||||
@ -185,11 +185,7 @@
|
||||
<!-- <el-button type="text" icon="el-icon-check" v-if="scope.row.id < 0" @click="onSaveChild()" /> -->
|
||||
<!-- <fromed v-if="props.row.parentId" /> -->
|
||||
<!-- {{props.row.materialCode}} -->
|
||||
<el-button
|
||||
v-if="props.row.parentId"
|
||||
size="mini"
|
||||
class="handle"
|
||||
icon="el-icon el-icon-rank"/>
|
||||
<el-button v-if="props.row.parentId" size="mini" class="handle" icon="el-icon el-icon-rank" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -209,10 +205,10 @@
|
||||
<el-table-column label="用量"width="60"align="center" prop="discUsage" />
|
||||
<el-table-column label="单位"width="60" align="center" prop="bomUnit" />-->
|
||||
<el-table-column label="工序号" width="60" align="center" prop="processNo" />
|
||||
<el-table-column label="工作中心" width="150" align="center" prop="workCenter">
|
||||
<el-table-column label="工作中心" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'list.' + scope.$index + '.key'">
|
||||
<el-select v-model="queryParams.workCenter" placeholder="工作中心" clearable @keyup.enter.native="handleQuery2">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'routeList.' + scope.$index + '.workCenter'">
|
||||
<el-select v-model="scope.row.workCenter" placeholder="工作中心" clearable @keyup.enter.native="handleQuery2">
|
||||
<el-option label="机一工段" value="机一工段"></el-option>
|
||||
<el-option label="机二工段" value="机二工段"></el-option>
|
||||
<el-option label="机三工段" value="机三工段"></el-option>
|
||||
@ -223,36 +219,54 @@
|
||||
<el-option label="委外中心" value="委外中心"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<span v-else>{{ scope.row.workCenter }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="工序名称" width="150" align="center" prop="processName">
|
||||
<el-table-column label="工序名称" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'list.' + scope.$index + '.key1'">
|
||||
<el-select v-model="queryParams.processName" filterable remote :remote-method="handleQuery3"
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'routeList.' + scope.$index + '.processName'">
|
||||
<el-select v-model="scope.row.processName" filterable remote :remote-method="handleQuery3"
|
||||
placeholder="请输入工序名称" clearable :loading="loading" @change="handleProcessNameChange(scope)">
|
||||
<el-option v-for="item in processName" :key="item" :label="item" :value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<span v-else>{{ scope.row.processName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="工序说明" width="300" align="center" prop="processDescription">
|
||||
<el-table-column label="工序说明" width="300" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'list.' + scope.$index + '.key2'">
|
||||
<el-input v-model="list.key2"></el-input>
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'routeList.' + scope.$index + '.processDescription'">
|
||||
<el-input v-model="scope.row.processDescription"></el-input>
|
||||
</el-form-item>
|
||||
<span v-else>{{ scope.row.processDescription }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="工序控制" width="220" align="center" prop="processControl">
|
||||
<el-table-column label="工序控制" width="220" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'list.' + scope.$index + '.key3'">
|
||||
<el-input v-model="list.key3"></el-input>
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'routeList.' + scope.$index + '.processControl'">
|
||||
<el-select v-model="scope.row.processControl" placeholder="工序控制" clearable @keyup.enter.native="handleQuery2">
|
||||
<el-option label="汇报+免检" value="汇报+免检"></el-option>
|
||||
<el-option label="委外+质量" value="委外+质量"></el-option>
|
||||
<el-option label="汇报+质量" value="汇报+质量"></el-option>
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<span v-else>{{ scope.row.processControl }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活动时长" align="center" prop="activityDuration"/>
|
||||
|
||||
<el-table-column label="活动时长" align="center" prop="activityDuration">
|
||||
<template slot-scope="scope">
|
||||
<el-form-item v-if="scope.row.id < 0" :prop="'routeList.' + scope.$index + '.activityDuration'">
|
||||
<el-input v-model="scope.row.activityDuration"></el-input>
|
||||
</el-form-item>
|
||||
<span v-else>{{ scope.row.activityDuration }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="活动单位" align="center" prop="activityUnit" />
|
||||
<el-table-column label="序开始时间" align="center" prop="xuStartTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
@ -264,7 +278,7 @@
|
||||
<span>{{ parseTime(scope.row.xuEndTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="材料BOM单位" align="center" prop="bomUnit"/>
|
||||
<el-table-column label="单位" align="center" prop="bomUnit" />
|
||||
<el-table-column label="单台数量" align="center" prop="unitQuantity" />
|
||||
<el-table-column label="本批数量" align="center" prop="batchQuantity" />
|
||||
<el-table-column label="首批数量" align="center" prop="firstBatchQuantity" />
|
||||
@ -392,7 +406,8 @@
|
||||
<el-table-column label="材质" width="70" align="center" prop="materialType" />
|
||||
<el-table-column label="用量" width="88" align="center" prop="quantity" />
|
||||
<el-table-column label="单位" width="88" align="center" prop="unit" />
|
||||
<el-table-column class="maxWidth" label="操作" width="150" fixed="right" align="center" class-name="small-padding fixed-width" />
|
||||
<el-table-column class="maxWidth" label="操作" width="150" fixed="right" align="center"
|
||||
class-name="small-padding fixed-width" />
|
||||
</el-table>
|
||||
<Bomfrom v-if="BOMpop" style="padding-top: 20px;" />
|
||||
</div>
|
||||
@ -414,9 +429,7 @@ import upload from "svg-sprite-loader/examples/custom-runtime-generator/build/ma
|
||||
import { getToken } from "../../../utils/auth";
|
||||
import Fromed from './fromed'
|
||||
import Bomfrom from './bomfrom'
|
||||
// 引用拖动排序列表的js插件
|
||||
import Sortable from 'sortablejs'
|
||||
import {getProcessInfoList, pushRouteBom} from "../../../api/system/route";
|
||||
import { getProcessInfoList, pushRouteBom, onSave } from "../../../api/system/route";
|
||||
|
||||
export default {
|
||||
name: "",
|
||||
@ -461,8 +474,10 @@ export default {
|
||||
showParentSaveBtn: null,
|
||||
// 总条数
|
||||
total: 0,
|
||||
form: {
|
||||
// 工艺路线表格数据
|
||||
routeList: [],
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
@ -470,7 +485,7 @@ export default {
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
pageSize: 500,
|
||||
routeDescription: [],
|
||||
materialCode: undefined,
|
||||
materialName: undefined,
|
||||
@ -553,17 +568,11 @@ export default {
|
||||
processName: [],
|
||||
activeRows: [], // 转换为列表的数据
|
||||
config: {
|
||||
elementSeletor: "tbody",
|
||||
filter: ".filtered",
|
||||
elementSeletor: "tbody", //元素选择
|
||||
filter: ".filtered", // 过滤
|
||||
onEnd: (event, oldValue, newValue) => {
|
||||
console.log(
|
||||
"源数据",
|
||||
oldValue.map((i) => i.date)
|
||||
);
|
||||
console.log(
|
||||
"改变后的数据",
|
||||
newValue.map((i) => i.date)
|
||||
);
|
||||
console.log("源数据", oldValue);
|
||||
console.log("改变后的数据", newValue);
|
||||
},
|
||||
},
|
||||
upload: {
|
||||
@ -581,13 +590,6 @@ export default {
|
||||
url: process.env.VUE_APP_BASE_API + "/system/route/importData"
|
||||
},
|
||||
id: 0,//动态增加表格列的ID
|
||||
list: {
|
||||
key1: '',
|
||||
key2: '',
|
||||
key3: '',
|
||||
key4: '',
|
||||
key5: ''
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id: [
|
||||
@ -646,21 +648,6 @@ export default {
|
||||
],
|
||||
updateTime: [
|
||||
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
||||
],
|
||||
key1: [
|
||||
{required: true, message: "请选择工作中心", trigger: "blur"}
|
||||
],
|
||||
key2: [
|
||||
{required: true, message: "请选择工序名称", trigger: "blur"}
|
||||
],
|
||||
key3: [
|
||||
{required: true, message: "请输入工序说明", trigger: "blur"}
|
||||
],
|
||||
key4: [
|
||||
{required: true, message: "请选择工序控制", trigger: "blur"}
|
||||
],
|
||||
key5: [
|
||||
{required: true, message: "请输入活动时长", trigger: "blur"}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -713,8 +700,9 @@ export default {
|
||||
this.processName = []; // 如果请求失败,清空选项
|
||||
});
|
||||
},
|
||||
|
||||
// 控制表格可移动部分
|
||||
tableRowClassName({ row, rowIndex }) {
|
||||
// 过滤掉父节点
|
||||
if (!row.parentId) {
|
||||
return "filtered";
|
||||
}
|
||||
@ -723,14 +711,14 @@ export default {
|
||||
// 添加子集
|
||||
onAddChild(props) {
|
||||
// 是否为父级,返回父级所在下标
|
||||
var index = this.routeList.findIndex(item => item.id === props.row.id);
|
||||
var index = this.form.routeList.findIndex(item => item.id === props.row.id);
|
||||
// -1为未检索到,不为父级
|
||||
if (index === -1) {
|
||||
alert("刷新试试,为检索到此目录,可能不存在")
|
||||
return;
|
||||
}
|
||||
|
||||
var routeList = this.routeList[index].children;
|
||||
var routeList = this.form.routeList[index].children;
|
||||
var route = routeList.sort(function (a, b) {
|
||||
return a.processNo - b.processNo
|
||||
})[routeList.length - 1];
|
||||
@ -738,18 +726,48 @@ export default {
|
||||
routeList.push({ id: --this.id, parentId: props.row.id, processNo: processNo, children: null });
|
||||
this.showParentSaveBtn = props.row.id;
|
||||
},
|
||||
// 保存子集
|
||||
onSave(props) {
|
||||
// 找到需要保存的新加子集
|
||||
var list = this.form.routeList.find(item => item.id === props.row.id);
|
||||
var newChildrenList = list.children.filter(item => item.id < 0).map(v => ({
|
||||
id: v.parentId,
|
||||
routeDescription: list.routeDescription,
|
||||
materialCode: list.materialCode,
|
||||
materialName: list.materialName,
|
||||
material: list.material,
|
||||
discWeight: list.discWeight,
|
||||
processNo: v.processNo,
|
||||
workCenter: v.workCenter,
|
||||
processControl: v.processControl,
|
||||
processDescription: v.processDescription,
|
||||
processName: v.processName,
|
||||
activityDuration: v.activityDuration
|
||||
}))
|
||||
|
||||
// 调用后端保存
|
||||
onSave(newChildrenList)
|
||||
.then((response) => {
|
||||
Messages.success('工艺路线保存成功');
|
||||
// 刷新表格
|
||||
this.getList();
|
||||
})
|
||||
.catch((error) => {
|
||||
Messages.error('工艺路线保存失败');
|
||||
});
|
||||
},
|
||||
// 删除子集
|
||||
onDelete(props) {
|
||||
// 获取父级的所在下标
|
||||
var index = this.routeList.findIndex(item => item.id === props.row.parentId);
|
||||
var index = this.form.routeList.findIndex(item => item.id === props.row.parentId);
|
||||
// 获取子集的所在下标
|
||||
var childrenIndex = this.routeList[index].children.findIndex(item => item.id === props.row.id);
|
||||
var childrenIndex = this.form.routeList[index].children.findIndex(item => item.id === props.row.id);
|
||||
// 找到子集并删除
|
||||
this.routeList[index].children.splice(childrenIndex, 1);
|
||||
this.form.routeList[index].children.splice(childrenIndex, 1);
|
||||
// 修改其它子集的工序号
|
||||
for (let i = 0; i < this.routeList[index].children.length; i++) {
|
||||
for (let i = 0; i < this.form.routeList[index].children.length; i++) {
|
||||
// 修改子集中工序号
|
||||
this.routeList[index].children[i].processNo = (i + 1) * 10;
|
||||
this.form.routeList[index].children[i].processNo = (i + 1) * 10;
|
||||
}
|
||||
},
|
||||
cellhand(row, column) {
|
||||
@ -779,7 +797,7 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRoute(this.queryParams).then(response => {
|
||||
this.routeList = response.rows;
|
||||
this.form.routeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
@ -991,8 +1009,6 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
||||
@ -90,6 +90,16 @@
|
||||
v-hasPermi="['system:stockData:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="generateDoc"
|
||||
v-hasPermi="['system:stockData:generateDoc']"
|
||||
>生成安全库存单据</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -167,7 +177,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listStockData, getStockData, delStockData, addStockData, updateStockData } from "@/api/system/stockData";
|
||||
import {
|
||||
listStockData,
|
||||
getStockData,
|
||||
delStockData,
|
||||
addStockData,
|
||||
updateStockData,
|
||||
generateDoc
|
||||
} from "@/api/system/stockData";
|
||||
import {listRoute} from "@/api/system/route";
|
||||
|
||||
export default {
|
||||
name: "StockData",
|
||||
@ -358,7 +376,28 @@ export default {
|
||||
this.download('system/stockData/export', {
|
||||
...this.queryParams
|
||||
}, `stockData_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
generateDoc() {
|
||||
this.loading = true;
|
||||
generateDoc().then(response => {
|
||||
this.loading = false;
|
||||
// 假设后端响应数据格式
|
||||
if (response.code === 200) {
|
||||
const stockDataList = response.data;
|
||||
} else {
|
||||
this.$message.error('生成安全库存单据失败,请稍后再试');
|
||||
}
|
||||
// 执行完后刷新页面
|
||||
this.refreshPage();
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading = false;
|
||||
console.error('请求错误:', error);
|
||||
this.$message.error('请求失败,请检查网络连接');
|
||||
// 执行完后刷新页面
|
||||
this.refreshPage();
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user