You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
390 lines
13 KiB
390 lines
13 KiB
<template>
|
|
<div class="app-container">
|
|
<div v-show="viewState === 1">
|
|
<button-bar view-title="采购退库管理" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
|
|
<div class="searchcon">
|
|
<el-button size="small" class="searchbtn" @click="isSearchShow = !isSearchShow">{{ isSearchShow ? '隐藏查询条件' :
|
|
'显示查询条件' }}
|
|
</el-button>
|
|
<div v-show="isSearchShow" class="search">
|
|
<el-form :inline="true" class="tab-header">
|
|
<el-form-item class="formItem" label="申请日期">
|
|
<el-date-picker
|
|
value-format="yyyy-MM-dd"
|
|
v-model="queryParams.params.applicationDateStart"
|
|
clearable
|
|
style="width: 160px;"
|
|
type="date"
|
|
placeholder="开始日期"/>
|
|
<div class="line">至</div>
|
|
<el-date-picker
|
|
value-format="yyyy-MM-dd"
|
|
v-model="queryParams.params.applicationDateEnd"
|
|
clearable
|
|
style="width: 160px;"
|
|
type="date"
|
|
placeholder="结束日期"/>
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<!-- <el-select v-model="queryParams.params.billType" @change="changeBillType" style="width:200px"-->
|
|
<!-- filterable placeholder="请选择" clearable>-->
|
|
<!-- <el-option v-for="item in billType_list" :key="item.dictKey" :label="item.dictValue"-->
|
|
<!-- :value="item.dictKey"></el-option>-->
|
|
<!-- </el-select>-->
|
|
<el-input v-model="queryParams.params.vehicleName" placeholder="请输入状态" clearable/>
|
|
<el-date-picker
|
|
value-format="yyyy-MM-dd"
|
|
v-model="queryParams.params.applyDateStart"
|
|
clearable
|
|
style="width: 160px;"
|
|
type="date"
|
|
placeholder="开始日期"/>
|
|
<div class="line">至</div>
|
|
<el-date-picker
|
|
value-format="yyyy-MM-dd"
|
|
v-model="queryParams.params.applyDateEnd"
|
|
clearable
|
|
style="width: 160px;"
|
|
type="date"
|
|
placeholder="结束日期"/>
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<el-input v-model="queryParams.params.nodeState" placeholder="请输入状态" clearable/>
|
|
</el-form-item>
|
|
<el-divider/>
|
|
<div class="btn" style="text-align: center;">
|
|
<el-button type="primary" @click="dosearch">查询</el-button>
|
|
<el-button type="primary" @click="resetQuery">重置</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<!--Start 项目列表头部-->
|
|
<div class="listtop">
|
|
|
|
<div class="tit">车辆采购退库列表</div>
|
|
<pageye
|
|
v-show="dataList.length > 0"
|
|
:total="queryParams.total"
|
|
:page.sync="queryParams.current"
|
|
:limit.sync="queryParams.size"
|
|
class="pagination"
|
|
@pagination="loadList"/>
|
|
</div>
|
|
<!--End 项目列表头部-->
|
|
<!--Start 项目列表-->
|
|
<div class="listcon">
|
|
<el-table
|
|
v-loading="tableLoading"
|
|
:data="dataList"
|
|
border
|
|
style="width: 100%"
|
|
@selection-change="handleSelectionChange">
|
|
<el-table-column width="50" type="selection" align="center"/>
|
|
<el-table-column width="80" label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column width="150" label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
type="primary"
|
|
size="small"
|
|
:disabled="scope.row.nodeState=='' ? false : scope.row.nodeState=='排产申请'?false:true"
|
|
@click="toEdit(scope.row)">办理
|
|
</el-button>
|
|
<el-button type="primary" size="small" @click="toInfo(scope.row)">查看</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="150" prop="nodeState" label="状态" align="center"/>
|
|
<el-table-column width="150" prop="schedulingType" label="排产类型" align="center"/>
|
|
<el-table-column width="200" prop="applicationCode" label="申请编号" align="center"/>
|
|
<el-table-column width="150" prop="applicationDate" label="申请日期" align="center"/>
|
|
<el-table-column width="150" prop="createByName" label="申请人" align="center"/>
|
|
<el-table-column prop="remarks" fit label="备注" align="left" header-align="center"/>
|
|
<el-table
|
|
v-loading="tableLoading"
|
|
:data="dataList"
|
|
border
|
|
style="width: 100%"
|
|
@selection-change="handleSelectionChange">
|
|
<el-table-column width="50px" type="selection" align="center"/>
|
|
<el-table-column width="80px" label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column width="150px" label="操作" align="center">
|
|
<template slot-scope="scope">
|
|
<div class="searchbtns">
|
|
<el-button
|
|
size="small"
|
|
type="primary"
|
|
:disabled="scope.row. nodeState== '' ? false:scope.row.nodeState == '发起订单'?false : true"
|
|
@click="changeNodeState(scope.row)">办理
|
|
</el-button>
|
|
<el-button size="small" type="primary" @click="toInfo(scope.row)">查看</el-button>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="nodeState" label="状态" align="center"/>
|
|
<el-table-column prop="applicationCode" label="申请编号" align="center"/>
|
|
<el-table-column prop="applicationName" label="申请人" align="center"/>
|
|
<el-table-column prop="createTime" label="申请日期" align="center"/>
|
|
<el-table-column prop="reason" label="退库原因" align="center"/>
|
|
<el-table-column prop="num" label="台数" align="center"/>
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
<!--End 项目列表-->
|
|
<div class="pages">
|
|
<!-- 翻页 -->
|
|
<pagination
|
|
v-show="dataList.length > 0"
|
|
:total="queryParams.total"
|
|
:page.sync="queryParams.current"
|
|
:limit.sync="queryParams.size"
|
|
class="pagination"
|
|
@pagination="loadList"/>
|
|
</div>
|
|
</div>
|
|
<!--End 查询和其列表部分-->
|
|
|
|
<!--新增修改部分组件-->
|
|
<div-add v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="loadList"/>
|
|
<!--详情部分组件-->
|
|
<div-info v-show="viewState == 4" ref="divinfo" @doback="resetState"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/supplychain/busvehicleapply'
|
|
import ButtonBar from '@/components/ButtonBar'
|
|
import Pagination from '@/components/pagination'
|
|
import pageye from '@/components/pagination/pageye'
|
|
import divAdd from './caigoutuikuAdd'
|
|
import divInfo from './caigoutuikuInfo'
|
|
|
|
export default {
|
|
name: 'Caigoutuiku',
|
|
components: {
|
|
ButtonBar,
|
|
Pagination,
|
|
pageye,
|
|
divAdd,
|
|
divInfo
|
|
},
|
|
data() {
|
|
return {
|
|
btndisabled: false,
|
|
viewState: 1, // 1、列表 2、添加 3、修改 4、查看
|
|
isSearchShow: false, // 显示隐藏
|
|
tableLoading: false,
|
|
// 列表数据
|
|
dataList: [],
|
|
// sid数组
|
|
sids: [], // 用于导出的时候保存已选择SID
|
|
sides: '', // 一条数据的sid
|
|
queryParams: {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
applicationDateStart: '',
|
|
applicationDateEnd: '',
|
|
vehicleName: '' // 车型
|
|
}
|
|
},
|
|
row: {}
|
|
}
|
|
},
|
|
created() {
|
|
this.loadList()
|
|
},
|
|
methods: {
|
|
btnHandle(btnKey) {
|
|
console.log('XXXXXXXXXXXXXXX' + btnKey)
|
|
switch (btnKey) {
|
|
case 'toAdd':
|
|
this.toAdd()
|
|
break
|
|
case 'toEdit':
|
|
this.toEdit()
|
|
break
|
|
case 'doSubmit':
|
|
this.doSubmit()
|
|
break
|
|
case 'doDel':
|
|
this.doDel()
|
|
break
|
|
case 'doImport':
|
|
this.doImport()
|
|
break
|
|
case 'doExport':
|
|
this.doExport()
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
},
|
|
// 获取数据sid
|
|
handleSelectionChange(row) {
|
|
const aa = []
|
|
row.forEach(element => {
|
|
aa.push(element.sid)
|
|
})
|
|
this.sids = aa
|
|
this.row = row
|
|
this.sides = this.sids.join() // 将sid数组的元素转化成字符串
|
|
console.log('获取sids数组', this.sids)
|
|
},
|
|
toAdd(row) {
|
|
this.viewState = 2
|
|
this.$refs['divadd'].showAdd()
|
|
},
|
|
toEdit() {
|
|
this.viewState = 3
|
|
const sid = this.sids[0]
|
|
const row = this.row
|
|
this.$refs['divadd'].showEdit(sid, row)
|
|
},
|
|
toInfo(row) {
|
|
this.viewState = 4
|
|
console.log('这是打开详情接口', row)
|
|
const sid = row.sid
|
|
this.$refs['divinfo'].showInfo(sid, row)
|
|
},
|
|
// 查询
|
|
dosearch() {
|
|
this.queryParams.current = 1
|
|
this.loadList()
|
|
},
|
|
// 重置
|
|
resetQuery() {
|
|
this.queryParams = {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
applicationDateStart: '',
|
|
applicationDateEnd: '',
|
|
vehicleName: '' // 车型
|
|
}
|
|
}
|
|
},
|
|
loadList() {
|
|
const _this = this
|
|
this.tableLoading = true
|
|
req.listPage(this.queryParams).then(resp => {
|
|
console.log('查询列表', resp)
|
|
_this.tableLoading = false
|
|
const data = resp.data
|
|
_this.queryParams.total = data.total
|
|
_this.dataList = data.records
|
|
}).catch(() => {
|
|
_this.tableLoading = false
|
|
})
|
|
},
|
|
// 序号
|
|
indexMethod(index) {
|
|
var pagestart = (this.queryParams.current - 1) * this.queryParams.size
|
|
var pageindex = index + 1 + pagestart
|
|
return pageindex
|
|
},
|
|
// 删除
|
|
doDel(row) {
|
|
if (this.sids.length === 0) {
|
|
this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' })
|
|
return
|
|
}
|
|
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?'
|
|
this.$confirm(tip, '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
const _this = this
|
|
req.delBySids(this.sids).then(resp => {
|
|
loading.close()
|
|
_this.$message({ type: 'success', message: resp.msg, showClose: true })
|
|
_this.loadList()
|
|
}).catch(e => {
|
|
loading.close()
|
|
})
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
// 子组件关闭(返回)
|
|
resetState() {
|
|
this.viewState = 1
|
|
this.loadList()
|
|
},
|
|
doSubmit(row) {
|
|
// 提交的代码
|
|
this.btndisabled = true
|
|
req.doSubmit(this.queryParams.params, this.sids).then(resp => {
|
|
console.log(resp)
|
|
this.btndisabled = false
|
|
}).catch(() => {
|
|
this.btndisabled = false
|
|
})
|
|
},
|
|
doImport(row) {
|
|
// 导入的代码
|
|
req.importExcel(this.queryParams.params, this.sids).then(resp => {
|
|
console.log(resp)
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
doExport(sids) {
|
|
// 导出的代码
|
|
req.exportExcel(this.queryParams.params, this.sids).then(resp => {
|
|
var map = resp.data
|
|
const fileName = map.filename // 导出文件名
|
|
// // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
|
|
// // IE10以上支持blob但是依然不支持download
|
|
const link = document.createElement('a') // 创建a标签
|
|
link.download = fileName // a标签添加属性
|
|
link.style.display = 'none'
|
|
link.href = map.downurl
|
|
document.body.appendChild(link)
|
|
link.click() // 执行下载
|
|
URL.revokeObjectURL(link.href) // 释放url
|
|
document.body.removeChild(link) // 释放标签
|
|
}).catch(() => {
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.line {
|
|
display: inline-block;
|
|
margin: 0px 15px;
|
|
}
|
|
|
|
.listtop {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border: 1px solid #dfe4ed;
|
|
height: 40px;
|
|
}
|
|
|
|
.tit {
|
|
margin-bottom: -10px;
|
|
}
|
|
|
|
.pagination {
|
|
margin-bottom: -10px;
|
|
}
|
|
|
|
.formItem {
|
|
margin-right: 28px;
|
|
}
|
|
|
|
.line {
|
|
display: inline-block;
|
|
margin: 0 10px;
|
|
}
|
|
</style>
|
|
|