| | |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import WarehouseModal from './modules/WarehouseModal' |
| | | import { getAction, putAction, deleteAction } from '../../api/manage' |
| | | import moment from 'moment' |
| | | |
| | | export default { |
| | | name: 'WarehouseList', |
| | |
| | | WarehouseModal |
| | | }, |
| | | data () { |
| | | const now = moment() |
| | | const lastWeek = now.clone().subtract(7,'days') |
| | | return { |
| | | description: '仓库管理', |
| | | queryParam: { |
| | | beginTime: lastWeek.format('YYYY-MM-DD HH:mm'), |
| | | endTime: now.format('YYYY-MM-DD HH:mm'), |
| | | warehouseName: '', |
| | | parentId: '' |
| | | }, |
| | | // 表头 |
| | | columns: [ |
| | | { |
| | |
| | | { |
| | | title:'父节点编号', |
| | | align:"center", |
| | | dataIndex: 'parentWarehouseId' |
| | | dataIndex: 'parentWarehouseId', |
| | | customRender:function (text,r) { |
| | | if (r.parentId === '-1') { |
| | | return '-1'; |
| | | } else { |
| | | return text; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title:'父节点名称', |
| | | align:"center", |
| | | dataIndex: 'parentWarehouseName' |
| | | dataIndex: 'parentWarehouseName', |
| | | customRender:function (text,r) { |
| | | if (r.parentId === '-1') { |
| | | return '航宇救生'; |
| | | } else { |
| | | return text; |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title:'状态', |
| | |
| | | { |
| | | title:'创建时间', |
| | | align:"center", |
| | | dataIndex: 'createTime', |
| | | customRender:function (text) { |
| | | return !text?"":(text.length>10?text.substr(0,10):text) |
| | | } |
| | | dataIndex: 'createTime' |
| | | }, |
| | | { |
| | | title: '操作', |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$bus.$on('getCurrSelected', (data) => { |
| | | console.log(data) |
| | | 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.$bus.$off('getCurrSelected', this.handleGetCurrSelected); |
| | | }, |
| | | methods: { |
| | | handleStatus(record) { |
| | | const params = { |
| | | id: record.id, |
| | | status: record.status === '1' ? '2' : '1' |
| | | } |
| | | putAction(this.url.edit, params).then((res) => { |
| | | getAction(this.url.list, { parentId: record.id }).then((res) => { |
| | | if (res.success) { |
| | | this.$message.success(res.message) |
| | | this.loadData() |
| | | 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) |
| | | this.$message.warning(res.message); |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | }, |
| | | handleDelete(id) { |
| | | getAction(this.url.list, { parentId: id }).then((res) => { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | // onBeginTimeChange(date, dateString) { |
| | | // this.queryParam.begin_time = dateString[0] |
| | | // }, |
| | | // onEndTimeChange(date, dateString) { |
| | | // this.queryParam.end_time = dateString[0] |
| | | // }, |
| | | searchReset() { |
| | | const now = moment() |
| | | const lastWeek = now.clone().subtract(7,'days') |
| | | this.queryParam = { |
| | | beginTime: lastWeek.format('YYYY-MM-DD HH:mm'), |
| | | endTime: now.format('YYYY-MM-DD HH:mm'), |
| | | warehouseName: '', |
| | | parentId: '' |
| | | parentId: this.treeSelected.key |
| | | } |
| | | this.treeSelected = {} |
| | | this.loadData(1) |
| | | this.$bus.$emit('clearTreeSelection') |
| | | }, |
| | | modalFormOk() { |
| | | this.loadData() |