Files
scrq-hd/.svn/pristine/00/0090f60dff83bb6b6393aa53a8f6c5eea06d7a20.svn-base
2025-07-03 10:34:04 +08:00

821 lines
22 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="80px"
>
<el-form-item prop="number">
<el-input
v-model="queryParams.name"
placeholder="请输入工艺名称"
size="small"
style="width: 230px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="bomName">
<el-input
v-model="queryParams.bomName"
size="small"
placeholder="请输入BOM版本"
style="width: 230px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item prop="dictStatus">
<el-select
size="small"
placeholder="请选择工艺状态"
v-model="queryParams.dictStatus"
style="width: 230px"
>
<el-option
v-for="(dict, index) in this.$dictType.getRouteStatusArray()"
:key="index"
:label="dict.text"
:value="dict.key"
/>
</el-select>
</el-form-item>
<el-form-item prop="dictType">
<el-select
size="small"
v-model="queryParams.dictType"
placeholder="请选择工艺类型"
style="width: 230px"
>
<el-option
v-for="(dict, index) in this.$dictType.getRouteTypeArray()"
:key="index"
:label="dict.text"
:value="dict.key"
/>
</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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['baRouter_add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['baRouter_edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="single"
@click="handleDelete"
v-hasPermi="['baRouter_remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['baRouter_import']"
>导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="openGraph"
v-hasPermi="['baRouter_openGraph']"
>工艺配置
</el-button>
</el-col>
<el-col :span="1.5">
<el-select
ref="select"
@click.native="notSelect"
style="width: 800px"
v-model="seqence"
:multiple="true"
placeholder=""
>
<el-option
v-for="item in seqenceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
<el-popover
style="float: right"
placement="bottom-end"
title="自定义显示列"
width="250"
@show="initPopover"
trigger="hover"
>
<headConfig
ref="test"
@fathers="fathers"
:propThis="propThis"
></headConfig>
<el-button
size="mini"
type="primary"
class="el-icon-caret-bottom"
slot="reference"
>自定义列</el-button
>
</el-popover>
</el-row>
<el-table
@sort-change="sortChange"
v-loading="loading"
:data="routeList"
@header-dragend="headerDragend"
lazy
v-if="indexShow"
highlight-current-row
@current-change="selectRow"
:tree-props="{ children: 'children', hasChildren: true }"
@selection-change="handleSelectionChange"
border
ref="list"
stripe
:height="tableHeight"
>
<el-table-column type="index" align="center" label="序号" width="50">
</el-table-column>
<!-- <el-table-column type="expand">-->
<!-- <template slot-scope="scope">-->
<!-- <el-table v-loading="subLoading" :data="childrenList" style="width: 80%"-->
<!-- class="two-list">-->
<!-- <el-table-column align="center" type="index" label="序号"></el-table-column>-->
<!-- <el-table-column prop="name" label="工序名称" width="200"></el-table-column>-->
<!-- <el-table-column prop="workCenterName" label="工作中心" width="200"></el-table-column>-->
<!-- <el-table-column prop="dictStatusShow" label="状态"></el-table-column>-->
<!-- <el-table-column prop="dictTypeShow" label="类型"></el-table-column>-->
<!-- <el-table-column prop="currentRevision" label="当前版本"></el-table-column>-->
<!-- </el-table>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
v-for="(item, index) in realList"
:sortable="item.notSort == true ? false : `custom`"
:prop="item.tableProp"
:key="index"
:align="item.align"
header-align="center"
:min-width="item.width"
:label="item.tableTitle"
:show-overflow-tooltip="item.show_overflow_tooltip"
>
</el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryParams.pageNo"
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
:page-size="queryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
<!-- 用户导入对话框 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示仅允许导入“xls”或“xlsx”格式文件
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
<el-link type="success" @click.prevent="down">下载模板</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import graphEdit from "./graphEdit";
import baRoute from "./ba-route-form";
// import bomList from './order-prod-valid'
import TreeSelect from "@riophae/vue-treeselect"; //引用下拉树组件
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
//引入css文件
import "@/assets/styles/cme-im-grid.scss";
import { getToken } from "@/utils/auth";
export default {
name: "OrderProd",
components: {
TreeSelect,
},
data() {
return {
normalizer(node) {
return {
id: node.value,
label: node.title,
children: node.children,
isDefaultExpanded: true,
};
},
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
// 上传的地址
url: "/dev-api/craft/craft/route/importExcel2",
},
propThis: this,
selectRowNow: {},
List: [],
realList: [],
tableHeight: 0,
indexShow: false,
treeValue: [],
treeOptions: [], //下拉树数据
routeList: [],
childrenList: [],
expendFlag: false,
subLoading: false,
// 遮罩层
dateRange: [],
loading: false,
orderStatus: [],
orderType: [],
// 选中数组
rows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 用户表格数据
// 弹出层标题
// 表单参数
form: {
id: undefined,
number: "",
planQty: 0,
materialId: "",
bomId: "",
dictStatus: 1,
dictType: 1,
order: 99,
customerOrder: "",
customer: "",
autoOrderPicking: false,
autoOrderWork: false,
planStartDt: undefined,
planEndDt: undefined,
routeId: undefined,
workCenterId: undefined,
},
centerTree: [],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 50,
number: undefined,
bomName: undefined,
dictStatus: undefined,
dictType: undefined,
workCenterId: undefined,
},
seqenceOptions: [],
seqence: [],
};
},
watch: {
seqence: function () {
this.getList();
},
},
computed: {
headers() {
return {
Authorization: "Bearer " + getToken(),
};
},
},
mounted() {
console.log(process.env.NODE_ENV,"渲染时候")
if (process.env.NODE_ENV == "development") {
this.upload.url = `/dev-api/craft/craft/route/importExcel2`;
} else {
this.upload.url = `/prod-api/craft/craft/route/importExcel2`;
}
},
created() {
let tempList = this.$headerConfig.getList("baRouter");
tempList.forEach((data, index) => {
if (data.notSort) return;
let temp = {
value: null,
label: null,
};
temp.value = data.tableProp.replace("Show", "") + " ascending";
temp.label = data.tableTitle + " 升序";
this.seqenceOptions.push(temp);
let tempD = {
value: null,
label: null,
};
tempD.value = data.tableProp.replace("Show", "") + " descending";
tempD.label = data.tableTitle + " 降序";
this.seqenceOptions.push(tempD);
});
this.initData();
},
methods: {
notSelect() {
this.$refs.select.blur();
},
sortChange({ column, prop, order }) {
console.log(prop);
let sTemp = {
value: null,
label: null,
};
let value = prop.replace("Show", "") + " " + order;
let judgeValue = value.split(" ");
// this.seqence.push(value)
if (this.seqence.length === 0) {
this.seqence.push(value);
} else {
for (let i = 0; i < this.seqence.length; i++) {
let judgeSeqence = this.seqence[i].split(" ");
if (judgeValue[0] === judgeSeqence[0]) {
if (judgeValue[1] === "null") {
return;
}
this.seqence.splice(i, 1, value);
console.log(this.seqence);
return;
}
if (i + 1 === this.seqence.length) {
this.seqence.push(value);
console.log(this.seqence);
}
}
}
},
headerDragend(newWidth, oldWidth, column, event) {
// realList
this.realList.forEach((value) => {
if (column.property == value.tableProp) {
value.width = newWidth;
}
});
this.$refs.test.init();
setTimeout(() => {
this.$refs.test.show();
}, 1000);
},
handleImport() {
this.upload.title = "工艺路线信息导入";
this.upload.open = true;
},
down() {
if (process.env.NODE_ENV == "development") {
window.location.href = `./down/route.xlsx`;
// 工艺路线信息导入 模板
} else {
window.location.href = `./down/route.xlsx`;
// 工艺路线信息导入 模板
}
},
// /** 下载模板操作 */
// importTemplate() {
// importTemplate().then(response => {
// this.download(response.msg)
// })
// },
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.data, "导入结果", {
dangerouslyUseHTMLString: true,
});
this.getList();
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit();
},
initPopover() {
const params = {
tableName: "baRouter",
};
this.$headerConfig.getRealList(params).then((data) => {
// console.log("dsffwggerwer2w",data);
let temp = JSON.parse(data.data.data);
// console.log(temp);
this.realList = temp.headerList;
console.log(this.realList);
this.$refs.test.init();
});
},
fathers(data) {
this.List = data.configure.List;
data.configure.List.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
data.configure.headerList.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
if (data.configure.headerList.length <= 0) {
return;
}
const params = {
tableName: "baRouter",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
selectRow(val) {
this.single = false;
this.selectRowNow = val;
},
handleSizeChange(val) {
this.queryParams.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.queryParams.pageNo = val;
this.getList();
},
//在method里面写上方法
// expandChange(value) {
// this.expendFlag = !this.expendFlag
// if (this.expendFlag) {
// this.getChildrenList(value.id)
// }
//
// },
//初始化表格
initData() {
this.getList();
this.getWorkCenterTree();
this.$nextTick(() => {
this.tableHeight =
window.innerHeight - this.$refs.queryForm.$el.offsetTop - 260;
// 监听窗口大小变化
let self = this;
window.onresize = function () {
self.tableHeight =
window.innerHeight - self.$refs.queryForm.$el.offsetTop - 260;
};
});
const params = {
tableName: "baRouter",
};
this.$headerConfig.getRealList(params).then((data) => {
console.log("开始输出真正表格");
if (data.data && data.data.data && data.data.data !== null) {
let temp = JSON.parse(data.data.data);
this.realList = temp.headerList;
this.List = temp.List;
} else {
this.List = this.$headerConfig.getList("baRouter");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "baRouter",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.indexShow = true;
});
},
getWorkCenterTree() {
this.$plan.getWorkCenterTree().then((resp) => {
this.treeOptions = [];
this.treeOptions.push(resp.data.data);
this.removeBlackChildren(this.treeOptions);
});
},
removeBlackChildren(list) {
list.forEach((value) => {
if (value.children.length == 0) {
value.children = undefined;
} else {
this.removeBlackChildren(value.children);
}
});
},
/** 查询工艺列表 */
getList() {
this.loading = true;
const orders = [];
this.seqence.map((val) => {
orders.push(
val.replace("ascending", "asc").replace("descending", "desc")
);
});
this.queryParams.orders = orders;
this.$baRoute.getRouteList(this.queryParams).then((resp) => {
this.loading = false;
this.total = resp.data.data.recordsTotal;
this.routeList = resp.data.data.data;
this.routeList.forEach((value) => {
value.dictStatusShow = this.$dictType.getRouteStatus(
value.dictStatus
);
value.dictTypeShow = this.$dictType.getRouteType(value.dictType);
});
});
},
//获取工序
getChildrenList(routeId) {
this.subLoading = true;
let params = {
routeId,
};
this.$baRoute.getOperationListByRoute(params).then((resp) => {
this.subLoading = false;
if (resp.data.code == "200") {
this.childrenList = resp.data.data;
this.childrenList.forEach((value) => {
value.dictStatusShow = this.$dictType.getRouteStatus(
value.dictStatus
);
value.dictTypeShow = this.$dictType.getRouteType(value.dictType);
});
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNo: 1,
pageSize: 50,
number: undefined,
bomName: undefined,
dictStatus: undefined,
dictType: undefined,
workCenterId: undefined,
};
this.seqence = [];
// this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.rows = selection;
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.$layer.iframe({
shadeClose: false,
content: {
content: baRoute, //传递的组件对象
parent: this, //当前的vue对象
},
area: ["730px", "400px"],
title: "创建工艺路线",
});
},
openGraph() {
console.log('1607')
this.$layer.iframe({
shadeClose: false,
content: {
content: graphEdit, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: {
formType: 1,
row: this.selectRowNow,
},
},
area: ["1200px", "670px"],
title: "编辑工艺路线",
});
},
handleUpdate() {
this.$layer.iframe({
shadeClose: false,
content: {
content: baRoute, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: {
formType: 1,
row: this.selectRowNow,
},
},
area: ["730px", "400px"],
title: "编辑工艺路线",
});
},
valid() {
// this.$layer.iframe({
// shadeClose:false,
// content: {
// content: bomList, //传递的组件对象
// parent: this,//当前的vue对象
// shadeClose: false,
// data: {
// rows:this.rows
// }
// },
// area: ['900px', '420px'],
// title: '齐套性判断'
// })
},
/** 删除按钮操作 */
handleDelete(row) {
row = this.selectRowNow;
this.$confirm("是否删除选中工艺路线【" + row.name + "】?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.$baRoute.deleteRoute({ id: row.id }).then((resp) => {
if (resp.data.code == "200") {
this.$message.success("删除成功!!");
this.getList();
}else{
}
}).catch(resp=>{
this.$message.error(resp.msg);
})
});
},
},
};
</script>
<style scoped lang="scss">
>>> .el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
>>> .el-table__body tr.current-row > td {
background-color: #8ac1ff !important;
cursor: pointer;
}
>>> .el-table__body tr:hover > td {
background-color: #e9edf3 !important;
cursor: pointer;
}
>>> .el-link.el-link--default {
color: white;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
padding-right: 35px;
}
>>> .el-input__suffix-inner {
display: none;
}
>>> .el-form-item {
margin-bottom: 10px;
}
.el-divider {
margin-top: 0px;
margin-bottom: 5px;
}
>>> .el-table .el-table__header-wrapper th {
padding: 5px 0;
}
</style>