<template>
|
<div>
|
<a-card :bordered="false" :bodyStyle="tstyle">
|
|
<div class="table-page-search-wrapper" v-if="hasPerm('WmsPart:page')">
|
<a-form layout="inline">
|
<a-row :gutter="48">
|
<a-col :md="8" :sm="24">
|
<a-form-item label="零件编号">
|
<a-input v-model="queryParam.partCode" allow-clear placeholder="请输入零件编号"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="零件名称">
|
<a-input v-model="queryParam.partName" allow-clear placeholder="请输入零件名称"/>
|
</a-form-item>
|
</a-col><template v-if="advanced"><a-col :md="8" :sm="24">
|
<a-form-item label="端拾器编码">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.materialCode" placeholder="请选择端拾器编码">
|
<a-select-option v-for="(item,index) in materialCodeData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<!-- <a-col :md="8" :sm="24">
|
<a-form-item label="状态">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.status" placeholder="请选择状态">
|
<a-select-option v-for="(item,index) in statusData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col> -->
|
</template>
|
|
<a-col :md="8" :sm="24" >
|
<span class="table-page-search-submitButtons">
|
<a-button type="primary" @click="$refs.table.refresh(true)" >查询</a-button>
|
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
|
<a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
</a>
|
</span>
|
</a-col>
|
|
</a-row>
|
</a-form>
|
</div>
|
</a-card>
|
<a-card :bordered="false">
|
<s-table
|
ref="table"
|
:columns="columns"
|
:data="loadData"
|
:alert="true"
|
:rowKey="(record) => record.id"
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
|
<template class="table-operator" slot="operator" v-if="hasPerm('WmsPart:add')" >
|
<a-button type="primary" v-if="hasPerm('WmsPart:add')" icon="plus" @click="$refs.addForm.add()">新增零件信息</a-button>
|
</template>
|
<template class="table-operator" slot="operator" v-if="hasPerm('WmsContainer:add')" >
|
<a-button type="primary" v-if="hasPerm('WmsContainer:add')" icon="plus" @click="handExport()">导出</a-button>
|
</template>
|
<span slot="materialCodescopedSlots" slot-scope="text">
|
{{ 'container_type' | dictType(text) }}
|
</span>
|
<span slot="statusscopedSlots" slot-scope="text">
|
{{ 'common_status' | dictType(text) }}
|
</span>
|
<span slot="materialCodeDataSlots" slot-scope="text,record">
|
<div v-for="option in materialCodeData" :key=option.code>
|
<span v-if="record.materialCode==option.code"> {{ option.name }}</span>
|
</div>
|
</span>
|
<span slot="lineTypeDataSlots" slot-scope="text,record">
|
<div v-for="option in sourceEnum" :key=option.value>
|
<span v-if="record.lineType==option.value"> {{ option.title }}</span>
|
</div>
|
</span>
|
<span slot="action" slot-scope="text, record">
|
<a v-if="hasPerm('WmsPart:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
<a-divider type="vertical" v-if="hasPerm('WmsPart:edit') & hasPerm('WmsPart:delete')"/>
|
<a-popconfirm v-if="hasPerm('WmsPart:delete')" placement="topRight" title="确认删除?" @confirm="() => WmsPartDelete(record)">
|
<a>删除</a>
|
</a-popconfirm>
|
</span>
|
</s-table>
|
<add-form ref="addForm" @ok="handleOk" />
|
<edit-form ref="editForm" @ok="handleOk" />
|
</a-card>
|
</div>
|
</template>
|
<script>
|
import { STable } from '@/components'
|
import { WmsPartPage, WmsPartDelete } from '@/api/modular/main/WmsPartManage'
|
import { WmsMaterialList } from '@/api/modular/main/WmsMaterialManage'
|
import addForm from './addForm.vue'
|
import editForm from './editForm.vue'
|
import { axios } from '@/utils/request'
|
export default {
|
components: {
|
STable,
|
addForm,
|
editForm
|
},
|
data () {
|
return {
|
advanced: false, // 高级搜索 展开/关闭
|
queryParam: {},
|
columns: [
|
{
|
title: '零件编号',
|
align: 'center',
|
dataIndex: 'partCode'
|
},
|
{
|
title: '零件名称',
|
align: 'center',
|
dataIndex: 'partName'
|
},
|
{
|
title: '小车编号',
|
align: 'center',
|
dataIndex: 'materialCode',
|
//scopedSlots: { customRender: 'materialCodeDataSlots' }
|
},
|
{
|
title: '车型',
|
align: 'center',
|
dataIndex: 'carType'
|
},
|
{
|
title: '长度',
|
align: 'center',
|
dataIndex: 'length'
|
},
|
{
|
title: '宽度',
|
align: 'center',
|
dataIndex: 'width'
|
},
|
{
|
title: '高度',
|
align: 'center',
|
dataIndex: 'height'
|
},
|
{
|
title: '备注',
|
align: 'center',
|
dataIndex: 'remark'
|
},
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'status',
|
scopedSlots: { customRender: 'statusscopedSlots' }
|
},
|
{
|
title: '生产线',
|
align: 'center',
|
dataIndex: 'lineType',
|
scopedSlots: { customRender: 'lineTypeDataSlots' }
|
}
|
],
|
tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
|
// 加载数据方法 必须为 Promise 对象
|
loadData: parameter => {
|
return WmsPartPage(Object.assign(parameter, this.queryParam)).then((res) => {
|
return res.data
|
})
|
},
|
materialCodeData: [],
|
statusData: [],
|
selectedRowKeys: [],
|
selectedRows: [],
|
sourceEnum:[
|
{
|
title: "A线",
|
value: 1
|
},
|
{
|
title: "B线",
|
value: 2
|
},
|
{
|
title: "C线",
|
value: 3
|
}
|
]
|
}
|
},
|
created () {
|
if (this.hasPerm('WmsPart:edit') || this.hasPerm('WmsPart:delete')) {
|
this.columns.push({
|
title: '操作',
|
width: '150px',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' }
|
})
|
}
|
const materialCodeOption = this.$options
|
//this.materialCodeData = materialCodeOption.filters['dictData']('container_type')
|
const statusOption = this.$options
|
this.statusData = statusOption.filters['dictData']('common_status')
|
this.WmsMaterialList()
|
},
|
methods: {
|
//导出
|
handExport(){
|
//ExcelExport(this.queryParam)
|
let fileName = "零件端拾器信息" + new Date().toLocaleString();
|
var AxiosRequestConfig = {responseType:"blob"}
|
var data = axios.post('http://10.103.9.5:7788/api/WmsPartService/download',this.queryParam,AxiosRequestConfig)
|
.then((res) => {
|
if (res.status == 200) {
|
let blob = new Blob([res.data],
|
{type: "application/vnd.ms-excel"})
|
if (window.navigator.msSaveOrOpenBlob) {
|
navigator.msSaveBlob(blob,fileName)
|
}else {
|
var link = document.createElement('a');
|
link.href = window.URL.createObjectURL(blob);
|
link.download = fileName;
|
link.click();//释放内存
|
window.URL.revokeobjectURL(link.href);
|
}}
|
else{
|
Message.error("操作失败,服务端出现异常错误!")
|
}})
|
return data;
|
},
|
/**
|
* 查询参数组装
|
*/
|
WmsMaterialList() {
|
WmsMaterialList().then(res => {
|
this.materialCodeData = res.data
|
})
|
},
|
switchingDate () {
|
const obj = JSON.parse(JSON.stringify(this.queryParam))
|
return obj
|
},
|
WmsPartDelete (record) {
|
WmsPartDelete(record).then((res) => {
|
if (res.success) {
|
this.$message.success('删除成功')
|
this.$refs.table.refresh()
|
} else {
|
this.$message.error('删除失败') // + res.message
|
}
|
})
|
},
|
toggleAdvanced () {
|
this.advanced = !this.advanced
|
},
|
handleOk () {
|
this.$refs.table.refresh()
|
},
|
onSelectChange (selectedRowKeys, selectedRows) {
|
this.selectedRowKeys = selectedRowKeys
|
this.selectedRows = selectedRows
|
},
|
getName(code){() =>
|
{
|
for (let i = 0, len = this.dictionariesList.length; i < len; i++){
|
let item = this.dictionariesListlil;
|
if(item.code == code) {
|
return item.name ;
|
}
|
}
|
}
|
}
|
}
|
}
|
</script>
|
<style lang="less">
|
.table-operator {
|
margin-bottom: 18px;
|
}
|
button {
|
margin-right: 8px;
|
}
|
</style>
|