|
@@ -40,6 +40,12 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
+ <el-form-item label="" label-width="20px">
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-search" plain>搜索</el-button>
|
|
|
+ <el-button size="small" icon="el-icon-refresh" plain>重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
<el-form-item label="是否已处理需求">
|
|
|
<el-select v-model="queryParams.isProcess" size="small" style="width: 200px" clearable placeholder="请选择">
|
|
|
<el-option
|
|
@@ -145,12 +151,6 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-form-item label="" label-width="20px">
|
|
|
- <el-button type="primary" size="small" icon="el-icon-search" plain>搜索</el-button>
|
|
|
- <el-button size="small" icon="el-icon-refresh" plain>重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
|
|
@@ -178,7 +178,7 @@
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
|
|
|
- <el-button type="primary" size="small">删除</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="delItems">删除</el-button>
|
|
|
<el-button type="primary" size="small">打印</el-button>
|
|
|
</div>
|
|
|
<el-table
|
|
@@ -234,7 +234,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Add from './add.vue'
|
|
|
-import {getDemandList} from '@/api/purchase/purchaseDemand.js'
|
|
|
+import {getDemandList, delDemand, downLoadDemand} from '@/api/purchase/purchaseDemand.js'
|
|
|
export default {
|
|
|
name: 'PurchaseDemandList',
|
|
|
components: {
|
|
@@ -270,7 +270,8 @@ export default {
|
|
|
tableList: [],
|
|
|
total: 0,
|
|
|
rowDetail: {},
|
|
|
- disable: false
|
|
|
+ disable: false,
|
|
|
+ ids: []
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -285,9 +286,32 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- handleSelectionChange() {},
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ console.log('选中', selection)
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
+ console.log('选中数组', this.ids.join())
|
|
|
+ },
|
|
|
handleCommand(command) {
|
|
|
- alert(command)
|
|
|
+ // alert(command)
|
|
|
+ if(command == '模板下载') {
|
|
|
+ downLoadDemand({}).then(res => {
|
|
|
+ console.log('下载的文件流', res)
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
+ });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
+ const downloadElement = document.createElement("a"); //创建a标签
|
|
|
+ const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
+ // var temp = res.headers["content-disposition"];
|
|
|
+ // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
|
+ // var name = fileName.split(";")[0]; //切割成文件名
|
|
|
+ downloadElement.href = href; //下载地址
|
|
|
+ downloadElement.download = '模板'; // 下载后文件名
|
|
|
+ document.body.appendChild(downloadElement);
|
|
|
+ downloadElement.click(); // 点击下载
|
|
|
+ document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
addDivision() {
|
|
|
this.isList = false
|
|
@@ -306,16 +330,33 @@ export default {
|
|
|
this.rowDetail = row
|
|
|
this.disable = false
|
|
|
},
|
|
|
+ // 行内删除
|
|
|
deleteids(row) {
|
|
|
console.log('row', row)
|
|
|
this.$modal.confirm('确认信息').then(() => {
|
|
|
- // delAddress(row.id).then(res => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // this.$modal.msgSuccess("删除成功");
|
|
|
- // this.getList(this.queryParams)
|
|
|
- // }
|
|
|
- // })
|
|
|
+ delDemand(row.id).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ this.getList(this.queryParams)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // 批量删除按钮
|
|
|
+ delItems() {
|
|
|
+ if(this.ids.length == 0) {
|
|
|
+ this.$modal.msgWarning("请选中至少一条数据");
|
|
|
+ } else {
|
|
|
+ let param = this.ids.join()
|
|
|
+ this.$modal.confirm('确认信息').then(() => {
|
|
|
+ delDemand(param).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ this.getList(this.queryParams)
|
|
|
+ }
|
|
|
+ })
|
|
|
}).catch(() => {})
|
|
|
+ }
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
console.log(`每页 ${val} 条`);
|