<template>
|
<div class="silkStandardSetting-container">
|
<div class="filter-card">
|
<CommonSearch ref="searchRef" :show-add="false" :amount-view="false" placeholder="请输入关键词"
|
@searchClick="onFilterSearch">
|
<template slot="leftButton">
|
<el-button size="small" type="primary" @click="addBtnClick">新增</el-button>
|
<el-button size="small" type="primary" @click="refreshClick">刷新</el-button>
|
<el-button size="small" type="primary" @click="printClick">打印</el-button>
|
</template>
|
</CommonSearch>
|
</div>
|
<div class="body-card">
|
<div class="list-view">
|
<TableCommonView :table-list="tableList"
|
:selectClassRow="selectRow"
|
@selTableCol="selTableCol"
|
@tableRowClick="tableRowClick">
|
<template slot="tableButton">
|
<el-table-column label="操作" width="180">
|
<template slot-scope="scope">
|
<el-button @click.stop="handleClick(scope.row, '查看')" type="text" size="small">查看</el-button>
|
<el-button @click.stop="handleClick(scope.row, '修改')" type="text" size="small">修改</el-button>
|
<el-button @click.stop="handleClick(scope.row, '删除')" type="text" size="small">删除</el-button>
|
</template>
|
</el-table-column>
|
</template>
|
</TableCommonView>
|
</div>
|
<div class="btn-pager">
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
<div class="body-card1">
|
<div class="bottom-tabs">
|
<div
|
class="tab-pane"
|
@click="getTab(0)"
|
:style="{
|
background: TabsIndex == 0 ? '#2a78fb' : '#F1F3F8',
|
color: TabsIndex == 0 ? '#fff' : '#666'
|
}"
|
>
|
组别列表
|
</div>
|
<!--<div
|
class="tab-pane"
|
@click="getTab(1)"
|
:style="{background: TabsIndex == 1 ? '#2a78fb' : '#F1F3F8',color: TabsIndex == 1 ? '#fff' : '#666'}"
|
>
|
单据追溯
|
</div>-->
|
</div>
|
<div class="list-view">
|
<TableCommonView :table-list="bottomTableList"
|
@selTableCol="selTableCol">
|
<template slot="tableButton">
|
</template>
|
</TableCommonView>
|
</div>
|
<div class="btn-pager">
|
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
|
</div>
|
</div>
|
<!--<AddWorkshop ref="bomTypeDialog" @handleConfirmSave="handleConfirmSave" :workList="workList" title="添加节点类型" />
|
<AddDataDictionaries :editDiaConfig="editConfig" />-->
|
<WorkshopDialog ref="workshopDialogRef" :edit-config="editConfig" @refresh="refresh"></WorkshopDialog>
|
</div>
|
</template>
|
|
<script>
|
import AddDataDictionaries from "@/views/systemSetting/workshopManage/components/addDialog.vue"
|
import { getWorkshopManageList, deleteWorkshopManage } from "@/api/systemSetting/workshopManage"
|
import TableCommonView from '@/components/makepager/TableCommonView.vue'
|
import AddWorkshop from '@/views/systemSetting/workshopManage/components/addWorkshop.vue'
|
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
|
import WorkshopDialog from '@/views/systemSetting/workshopManage/components/workshopDialog.vue'
|
export default {
|
name: "workshopManage",
|
props: {},
|
components: { TableCommonView, AddWorkshop, AddDataDictionaries,WorkshopDialog },
|
mixins: [pageMixin],
|
computed: {
|
|
},
|
data() {
|
return {
|
selectRow:{},
|
TabsIndex:0,
|
bottomTableList:{},
|
tableList: {},
|
showCol: ["车间", "组别", "开始车号", "结束车号", "标志类型", "备注"],
|
tableColumn: [
|
// { label: "车间", prop: "workshopNumber",iconRight:"el-icon-setting"},
|
{ label: "车间", prop: "workshopName", },
|
{ label: "组别", prop: "groupNumber", },
|
{ label: "开始车号", prop: "startCarNumber" },
|
{ label: "结束车号", prop: "endCarNumber" },
|
{ label: "标志类型", prop: "carFlag", isCallMethod: true, getCallMethod: this.getStatusCarFlag },
|
{ label: "备注", prop: "notes", },
|
],
|
// 类型
|
workList: [],
|
getDataParams: {
|
keyWord: '',
|
},
|
editConfig: {
|
visible: false,
|
infomitton: {
|
TabsIndex: 0,
|
workshopId: null,
|
}
|
},
|
}
|
},
|
created() {
|
this.setTable()
|
this.getData()
|
},
|
methods: {
|
refresh(){
|
this.getData();
|
},
|
setTable() {
|
const obj={
|
selectIndex: true,
|
tableInfomation: [],
|
allcol: [],
|
showcol: this.showCol,
|
tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
|
};
|
// top 明细单列表
|
this.tableList = {...obj};
|
this.bottomTableList={...obj};
|
this.setTableList(this.tableList);
|
this.setTableList(this.bottomTableList);
|
},
|
setColumnVisible(showCol, tableColumn) {
|
return tableColumn.map((ele) => {
|
return {
|
...ele,
|
isShowColumn: showCol.includes(ele.label)
|
}
|
})
|
},
|
setTableList(tableList) {
|
tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
|
this.searchOptions = [];
|
for (let i = 0; i < tableList.tableColumn.length; i++) {
|
const label = tableList.tableColumn[i].label
|
const value = tableList.tableColumn[i].prop
|
this.searchOptions.push({ value: value, label: label })
|
}
|
},
|
selTableCol(val) {
|
this.showcol = val
|
this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
|
},
|
// 表格行点击
|
tableRowClick(row) {
|
this.selectRow={...row};
|
this.bottomTableList.tableInfomation=row.details||[];
|
},
|
// 搜索
|
onFilterSearch(searchText) {
|
this.getDataParams.keyWord = searchText,
|
this.pagerOptions.currPage = 1;
|
this.getData()
|
},
|
// 新增
|
addBtnClick() {
|
this.editConfig.infomitton = {
|
carFlag:1,
|
workshop:{}
|
};
|
this.editConfig.OperationType=1;
|
this.editConfig.title = "新增";
|
this.editConfig.visible = true
|
},
|
// 保存
|
saveBtnClick() {
|
|
},
|
// 刷新
|
refreshClick() {
|
this.getDataParams.keyWord = "";
|
this.pagerOptions.currPage = 1;
|
this.pagerOptions.pageSize = 15;
|
this.$refs.searchRef.searchInput = "";
|
this.getData()
|
},
|
// 打印
|
printClick() { },
|
// 删除
|
delBtnClick() { },
|
// 组别
|
/* handleShow() {
|
this.$refs.bomTypeDialog.editDialogVisible = true;
|
},*/
|
handleGetBomKindDictList() {
|
// postGetBomKindDictList().then((res) => {
|
// this.workList = res.data;
|
// });
|
},
|
handleConfirmSave(data) {
|
console.log(data);
|
},
|
// 车间列表
|
async getData() {
|
await getWorkshopManageList({
|
keyWord: this.getDataParams.keyWord,
|
page: this.pagerOptions.currPage,
|
pageSize: this.pagerOptions.pageSize,
|
type:1
|
}).then((res) => {
|
this.tableList.tableInfomation = res.data
|
this.pagerOptions.totalCount = res.total
|
if(res.data.length>0){
|
this.bottomTableList.tableInfomation=res.data[0].details||[];
|
}
|
});
|
},
|
getStatusCarFlag(val) {
|
if(val===0){
|
return '全车'
|
}else{
|
return '半车'
|
}
|
},
|
handleClick(row, type) {
|
if (type !== "删除") {
|
this.editConfig.infomitton = {
|
...row,
|
workshop:{
|
workshopNumber:row.workshopNumber,
|
workshopName:row.workshopName
|
}
|
};
|
this.editConfig.infomitton.workshopId = row.ID
|
this.editConfig.infomitton.workshopNumber = Number(this.editConfig.infomitton.workshopNumber)
|
this.editConfig.title = type;
|
if(type==='修改'){
|
this.editConfig.OperationType=2
|
}else{
|
this.editConfig.OperationType=3
|
}
|
this.editConfig.visible = true;
|
(row.details||[]).forEach((item,index)=>{
|
if(index<row.details.length-1){
|
item.noEdit=true;
|
}else{
|
item.noEdit=false;
|
}
|
});
|
this.$refs['workshopDialogRef'].initBottomTableList(row.details||[]);
|
} else if (type === "删除") {
|
this.$confirm(`确认删除吗?`, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteWorkshopManage({ id: row.ID }).then((res) => {
|
if (res && res.code === 200) {
|
this.$message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
this.pagerOptions.currPage = 1;
|
this.getData()
|
}
|
})
|
}).catch(() => {
|
console.log("取消删除")
|
});
|
}
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.silkStandardSetting-container {
|
height: 100%;
|
|
.filter-card {
|
margin: 20px 30px;
|
height: 80px;
|
display: flex;
|
align-items: center;
|
padding: 0 20px 0 20px;
|
border-radius: 4px;
|
background-color: #fff;
|
}
|
.body-card,.body-card1 {
|
margin: 0 30px;
|
background-color: #fff;
|
padding: 10px 15px;
|
border-radius: 4px;
|
.edit-save {
|
display: flex;
|
align-items: center;
|
margin-bottom: 10px;
|
.edit-save-icon {
|
font-size: 24px;
|
color: #5582f3;
|
cursor: pointer;
|
}
|
|
.edit-sace-label {
|
margin-left: 10px;
|
font-size: 14px;
|
color: #000000d8;
|
}
|
}
|
}
|
.body-card{
|
height: calc(100% - 440px);
|
}
|
.body-card1{
|
margin-top: -50px;
|
height: calc(100% - 500px);
|
.bottom-tabs {
|
height: 40px;
|
line-height: 40px;
|
background: white;
|
display: flex;
|
.tab-pane {
|
width: 100px;
|
margin-right: 20px;
|
font-size: 14px !important;
|
text-align: center;
|
cursor: pointer;
|
background: #2a78fb;
|
border-top-left-radius: 20px;
|
border-top-right-radius: 20px;
|
}
|
}
|
padding-bottom: 100px;
|
.btn-pager{
|
position: relative;
|
top: -5px;
|
}
|
}
|
}
|
|
.list-view {
|
height: calc(100% - 60px);
|
overflow: hidden;
|
}
|
|
.btn-pager {
|
display: flex;
|
margin-top: 10px;
|
.page {
|
margin-left: auto;
|
}
|
}
|
</style>
|