factory_web/src/views/ungrouped/priceset.vue

138 lines
3.7 KiB
Vue

<template>
<el-container>
<el-header>
<div class="left-panel">
<el-date-picker
v-model="query.month"
type="month"
value-format="YYYY-MM"
format="YYYY-MM"
placeholder="月"
style="width: 120px;margin-right: 5px;"
/>
<el-select
v-model="query.fee"
placeholder="物料"
clearable
style="width: 120px;margin-right: 5px;"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
<div class="right-panel">
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'role.create'"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id">
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="年" prop="year" min-width="100"></el-table-column>
<el-table-column label="月" prop="month" min-width="100"></el-table-column>
<el-table-column label="关联物料" prop="material_name" min-width="150"></el-table-column>
<el-table-column label="单价" prop="price_unit" min-width="150"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope">
<el-button link size="small" @click="table_edit(scope.row)" v-auth="'team.update'" type="primary">编辑</el-button>
<el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<script>
import saveDialog from "./priceset_form.vue";
export default {
name: 'dept',
components: {
saveDialog
},
data() {
return {
apiObj: this.$API.fim.priceset.list,
query: {
year:'',
month:'',
material:'',
},
dialog: {
save: false,
},
selection:[],
options:[],
}
},
mounted(){
this.getMaterial();
},
methods: {
//获取物料列表
getMaterial(){
this.$API.mtm.material.list.req({page:0}).then(res=>{
this.options = res;
})
},
//添加
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//编辑
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//删除测点集
async table_del(row){
var id = row.id;
var res = await this.$API.mtm.mgroup.delete.req(id);
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
},
//表格选择后回调事件
selectionChange(selection){
this.selection = selection;
},
//搜索
handleQuery(){
this.$refs.table.queryData(this.query)
},
//本地更新数据
//新增岗位后更新数据
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
}
}
</script>
<style scoped>
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;}
</style>