Commit 8276f5f0 by 夏超

[fix] 修改前端工艺设计

parent 7578583f
......@@ -7,15 +7,14 @@
<!-- 禁止界面缩放 -->
<meta content="width=device-width,initial-scale=1.0, maximum-scale=1.0,user-scalable=0" name="viewport" />
<!-- 引入本地文件--Vue、axios、element-ui的样式文件、element-ui的JS文件-->
<!-- /roke_workstation_api/static/src/html/element-ui -->
<link rel="stylesheet" href="/sdddl_project/static/src/html/element-ui/index.css" />
<link rel="stylesheet" href="/sdddl_project/static/src/html/assets/iconfont/iconfont.css" />
<script src="/sdddl_project/static/src/html/js/vue.js"></script>
<script src="/sdddl_project/static/src/html/js/axios.min.js"></script>
<script src="/sdddl_project/static/src/html/js/Sortable.min.js"></script>
<script src="/sdddl_project/static/src/html/js/vuedraggable.umd.min.js"></script>
<script src="/sdddl_project/static/src/html/element-ui/index.js"></script>
<script src="/sdddl_project/static/src/html/assets/iconfont/iconfont.js"></script>
<link rel="stylesheet" href="/roke_workstation_api/static/html/routing/element-ui/index.css" />
<link rel="stylesheet" href="/roke_workstation_api/static/html/routing/assets/iconfont/iconfont.css" />
<script src="/roke_workstation_api/static/html/routing/js/vue.js"></script>
<script src="/roke_workstation_api/static/html/routing/js/axios.min.js"></script>
<script src="/roke_workstation_api/static/html/routing/js/Sortable.min.js"></script>
<script src="/roke_workstation_api/static/html/routing/js/vuedraggable.umd.min.js"></script>
<script src="/roke_workstation_api/static/html/routing/element-ui/index.js"></script>
<script src="/roke_workstation_api/static/html/routing/assets/iconfont/iconfont.js"></script>
</head>
<body id="bodyId" style="display: none;">
......@@ -516,8 +515,7 @@
<!-- 产线以及工位 -->
<div v-if="activeIndex=='产线以及工位'">
<el-table ref="tabelRef" :data="productionLineStationList" style="width: 100%"
:height="routingData.routing_id?(windowHeight-50):windowHeight"
:header-cell-style="{backgroundColor:'#f5f7fa'}">
:height="windowHeight" :header-cell-style="{backgroundColor:'#f5f7fa'}">
<el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
<el-table-column label="产线" align="center" prop="workshop_name"></el-table-column>
<el-table-column label="工位" align="center" prop="work_center_text"></el-table-column>
......@@ -776,22 +774,53 @@
<!-- 选择物料弹窗 -->
<el-dialog title="选择物料" :visible.sync="selMaterialDialogShow" destroy-on-close width="60%"
@close="dialogCloseHandle('选择物料')" @open="selMaterialDialogOpen">
<div style="display: flex; align-items: center; justify-content: center;">
<el-transfer v-model="selmaterialList" :data="materialList" filterable filter-placeholder="请输入名称"
:titles="['物料列表','选中列表']" :props="{key:'id', label:'name',disabled:'disabled'}"
@change="selMaterialChange">
<span slot-scope="{ option }">
<span>[[option.name]]</span>
<el-tooltip effect="dark" content="BOM内" placement="bottom"
v-if="materialCheckList.includes(option.id)">
<i class="el-icon-paperclip" style="color: #409EFF;"></i>
<div class="selectMaterialsBoxClass">
<div class="tagBoxClass">
<label>已选择物料:</label>
<el-tag class="tagClass" v-for="item in selmaterialList" :key="item.id" closable
@close="tagClosehandle(item)">
[[item.name]]
</el-tag>
</div>
<div class="selMaterialsFiltrateBox">
<el-input style="width: 30%;" size="medium" v-model="selMaterialValue" placeholder="请输入物料名称"
@change="selMaterialCategoryChange"></el-input>
<el-select style="width: 30%; margin-left: 20px;" size="medium" clearable
v-model="selMaterialCategoryId" placeholder="请选择类别" @change="selMaterialCategoryChange">
<el-option v-for="item in materialCategoryList" :key="item.id" :label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="selMaterialsContentBox">
<div v-for="(item,index) in materialList" :key="index" class="materialItemClass">
<el-checkbox v-model="item.show" @change="materialsChangeHandle($event,item)">
<el-tooltip effect="dark" :disabled="item.name.length<7" :content="item.name"
placement="top">
<span class="nameLabelClass">[[item.name]]</span>
</el-tooltip>
<el-tooltip effect="dark" content="BOM内" placement="bottom"
:disabled="!(materialCheckList.includes(item.id))">
<span class="iconLabelClass">
<i v-if="materialCheckList.includes(item.id)" class="el-icon-paperclip"
style="color: #409EFF;"></i>
</span>
</el-transfer>
</el-tooltip>
</el-checkbox>
</div>
<span slot="footer" class="dialog-footer">
</div>
</div>
<!-- 789 -->
<span slot="footer" class="selMaterialsBottonBox">
<div class="selMaterialsPaginationBox">
<el-pagination @current-change="materialsCurrentChange" :current-page.sync="materialPageCount"
:page-size="materialPageSize" layout="prev, pager, next, jumper" :total="materialTotal">
</el-pagination>
</div>
<div class="dialog-footer">
<el-button size="small" @click="dialogCloseHandle('选择物料')">取消</el-button>
<el-button size="small" type="primary" @click="dialogSaveHandle('选择物料')">确定</el-button>
</div>
</span>
</el-dialog>
<!-- 维护工位弹窗 -->
......@@ -878,7 +907,7 @@
searchProcessValue: '', // 搜索工序输入框的值
processList: [], // 添加产品工序弹窗工序列表
multipleSelection: [], // 添加产品工序弹窗选中工序列表
activeIndex: "工艺参数", // 当前选中的导航菜单
activeIndex: "关键物料", // 当前选中的导航菜单
isEdit: false, // 是否为编辑状态
standardsDialogShow: false, // 工艺参数添加弹窗状态
standardsForm: {
......@@ -939,6 +968,12 @@
materialList: [], // 物料列表
selmaterialList: [], // 选中的物料列表
materialCheckList: [], // 关键物料校验数组
selMaterialValue: '', // 选择物料弹窗输入框的值
selMaterialCategoryId: '', // 选择物料弹窗下拉框的值
materialCategoryList: [], // 物料类别列表
materialPageCount: 1, // 物料列表页码
materialPageSize: 30, // 物料列表每页数量
materialTotal: 0, // 物料列表总条数
topNodeId: null, // 顶级元素的id
scanCodeShow: false, // 扫码打码展开状态
// 打码方式数据列表
......@@ -1093,7 +1128,7 @@
model: "roke.print.setting",
fields: ["id", "name"],
domain: [["model_id.model", "=", "roke.product"]],
offset: 1,
offset: 0,
limit: 999999
}).then(data => {
this.labelOptions = data.result.data
......@@ -1330,7 +1365,7 @@
domain: [["is_finished", "=", true]],
fields: ["id", "name"],
order: "id asc",
offset: 1,
offset: 0,
limit: 999999
},
headers: {
......@@ -1383,7 +1418,7 @@
fields: ["id", "code", "name", "specification", "category_id"],
order: "id asc",
domain: [["name", "ilike", this.searchProductValue]],
offset: 1,
offset: 0,
limit: 999999
},
headers: {
......@@ -1561,7 +1596,7 @@
fields: ["id", "name", "category_id"],
model: "roke.process",
domain: [["name", "ilike", this.searchProcessValue]],
offset: 1,
offset: 0,
limit: 999999
},
headers: {
......@@ -2633,7 +2668,7 @@
} else if (type == '选择物料') {
let oldList = []
this.keyMaterialList.forEach(item => {
if (this.selmaterialList.includes(item.product_id)) {
if (this.selmaterialList.find(it => it.id == item.product_id)) {
let data = {
id: item.id,
product_id: item.product_id,
......@@ -2651,12 +2686,12 @@
oldIdList.push(item.product_id)
})
this.selmaterialList.forEach(item => {
if (!(oldIdList.includes(item))) {
if (!(oldIdList.includes(item.id))) {
let data = {
id: '',
product_id: item,
product_name: this.materialList.find(it => it.id == item).name,
product_code: this.materialList.find(it => it.id == item).code,
product_id: item.id,
product_name: this.materialList.find(it => it.id == item.id).name,
product_code: this.materialList.find(it => it.id == item.id).code,
qty: 1,
protection_code: ""
}
......@@ -3188,7 +3223,7 @@
fields: ["id", "name"],
model: "roke.scrap.reason",
domain: [['id', "not in", ids]],
offset: 1,
offset: 0,
limit: 999999
}
this.requestApi('/roke/workstation/search_read', config, '获取不良类型列表失败!').then(data => {
......@@ -3333,56 +3368,155 @@
})
}
},
// 选择物料弹窗打开事件
selMaterialDialogOpen() {
let selIdList = []
this.keyMaterialList.forEach(item => {
selIdList.push(item.product_id)
})
this.selmaterialList = selIdList
// 获取物料列表
getMaterialListApi() {
return new Promise((resolve, reject) => {
let id = this.treeActiveData.type == 'bom' ? this.treeActiveData.product_id : this.treeActiveData.id
let config = {
model: 'roke.product',
domain: [["id", "not in", [id]]],
fields: ['id', 'name', 'code'],
offset: 1,
limit: 999999
offset: (this.materialPageCount - 1) * this.materialPageSize,
limit: this.materialPageSize
}
if (this.selMaterialValue) {
config.domain.push(["name", "ilike", this.selMaterialValue])
}
this.requestApi("/roke/workstation/search_read", config, '获取物料列表失败!').then(data => {
if (this.selMaterialCategoryId) {
config.domain.push(["category_id", "=", this.selMaterialCategoryId])
}
axios({
method: "POST",
url: this.baseURL + "/roke/workstation/search_read",
data: config,
headers: {
'Content-Type': 'application/json',
},
}).then((result) => {
if (result?.data?.result?.code == 0) {
this.materialTotal = result.data.result.count
// 对数据进行排序
let accordArr = []
let otherArr = []
data.result.data.forEach(item => {
result.data.result.data.forEach(item => {
if (this.selmaterialList.find(it => item.id == it.id)) {
item['show'] = true
} else {
item['show'] = false
}
if (this.materialCheckList.includes(item.id)) {
accordArr.push(item)
} else {
otherArr.push(item)
}
})
data.result.data = accordArr.concat(otherArr)
this.materialList = data.result.data
// 789
result.data.result.data = accordArr.concat(otherArr)
this.materialList = result.data.result.data
resolve()
} else if (result?.data?.result?.code == 1) {
reject(result.data.result.message)
} else if (result?.data?.error) {
reject(result.data.error.message)
}
}).catch((error) => {
reject("获取工位列表失败!")
})
})
},
// 选择物料弹窗打开事件
async selMaterialDialogOpen() {
let selIdList = []
this.keyMaterialList.forEach(item => {
let obj = {
id: item.product_id,
name: item.product_name,
code: item.product_code
}
selIdList.push(obj)
})
this.selmaterialList = selIdList
this.loading = true
// 获取物料类别列表
this.requestApi("/roke/workstation/search_read", {
model: 'roke.product.category',
domain: [["is_finished", "=", true]],
fields: ['id', 'name'],
offset: 0,
limit: 999999
}, '获取物料类别列表失败!').then(data => {
this.materialCategoryList = data.result.data
}).catch(error => {
this.errorHandle(error, true)
})
await this.getMaterialListApi().then(data => {
this.loading = false
}).catch(error => {
this.errorHandle(error, true)
})
},
// 选择物料弹窗选择框change事件
selMaterialCategoryChange(el) {
this.loading = true
this.materialPageCount = 1
this.getMaterialListApi().then(data => {
this.loading = false
}).catch(error => {
this.errorHandle(error, true)
})
},
// 选择物料change事件
selMaterialChange(e, direction, selList) {
// 向右移动时为添加,如果校验列表有数据需要校验一下
if (direction == 'right' && this.materialCheckList.length > 0) {
// 本次选择的不符合产品的bom列表
let bomAccordList = selList.filter(item => !(this.materialCheckList.includes(item)))
// 通过符合条件的和本次选中的列表长度是不是一致来判断是不有不是当前产品下的bom的数据
if (bomAccordList.length > 0) {
// 物料选中事件
materialsChangeHandle(el, data) {
if (el) {
// 选中
if (!this.materialCheckList.includes(data.id)) {
// 选中且该物料不在产品bom中
this.$confirm('选中的物料不在产品BOM中,是否添加?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => { }).catch(() => {
// 点击取消把本次选择的数据并且不在产品BOM中数据去掉
this.selmaterialList = this.selmaterialList.filter(item => !(selList.includes(item)) || (selList.includes(item) && this.materialCheckList.includes(item)))
}).then(() => {
this.selmaterialList.push(JSON.parse(JSON.stringify(data)))
}).catch(() => {
// 点击取消把本次选择的数据取消选中
data.show = false
let index = this.selmaterialList.findIndex(item => item.id == data.id)
if (index || index == 0) {
this.selmaterialList.splice(index, 1)
}
})
} else {
// 选中且该物料在产品bom中
this.selmaterialList.push(JSON.parse(JSON.stringify(data)))
}
} else {
// 取消选中 把选中列表中的这条数据删除掉
let index = this.selmaterialList.findIndex(item => item.id == data.id)
if (index || index == 0) {
this.selmaterialList.splice(index, 1)
}
}
},
// 标签关闭事件
tagClosehandle(data) {
let index = this.selmaterialList.findIndex(item => item.id == data.id)
if (index || index == 0) {
this.selmaterialList.splice(index, 1)
}
this.materialList.forEach(item => {
if (item.id == data.id) {
item.show = false
}
})
},
// 选择物料弹窗页码改变事件
materialsCurrentChange(prev, pager, next, jumper) {
this.loading = true
this.getMaterialListApi().then(data => {
this.loading = false
}).catch(error => {
this.errorHandle(error, true)
})
},
// 展开方法
expandHandle() {
......@@ -4063,6 +4197,78 @@
.el-menu-item {
padding: 0 10px;
}
.selectMaterialsBoxClass {
display: flex;
flex-direction: column;
align-items: center;
height: 60vh;
.tagBoxClass {
width: 100%;
border-bottom: 1px solid #D9D9D9;
.tagClass {
margin: 0 8px 8px 0;
}
}
.selMaterialsFiltrateBox {
width: 100%;
height: 50px;
display: flex;
align-items: center;
}
.selMaterialsContentBox {
flex: auto;
height: 1px;
width: 100%;
display: flex;
align-content: flex-start;
flex-wrap: wrap;
.materialItemClass {
display: flex;
align-items: center;
height: 35px;
margin-right: 8px;
.el-checkbox {
margin-right: 4px;
display: flex;
align-items: center;
}
.nameLabelClass {
width: 6rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
}
.iconLabelClass {
display: inline-block;
width: 14px;
height: 14px;
}
}
}
}
.selMaterialsBottonBox {
display: flex;
align-items: center;
justify-content: space-between;
.selMaterialsPaginationBox {
height: 40px;
display: flex;
align-items: flex-end;
justify-content: center;
}
}
</style>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment