|
@@ -16,7 +16,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-form-item label="需求客户">
|
|
|
- <el-select clearable size="small" v-model="queryParams.customer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
|
|
|
+ <el-select clearable size="small" v-model="queryParams.customer" @focus="chooseOrg('CUSTOMER_PARAM', true, '需求客户')" style="width: 200px">
|
|
|
<el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -226,14 +226,53 @@
|
|
|
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
|
|
</el-upload>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
- <el-button @click="upload.open = false">取 消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
+ <el-button size="small" @click="upload.open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 模板下载新增参数 -->
|
|
|
+ <el-dialog title="需求模板下载" :visible.sync="download.open" width="400px">
|
|
|
+ <el-row style="margin-bottom: 20px;">
|
|
|
+ <span style="margin-right: 10px;">需求客户</span>
|
|
|
+ <el-select clearable size="small" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
|
|
|
+ <el-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-bottom: 20px;">
|
|
|
+ <span style="margin-right: 10px;">供应仓库</span>
|
|
|
+ <el-select clearable size="small" v-model="download.warehouse" @clear="cleanMb" @focus="chooseOrg('WAREHOUSE_PARAM', true, '选择仓库')">
|
|
|
+ <el-option v-for="item in mBwarehouse" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-bottom: 20px;">
|
|
|
+ <span style="margin-right: 10px;">供应货位</span>
|
|
|
+ <el-select clearable size="small" v-model="download.cargoSpace" @clear="download.cargoSpace = ''" @focus="chooseOrg('ALLOCATION_PARAM', true, '选择货位', download.warehouseId)">
|
|
|
+ <el-option v-for="item in mBcargoSpace" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-bottom: 20px;">
|
|
|
+ <span style="margin-right: 10px;">品类选择</span>
|
|
|
+ <el-select
|
|
|
+ v-model="download.category"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
|
|
|
+ >
|
|
|
+ <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
+ </el-row>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" type="primary" @click="mbDownload">模板下载</el-button>
|
|
|
+ <el-button size="small" @click="download.open = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
<Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="resetList"/>
|
|
|
|
|
|
<Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
|
|
|
+
|
|
|
+ <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -242,6 +281,7 @@
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
import Add from './add.vue'
|
|
|
import Refers from '@/components/Refers/refers.vue'
|
|
|
+import TreeRefers from '@/components/Refers/treeRefer.vue'
|
|
|
import CollapseTransition from '@/components/MyCollapse/collapse.vue'
|
|
|
import {getDemandList, delDemand, downLoadDemand, exportDemand } from '@/api/purchase/purchaseDemand.js'
|
|
|
export default {
|
|
@@ -249,7 +289,8 @@ export default {
|
|
|
components: {
|
|
|
Add,
|
|
|
CollapseTransition,
|
|
|
- Refers
|
|
|
+ Refers,
|
|
|
+ TreeRefers
|
|
|
},
|
|
|
dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
|
|
|
data() {
|
|
@@ -269,6 +310,19 @@ export default {
|
|
|
// 上传的地址
|
|
|
url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
|
|
|
},
|
|
|
+ // 模板下载参数
|
|
|
+ download: {
|
|
|
+ open: false,
|
|
|
+ customer: '',
|
|
|
+ warehouse: '',
|
|
|
+ warehouseId: '',
|
|
|
+ cargoSpace: '',
|
|
|
+ category: ''
|
|
|
+ },
|
|
|
+ mBcustomer: [],
|
|
|
+ mBwarehouse: [],
|
|
|
+ mBcargoSpace: [],
|
|
|
+ classOptions: [],
|
|
|
// 下拉收起配置
|
|
|
expanded: false,
|
|
|
// 页面配置
|
|
@@ -389,26 +443,30 @@ export default {
|
|
|
this.ids = selection.map(item => item.id)
|
|
|
console.log('选中数组', this.ids.join())
|
|
|
},
|
|
|
+ mbDownload() {
|
|
|
+ downLoadDemand(this.download).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对象
|
|
|
+ this.download.open = false
|
|
|
+ })
|
|
|
+ },
|
|
|
handleCommand(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对象
|
|
|
- })
|
|
|
+ this.download.open = true
|
|
|
}
|
|
|
if (command == '数据导入') {
|
|
|
this.upload.title = "用户导入"
|
|
@@ -536,17 +594,35 @@ export default {
|
|
|
this.expanded = !this.expanded
|
|
|
},
|
|
|
// 搜索区参照选择
|
|
|
- chooseOrg(type, isPage, title) {
|
|
|
+ chooseOrg(type, isPage, title, stordocId) {
|
|
|
this.referCondition.type = type
|
|
|
this.referCondition.isPage = isPage
|
|
|
this.referCondition.title = title
|
|
|
+ this.referCondition.stordocId = stordocId
|
|
|
this.$refs.refer.init(this.referCondition)
|
|
|
},
|
|
|
selectionsToInput(selection) {
|
|
|
- if (this.referCondition.type == 'CUSTOMER_PARAM') {
|
|
|
+ // 搜索区选择客户
|
|
|
+ if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '需求客户') {
|
|
|
this.customerOptions = selection
|
|
|
this.queryParams.customer = selection[0].id
|
|
|
}
|
|
|
+ // 模板内选择客户
|
|
|
+ if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
|
|
|
+ this.mBcustomer = selection
|
|
|
+ this.download.customer = selection[0].code
|
|
|
+ }
|
|
|
+ // 模板内选择仓库
|
|
|
+ if (this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '选择仓库') {
|
|
|
+ this.mBwarehouse = selection
|
|
|
+ this.download.warehouse = selection[0].code
|
|
|
+ this.download.warehouseId = selection[0].id
|
|
|
+ }
|
|
|
+ // 模板内选择货位
|
|
|
+ if (this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '选择货位') {
|
|
|
+ this.mBcargoSpace = selection
|
|
|
+ this.download.cargoSpace = selection[0].code
|
|
|
+ }
|
|
|
if (this.referCondition.type == 'CONTACTS_PARAM') {
|
|
|
this.personOptions = selection
|
|
|
this.queryParams.demandPersonal = selection[0].code
|
|
@@ -555,7 +631,22 @@ export default {
|
|
|
this.deptOptions = selection
|
|
|
this.queryParams.demandDept = selection[0].id
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ cleanMb() {
|
|
|
+ this.download.warehouse = ''
|
|
|
+ this.download.warehouseId = ''
|
|
|
+ },
|
|
|
+ // 搜索区树形选择
|
|
|
+ chooseTreeRefer(type, isPage, title) {
|
|
|
+ this.referCondition.type = type
|
|
|
+ this.referCondition.isPage = isPage
|
|
|
+ this.referCondition.title = title
|
|
|
+ this.$refs.tree.init(this.referCondition)
|
|
|
+ },
|
|
|
+ selectionsToInput2(selection) {
|
|
|
+ this.classOptions.push(selection)
|
|
|
+ this.download.category = selection.code
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|