<!--
|
* @Author: lzhe lzhe@example.com
|
* @Date: 2024-03-26 10:28:33
|
* @LastEditors: lzhe lzhe@example.com
|
* @LastEditTime: 2024-05-24 18:18:17
|
* @FilePath: /smart-web/src/views/master/person/main/index.vue
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
-->
|
<template>
|
<div class="user-main">
|
<div class="user-top">
|
<div class="noteTop">
|
<import-table class="marginR12" :exportUrl="exportUrl" :uploadUrl="uploadUrl"></import-table>
|
<el-button type="primary" @click="getExport">导出</el-button>
|
<el-button type="danger" plain @click="delData">删除</el-button>
|
</div>
|
<el-form :inline="true" :model="searchData" label-width="80px" style="width: 381px;">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="状态">
|
<el-select v-model="searchData.status" style="width: 100%" @change="searchChange">
|
<el-option key="1" label="启用" value="1"/>
|
<el-option key="0" label="停用" value="0"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="">
|
<el-input v-model="searchData.keyword" placeholder="请输入搜索内容" clearable style="width: 100%" @change="searchChange"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div class="user-bottom">
|
<div class="user-table">
|
<div class="addLeftData" @click="addLeftData">+ 快速创建</div>
|
<el-row style="margin-top: 12px;margin-bottom: 12px;" v-if="isAddData0">
|
<el-col :span="4">
|
<el-input v-model="addData0.name" size="small" placeholder="工序名称" style="padding-right: 20px;"></el-input>
|
</el-col>
|
<el-col :span="4">
|
<el-select v-model="addData0.type" placeholder="工种" size="small" style="padding-right: 20px;">
|
<el-option v-for="item in typeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
|
</el-select>
|
</el-col>
|
<el-col :span="4">
|
<el-input v-model="addData0.description" size="small" placeholder="工序描述" style="padding-right: 20px;"></el-input>
|
</el-col>
|
<el-col :span="4">
|
<el-select v-model="addData0.status" size="small" style="padding-right: 20px;">
|
<el-option key="1" label="启用" value="1"/>
|
<el-option key="0" label="停用" value="0"/>
|
</el-select>
|
</el-col>
|
<el-col :span="4">
|
<el-button type="primary" size="small" @click="addData0Submit0">确定</el-button>
|
<el-button size="small" @click="addDataCencel0">取消</el-button>
|
</el-col>
|
</el-row>
|
<el-table ref="multipleTableRef0" :data="tableData0" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange" @row-click="rowClick">
|
<el-table-column type="selection" width="55" />
|
<el-table-column prop="code" label="工序编号"></el-table-column>
|
<el-table-column prop="name" label="工序名称"></el-table-column>
|
<el-table-column prop="typeName" label="工种"></el-table-column>
|
<el-table-column prop="description" label="工序描述"></el-table-column>
|
<el-table-column prop="status" label="状态">
|
<template #default="scope">
|
<span>{{ scope.row.status == "1"?"启用":"停用" }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column fixed="right" label="操作">
|
<template #default="scope">
|
<el-button type="text" size="small" @click="table_del(scope.row, scope.$index)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination
|
style="margin-top: 12px;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="currentPage4"
|
:page-sizes="[15, 50, 100]"
|
:page-size="15"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total0">
|
</el-pagination>
|
</div>
|
<div class="working-detail">
|
<div class="container-title">工序详情</div>
|
<ul>
|
<li>工序编号<span>{{workDetail.code}}</span></li>
|
<li>工序名称<span>{{workDetail.name}}</span></li>
|
<li>工种<span>{{workDetail.typeName}}</span></li>
|
<li>工序描述<span>{{workDetail.description}}</span></li>
|
</ul>
|
<div class="info-top-title">工位</div>
|
<div class="addRightData" @click="addRightData">+ 快速创建</div>
|
<el-row style="margin-top: 12px;margin-bottom: 12px;" v-if="isAddData1">
|
<el-col :span="4">
|
<el-select v-model="addData1.bizId" placeholder="工位编号" size="small" style="padding-right: 20px;">
|
<el-option v-for="item in bizIdList" :key="item.id" :label="item.code" :value="item.id"/>
|
</el-select>
|
</el-col>
|
<el-col :span="4">
|
<el-button type="primary" size="small" @click="addData0Submit1">确定</el-button>
|
<el-button size="small" @click="addDataCencel1">取消</el-button>
|
</el-col>
|
</el-row>
|
<el-table ref="multipleTableRef1" :data="tableData1" border style="width: 100%" class="multipleTableRef">
|
<el-table-column prop="workstationCode" label="工位编号"></el-table-column>
|
<el-table-column prop="workstationName" label="工位名称"></el-table-column>
|
<el-table-column fixed="right" label="操作">
|
<template #default="scope">
|
<el-button type="text" size="small" @click="biz_table_del(scope.row, scope.$index)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
</div>
|
<!-- 删除 -->
|
<el-dialog title="" v-model="delTypeModel" :width="400" destroy-on-close>
|
<div>
|
<div style="margin-bottom: 6px;"><span class="delIcon">!</span>请你谨慎选择!</div>
|
<div style="text-indent: 24px;">删除数据会影响已关联的业务 ,若您想在已关联的业务中依然显示这些数据, 您可以选择 停用 操作。停用后此数据将不能再被新业务使用。</div>
|
</div>
|
<template #footer>
|
<div class="footerDiv">
|
<div class="delBtn" @click="delTypeDataSingle(0)">删除</div>
|
<div class="delBtn" @click="delTypeDataSingle(1)">停用</div>
|
</div>
|
</template>
|
</el-dialog>
|
<!-- 删除left -->
|
<el-dialog title="" v-model="delLeftModel" :width="400" destroy-on-close>
|
<div>
|
<div style="margin-bottom: 6px;"><span class="delIcon">!</span>请你谨慎选择!</div>
|
<div style="text-indent: 24px;">删除数据会影响已关联的业务 ,若您想在已关联的业务中依然显示这些数据, 您可以选择 停用 操作。停用后此数据将不能再被新业务使用。</div>
|
</div>
|
<template #footer>
|
<div class="footerDiv">
|
<div class="delBtn" @click="delLeft(0)">删除</div>
|
<div class="delBtn" @click="delLeft(1)">停用</div>
|
</div>
|
</template>
|
</el-dialog>
|
</template>
|
<script>
|
import importTable from '@/layout/components/importTable.vue'
|
export default {
|
name: "working",
|
data(){
|
return {
|
delleftId: "",
|
bizIdList: [],
|
leftId: "",
|
delTypeModel: false,
|
delLeftModel: false,
|
typeList: [],
|
addData0: {
|
name: "",
|
type: "",
|
description: "",
|
status: "1"
|
},
|
addData1: {
|
bizId: "",
|
processId: "",
|
type: "1"
|
},
|
isAddData0: false,
|
isAddData1: false,
|
uploadUrl: "/api/blade-cps/employee/import-employee",
|
exportUrl: "/api/blade-cps/employee/export-template",
|
categoryList: [],
|
selection: [],
|
searchData: {
|
status: "1",
|
keyword: "",
|
current: "1",
|
size: "15"
|
},
|
total0: 0,
|
total1: 0,
|
isSaveing: false,
|
dialog: {
|
save: false
|
},
|
tableData0: [],
|
tableData1: [],
|
workDetail: {
|
code: "",
|
name: "",
|
typeName: "",
|
description: ""
|
}
|
}
|
},
|
created(){
|
|
},
|
mounted(){
|
this.getData();
|
this.getTypeList(); //工种
|
this.getBizIdList(); //工位编号
|
},
|
components: {
|
importTable
|
},
|
methods: {
|
rowClick(row, column, event) {
|
this.id = row.id;
|
this.getWorkDetail();
|
this.getPage1();
|
},
|
delLeft(type) {
|
var selStr = "";
|
this.selection.map(item=> {
|
selStr += item.id + ","
|
})
|
selStr = selStr.replace(/,$/, '');
|
var url = `/api/blade-cps/process/remove?processIds=${selStr}&type=${type}`;
|
this.$HTTP.delete(url).then(res=> {
|
if(res.code == 200) {
|
this.$message.success("操作成功");
|
this.delLeftModel = false;
|
this.selection = [];
|
this.getData();
|
}
|
})
|
},
|
delTypeDataSingle(type) {
|
var url = `/api/blade-cps/process/remove?processIds=${this.leftId}&type=${type}`;
|
this.$HTTP.delete(url).then(res=> {
|
if(res.code == 200) {
|
this.$message.success("操作成功");
|
this.delTypeModel = false;
|
this.leftId = "";
|
this.getData();
|
}
|
})
|
},
|
addData0Submit0() {
|
this.$HTTP.post(`/api/blade-cps/process/save`,this.addData0).then(res => {
|
if (res.code == 200) {
|
this.getData();
|
this.clearData0();
|
}
|
})
|
},
|
clearData0() {
|
this.isAddData0 = false;
|
this.addData0 = {
|
name: "",
|
type: "",
|
description: "",
|
status: "1"
|
}
|
},
|
addDataCencel0() {
|
this.clearData0();
|
},
|
addData0Submit1() {
|
this.addData1.processId = this.id;
|
this.$HTTP.post(`/api/blade-cps/process-association/save`,this.addData1).then(res => {
|
if (res.code == 200) {
|
this.getPage1();
|
this.clearData1();
|
}
|
})
|
},
|
clearData1() {
|
this.isAddData1 = false;
|
this.addData1 = {
|
bizId: "",
|
processId: "",
|
type: "1"
|
}
|
},
|
addDataCencel1() {
|
this.clearData1();
|
},
|
addLeftData() {
|
this.isAddData0 = true;
|
},
|
addRightData() {
|
this.isAddData1 = true;
|
},
|
getTypeList() {
|
this.$HTTP.get(`/api/blade-system/dict/dictionary?code=work_type`).then(res => {
|
if (res.code == 200) {
|
this.typeList = res.data;
|
}
|
})
|
},
|
getBizIdList() {
|
this.$HTTP.get(`/api/blade-cps/workstation/page?workstationCode=&workstationName=&size=-1&groupId=&keyWord=`).then(res => {
|
if (res.code == 200) {
|
this.bizIdList = res.data.records;
|
}
|
})
|
},
|
getExport() {
|
this.$HTTP.get(`/api/blade-cps/process/export-process?keyword=&status=1`).then(res => {
|
if (res.code == 200) {
|
window.open(res.data.link);
|
}
|
})
|
},
|
searchChange() {
|
this.getData();
|
},
|
addUserSuccess() {
|
this.getData();
|
},
|
getWorkDetail(id) {
|
this.$HTTP.get(`/api/blade-cps/process/get?processId=${this.id}`).then(res=> {
|
if(res.code == 200) {
|
this.workDetail = res.data;
|
}
|
})
|
},
|
getData() {
|
this.$HTTP.get(`/api/blade-cps/process/page?status=${this.searchData.status}&keyword=${this.searchData.keyword}¤t=${this.searchData.current}&size=${this.searchData.size}`).then(res=> {
|
if(res.code == 200) {
|
this.tableData0 = res.data.records;
|
if(this.tableData0.length != 0) {
|
this.id = this.tableData0[0].id;
|
this.getWorkDetail();
|
this.getPage1();
|
}else {
|
this.workDetail = {
|
code: "",
|
name: "",
|
typeName: "",
|
description: ""
|
}
|
}
|
}
|
})
|
},
|
getPage1() {
|
this.$HTTP.get(`/api/blade-cps/process-association/page?processId=${this.id}`).then(res=> {
|
if(res.code == 200) {
|
this.tableData1 = res.data.workstationList;
|
}
|
})
|
},
|
//删除
|
table_del(row) {
|
this.leftId = row.id;
|
this.delTypeModel = true;
|
},
|
//删除
|
biz_table_del(row) {
|
var url = `/api/blade-cps/process-association/remove?bizId=${row.id}&processId=${this.id}`;
|
this.$HTTP.delete(url).then(res=> {
|
if(res.code == 200) {
|
this.$message.success("操作成功");
|
this.getPage1();
|
}
|
})
|
},
|
handleSelectionChange(selection) {
|
this.selection = selection;
|
},
|
delData() {
|
if(this.selection.length == 0) {
|
this.$message({
|
message: '请选择至少一条数据',
|
type: 'warning'
|
});
|
return;
|
}
|
this.delLeftModel = true;
|
},
|
handleSizeChange(val) {
|
console.log(`每页 ${val} 条`);
|
this.searchData.current = "1";
|
this.searchData.size = val;
|
this.getData();
|
},
|
handleCurrentChange(val) {
|
console.log(`当前页: ${val}`);
|
this.searchData.current = val;
|
this.getData();
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.user-main {
|
background-color: #f9fafb;
|
border: 1px solid #dcdfe6;
|
box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
|
margin: 8px;
|
padding: 8px;
|
background-color: #fff;
|
}
|
.user-top {
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
}
|
.user-table {
|
width: 50%;
|
margin-bottom: 8px;
|
margin-right: 12px;
|
|
}
|
.working-detail {
|
flex: 1;
|
}
|
.working-detail ul {
|
overflow: hidden;
|
padding: 12px 30px;
|
}
|
.working-detail ul li {
|
width: 50%;
|
float: left;
|
list-style: none;
|
margin-bottom:12px;
|
}
|
.working-detail ul li span {
|
margin-left:12px;
|
}
|
.multipleTableRef {
|
margin-bottom: 8px;
|
}
|
.user-bottom {
|
display: flex;
|
}
|
.container-title {
|
font-size: 16px;
|
text-align: center;
|
height: 38px;
|
line-height: 38px;
|
border-bottom: 1px solid #e2e2e2;
|
background-color: #409eff;
|
color: #fff;
|
border-radius: 2px 2px 0 0;
|
margin-bottom: 12px;
|
}
|
.marginR12 {
|
margin-right: 12px;
|
}
|
.info-top-title {
|
padding-left: 8px;
|
border-left: 4px solid #86bffa;
|
line-height: 18px;
|
margin-bottom: 16px;
|
font-weight: 700;
|
font-size: 16px;
|
color: #333;
|
}
|
.addLeftData,.addRightData {
|
font-size: 14px;
|
margin-bottom: 12px;
|
color: #1573f3;
|
text-decoration-line: underline;
|
cursor: pointer;
|
}
|
.delIcon {
|
color: #fff;
|
background: red;
|
border-radius: 50%;
|
display: inline-block;
|
width: 20px;
|
height: 20px;
|
font-size: 14px;
|
text-align: center;
|
line-height: 20px;
|
margin-right: 6px;
|
}
|
.footerDiv {
|
text-align: center;
|
}
|
.delBtn {
|
color: #fff;
|
width: 112px;
|
height: 32px;
|
display: inline-block;
|
color: #fa554c;
|
background-color: #fff;
|
border: 1px solid #fdbbb7;
|
text-align: center;
|
line-height: 32px;
|
cursor: pointer;
|
}
|
|
.delBtn:nth-child(1) {
|
margin-right: 4px;
|
}
|
.delBtn:hover {
|
background-color: #f34d5b;
|
border-color: #f34d5b;
|
color: #fff;
|
}
|
</style>
|