|
@@ -122,9 +122,7 @@
|
|
|
<div class="table-operator">
|
|
|
<a-button type="danger" size="small" @click='addList'>新增</a-button>
|
|
|
<a-button size="small" @click='editList'>修改</a-button>
|
|
|
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="delectList()">
|
|
|
- <a-button size="small">删除</a-button>
|
|
|
- </a-popconfirm>
|
|
|
+ <a-button size="small" @click="delectList">删除</a-button>
|
|
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl">
|
|
|
<a-button size="small">导入</a-button>
|
|
|
</a-upload>
|
|
@@ -350,6 +348,7 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ //获取数据
|
|
|
getTableList(){
|
|
|
alertModal.loading("执行中,请稍后!")
|
|
|
getAction('/production/safetyStock/list',this.queryParam).then(res=>{
|
|
@@ -369,41 +368,52 @@
|
|
|
onSearch(){
|
|
|
// this.$refs.materialProcurementSearch.visible = true
|
|
|
},
|
|
|
+ //导出
|
|
|
exportList(fileName){
|
|
|
- alertModal.loading("执行中,请稍后!")
|
|
|
- downFile('/production/safetyStock/exportXls', this.queryParam).then(data => {
|
|
|
- alertModal.closeLoading();
|
|
|
- if (!data) {
|
|
|
- this.$message.warning('文件下载失败')
|
|
|
- return
|
|
|
- }
|
|
|
- if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
- window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
|
|
|
- } else {
|
|
|
- let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
|
|
- let link = document.createElement('a')
|
|
|
- link.style.display = 'none'
|
|
|
- link.href = url
|
|
|
- link.setAttribute('download', fileName + '.xlsx')
|
|
|
- document.body.appendChild(link)
|
|
|
- link.click()
|
|
|
- document.body.removeChild(link) // 下载完成移除元素
|
|
|
- window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$confirm({
|
|
|
+ title: '确认导出',
|
|
|
+ content: '是否导出数据?',
|
|
|
+ onOk: ()=> {
|
|
|
+ alertModal.loading("执行中,请稍后!")
|
|
|
+ downFile('/production/safetyStock/exportXls', this.queryParam).then(data => {
|
|
|
+ alertModal.closeLoading();
|
|
|
+ if (!data) {
|
|
|
+ this.$message.warning('文件下载失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
+ window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
|
|
|
+ } else {
|
|
|
+ let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
|
|
+ let link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ link.setAttribute('download', fileName + '.xlsx')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link) // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(url) // 释放掉blob对象
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
+ //重置
|
|
|
searchReset(){
|
|
|
this.queryParam={}
|
|
|
this.getTableList()
|
|
|
},
|
|
|
+ //查询
|
|
|
searchQuery(){
|
|
|
this.queryParam.pageNo = '1'
|
|
|
this.getTableList()
|
|
|
},
|
|
|
+ //新增
|
|
|
addList(){
|
|
|
this.$refs.safetyStockListAdd.visible=true
|
|
|
this.$refs.safetyStockListAdd.defaultMethod='add'
|
|
|
},
|
|
|
+ //编辑
|
|
|
editList(){
|
|
|
if(this.selectedRowKeys.length==0){
|
|
|
this.$message.warning('请勾选数据!')
|
|
@@ -415,35 +425,49 @@
|
|
|
this.$refs.safetyStockListAdd.getEditData(this.selectedRowKeys[0])
|
|
|
}
|
|
|
},
|
|
|
+ //删除
|
|
|
delectList(){
|
|
|
if(this.selectedRowKeys.length==0){
|
|
|
this.$message.warning('请勾选数据!')
|
|
|
}else if(this.selectedRowKeys.length>1){
|
|
|
- var ids = this.selectedRowKeys.toString()
|
|
|
- var that = this
|
|
|
- alertModal.loading("执行中,请稍后!")
|
|
|
- deleteAction('/production/safetyStock/deleteBatch', {ids: ids}).then((res) => {
|
|
|
- alertModal.closeLoading();
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.getTableList()
|
|
|
- } else {
|
|
|
- that.$message.error(res.message);
|
|
|
+ this.$confirm({
|
|
|
+ title: '确认删除',
|
|
|
+ content: '是否删除选中数据?',
|
|
|
+ onOk: ()=> {
|
|
|
+ var ids = this.selectedRowKeys.toString()
|
|
|
+ var that = this
|
|
|
+ alertModal.loading("执行中,请稍后!")
|
|
|
+ deleteAction('/production/safetyStock/deleteBatch', {ids: ids}).then((res) => {
|
|
|
+ alertModal.closeLoading();
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.getTableList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}else{
|
|
|
- alertModal.loading("执行中,请稍后!")
|
|
|
- deleteAction('/production/safetyStock/delete', {id: this.selectedRowKeys[0]}).then((res) => {
|
|
|
- alertModal.closeLoading();
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.getTableList()
|
|
|
- } else {
|
|
|
- that.$message.error(res.message);
|
|
|
+ this.$confirm({
|
|
|
+ title: '确认删除',
|
|
|
+ content: '是否删除选中数据?',
|
|
|
+ onOk: ()=> {
|
|
|
+ alertModal.loading("执行中,请稍后!")
|
|
|
+ deleteAction('/production/safetyStock/delete', {id: this.selectedRowKeys[0]}).then((res) => {
|
|
|
+ alertModal.closeLoading();
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.getTableList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
+ //勾选
|
|
|
onSelectChange(selectedRowKeys, selectionRows) {
|
|
|
this.selectedRowKeys = selectedRowKeys;
|
|
|
this.selectedRow = selectionRows;
|
|
@@ -454,6 +478,7 @@
|
|
|
this.queryParam.pageSize = pagination.pageSize
|
|
|
this.getTableList()
|
|
|
},
|
|
|
+ //双击
|
|
|
clickRow(record, index){
|
|
|
return {
|
|
|
on: {
|