<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :xl="4" :lg="7" :md="8" :sm="24">
|
<a-form-item label="刀具名称">
|
<a-input placeholder="请输入刀具名称" v-model="queryParam.toolName"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :xl="4" :lg="7" :md="8" :sm="24">
|
<a-form-item label="刃磨结果">
|
<a-input placeholder="请输入刃磨结果" v-model="queryParam.grindingResult"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-form-item label="刃磨时间">
|
<a-range-picker v-model="queryParam.inspectionDateRange" @change="onInspectionDateChange" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
|
</a-form-item>
|
</a-col>
|
<a-col :xl="4" :lg="7" :md="8" :sm="24">
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 查询区域-END -->
|
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<div class="table-operator">
|
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
</div>
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
|
|
<a-table
|
ref="table"
|
size="middle"
|
:scroll="{x:true}"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="null"
|
class="j-table-force-nowrap"
|
@change="handleTableChange">
|
|
|
|
<span slot="action" slot-scope="text, record">
|
<a @click="handleDetail(record)">详情</a>
|
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
</div>
|
|
<tools-sharpening-modal ref="modalForm" :treeSelected="treeSelected" @ok="modalFormOk"></tools-sharpening-modal>
|
</a-card>
|
</template>
|
|
<script>
|
|
import '@/assets/less/TableExpand.less'
|
import { mixinDevice } from '@/utils/mixin'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import ToolsSharpeningModal from './modules/ToolsSharpeningModal'
|
import { getAction, putAction, deleteAction } from '../../../api/manage'
|
|
export default {
|
name: 'ToolSharpeningList ',
|
mixins:[JeecgListMixin, mixinDevice],
|
components: {
|
ToolsSharpeningModal
|
},
|
data () {
|
return {
|
description: '刀具刃磨',
|
// 表头
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key:'rowIndex',
|
width:60,
|
align:"center",
|
customRender:function (t,r,index) {
|
return parseInt(index)+1;
|
}
|
},
|
{
|
title:'刀具分类',
|
align:"center",
|
dataIndex: 'warehouseId'
|
},
|
{
|
title:'刀具编号',
|
align:"center",
|
dataIndex: 'warehouseName'
|
},
|
{
|
title:'刀具名称',
|
align:"center",
|
dataIndex: 'warehouseName'
|
},
|
{
|
title:'刀具材料',
|
align:"center",
|
dataIndex: 'parentWarehouseName',
|
},
|
{
|
title:'厂家',
|
align:"center",
|
dataIndex: 'status',
|
},
|
{
|
title:'零件材料',
|
align:"center",
|
dataIndex: 'remark'
|
},
|
|
{
|
title:'刃磨时间',
|
align:"center",
|
dataIndex: 'createBy'
|
},
|
{
|
title:'刃磨结果及建议',
|
align:"center",
|
dataIndex: 'createBy'
|
},
|
{
|
title:'责任人',
|
align:"center",
|
dataIndex: 'createBy'
|
},
|
|
{
|
title:'创建人',
|
align:"center",
|
dataIndex: 'createBy'
|
},
|
|
{
|
title:'创建时间',
|
align:"center",
|
dataIndex: 'createTime'
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align:"center",
|
fixed:"right",
|
width:147,
|
scopedSlots: { customRender: 'action' }
|
}
|
],
|
url: {
|
list: "/tms/toolSharpening/list",
|
delete: "/tms/toolSharpening/delete",
|
edit: "/tms/toolSharpening/edit",
|
deleteBatch: "/tms/toolSharpening/deleteBatch",
|
exportXlsUrl: "/tms/toolSharpening/exportXls",
|
importExcelUrl: "tms/toolSharpening/importExcel",
|
|
},
|
dictOptions:{},
|
superFieldList:[],
|
treeSelected: {},
|
}
|
},
|
created() {
|
this.getSuperFieldList();
|
},
|
computed: {
|
importExcelUrl: function(){
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
},
|
addFlag: function(){
|
return !(this.treeSelected.key && this.treeSelected.entity.leafFlag === '2');
|
}
|
},
|
mounted() {
|
this.handleGetCurrSelected = (data) => {
|
this.treeSelected = data;
|
this.queryParam.parentId = data.key;
|
this.loadData();
|
}
|
this.$bus.$on('getCurrSelected', this.handleGetCurrSelected);
|
},
|
beforeDestroy() {
|
this.$bus.$off('getCurrSelected', this.handleGetCurrSelected);
|
},
|
methods: {
|
handleStatus(record) {
|
getAction(this.url.list, { parentId: record.id }).then((res) => {
|
if (res.success) {
|
if (res.result.total > 0) {
|
this.$message.warning('该节点下存在子节点,不能变更状态!')
|
} else {
|
const params = {
|
id: record.id,
|
status: record.status === '1' ? '2' : '1'
|
}
|
putAction(this.url.edit, params).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message)
|
this.loadData()
|
} else {
|
this.$message.warning(res.message)
|
}
|
})
|
}
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
|
},
|
handleDelete(id) {
|
getAction(this.url.list, { parentId: id }).then((res) => {
|
if (res.success) {
|
if (res.result.total > 0) {
|
this.$message.warning('请先删除子节点');
|
} else {
|
deleteAction(this.url.delete, {id: id}).then((res) => {
|
if (res.success) {
|
//重新计算分页问题
|
this.loadData()
|
this.$message.success(res.message);
|
this.$bus.$emit('queryTreeData')
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
}
|
} else {
|
this.$message.warning(res.message);
|
}
|
})
|
},
|
searchReset() {
|
this.queryParam = {
|
parentId: this.treeSelected.key
|
}
|
this.loadData(1)
|
},
|
modalFormOk() {
|
this.loadData()
|
this.$bus.$emit('queryTreeData')
|
},
|
initDictConfig(){
|
},
|
getSuperFieldList(){
|
let fieldList=[];
|
fieldList.push({type:'string',value:'toolId',text:'工具编号',dictCode:''})
|
fieldList.push({type:'string',value:'warehouseName',text:'仓库名称',dictCode:''})
|
fieldList.push({type:'string',value:'parentId',text:'父节点编号',dictCode:''})
|
fieldList.push({type:'string',value:'seq',text:'展示序号',dictCode:''})
|
fieldList.push({type:'string',value:'leafFlag',text:'是否叶子节点(1是;2否)',dictCode:''})
|
fieldList.push({type:'string',value:'status',text:'状态(1启用;2停用)',dictCode:''})
|
fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
|
fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
|
fieldList.push({type:'date',value:'createTime',text:'创建时间'})
|
this.superFieldList = fieldList
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less';
|
.enable {
|
color: green;
|
}
|
.disable {
|
color: red;
|
}
|
</style>
|