功能添加

This commit is contained in:
打豆豆
2024-03-21 16:10:50 +08:00
parent 2415808862
commit 86ca719f6c
18 changed files with 1791 additions and 594 deletions

View File

@@ -42,3 +42,11 @@ export function delProroute(routeId) {
method: 'delete'
})
}
// 复制
export function copyProRoute(routeId) {
return request({
url: '/mes/pro/proroute/copyProRoute/' + routeId,
method: 'get'
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 KiB

After

Width:  |  Height:  |  Size: 588 KiB

View File

@@ -1,26 +1,60 @@
<template>
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
:unique-opened="true"
:active-text-color="settings.theme"
:collapse-transition="false"
mode="vertical"
>
<sidebar-item
v-for="(route, index) in sidebarRouters"
:key="route.path + index"
:item="route"
:base-path="route.path"
/>
</el-menu>
</el-scrollbar>
<div
:class="{ 'has-logo': showLogo }"
:style="{
backgroundColor:
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground,
}"
>
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar
:class="settings.sideTheme"
wrap-class="scrollbar-wrapper"
style="height: 80%"
>
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground
"
:text-color="
settings.sideTheme === 'theme-dark'
? variables.menuColor
: variables.menuLightColor
"
:unique-opened="true"
:active-text-color="settings.theme"
:collapse-transition="false"
mode="vertical"
>
<sidebar-item
v-for="(route, index) in sidebarRouters"
:key="route.path + index"
:item="route"
:base-path="route.path"
/>
</el-menu>
</el-scrollbar>
<div
style="
height: 10%;
display: flex;
justify-content: center;
align-items: center;
"
@click="stop"
>
<img src="../../../assets/images/emergencyStop.png" style="width: 90px" />
</div>
<div style="height: 10%; width: 100%; font-size: 13px">
紧急制动所有设备全部停止
</div>
</div>
</template>
<script>
@@ -28,30 +62,85 @@ import { mapGetters, mapState } from "vuex";
import Logo from "./Logo";
import SidebarItem from "./SidebarItem";
import variables from "@/assets/styles/variables.scss";
import axios from "axios";
export default {
components: { SidebarItem, Logo },
computed: {
...mapState(["settings"]),
...mapGetters(["sidebarRouters", "sidebar"]),
activeMenu() {
const route = this.$route;
const { meta, path } = route;
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu;
}
return path;
},
showLogo() {
return this.$store.state.settings.sidebarLogo;
},
variables() {
return variables;
},
isCollapse() {
return !this.sidebar.opened;
components: { SidebarItem, Logo },
computed: {
...mapState(["settings"]),
...mapGetters(["sidebarRouters", "sidebar"]),
activeMenu() {
const route = this.$route;
const { meta, path } = route;
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu;
}
return path;
},
showLogo() {
return this.$store.state.settings.sidebarLogo;
},
variables() {
return variables;
},
isCollapse() {
return !this.sidebar.opened;
},
},
methods: {
stop() {
this.$confirm(
"确定制动后,车间内所有设备将全部紧急停止运行,请谨慎操作! 如确定要进行紧急制动,请点击【确定】按钮!",
"紧急制动确认",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
}
)
.then(() => {
axios
.get("http://192.168.3.53:8077/manage/task/emergencyStop")
.then((res) => {
if (res.code === 200) {
this.$message({
message: "紧急制动成功",
type: "success",
});
} else {
this.$message({
message: "紧急制动失败",
type: "error",
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消",
});
});
},
},
};
</script>
<style lang="scss">
.el-message-box {
width: 430px !important;
border: 0px solid #ebeef5 !important;
}
.el-message-box__header {
background: #922423 !important;
color: #fff !important;
}
.el-message-box__title {
color: #fdf3f7 !important;
}
.el-message-box__content {
color: #fdf3f7 !important;
background: #cf3533 !important;
}
</style>

View File

@@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="类型名称" prop="machineryTypeName">
<el-input
v-model="queryParams.machineryTypeName"
@@ -10,7 +17,11 @@
/>
</el-form-item>
<el-form-item label="是否启用" prop="enableFlag">
<el-select v-model="queryParams.enableFlag" placeholder="选择是或否" clearable>
<el-select
v-model="queryParams.enableFlag"
placeholder="选择是或否"
clearable
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
@@ -20,8 +31,16 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
@@ -30,17 +49,28 @@
:data="machinerytypeList"
row-key="machineryTypeId"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="设备类型编码" prop="machineryTypeCode" />
<el-table-column label="设备类型名称" align="center" prop="machineryTypeName" />
<el-table-column label="是否启用" align="center" prop="enableFlag" >
<el-table-column
label="设备类型名称"
align="center"
prop="machineryTypeName"
/>
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@@ -48,14 +78,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:dv:machinerytype:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:dv:machinerytype:add']"
>新增</el-button>
>新增</el-button
>
<el-button
v-if="scope.row.parentTypeId != 0"
size="mini"
@@ -63,7 +95,8 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:dv:machinerytype:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@@ -74,39 +107,70 @@
<el-row>
<el-col :span="24" v-if="form.parentTypeId !== 0">
<el-form-item label="父类型" prop="parentTypeId">
<treeselect v-model="form.parentTypeId" :options="machinerytypeOptions" :normalizer="normalizer" placeholder="请选择父类型" />
<treeselect
v-model="form.parentTypeId"
:options="machinerytypeOptions"
:normalizer="normalizer"
placeholder="请选择父类型"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备类型名称" prop="machineryTypeName">
<el-input v-model="form.machineryTypeName" placeholder="请输入设备类型名称" />
<el-input
v-model="form.machineryTypeName"
placeholder="请输入设备类型名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认设备类型" prop="code">
<el-select v-model="form.code" placeholder="请选择默认设备类型">
<el-option
v-for="dict in dict.type.dv_m_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
@@ -120,19 +184,25 @@
</template>
<script>
import { listMachinerytype, getMachinerytype, delMachinerytype, addMachinerytype, updateMachinerytype } from "@/api/mes/dv/machinerytype";
import {
listMachinerytype,
getMachinerytype,
delMachinerytype,
addMachinerytype,
updateMachinerytype,
} from "@/api/mes/dv/machinerytype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Machinerytype",
dicts: ['sys_yes_no'],
dicts: ["sys_yes_no", "dv_m_type"],
components: {
Treeselect
Treeselect,
},
data() {
return {
optType:undefined,
optType: undefined,
// 遮罩层
loading: true,
// 显示搜索条件
@@ -158,15 +228,18 @@ export default {
// 表单校验
rules: {
parentTypeId: [
{ required: true, message: "父类型不能为空", trigger: "blur" }
{ required: true, message: "父类型不能为空", trigger: "blur" },
],
machineryTypeName: [
{ required: true, message: "设备类型名称不能为空", trigger: "blur" }
{ required: true, message: "设备类型名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
}
code: [
{ required: true, message: "请默认设备类型不能为空", trigger: "blur" },
],
},
};
},
created() {
@@ -176,8 +249,12 @@ export default {
/** 查询设备类型列表 */
getList() {
this.loading = true;
listMachinerytype(this.queryParams).then(response => {
this.machinerytypeList = this.handleTree(response.data, "machineryTypeId", "parentTypeId");
listMachinerytype(this.queryParams).then((response) => {
this.machinerytypeList = this.handleTree(
response.data,
"machineryTypeId",
"parentTypeId"
);
this.loading = false;
});
},
@@ -189,15 +266,19 @@ export default {
return {
id: node.machineryTypeId,
label: node.machineryTypeName,
children: node.children
children: node.children,
};
},
/** 查询设备类型下拉树结构 */
/** 查询设备类型下拉树结构 */
getTreeselect() {
listMachinerytype().then(response => {
listMachinerytype().then((response) => {
debugger;
this.machinerytypeOptions = [];
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
const data = this.handleTree(
response.data,
"machineryTypeId",
"parentTypeId"
)[0];
this.machinerytypeOptions.push(data);
});
},
@@ -213,12 +294,12 @@ export default {
machineryTypeName: null,
parentTypeId: 1,
ancestors: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.resetForm("form");
},
@@ -250,7 +331,7 @@ export default {
if (row != null) {
this.form.parentTypeId = row.machineryTypeId;
}
getMachinerytype(row.machineryTypeId).then(response => {
getMachinerytype(row.machineryTypeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改设备类型";
@@ -258,16 +339,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.machineryTypeId != null) {
updateMachinerytype(this.form).then(response => {
updateMachinerytype(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMachinerytype(this.form).then(response => {
addMachinerytype(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@@ -278,13 +359,19 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除设备类型编号为"' + row.machineryTypeId + '"的数据项?').then(function() {
return delMachinerytype(row.machineryTypeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
this.$modal
.confirm(
'是否确认删除设备类型编号为"' + row.machineryTypeId + '"的数据项?'
)
.then(function () {
return delMachinerytype(row.machineryTypeId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script>

View File

@@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-col :span="8">
<el-form-item label="工作站编码" prop="workstationCode">
@@ -24,7 +31,10 @@
</el-col>
<el-col :span="8">
<el-form-item label="所在车间名称" prop="workshopName">
<el-select v-model="queryParams.workshopId" placeholder="请选择车间">
<el-select
v-model="queryParams.workshopId"
placeholder="请选择车间"
>
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
@@ -39,19 +49,27 @@
<el-col :span="8">
<el-form-item label="所属工序" prop="processName">
<el-select v-model="queryParams.processId" placeholder="请选择工序">
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processId"
></el-option>
</el-select>
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-col>
</el-row>
@@ -66,7 +84,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:workstation:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -77,7 +96,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:md:workstation:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -88,7 +108,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:workstation:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -98,33 +119,61 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:md:workstation:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="workstationList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="workstationList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工作站编号" align="center" prop="workstationCode" >
<el-table-column label="工作站编号" align="center" prop="workstationCode">
<template slot-scope="scope">
<el-button
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:md:workstation:query']"
>{{scope.row.workstationCode}}</el-button>
>{{ scope.row.workstationCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工作站名称" align="center" prop="workstationName" />
<el-table-column label="工作站地点" align="center" prop="workstationAddress" />
<el-table-column label="所在车间名称" align="center" prop="workshopName" />
<el-table-column
label="工作站名称"
align="center"
prop="workstationName"
/>
<el-table-column
label="工作站地点"
align="center"
prop="workstationAddress"
/>
<el-table-column
label="所在车间名称"
align="center"
prop="workshopName"
/>
<el-table-column label="所属工序" align="center" prop="processName" />
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@@ -132,20 +181,22 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:workstation:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:workstation:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@@ -158,71 +209,98 @@
<el-row>
<el-col :span="8">
<el-form-item label="工作站编号" prop="workstationCode">
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
<el-input
v-model="form.workstationCode"
placeholder="请输入工作站编码"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
<el-form-item label-width="80">
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作站名称" prop="workstationName">
<el-input v-model="form.workstationName" placeholder="请输入工作站名称" />
<el-input
v-model="form.workstationName"
placeholder="请输入工作站名称"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工作站地点" prop="workstationAddress">
<el-input v-model="form.workstationAddress" placeholder="请输入工作站地点" />
<el-input
v-model="form.workstationAddress"
placeholder="请输入工作站地点"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在车间" prop="workshopId">
<el-select v-model="form.workshopId" placeholder="请选择车间">
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
:label="item.workshopName"
:value="item.workshopId"
></el-option>
</el-select>
<el-select
v-model="form.workshopId"
style="width: 100%"
placeholder="请选择车间"
>
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
:label="item.workshopName"
:value="item.workshopId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="所属工序" prop="processId">
<el-select v-model="form.processId" placeholder="请选择工序">
<el-select
v-model="form.processId"
multiple
style="width: 100%"
placeholder="请选择工序"
>
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processId"
:value="item.processId + ''"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
@@ -230,23 +308,45 @@
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider content-position="center" v-if="form.workstationId !=null">工作站资源</el-divider>
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
<el-row v-if="form.workstationId !=null">
<el-col :span=24>
<el-divider content-position="center" v-if="form.workstationId != null"
>工作站资源</el-divider
>
<MachinerySelectSingle
ref="machinerySelect"
@onSelected="onMachineryAdd"
></MachinerySelectSingle>
<el-row v-if="form.workstationId != null">
<el-col :span="24">
<el-carousel trigger="click" type="card" :autoplay="false">
<el-carousel-item>
<el-card shadow="always" style="width:450px">
<el-card shadow="always" style="width: 450px">
<div slot="header">
<span>设备资源</span>
<el-button style="float:right; padding: 3px 0" @click="handleMachineryAdd" v-if="optType !='view'" type="text">新增</el-button>
<span v-if="optTypebutton">
<el-button
style="float: right; padding: 3px 0"
@click="handleMachineryAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</span>
</div>
<WorkStationMachine ref="machineryList" :optType="optType" :workstationId="form.workstationId" style="align:center"></WorkStationMachine>
<WorkStationMachine
ref="machineryList"
:optType="optType"
:workstationId="form.workstationId"
style="align: center"
></WorkStationMachine>
</el-card>
</el-carousel-item>
<!-- <el-carousel-item>
@@ -271,7 +371,9 @@
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="cancel" v-if="optType == 'view'"
>返回</el-button
>
<el-button type="primary" @click="submitForm" v-else> </el-button>
<el-button @click="cancel"> </el-button>
</div>
@@ -280,35 +382,50 @@
</template>
<script>
import { listWorkstation, getWorkstation, delWorkstation, addWorkstation, updateWorkstation } from "@/api/mes/md/workstation";
import {
listWorkstation,
getWorkstation,
delWorkstation,
addWorkstation,
updateWorkstation,
} from "@/api/mes/md/workstation";
//设备资源选择与保存
import WorkStationMachine from "./components/machine";
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
import {addWorkstationmachine} from "@/api/mes/md/workstationmachine";
import {
listWorkstationmachine,
addWorkstationmachine,
} from "@/api/mes/md/workstationmachine";
//人力资源选择与保存
import Workstationworker from "./components/worker";
//工装夹具资源选择与保存
import WorkStationTool from "./components/tool";
import {getTreeList} from "@/api/mes/wm/warehouse"
import {listAllProcess} from "@/api/mes/pro/process";
import {genCode} from "@/api/system/autocode/rule";
import { getTreeList } from "@/api/mes/wm/warehouse";
import { listAllProcess } from "@/api/mes/pro/process";
import { genCode } from "@/api/system/autocode/rule";
import { listAllWorkshop } from "@/api/mes/md/workshop";
export default {
name: "Workstation",
dicts: ['sys_yes_no'],
components: {WorkStationMachine,MachinerySelectSingle,Workstationworker,WorkStationTool},
dicts: ["sys_yes_no"],
components: {
WorkStationMachine,
MachinerySelectSingle,
Workstationworker,
WorkStationTool,
},
data() {
return {
//自动生成编码
autoGenFlag:true,
autoGenFlag: true,
optType: undefined,
warehouseInfo:[],
warehouseOptions:[],
warehouseProps:{
warehouseInfo: [],
warehouseOptions: [],
warehouseProps: {
multiple: false,
value: 'pId',
label: 'pName',
value: "pId",
label: "pName",
},
// 遮罩层
loading: true,
@@ -325,9 +442,9 @@ export default {
// 工作站表格数据
workstationList: [],
//车间选项
workshopOptions:[],
workshopOptions: [],
//工序选项
processOptions:[],
processOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
@@ -349,27 +466,29 @@ export default {
locationId: null,
areaId: null,
enableFlag: null,
workstationId: null,
},
optTypebutton: true,
// 表单参数
form: {},
// 表单校验
rules: {
workstationCode: [
{ required: true, message: "工作站编号不能为空", trigger: "blur" }
{ required: true, message: "工作站编号不能为空", trigger: "blur" },
],
workstationName: [
{ required: true, message: "工作站名称不能为空", trigger: "blur" }
{ required: true, message: "工作站名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
workshopId: [
{ required: true, message: "请选择所属车间", trigger: "blur" }
{ required: true, message: "请选择所属车间", trigger: "blur" },
],
processId: [
{ required: true, message: "请选择所属工序", trigger: "blur" }
]
}
{ required: true, message: "请选择所属工序", trigger: "blur" },
],
},
};
},
created() {
@@ -382,45 +501,52 @@ export default {
/** 查询工作站列表 */
getList() {
this.loading = true;
listWorkstation(this.queryParams).then(response => {
listWorkstation(this.queryParams).then((response) => {
this.workstationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//查询车间信息
getWorkshops(){
listAllWorkshop().then( response => {
getWorkshops() {
listAllWorkshop().then((response) => {
this.workshopOptions = response.data;
});
},
//查询工序信息
getProcess(){
listAllProcess().then( response =>{
getProcess() {
listAllProcess().then((response) => {
this.processOptions = response.data;
});
},
//获取仓库
getWarehouseList(){
getTreeList().then( response =>{
getWarehouseList() {
getTreeList().then((response) => {
this.warehouseOptions = response.data;
this.warehouseOptions.map(w =>{
w.children.map(l =>{
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
l.children = JSON.parse(lstr);
this.warehouseOptions.map((w) => {
w.children.map((l) => {
let lstr = JSON.stringify(l.children)
.replace(/locationId/g, "lId")
.replace(/areaId/g, "pId")
.replace(/areaName/g, "pName");
l.children = JSON.parse(lstr);
});
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
let wstr = JSON.stringify(w.children)
.replace(/warehouseId/g, "wId")
.replace(/locationId/g, "pId")
.replace(/locationName/g, "pName");
w.children = JSON.parse(wstr);
});
let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');
let ostr = JSON.stringify(this.warehouseOptions)
.replace(/warehouseId/g, "pId")
.replace(/warehouseName/g, "pName");
this.warehouseOptions = JSON.parse(ostr);
});
},
//选择默认的仓库、库区、库位
handleWarehouseChanged(obj){
if(obj !=null){
//选择默认的仓库、库区、库位
handleWarehouseChanged(obj) {
if (obj != null) {
this.form.warehouseId = obj[0];
this.form.locationId = obj[1];
this.form.areaId = obj[2];
@@ -447,12 +573,12 @@ export default {
warehouseId: null,
locationId: null,
areaId: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.autoGenFlag = true;
this.resetForm("form");
@@ -464,7 +590,7 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams ={
this.queryParams = {
pageNum: 1,
pageSize: 10,
workstationCode: null,
@@ -486,9 +612,9 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.workstationId)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.workstationId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
@@ -497,16 +623,16 @@ export default {
this.open = true;
this.title = "添加工作站";
this.optType = "add";
genCode('WORKSTATION_CODE').then(response =>{
this.form.workstationCode = response;
});
genCode("WORKSTATION_CODE").then((response) => {
this.form.workstationCode = response;
});
},
// 查询明细按钮操作
handleView(row){
handleView(row) {
this.reset();
this.getWorkshops();
const workstationId = row.workstationId || this.ids;
getWorkstation(workstationId).then(response => {
getWorkstation(workstationId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看车间信息";
@@ -517,26 +643,41 @@ export default {
handleUpdate(row) {
this.reset();
this.getWorkshops();
const workstationId = row.workstationId || this.ids
getWorkstation(workstationId).then(response => {
const workstationId = row.workstationId || this.ids;
getWorkstation(workstationId).then((response) => {
this.form = response.data;
this.form.processId = response.data.processId.split(",");
console.log(this.form.processId);
this.open = true;
this.title = "修改工作站";
this.optType = "edit";
});
var queryParams = {
pageNum: 1,
pageSize: 1000,
workstationId: workstationId,
};
listWorkstationmachine(queryParams).then((response) => {
if (response.total == 1) {
this.optTypebutton = false;
} else {
this.optTypebutton = true;
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.workstationId != null) {
updateWorkstation(this.form).then(response => {
updateWorkstation(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWorkstation(this.form).then(response => {
this.form.processId = this.form.processId.join(",");
addWorkstation(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@@ -548,51 +689,59 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const workstationIds = row.workstationId || this.ids;
this.$modal.confirm('是否确认删除工作站?').then(function() {
return delWorkstation(workstationIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm("是否确认删除工作站?")
.then(function () {
return delWorkstation(workstationIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/md/workstation/export', {
...this.queryParams
}, `workstation_${new Date().getTime()}.xlsx`)
this.download(
"mes/md/workstation/export",
{
...this.queryParams,
},
`workstation_${new Date().getTime()}.xlsx`
);
},
//自动生成编码
handleAutoGenChange(autoGenFlag){
if(autoGenFlag){
genCode('WORKSTATION_CODE').then(response =>{
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode("WORKSTATION_CODE").then((response) => {
this.form.workstationCode = response;
});
}else{
} else {
this.form.workstationCode = null;
}
},
//设备资源选择弹出
handleMachineryAdd(){
handleMachineryAdd() {
this.$refs.machinerySelect.showFlag = true;
},
//设备资源选择回调
onMachineryAdd(rows){
debugger
onMachineryAdd(rows) {
debugger;
this.loading = true;
rows.workstationId = this.form.workstationId;
addWorkstationmachine(rows).then(response =>{
addWorkstationmachine(rows).then((response) => {
this.$refs.machineryList.getList();
this.loading = false;
});
},
//人力资源-岗位新增
handlePostAdd(){
handlePostAdd() {
this.$refs.postList.handleAdd();
},
//工装夹具资源新增
handleToolTypeAdd(){
handleToolTypeAdd() {
this.$refs.toolList.handleAdd();
}
}
},
},
};
</script>

View File

@@ -97,16 +97,16 @@ export default {
type: "category",
boundaryGap: true, //坐标轴两边留白
data: [
"2023-03",
"2023-04",
"2023-05",
"2023-06",
"2023-07",
"2023-08",
"2023-09",
"2023-10",
"2023-11",
"2023-12",
"2023-13",
"2023-14",
"2023-15",
"2023-16",
"2023-17",
],
axisLabel: {
//坐标轴刻度标签的相关设置。

View File

@@ -0,0 +1,343 @@
<template>
<div class="videoMain" ref="playWndBox">
<div
id="playWnd"
class="playWnd"
:style="{
height: playWndHeight + 'px',
width: playWndWidth + 'px',
}"
></div>
</div>
</template>
<script>
export default {
name: "HikVideo",
data() {
return {
// 视频盒子的高度
playWndHeight: "",
// 视频盒子的宽度
playWndWidth: "",
oWebControl: null,
initCount: 0,
pubKey: "",
cameraIndexCode: "", // 这里面是监控点编号
objData: {
appkey: "", //海康平台提供的appkey
ip: "", //平台地址
secret: "", //海康平台提供的secret
port: 443,
playMode: 0, // 0 预览 1回放
layout: "2x2", //页面展示的模块数【16】
},
};
},
mounted() {
// 首次加载时的到父容器的高度
this.playWndHeight = this.$refs.playWndBox.clientHeight;
// 首次加载时的到父容器的宽度
this.playWndWidth = this.$refs.playWndBox.clientWidth;
// 初始化播放器插件
this.$nextTick(() => {
this.initPlugin();
});
// 监听scroll事件使插件窗口尺寸跟随DIV窗口变化
window.addEventListener("scroll", () => {
if (this.oWebControl != null) {
this.oWebControl.JS_Resize(
this.$refs.playWndBox.clientWidth,
this.$refs.playWndBox.clientHeight
);
this.setWndCover();
}
});
// 监听resize事件使插件窗口尺寸跟随DIV窗口变化
window.addEventListener("resize", (e) => {
if (this.oWebControl != null) {
this.oWebControl.JS_Resize(
this.$refs.playWndBox.clientWidth,
this.$refs.playWndBox.clientHeight
);
this.setWndCover();
}
});
},
destroyed() {
if (this.oWebControl != null) {
// 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
this.oWebControl.JS_HideWnd();
// 销毁当前播放的视频
this.oWebControl.JS_RequestInterface({ funcName: "destroyWnd" });
// 断开与插件服务连接
this.oWebControl.JS_Disconnect();
}
},
methods: {
// 创建播放实例
initPlugin() {
let that = this;
this.oWebControl = null;
that.oWebControl = new WebControl({
szPluginContainer: "playWnd", // 指定容器id
iServicePortStart: 15900, // 指定起止端口号,建议使用该值
iServicePortEnd: 15909,
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // 用于IE10使用ActiveX的clsid
cbConnectSuccess: () => {
// 创建WebControl实例成功
that.oWebControl
.JS_StartService("window", {
// WebControl实例创建成功后需要启动服务
// 值"./VideoPluginConnect.dll"写死
dllPath: "./VideoPluginConnect.dll",
})
.then(
function () {
// 设置消息回调
that.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: that.cbIntegrationCallBack,
});
//JS_CreateWnd创建视频播放窗口宽高可设定
that.oWebControl
.JS_CreateWnd("playWnd", 2040, 945, { bEmbed: true })
//注2040,945这是我本人项目视频盒子的大小你们要根据自己视频盒子的大小进行修改不然初始化插件的时候会有空白闪烁。
.then(function () {
// 创建播放实例成功后初始化
that.init();
});
},
function () {
// 启动插件服务失败
}
);
},
// 创建WebControl实例失败
cbConnectError: function () {
that.oWebControl = null;
// alert('插件未启动,正在尝试启动,请稍候...')
// that.$message.warning("插件未启动,正在尝试启动,请稍候...");
// 程序未启动时执行error函数采用wakeup来启动程序
window.WebControl.JS_WakeUp("VideoWebPlugin://");
that.initCount++;
if (that.initCount < 3) {
setTimeout(function () {
that.initPlugin();
}, 3000);
} else {
// that.messageBox = true
// alert('插件启动失败,请安装插件并重新启动!')
// that.downloadHikVideo()
// setTimeout(function () {
// that.messageBox = false
// }, 5000)
// setTimeout(function () {
// alert('插件启动失败,请检查插件是否安装!')
// that.$message({
// message: '插件启动失败,请检查插件是否安装! \n 插件下载地址https://www.baidu.com',
// type: 'warning'
// });
// }, 5000)
}
},
cbConnectClose: () => {
// 异常断开bNormalClose = false
// JS_Disconnect正常断开bNormalClose = true
// console.log("cbConnectClose");
that.oWebControl = null;
},
});
},
// 初始化
init(callback) {
let that = this;
that.getPubKey(() => {
let appkey = that.objData.appkey; //综合安防管理平台提供的appkey必填
let secret = that.setEncrypt(that.objData.secret); //综合安防管理平台提供的secret必填
let ip = that.objData.ip; //综合安防管理平台IP地址必填
let playMode = that.objData.playMode; //初始播放模式0-预览1-回放
let port = that.objData.port; //综合安防管理平台端口若启用HTTPS协议默认443
let snapDir = "D:\\SnapDir"; //抓图存储路径
let videoDir = "D:\\VideoDir"; //紧急录像或录像剪辑存储路径
let layout = that.objData.layout; //playMode指定模式的布局
let enableHTTPS = 1; //是否启用HTTPS协议与综合安防管理平台交互这里总是填1
let encryptedFields = "secret"; //加密字段默认加密领域为secret
let showToolbar = 1; //是否显示工具栏0-不显示非0-显示
let showSmart = 1; //是否显示智能信息如配置移动侦测后画面上的线框0-不显示非0-显示
let buttonIDs =
"0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //自定义工具条按钮
// var toolBarButtonIDs = "2049,2304" // 工具栏上自定义按钮
that.oWebControl
.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //API网关提供的appkey
secret: secret, //API网关提供的secret
ip: ip, //API网关IP地址
playMode: playMode, //播放模式(决定显示预览还是回放界面)
port: port, //端口
snapDir: snapDir, //抓图存储路径
videoDir: videoDir, //紧急录像或录像剪辑存储路径
layout: layout, //布局
enableHTTPS: enableHTTPS, //是否启用HTTPS协议
encryptedFields: encryptedFields, //加密字段
showToolbar: showToolbar, //是否显示工具栏
showSmart: showSmart, //是否显示智能信息
buttonIDs, //自定义工具条按钮
}),
})
.then(function (oData) {
that.oWebControl.JS_Resize(that.playWndWidth, that.playWndHeight); // 初始化后resize一次规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
if (callback) {
callback();
}
// 隐藏
// that.oWebControl.JS_HideWnd()
});
});
},
// 获取公钥
getPubKey(callback) {
let that = this;
this.oWebControl
.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then(function (oData) {
if (oData.responseMsg.data) {
that.pubKey = oData.responseMsg.data;
callback();
}
});
},
// RSA 加密
setEncrypt(value) {
let that = this;
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(that.pubKey);
return encrypt.encrypt(value);
},
// 回调的消息
cbIntegrationCallBack(oData) {
let { responseMsg: type } = oData;
if (type === "error") {
} else {
}
},
// 视频预览功能
previewVideo(data) {
let that = this;
let cameraIndexCode = data; // 获取输入的监控点编号值,必填
let streamMode = 0; // 主子码流标识0-主码流1-子码流
let transMode = 0; // 传输协议0-UDP1-TCP
let gpuMode = 0; // 是否启用GPU硬解0-不启用1-启用
let wndId = -1; // 播放窗口序号在2x2以上布局下可指定播放窗口
// console.log(cameraIndexCode, "-------cameraIndexCode-");
that.oWebControl.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode.trim(), // 监控点编号
streamMode: streamMode, // 主子码流标识
transMode: transMode, // 传输协议
gpuMode: gpuMode, // 是否开启GPU硬解
wndId: wndId, // 可指定播放窗口
}),
});
},
// 停止全部预览
stopAllPreview() {
this.oWebControl.JS_RequestInterface({
funcName: "stopAllPreview",
});
},
// 格式化时间
dateFormat(oDate, fmt) {
let o = {
"M+": oDate.getMonth() + 1, //月份
"d+": oDate.getDate(), //日
"h+": oDate.getHours(), //小时
"m+": oDate.getMinutes(), //分
"s+": oDate.getSeconds(), //秒
"q+": Math.floor((oDate.getMonth() + 3) / 3), //季度
S: oDate.getMilliseconds(), //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
(oDate.getFullYear() + "").substr(4 - RegExp.$1.length)
);
}
for (let k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1
? o[k]
: ("00" + o[k]).substr(("" + o[k]).length)
);
}
}
return fmt;
},
// 设置窗口裁剪当因滚动条滚动导致窗口需要被遮住的情况下需要JS_CuttingPartWindow部分窗口
setWndCover() {
var iWidth = $(window).width();
var iHeight = $(window).height();
var oDivRect = $("#playWnd").get(0).getBoundingClientRect();
var iCoverLeft = oDivRect.left < 0 ? Math.abs(oDivRect.left) : 0;
var iCoverTop = oDivRect.top < 0 ? Math.abs(oDivRect.top) : 0;
var iCoverRight =
oDivRect.right - iWidth > 0 ? Math.round(oDivRect.right - iWidth) : 0;
var iCoverBottom =
oDivRect.bottom - iHeight > 0
? Math.round(oDivRect.bottom - iHeight)
: 0;
iCoverLeft = iCoverLeft > 2041 ? 2041 : iCoverLeft;
iCoverTop = iCoverTop > 945 ? 945 : iCoverTop;
iCoverRight = iCoverRight > 2041 ? 2041 : iCoverRight;
iCoverBottom = iCoverBottom > 945 ? 945 : iCoverBottom;
this.oWebControl.JS_RepairPartWindow(0, 0, 2041, 946); // 多1个像素点防止还原后边界缺失一个像素条
if (iCoverLeft != 0) {
this.oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, 946);
}
if (iCoverTop != 0) {
this.oWebControl.JS_CuttingPartWindow(0, 0, 2041, iCoverTop); // 多剪掉一个像素条,防止出现剪掉一部分窗口后出现一个像素条
}
if (iCoverRight != 0) {
this.oWebControl.JS_CuttingPartWindow(
2041 - iCoverRight,
0,
iCoverRight,
946
);
}
if (iCoverBottom != 0) {
this.oWebControl.JS_CuttingPartWindow(
0,
946 - iCoverBottom,
2041,
iCoverBottom
);
}
},
},
};
</script>
<style lang="scss" scoped>
.videoMain {
width: 100%;
height: 100%;
}
</style>

View File

@@ -139,12 +139,19 @@
<!-- 第二部分 -->
<div style="height: 75%">
<div style="height: 50%; display: flex">
<div style="width: 80%">
<div style="width: 45%">
<ticket :message="this.ticketData" />
</div>
<div style="width: 24%; margin-top: 50px">
<defective :message="this.defectiveData" />
</div>
<div style="width: 30%; margin-top: 50px">
<hkVideo
:cameraIndexCode="cameraIndexCode"
:objData="objData"
ref="hikVideo"
></hkVideo>
</div>
</div>
<div style="height: 50%; display: flex">
<div style="width: 45%">
@@ -252,11 +259,24 @@ import screenfull from "screenfull";
import defective from "./components/defective.vue";
import complete from "./components/complete.vue";
import ticket from "./components/ticket.vue";
import hkVideo from "./components/video.vue";
export default {
components: { defective, complete, ticket },
components: { defective, complete, ticket, hkVideo },
data() {
return {
cameraIndexCode: "", //wed插件监控点
//海康wed插件初始化数据
objData: {
appkey: "", //综合安防管理平台提供的appkey必填
ip: "", //综合安防管理平台IP地址必填
secret: "", //综合安防管理平台提供的secret必填
port: 443, //综合安防管理平台端口若启用HTTPS协议默认443
playMode: 0, // 0 预览 1回放
layout: "2x2", //页面展示的模块数【16】
showToolbar: 1, //是否显示工具栏0-不显示非0-显示
},
screenfull: false,
title: "生产监控分析",
titleVisible: false,

View File

@@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="工艺路线编号" prop="routeCode">
<el-input
v-model="queryParams.routeCode"
@@ -26,8 +33,16 @@
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
@@ -40,7 +55,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:pro:proroute:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -51,7 +67,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:pro:proroute:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -62,7 +79,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:pro:proroute:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -72,31 +90,47 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:pro:proroute:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="prorouteList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="prorouteList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工艺路线编号" align="center" prop="routeCode" >
<el-table-column label="工艺路线编号" align="center" prop="routeCode">
<template slot-scope="scope">
<el-button
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:pro:proroute:query']"
>{{scope.row.routeCode}}</el-button>
>{{ scope.row.routeCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工艺路线名称" align="center" prop="routeName" />
<el-table-column label="工艺路线说明" align="center" prop="routeDesc" />
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@@ -104,20 +138,25 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:pro:proroute:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:pro:proroute:remove']"
>删除</el-button>
>删除</el-button
>
<el-button size="mini" type="text" @click="handlecopy(scope.row)"
>复制</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@@ -125,43 +164,63 @@
/>
<!-- 添加或修改工艺路线对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1080px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="编号" prop="routeCode">
<el-input v-model="form.routeCode" placeholder="请输入工艺路线编号" />
<el-input
v-model="form.routeCode"
placeholder="请输入工艺路线编号"
/>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
<el-form-item label-width="80">
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="名称" prop="routeName">
<el-input v-model="form.routeName" placeholder="请输入工艺路线名称" />
<el-input
v-model="form.routeName"
placeholder="请输入工艺路线名称"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
@@ -169,28 +228,46 @@
<el-row>
<el-col :span="24">
<el-form-item label="说明" prop="routeDesc">
<el-input v-model="form.routeDesc" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.routeDesc"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.routeId != null">
<el-tabs type="border-card" v-if="form.routeId != null">
<el-tab-pane label="组成工序">
<Routeprocess v-if="form.routeId !=null" :optType="optType" :routeId="form.routeId"></Routeprocess>
<Routeprocess
v-if="form.routeId != null"
:optType="optType"
:routeId="form.routeId"
></Routeprocess>
</el-tab-pane>
<el-tab-pane label="关联产品">
<Routeproduct v-if="form.routeId !=null" :optType="optType" :routeId="form.routeId"></Routeproduct>
<Routeproduct
v-if="form.routeId != null"
:optType="optType"
:routeId="form.routeId"
></Routeproduct>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="cancel" v-if="optType == 'view'"
>返回</el-button
>
<el-button type="primary" @click="submitForm" v-else> </el-button>
<el-button @click="cancel"> </el-button>
</div>
@@ -199,18 +276,25 @@
</template>
<script>
import { listProroute, getProroute, delProroute, addProroute, updateProroute } from "@/api/mes/pro/proroute";
import {
listProroute,
getProroute,
delProroute,
addProroute,
updateProroute,
copyProRoute,
} from "@/api/mes/pro/proroute";
import Routeprocess from "./routeprocess";
import Routeproduct from "./product";
import {genCode} from "@/api/system/autocode/rule"
import { genCode } from "@/api/system/autocode/rule";
export default {
name: "Proroute",
dicts: ['sys_yes_no'],
components: {Routeprocess,Routeproduct},
dicts: ["sys_yes_no"],
components: { Routeprocess, Routeproduct },
data() {
return {
//自动生成编码
autoGenFlag:true,
autoGenFlag: true,
optType: undefined,
// 遮罩层
loading: true,
@@ -244,15 +328,15 @@ export default {
// 表单校验
rules: {
routeCode: [
{ required: true, message: "工艺路线编号不能为空", trigger: "blur" }
{ required: true, message: "工艺路线编号不能为空", trigger: "blur" },
],
routeName: [
{ required: true, message: "工艺路线名称不能为空", trigger: "blur" }
{ required: true, message: "工艺路线名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
}
},
};
},
created() {
@@ -262,7 +346,7 @@ export default {
/** 查询工艺路线列表 */
getList() {
this.loading = true;
listProroute(this.queryParams).then(response => {
listProroute(this.queryParams).then((response) => {
this.prorouteList = response.rows;
this.total = response.total;
this.loading = false;
@@ -280,12 +364,12 @@ export default {
routeCode: null,
routeName: null,
routeDesc: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.autoGenFlag = true;
this.resetForm("form");
@@ -302,9 +386,9 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.routeId)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.routeId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
@@ -312,15 +396,15 @@ export default {
this.open = true;
this.title = "添加工艺路线";
this.optType = "add";
genCode('ROUTE_CODE').then(response =>{
this.form.routeCode = response;
});
genCode("ROUTE_CODE").then((response) => {
this.form.routeCode = response;
});
},
// 查询明细按钮操作
handleView(row){
handleView(row) {
this.reset();
const routeId = row.routeId || this.ids;
getProroute(routeId).then(response => {
getProroute(routeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看工艺线路信息";
@@ -330,8 +414,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const routeId = row.routeId || this.ids
getProroute(routeId).then(response => {
const routeId = row.routeId || this.ids;
getProroute(routeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改工艺路线";
@@ -340,16 +424,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.routeId != null) {
updateProroute(this.form).then(response => {
updateProroute(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProroute(this.form).then(response => {
addProroute(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@@ -361,29 +445,52 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const routeIds = row.routeId || this.ids;
this.$modal.confirm('是否确认删除工艺路线编号为"' + routeIds + '"的数据项?').then(function() {
return delProroute(routeIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除?')
.then(function () {
return delProroute(routeIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
handlecopy(row) {
const routeId = row.routeId || this.ids;
copyProRoute(routeId).then((response) => {
this.$modal
.confirm("是否确认复制?")
.then(function () {
return delProroute(routeId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("复制成功");
})
.catch(() => {});
});
},
/** 导出按钮操作 */
handleExport() {
this.download('pro/proroute/export', {
...this.queryParams
}, `proroute_${new Date().getTime()}.xlsx`)
this.download(
"pro/proroute/export",
{
...this.queryParams,
},
`proroute_${new Date().getTime()}.xlsx`
);
},
//自动生成编码
handleAutoGenChange(autoGenFlag){
if(autoGenFlag){
genCode('ROUTE_CODE').then(response =>{
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode("ROUTE_CODE").then((response) => {
this.form.routeCode = response;
});
}else{
} else {
this.form.routeCode = null;
}
}
}
},
},
};
</script>

View File

@@ -164,7 +164,7 @@
>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="序号" prop="orderNum">
<el-input-number
:min="1"
@@ -173,7 +173,18 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="工序类型" prop="processTypeId">
<treeselect
v-model="form.processTypeId"
:options="machineryTypeOptions1"
:normalizer="normalizer1"
placeholder="请选择工序类型"
@select="handleNodeProcess"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="工序" prop="processId">
<el-select v-model="form.processId" placeholder="请选择工序">
<el-option
@@ -311,40 +322,16 @@
placeholder="请选择设备类型"
@select="handleNodeClick"
/>
<!-- :disable-branch-nodes="true" -->
</el-form-item>
</el-col>
<!-- <el-col :span="12"> -->
<el-col :span="12" v-if="Typefile">
<!-- <el-form-item label="代码上传" prop="">
<el-upload
ref="codeName"
class="upload-demo"
:headers="this.headers"
action="/prod-api/common/uploadMinio"
:before-remove="beforeRemove"
:on-change="customUploadChangeImage2"
:before-upload="beforeUpload"
:on-exceed="handleExceedImage1"
accept=".PDF"
name="file"
multiple
:limit="1"
:file-list="fileList"
>
<el-button size="small" type="primary" icon="el-icon-upload2"
>点击上传</el-button
>
<el-button type="primary" size="small" @click.stop="previewFile"
>&nbsp;预览文件</el-button
>
</el-upload>
</el-form-item> -->
<el-form-item label="代码上传" prop="url">
<el-col
:span="12"
v-if="this.form.code == 'CNC' || this.form.code == 'ROBOT'"
>
<el-form-item label="选择代码" prop="url">
<el-select
v-model="form.originalName"
value-key="codeId"
placeholder="请选择工序"
@change="selectSource($event)"
>
<el-option
@@ -358,7 +345,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="warehousing">
<el-col :span="12" v-if="this.form.code == 'STORE'">
<el-form-item label="选择出入库类型" prop="exitType">
<el-radio-group v-model="form.exitType">
<el-radio label="0">出库</el-radio>
@@ -368,7 +355,44 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="TypeId">
<el-col
:span="12"
v-if="
this.form.code == 'AGV_TRANSMIT' ||
this.form.code == 'TRANSMIT' ||
this.form.code == 'ROBOT_TRANSMIT'
"
>
<el-form-item label="传送带转动方向" prop="rotationDirection">
<el-radio-group v-model="form.rotationDirection">
<el-radio label="0">正转</el-radio>
<el-radio label="1">反转</el-radio>
<el-radio label="2">停止</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="this.form.code == 'ROBOT_TRANSMIT'">
<el-form-item label="传送带位置" prop="conveyNumber">
<el-radio-group v-model="form.conveyNumber">
<el-radio label="1">1号传送带</el-radio>
<el-radio label="2">2号传送带</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="this.form.code == 'CNC' || this.form.code == 'ROBOT'"
>
<el-form-item label="安全门状态" prop="securityDoor">
<el-radio-group v-model="form.securityDoor">
<el-radio label="0">开启</el-radio>
<el-radio label="1">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="this.form.code == 'AGV'">
<el-form-item label="选择线路" prop="lineId">
<el-select
v-model="form.lineId"
@@ -385,7 +409,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if="TypeId">
<el-col :span="12" v-if="this.form.code == 'AGV'">
<el-form-item label="选择点位" prop="pointId">
<el-select
v-model="form.pointId"
@@ -437,9 +461,13 @@ import {
addRouteprocess,
updateRouteprocess,
} from "@/api/mes/pro/routeprocess";
import { listAllProcess } from "@/api/mes/pro/process";
import { listProcess } from "@/api/mes/pro/process";
import { getToken } from "@/utils/auth";
import { listMachinerytype } from "@/api/mes/dv/machinerytype";
import {
listMachinerytype,
getMachinerytype,
} from "@/api/mes/dv/machinerytype";
import * as listType from "@/api/mes/pro/processType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
@@ -489,6 +517,7 @@ export default {
},
// 设备类型树选项
machineryTypeOptions: [],
machineryTypeOptions1: [],
fileList: [],
//车间线路
workshopOptions: [],
@@ -505,6 +534,7 @@ export default {
url: "",
lineId: "",
pointId: "",
code: null,
},
machineryList: [],
// 表单校验
@@ -532,6 +562,9 @@ export default {
trigger: "blur",
},
],
processTypeId: [
{ required: true, message: "请选择工序类型", trigger: "blur" },
],
idid: [
{ required: true, message: "请选择是否工艺节点", trigger: "blur" },
],
@@ -544,7 +577,7 @@ export default {
},
created() {
this.getList();
this.getProcess();
// this.getProcess();
this.getTreeselect();
this.getWorkshops();
},
@@ -558,12 +591,12 @@ export default {
this.loading = false;
});
},
//查询工序信息
getProcess() {
listAllProcess().then((response) => {
this.processOptions = response.data;
});
},
// //查询工序信息
// getProcess() {
// listAllProcess().then((response) => {
// this.processOptions = response.data;
// });
// },
getWorkshops() {
findProAgvline().then((response) => {
this.workshopOptions = response.rows;
@@ -583,6 +616,15 @@ export default {
)[0];
this.machineryTypeOptions.push(data);
});
listType.listMachinerytype().then((response) => {
this.machineryTypeOptions1 = [];
const data = this.handleTree(
response.data,
"processTypeId",
"parentTypeId"
)[0];
this.machineryTypeOptions1.push(data);
});
},
/** 转换设备类型数据结构 */
normalizer(node) {
@@ -595,28 +637,47 @@ export default {
children: node.children,
};
},
/** 转换设备类型数据结构 */
normalizer1(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.processTypeId,
label: node.processTypeName,
children: node.children,
};
},
// 节点单击事件
handleNodeClick(data) {
if (data.machineryTypeId == 229) {
this.TypeId = true;
this.Typefile = false;
this.warehousing = false;
console.log(data);
if (data.code == "AGV") {
// this.TypeId = true;
// this.Typefile = false;
// this.warehousing = false;
this.form.originalName = "";
this.form.url = "";
this.form.exitType = "";
} else if (data.machineryTypeId == 230) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = true;
} else if (data.code == "STORE") {
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = true;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "0";
this.form.originalName = "";
this.form.url = "";
} else if (data.code == "CNC" || data.code == "ROBOT") {
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = true;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "";
} else {
this.TypeId = false;
this.Typefile = true;
this.warehousing = false;
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = false;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "";
@@ -624,11 +685,18 @@ export default {
this.form.url = "";
}
this.form.machineryTypeName = data.machineryTypeName;
var queryParams = { machineryTypeId: data.machineryTypeId };
list(queryParams).then((response) => {
this.form.code = data.code;
var arr = { machineryTypeId: data.machineryTypeId };
list(arr).then((response) => {
this.machineryList = response.data;
});
},
handleNodeProcess(data) {
var arr = { processTypeId: data.processTypeId };
listProcess(arr).then((response) => {
this.processOptions = response.rows;
});
},
selectSource(e) {
console.log(e);
this.form.url = e.url;
@@ -724,6 +792,10 @@ export default {
lineId: null,
pointId: null,
exitType: "0",
rotationDirection: "0",
processTypeId: null,
code: null,
securityDoor: null,
};
this.fileList = [];
this.resetForm("form");
@@ -747,7 +819,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
if (this.form.machineryTypeId == null) {
if (this.form.code == null) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = false;
@@ -770,40 +842,21 @@ export default {
const recordId = row.recordId || this.ids;
getRouteprocess(recordId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改工艺组成";
getMachinerytype(row.machineryTypeId).then((response) => {
this.form.code = response.data.code;
this.open = true;
this.title = "修改工艺组成";
});
});
if (row.machineryTypeId == null) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = false;
} else {
if (row.machineryTypeId == 229) {
this.TypeId = true;
this.Typefile = false;
this.warehousing = false;
// this.form.originalName = "";
// this.form.url = "";
// this.form.exitType = "";
} else if (row.machineryTypeId == 230) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = true;
// this.form.lineId = "";
// this.form.pointId = "";
} else {
this.TypeId = false;
this.Typefile = true;
this.warehousing = false;
// this.form.lineId = "";
// this.form.pointId = "";
// this.form.exitType = "";
}
}
var queryParams = { machineryTypeId: row.machineryTypeId };
list(queryParams).then((response) => {
var arr = { machineryTypeId: row.machineryTypeId };
list(arr).then((response) => {
this.machineryList = response.data;
});
var arr1 = { processTypeId: row.processTypeId };
listProcess(arr1).then((response) => {
this.processOptions = response.rows;
});
var name = {};
if (row.originalName != undefined && row.originalName != "") {
this.$set(name, "name", row.originalName);
@@ -815,13 +868,6 @@ export default {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.recordId != null) {
// if (this.form.machineryTypeId == 229) {
// this.form.originalName = "";
// this.form.url = "";
// } else {
// this.form.lineId = "";
// this.form.pointId = "";
// }
updateRouteprocess(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;

View File

@@ -117,7 +117,7 @@
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
<el-col :span="1.5">
<el-button type="primary" plain size="mini" @click="production"
<el-button type="primary" plain size="mini" @click="handleproductione"
>批量执行生产</el-button
>
</el-col>
@@ -242,10 +242,24 @@
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'CONFIRMED'"
v-if="scope.row.status == 'PRODUCTION'"
@click="handleproductione(scope.row)"
>执行生产</el-button
>
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'WORKING'"
@click="Pendingproduction(scope.row)"
>暂停生产</el-button
>
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'SUSPENDED'"
@click="handleSuspended(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@@ -259,7 +273,12 @@
/>
<!-- 添加或修改生产工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1550px"
append-to-body
>
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="12">
@@ -274,7 +293,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="来源类型" prop="orderSource">
<el-radio-group v-model="form.orderSource" disabled>
<el-radio
@@ -286,12 +305,12 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8" v-if="form.orderSource == 'ORDER'">
<el-col :span="12" v-if="form.orderSource == 'ORDER'">
<el-form-item label="订单编号" prop="sourceCode">
<el-input v-model="form.sourceCode" readonly="readonly" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="排产状态" prop="status">
<el-select v-model="form.status" disabled>
<el-option
@@ -374,19 +393,22 @@
</el-col>
</el-row>
</el-form>
<el-steps
:active="activeProcess"
v-if="form.workorderId != null"
align-center
simple
>
<el-step
v-for="(item, index) in processOptions"
:title="item.processName"
@click.native="handleStepClick(index)"
<el-scrollbar style="height: 100%; background: #f5f7fa">
<el-steps
:active="activeProcess"
v-if="form.workorderId != null"
align-center
simple
>
</el-step>
</el-steps>
<el-step
v-for="(item, index) in processOptions"
:title="item.processName"
@click.native="handleStepClick(index)"
>
</el-step>
</el-steps>
</el-scrollbar>
<el-card
v-for="(item, index) in processOptions"
:key="index"
@@ -397,6 +419,7 @@
:routeId="item.routeId"
:processId="item.processId"
:colorCode="item.colorCode"
:orderNum="item.orderNum"
:optType="optType"
:recordId="item.recordId"
></ProTask>
@@ -431,6 +454,7 @@
</template>
<script>
import axios from "axios";
import {
listWorkorder,
getWorkorder,
@@ -511,6 +535,7 @@ export default {
},
// 表单参数
form: {},
ids: "",
};
},
created() {
@@ -634,14 +659,23 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
var ids = [];
ids = selection.map((item) => item.routeId);
this.ids = selection.map((item) => item.workorderId);
},
// 执行生产
handleproductione(row) {
const routeId = row.workorderId || this.ids;
axios
.get("http://192.168.3.53:8077/manage/task/execute?ids=" + routeId)
.then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess("执行成功");
this.getList();
}
});
},
production() {},
handleproductione() {},
selectable(row, index) {
if (row.status == "WORKING") {
if (row.status == "WORKING" || row.status == "PREPARE") {
return false;
} else {
return true;

View File

@@ -70,7 +70,7 @@
<el-color-picker v-model="scope.row.colorCode" disabled></el-color-picker>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100px" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="150px" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@@ -220,6 +220,7 @@ export default {
endTime: null,
colorCode: null,
requestDate: null,
orderNum: this.orderNum,
},
// 表单参数
form: {},
@@ -246,7 +247,8 @@ export default {
routeId: null,
processId: null,
optType: null,
recordId:null
recordId:null,
orderNum:null,
},
created() {
this.getList();

View File

@@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="工单编码" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
@@ -68,20 +75,30 @@
/>
</el-form-item>
<el-form-item label="需求日期" prop="requestDate">
<el-date-picker clearable
<el-date-picker
clearable
v-model="queryParams.requestDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择需求日期">
placeholder="请选择需求日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@@ -90,7 +107,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:pro:workorder:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -101,7 +119,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:pro:workorder:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -112,7 +131,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:pro:workorder:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@@ -122,9 +142,13 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:pro:workorder:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
@@ -132,89 +156,158 @@
:data="workorderList"
row-key="workorderId"
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="工单编码" width="180" prop="workorderCode" >
<el-table-column label="工单编码" width="180" prop="workorderCode">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:pro:workorder:query']"
>{{scope.row.workorderCode}}</el-button>
>{{ scope.row.workorderCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工单名称" width="200" align="center" prop="workorderName" :show-overflow-tooltip="true"/>
<el-table-column label="工单类型" align="center" prop="workorderType" >
<el-table-column
label="工单名称"
width="200"
align="center"
prop="workorderName"
:show-overflow-tooltip="true"
/>
<el-table-column label="工单类型" align="center" prop="workorderType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType"/>
<dict-tag
:options="dict.type.mes_workorder_type"
:value="scope.row.workorderType"
/>
</template>
</el-table-column>
<el-table-column label="工单来源" align="center" prop="orderSource" >
<el-table-column label="工单来源" align="center" prop="orderSource">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_sourcetype" :value="scope.row.orderSource"/>
<dict-tag
:options="dict.type.mes_workorder_sourcetype"
:value="scope.row.orderSource"
/>
</template>
</el-table-column>
<el-table-column label="订单编号" width="140" align="center" prop="sourceCode" />
<el-table-column label="产品编号" width="120" align="center" prop="productCode" />
<el-table-column label="产品名称" width="200" align="center" prop="productName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="productSpc" :show-overflow-tooltip="true"/>
<el-table-column
label="订单编号"
width="140"
align="center"
prop="sourceCode"
/>
<el-table-column
label="产品编号"
width="120"
align="center"
prop="productCode"
/>
<el-table-column
label="产品名称"
width="200"
align="center"
prop="productName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
prop="productSpc"
:show-overflow-tooltip="true"
/>
<el-table-column label="单位" align="center" prop="unitOfMeasure" />
<el-table-column label="计划数量" align="center" prop="quantity" />
<el-table-column label="计划数量" align="center" prop="quantity" />
<el-table-column label="调整数量" align="center" prop="quantityChanged" />
<el-table-column label="已生产数量" align="center" width="100px" prop="quantityProduced" />
<el-table-column label="批次号" align="center" width="100px" prop="batchCode" />
<el-table-column
label="已生产数量"
align="center"
width="100px"
prop="quantityProduced"
/>
<el-table-column
label="批次号"
align="center"
width="100px"
prop="batchCode"
/>
<el-table-column label="客户编码" align="center" prop="clientCode" />
<el-table-column label="客户名称" align="center" prop="clientName" :show-overflow-tooltip="true"/>
<el-table-column label="需求日期" align="center" prop="requestDate" width="180">
<el-table-column
label="客户名称"
align="center"
prop="clientName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="需求日期"
align="center"
prop="requestDate"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.requestDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.requestDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
<dict-tag
:options="dict.type.mes_order_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
width="150px"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-if="scope.row.status =='PREPARE'"
v-if="scope.row.status == 'PREPARE'"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:pro:workorder:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
v-if="scope.row.status =='CONFIRMED' && scope.row.workorderType =='SELF'"
v-if="
scope.row.status == 'CONFIRMED' &&
scope.row.workorderType == 'SELF'
"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:pro:workorder:update']"
>新增</el-button>
>新增</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-circle-check"
v-if="scope.row.status =='CONFIRMED'"
v-if="scope.row.status == 'CONFIRMED'"
@click="handleFinish(scope.row)"
v-hasPermi="['mes:pro:workorder:update']"
>完成</el-button>
>完成</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-if="scope.row.status =='PREPARE'"
v-if="scope.row.status == 'PREPARE'"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:pro:workorder:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@@ -227,51 +320,73 @@
<el-row>
<el-col :span="8">
<el-form-item label="工单编号" prop="workorderCode">
<el-input v-model="form.workorderCode" placeholder="请输入工单编号" />
<el-input
v-model="form.workorderCode"
placeholder="请输入工单编号"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view' && form.status =='PREPARE'">
<el-form-item label-width="80">
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view' && form.status == 'PREPARE'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工单名称" prop="workorderName">
<el-input v-model="form.workorderName" placeholder="请输入工单名称" />
<el-input
v-model="form.workorderName"
placeholder="请输入工单名称"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="来源类型" prop="orderSource">
<el-radio-group v-model="form.orderSource" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.orderSource"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.mes_workorder_sourcetype"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.orderSource" v-else>
<el-radio
v-for="dict in dict.type.mes_workorder_sourcetype"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8" v-if="form.orderSource == 'ORDER'">
<el-form-item label="订单编号" prop="sourceCode">
<el-input v-model="form.sourceCode" placeholder="请输入订单编号" />
<el-input
v-model="form.sourceCode"
placeholder="请输入订单编号"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据状态" prop="status">
<el-select v-model="form.status" disabled placeholder="请选择单据状态">
<el-select
v-model="form.status"
disabled
placeholder="请选择单据状态"
>
<el-option
v-for="dict in dict.type.mes_order_status"
:key="dict.value"
@@ -297,43 +412,66 @@
</el-col>
<el-col :span="8">
<el-form-item label="产品编号" prop="productCode">
<el-input v-model="form.productCode" placeholder="请选择产品" >
<el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
<el-input v-model="form.productCode" placeholder="请选择产品">
<el-button
slot="append"
@click="handleSelectProduct"
icon="el-icon-search"
></el-button>
</el-input>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected">
</ItemSelect>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="form.productName" placeholder="请选择产品" disabled/>
<el-input
v-model="form.productName"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="规格型号" prop="productSpc">
<el-input v-model="form.productSpc" placeholder="请选择产品" disabled/>
<el-input
v-model="form.productSpc"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitOfMeasure">
<el-input v-model="form.unitOfMeasure" placeholder="请选择产品" disabled/>
<el-input
v-model="form.unitOfMeasure"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="计划数量" prop="quantity">
<el-input-number :min="1" v-model="form.quantity" placeholder="请输入计划数量" />
<el-input-number
:min="1"
v-model="form.quantity"
placeholder="请输入计划数量"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="需求日期" prop="requestDate">
<el-date-picker clearable
<el-date-picker
clearable
v-model="form.requestDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择需求日期">
placeholder="请选择需求日期"
>
</el-date-picker>
</el-form-item>
</el-col>
@@ -343,34 +481,66 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工件数量" prop="workpieceType">
<el-radio-group v-model="form.workpieceType">
<el-radio label="1">一个托盘单工件</el-radio>
<el-radio label="0">一个托盘多工件</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.orderSource == 'ORDER'">
<el-col :span="12">
<el-form-item label="客户编码" prop="clientCode">
<el-input v-model="form.clientCode" placeholder="请选择客户" >
<el-button slot="append" @click="handleSelectClient" icon="el-icon-search"></el-button>
<el-input v-model="form.clientCode" placeholder="请选择客户">
<el-button
slot="append"
@click="handleSelectClient"
icon="el-icon-search"
></el-button>
</el-input>
<ClientSelect ref="clientSelect" @onSelected="onClientSelected" > </ClientSelect>
<ClientSelect ref="clientSelect" @onSelected="onClientSelected">
</ClientSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="clientName">
<el-input v-model="form.clientName" readonly="readonly" placeholder="请输入客户名称" />
<el-input
v-model="form.clientName"
readonly="readonly"
placeholder="请输入客户名称"
/>
</el-form-item>
</el-col>
<el-col></el-col>
</el-row>
<el-row v-if="form.workorderType == 'OUTSOURCE' || form.workorderType == 'PURCHASE'">
<el-row
v-if="
form.workorderType == 'OUTSOURCE' ||
form.workorderType == 'PURCHASE'
"
>
<el-col :span="12">
<el-form-item label="供应商编码" prop="vendorCode">
<el-input v-model="form.vendorCode" placeholder="请选择供应商" >
<el-button slot="append" @click="handleSelectVendor" icon="el-icon-search"></el-button>
<el-input v-model="form.vendorCode" placeholder="请选择供应商">
<el-button
slot="append"
@click="handleSelectVendor"
icon="el-icon-search"
></el-button>
</el-input>
<VendorSelect ref="vendorSelect" @onSelected="onVendorSelected" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称" prop="vendorName">
<el-input v-model="form.vendorName" readonly="readonly" placeholder="请选择供应商" />
<el-input
v-model="form.vendorName"
readonly="readonly"
placeholder="请选择供应商"
/>
</el-form-item>
</el-col>
<el-col></el-col>
@@ -383,23 +553,49 @@
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.workorderId != null">
<el-tab-pane label="BOM组成">
<Workorderbom ref="bomlist" :optType="optType" :workorder="form" @handleAddSub="handleSubAdd" ></Workorderbom>
</el-tab-pane>
<el-tab-pane label="物料需求">
<Workorderbom
ref="bomlist"
:optType="optType"
:workorder="form"
@handleAddSub="handleSubAdd"
></Workorderbom>
</el-tab-pane>
<el-tab-pane label="物料需求"> </el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
<el-button type="success" @click="handleConfirm" v-if="form.status =='PREPARE' && optType !='view' && form.workorderId !=null"> </el-button>
<el-button
type="primary"
@click="cancel"
v-if="optType == 'view' || form.status != 'PREPARE'"
>返回</el-button
>
<el-button
type="primary"
@click="submitForm"
v-if="form.status == 'PREPARE' && optType != 'view'"
>保 存</el-button
>
<el-button
type="success"
@click="handleConfirm"
v-if="
form.status == 'PREPARE' &&
optType != 'view' &&
form.workorderId != null
"
>确 认</el-button
>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
@@ -407,31 +603,38 @@
</template>
<script>
import { listWorkorder, getWorkorder, delWorkorder, addWorkorder, updateWorkorder ,dofinish} from "@/api/mes/pro/workorder";
import {
listWorkorder,
getWorkorder,
delWorkorder,
addWorkorder,
updateWorkorder,
dofinish,
} from "@/api/mes/pro/workorder";
import Workorderbom from "./bom/bom.vue";
import WorkorderItemList from "./items/item.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import ClientSelect from "@/components/clientSelect/single.vue";
import VendorSelect from "@/components/vendorSelect/single.vue";
import {genCode} from "@/api/system/autocode/rule"
import { genCode } from "@/api/system/autocode/rule";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Workorder",
dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],
dicts: ["mes_order_status", "mes_workorder_sourcetype", "mes_workorder_type"],
components: {
Treeselect,
ItemSelect ,
ItemSelect,
ClientSelect,
VendorSelect,
Workorderbom,
WorkorderItemList
WorkorderItemList,
},
data() {
return {
//自动生成编码
autoGenFlag:true,
autoGenFlag: true,
optType: undefined,
// 遮罩层
loading: true,
@@ -481,33 +684,33 @@ export default {
// 表单校验
rules: {
workorderCode: [
{ required: true, message: "工单编码不能为空", trigger: "blur" }
{ required: true, message: "工单编码不能为空", trigger: "blur" },
],
workorderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" }
{ required: true, message: "工单名称不能为空", trigger: "blur" },
],
// workorderType: [
// { required: true, message: "请选择生产工单类型", trigger: "blur" }
// ],
orderSource: [
{ required: true, message: "来源类型不能为空", trigger: "blur" }
{ required: true, message: "来源类型不能为空", trigger: "blur" },
],
productId: [
{ required: true, message: "产品不能为空", trigger: "blur" }
{ required: true, message: "产品不能为空", trigger: "blur" },
],
productCode: [
{ required: true, message: "产品编号不能为空", trigger: "blur" }
{ required: true, message: "产品编号不能为空", trigger: "blur" },
],
productName: [
{ required: true, message: "产品名称不能为空", trigger: "blur" }
{ required: true, message: "产品名称不能为空", trigger: "blur" },
],
quantity: [
{ required: true, message: "生产数量不能为空", trigger: "blur" }
{ required: true, message: "生产数量不能为空", trigger: "blur" },
],
requestDate: [
{ required: true, message: "需求日期不能为空", trigger: "blur" }
{ required: true, message: "需求日期不能为空", trigger: "blur" },
],
}
},
};
},
created() {
@@ -517,8 +720,12 @@ export default {
/** 查询生产工单列表 */
getList() {
this.loading = true;
listWorkorder(this.queryParams).then(response => {
this.workorderList = this.handleTree(response.rows, "workorderId", "parentId");
listWorkorder(this.queryParams).then((response) => {
this.workorderList = this.handleTree(
response.rows,
"workorderId",
"parentId"
);
this.total = response.total;
this.loading = false;
});
@@ -531,15 +738,23 @@ export default {
return {
id: node.workorderId,
label: node.workorderName,
children: node.children
children: node.children,
};
},
/** 查询生产工单下拉树结构 */
/** 查询生产工单下拉树结构 */
getTreeselect() {
listWorkorder().then(response => {
listWorkorder().then((response) => {
this.workorderOptions = [];
const data = { workorderId: 0, workorderName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "workorderId", "parentId");
const data = {
workorderId: 0,
workorderName: "顶级节点",
children: [],
};
data.children = this.handleTree(
response.data,
"workorderId",
"parentId"
);
this.workorderOptions.push(data);
});
},
@@ -554,7 +769,7 @@ export default {
workorderId: null,
workorderCode: null,
workorderName: null,
workorderType: 'SELF',
workorderType: "SELF",
orderSource: null,
sourceCode: null,
productId: null,
@@ -579,7 +794,8 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
workpieceType: "1",
};
this.autoGenFlag = true;
this.resetForm("form");
@@ -594,7 +810,7 @@ export default {
this.handleQuery();
},
//从BOM行中直接新增
handleSubAdd(row){
handleSubAdd(row) {
this.open = false;
this.reset();
this.getTreeselect();
@@ -608,7 +824,7 @@ export default {
}
this.open = true;
this.title = "添加生产工单";
this.optType="add";
this.optType = "add";
},
/** 新增按钮操作 */
handleAdd(row) {
@@ -626,17 +842,17 @@ export default {
}
this.open = true;
this.title = "添加生产工单";
this.optType="add";
genCode('WORKORDER_CODE').then(response =>{
this.form.workorderCode = response;
});
this.optType = "add";
genCode("WORKORDER_CODE").then((response) => {
this.form.workorderCode = response;
});
},
// 查询明细按钮操作
handleView(row){
handleView(row) {
this.reset();
this.getTreeselect();
const workorderId = row.workorderId || this.ids;
getWorkorder(workorderId).then(response => {
getWorkorder(workorderId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看工单信息";
@@ -650,27 +866,27 @@ export default {
if (row != null) {
this.form.parentId = row.workorderId;
}
getWorkorder(row.workorderId).then(response => {
getWorkorder(row.workorderId).then((response) => {
this.form = response.data;
this.form.workorderType = 'SELF'
this.form.workorderType = "SELF";
this.open = true;
this.title = "修改生产工单";
this.optType="edit";
this.optType = "edit";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.workorderId != null) {
updateWorkorder(this.form).then(response => {
updateWorkorder(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
//this.open = false;
this.$refs["bomlist"].getList();
this.getList();
});
} else {
addWorkorder(this.form).then(response => {
addWorkorder(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
//this.open = false;
this.form.workorderId = response.data;
@@ -682,82 +898,98 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除生产工单编号为"' + row.workorderId + '"的数据项?').then(function() {
return delWorkorder(row.workorderId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm(
'是否确认删除生产工单编号为"' + row.workorderId + '"的数据项?'
)
.then(function () {
return delWorkorder(row.workorderId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
handleSelectProduct(){
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true;
},
handleSelectClient(){
handleSelectClient() {
this.$refs.clientSelect.showFlag = true;
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/pro/workorder/export', {
...this.queryParams
}, `workorder_${new Date().getTime()}.xlsx`)
this.download(
"mes/pro/workorder/export",
{
...this.queryParams,
},
`workorder_${new Date().getTime()}.xlsx`
);
},
handleConfirm(){
handleConfirm() {
let that = this;
this.$modal.confirm('是否确认完成工单编制?【确认后将不能更改】').then(function(){
that.form.status = 'CONFIRMED';
that.submitForm();
});
this.$modal
.confirm("是否确认完成工单编制?【确认后将不能更改】")
.then(function () {
that.form.status = "CONFIRMED";
that.submitForm();
});
},
handleFinish(row){
handleFinish(row) {
const workorderIds = row.workorderId || this.ids;
this.$modal.confirm('确认完成工单?一旦完成,此工单将无法继续报工').then(function() {
return dofinish(workorderIds) //完成工单
}).then(() => {
this.getList();
this.$modal.msgSuccess("更改成功");
}).catch(() => {});
this.$modal
.confirm("确认完成工单?一旦完成,此工单将无法继续报工")
.then(function () {
return dofinish(workorderIds); //完成工单
})
.then(() => {
this.getList();
this.$modal.msgSuccess("更改成功");
})
.catch(() => {});
},
//物料选择弹出框
onItemSelected(obj){
if(obj != undefined && obj != null){
this.form.productId = obj.itemId;
this.form.productCode = obj.itemCode;
this.form.productName = obj.itemName;
this.form.productSpc = obj.specification;
this.form.unitOfMeasure = obj.unitOfMeasure;
}
onItemSelected(obj) {
if (obj != undefined && obj != null) {
this.form.productId = obj.itemId;
this.form.productCode = obj.itemCode;
this.form.productName = obj.itemName;
this.form.productSpc = obj.specification;
this.form.unitOfMeasure = obj.unitOfMeasure;
}
},
//客户选择弹出框
onClientSelected(obj){
if(obj != undefined && obj != null){
this.form.clientId = obj.clientId;
this.form.clientCode = obj.clientCode;
this.form.clientName = obj.clientName;
}
onClientSelected(obj) {
if (obj != undefined && obj != null) {
this.form.clientId = obj.clientId;
this.form.clientCode = obj.clientCode;
this.form.clientName = obj.clientName;
}
},
//供应商选择
handleSelectVendor(){
handleSelectVendor() {
this.$refs.vendorSelect.showFlag = true;
},
//供应商选择弹出框
onVendorSelected(obj){
debugger;
if(obj != undefined && obj != null){
this.form.vendorId = obj.vendorId;
this.form.vendorCode = obj.vendorCode;
this.form.vendorName = obj.vendorName;
}
onVendorSelected(obj) {
debugger;
if (obj != undefined && obj != null) {
this.form.vendorId = obj.vendorId;
this.form.vendorCode = obj.vendorCode;
this.form.vendorName = obj.vendorName;
}
},
//自动生成编码
handleAutoGenChange(autoGenFlag){
if(autoGenFlag){
genCode('WORKORDER_CODE').then(response =>{
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode("WORKORDER_CODE").then((response) => {
this.form.workorderCode = response;
});
}else{
} else {
this.form.workorderCode = null;
}
}
}
},
},
};
</script>