<!--
|
* @Author: lzhe lzhe@example.com
|
* @Date: 2024-05-24 11:25:26
|
* @LastEditors: lzhe lzhe@example.com
|
* @LastEditTime: 2024-05-27 14:11:14
|
* @FilePath: /src/views/console/product-process/process-route/addWorking.vue
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
-->
|
<template>
|
<el-dialog :title="titleMap[mode]" v-model="visible" :width="700" destroy-on-close @closed="$emit('closed')">
|
<div class="add-btn">
|
<el-button type="primary" @click="addWorking">新建工艺</el-button>
|
</div>
|
<el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange">
|
<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>
|
<el-pagination
|
style="margin-top: 12px;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:page-sizes="[15, 50, 100]"
|
:page-size="15"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="totle">
|
</el-pagination>
|
<template #footer>
|
<el-button @click="visible=false" >取消</el-button>
|
<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="workingSubmit">确定</el-button>
|
</template>
|
</el-dialog>
|
</template>
|
|
<script>
|
export default {
|
emits: ['success', 'closed'],
|
data() {
|
return {
|
current: 1,
|
size: 15,
|
totle: 0,
|
tableData: [],
|
selection: [],
|
mode: "add",
|
titleMap: {
|
add: '选择工序',
|
edit: '编辑',
|
show: '查看'
|
},
|
visible: false,
|
isSaveing: false,
|
}
|
},
|
mounted() {
|
},
|
methods: {
|
addWorking() {
|
this.$router.push({path: `/console/basic-data/work-process`});
|
},
|
handleSelectionChange(selection) {
|
this.selection = selection;
|
},
|
getTable() {
|
this.$HTTP.get(`/api/blade-cps/process/page?current=${this.current}&size=${this.size}&keyword=`).then(res=> {
|
if(res.code == 200) {
|
this.tableData = res.data.records;
|
this.totle = res.data.total;
|
}
|
})
|
},
|
//显示
|
open(mode='add'){
|
this.getTable();
|
this.mode = mode;
|
this.visible = true;
|
return this
|
},
|
//表单提交方法
|
workingSubmit(){
|
this.$emit('success', this.selection, this.mode);
|
this.visible = false;
|
this.$message.success("操作成功");
|
this.selection = [];
|
},
|
//表单注入数据
|
setData(data,res){
|
//可以和上面一样单个注入,也可以像下面一样直接合并进去
|
this.productList = res;
|
Object.assign(this.addWorkingForm, data);
|
},
|
handleSizeChange(val) {
|
this.size = val;
|
console.log(`每页 ${val} 条`);
|
this.getTable();
|
},
|
handleCurrentChange(val) {
|
this.current = val;
|
console.log(`当前页: ${val}`);
|
this.getTable();
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.add-btn {
|
margin-bottom: 12px;
|
}
|
</style>
|