|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <Toptitle :title="$route.query.type==1?'新增采购单':$route.query.type==2?'查看采购单':'编辑采购单'">
|
|
|
+ <Toptitle :title="$route.query.type==1?'新增采购订单':$route.query.type==2?'查看采购单':'编辑采购单'">
|
|
|
<slot name="titleButton">
|
|
|
<Button @click="handleReference(1)"
|
|
|
type="primary"
|
|
|
v-show="!isCheck"
|
|
|
ghost
|
|
|
style="margin-right:10px;"
|
|
|
- :disabled="$route.query.is_refer == 1?true:btn1_disable">参照请购单</Button>
|
|
|
+ >参照采购计划</Button>
|
|
|
<Button @click="goBack"
|
|
|
type="primary"
|
|
|
ghost
|
|
@@ -22,7 +22,18 @@
|
|
|
<div class="content_topform">
|
|
|
<Form :label-width="90"
|
|
|
:model="searchData">
|
|
|
- <FormItem label="项目名称:">
|
|
|
+ <FormItem label="订单号:">
|
|
|
+ <Input type="text"
|
|
|
+ size="small"
|
|
|
+ v-show="!isCheck"
|
|
|
+ disabled
|
|
|
+ v-model="searchData.residential_name"
|
|
|
+ style="width: 200px;margin-top:6px"
|
|
|
+ placeholder="自动生成订单号">
|
|
|
+ </Input>
|
|
|
+ <span v-show="isCheck">{{searchData.residential_name}}</span>
|
|
|
+ </FormItem>
|
|
|
+ <!-- <FormItem label="项目名称:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -34,7 +45,7 @@
|
|
|
@click="showProjectModal=true">选择</span>
|
|
|
</Input>
|
|
|
<span v-show="isCheck">{{searchData.residential_name}}</span>
|
|
|
- </FormItem>
|
|
|
+ </FormItem> -->
|
|
|
<FormItem label="供应商名称:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
@@ -48,7 +59,7 @@
|
|
|
</Input>
|
|
|
<span v-show="isCheck">{{searchData.supply_title}}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="采购类型:">
|
|
|
+ <FormItem label="采购订单类型:">
|
|
|
<Select v-model="searchData.type_id"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -64,7 +75,7 @@
|
|
|
</Select>
|
|
|
<span v-show="isCheck">{{searchData.type_title}}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="单据号:">
|
|
|
+ <!-- <FormItem label="单据号:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -73,9 +84,9 @@
|
|
|
style="width: 200px"
|
|
|
placeholder="自动生成" />
|
|
|
<span v-show="isCheck">{{searchData.purchase_order_no}}</span>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="制单人:"
|
|
|
- v-show="isCheck">
|
|
|
+ </FormItem> -->
|
|
|
+ <!-- <FormItem label="制单人:"
|
|
|
+ v-show="isCheck"> -->
|
|
|
<!-- <Select v-model="searchData.nickname"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -89,9 +100,9 @@
|
|
|
:value="sitem.nickname">
|
|
|
</Option>
|
|
|
</Select> -->
|
|
|
- <span>{{searchData.nickname}}</span>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="制单日期:">
|
|
|
+ <!-- <span>{{searchData.nickname}}</span>
|
|
|
+ </FormItem> -->
|
|
|
+ <!-- <FormItem label="制单日期:">
|
|
|
<DatePicker type="date"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
@@ -99,8 +110,8 @@
|
|
|
placeholder="年/月/日"
|
|
|
v-model="searchData.crt_time"></DatePicker>
|
|
|
<span v-show="isCheck">{{func.replaceDate(searchData.crt_time)}}</span>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="预计到货:">
|
|
|
+ </FormItem> -->
|
|
|
+ <FormItem label="预计到货日期:">
|
|
|
<DatePicker type="date"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
@@ -123,31 +134,109 @@
|
|
|
<div class="content_table">
|
|
|
<div class="content_table_btn">
|
|
|
<div>
|
|
|
- <span>请购清单</span>
|
|
|
- <Button @click="showModal=true"
|
|
|
+ <span>采购清单</span>
|
|
|
+ <!-- <Button @click="showModal=true"
|
|
|
v-show="!isCheck"
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
style="margin-left:10px;"
|
|
|
- :disabled="$route.query.is_refer == 0?true:btn_disable">选择物料</Button>
|
|
|
+ :disabled="$route.query.is_refer == 0?true:btn_disable">选择物料</Button> -->
|
|
|
+ <div><span>参照计划单号:</span><span></span></div>
|
|
|
</div>
|
|
|
<div class="content_table_btn_right"
|
|
|
v-show="!isCheck">
|
|
|
- <span>税率一键修改: </span>
|
|
|
- <Input type="text"
|
|
|
- size="small"
|
|
|
- @on-change="handleModify"
|
|
|
- v-model="fax_modify"
|
|
|
- style="width: 80px;margin-right:10px"
|
|
|
- placeholder="税率">
|
|
|
- <span slot="append">%</span>
|
|
|
- </Input>
|
|
|
+ <Dropdown trigger="click" style="margin-left: 20px" @on-click='DropDownSort' >
|
|
|
+ <a href="javascript:void(0)">
|
|
|
+ 批量修改
|
|
|
+ <Icon type="ios-arrow-down"></Icon>
|
|
|
+ </a>
|
|
|
+ <DropdownMenu slot="list" >
|
|
|
+ <DropdownItem :name='2'>数量</DropdownItem>
|
|
|
+ <DropdownItem :name='3'>税率</DropdownItem>
|
|
|
+ <DropdownItem :name='1'>项目信息</DropdownItem>
|
|
|
+ </DropdownMenu>
|
|
|
+ </Dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
<Table :columns="tableColumns"
|
|
|
border
|
|
|
- :data="tableData">
|
|
|
+ :data="tableData"
|
|
|
+ :max-height='500'
|
|
|
+ show-summary
|
|
|
+ :summary-method="handleSummary"
|
|
|
+ @on-selection-change='selectRow' >
|
|
|
+ <template slot="material_sort" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <span >{{ tableData[index].material_type }}</span></div>
|
|
|
+ </template>
|
|
|
+ <template slot="material_title" slot-scope="{ row,index }">
|
|
|
+ <span
|
|
|
+
|
|
|
+ v-show="!isCheck"
|
|
|
+
|
|
|
+ style="cursor: pointer;color:#2d8cf0"
|
|
|
+ @click="showModal = true"
|
|
|
+
|
|
|
+ >
|
|
|
+ {{tableData[index].material_title}}
|
|
|
+ </span>
|
|
|
+ <span v-show="isCheck">{{ row.material_title }}</span>
|
|
|
+ </template>
|
|
|
+<template slot="project_number" slot-scope="{row}">
|
|
|
+ <span @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_number}}</span>
|
|
|
+</template>
|
|
|
+ <template slot="project_code" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <Select
|
|
|
+ v-model="tableData[index].project_code"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ v-show="!isCheck&&row.project_number!=='查看'"
|
|
|
+ @on-change='selectChange(row,index)'
|
|
|
+ filterable
|
|
|
+ label-in-value
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="(sitem,index) in project_number"
|
|
|
+ :key="index"
|
|
|
+ :label="sitem"
|
|
|
+ :value="sitem"
|
|
|
+ >
|
|
|
+ </Option>
|
|
|
+ </Select>
|
|
|
+ <span v-show="isCheck||row.project_number == '查看'" @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_code}}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot="project_title" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <Select
|
|
|
+ v-model="tableData[index].project_title"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ transfer
|
|
|
+ @on-change='selectChange(row,index)'
|
|
|
+ v-show="!isCheck&&row.project_number!=='查看'"
|
|
|
+ filterable
|
|
|
+ label-in-value
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="(sitem,index) in project_name"
|
|
|
+ :key="index"
|
|
|
+ :label="sitem"
|
|
|
+ :value="sitem"
|
|
|
+ >
|
|
|
+ </Option>
|
|
|
+ </Select>
|
|
|
+ <span v-show="isCheck||row.project_number == '查看'" @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_title}}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template slot="numberSet" slot-scope="{row , index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
<Tooltip
|
|
|
placement="left"
|
|
|
@on-popper-show="handleToolShow(index, row)"
|
|
@@ -169,14 +258,23 @@
|
|
|
>
|
|
|
</Input>
|
|
|
<span v-show="isCheck">{{ tableData[index].num }}</span>
|
|
|
- </Tooltip>
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template slot="setSlot"
|
|
|
slot-scope="{row,index}">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <a style="margin:0 5px"
|
|
|
+ v-show="!isCheck"
|
|
|
+ :disabled="row.state==0"
|
|
|
+ @click="handleSet(3,row,index)"
|
|
|
+ >复制</a>
|
|
|
<a style="margin:0 5px"
|
|
|
v-show="!isCheck"
|
|
|
:disabled="row.state==0"
|
|
|
@click="handleSet(4,row,index)">删除</a>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</Table>
|
|
|
</div>
|
|
@@ -335,6 +433,51 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
+ <Modal
|
|
|
+ :width='400'
|
|
|
+ v-model="showTotal"
|
|
|
+ @on-ok='total_sure'
|
|
|
+ :title="total_type==1?'批量修改项目信息':total_type==2?'批量修改数量':'批量修改税率'">
|
|
|
+ <div style="text-align:center">
|
|
|
+ <div v-if="total_type==1">
|
|
|
+ <Form>
|
|
|
+ <FormItem>
|
|
|
+ <span>项目编码 : </span>
|
|
|
+ <Select v-model="total_project_info.code" style="width:200px">
|
|
|
+ <Option v-for="(item,index) in project_number" :value="item" :key="index">{{ item }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <span>项目名称 : </span>
|
|
|
+ <Select v-model="total_project_info.name" style="width:200px">
|
|
|
+ <Option v-for="(item,index) in project_name" :value="item" :key="index">{{ item }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ <div v-if="total_type==2">
|
|
|
+ <span>数量 : </span><Input v-model="total_num" style="width:50%" type="number"/>
|
|
|
+ </div>
|
|
|
+ <div v-if="total_type == 3">
|
|
|
+ <span>税率一键修改 : </span>
|
|
|
+ <Input v-model="total_fax" style="width:50%" type="number"/>%
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ <Modal
|
|
|
+ :width='800'
|
|
|
+ v-model="showCheck"
|
|
|
+ title="查看">
|
|
|
+ <span>物料名称:{{material_name}}</span>
|
|
|
+ <Table
|
|
|
+ :columns="CheckTableColumns"
|
|
|
+ :max-height="520"
|
|
|
+ border
|
|
|
+ :data='checkData'
|
|
|
+ style='margin-top:10px'
|
|
|
+ >
|
|
|
+ </Table>
|
|
|
+ </Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -352,8 +495,28 @@ export default {
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
+ material_name:'',
|
|
|
+ checkData:[],
|
|
|
+ CheckTableColumns:[
|
|
|
+ { title: '计划单号', key: 'plan_no', align: 'center', minWidth: 150},
|
|
|
+ { title: '采购计划类型', key: 'plan_type_title', align: 'center', minWidth: 100},
|
|
|
+ { title: '项目编码', key: 'project_code', align: 'center', minWidth: 150},
|
|
|
+ { title: '项目名称', key: 'project_name', align: 'center', minWidth: 150},
|
|
|
+ { title: '数量', key: 'purchases_num', align: 'center', minWidth: 100}
|
|
|
+ ],
|
|
|
+ showCheck:false,
|
|
|
+ selectChoose:[],
|
|
|
+ total_fax:0,
|
|
|
+ project_name:[],
|
|
|
+ project_number:[],
|
|
|
+ total_num:'',
|
|
|
+ total_project_info:{
|
|
|
+ code:'',
|
|
|
+ name:""
|
|
|
+ },
|
|
|
+ total_type:'',
|
|
|
+ showTotal:false,
|
|
|
btn_disable:false,
|
|
|
- btn1_disable:false,
|
|
|
fax_modify: '',
|
|
|
searchData: {
|
|
|
residential_name: ''
|
|
@@ -404,20 +567,25 @@ export default {
|
|
|
tableData: [{}]
|
|
|
},
|
|
|
tableColumns: [
|
|
|
- { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 140 },
|
|
|
- { title: '物料分类', key: 'type_title', align: 'center', minWidth: 140 },
|
|
|
- { title: '物料名称', key: 'title', align: 'center', minWidth: 140 },
|
|
|
+ {key: 'select', align: 'center', minWidth: 80,type:'selection'},
|
|
|
+ { title: '物料分类', key: 'type_title', align: 'center', minWidth: 140,slot:'material_sort'},
|
|
|
+ { title: '物料名称', key: 'material_title', align: 'center', minWidth: 140 ,slot:'material_title'},
|
|
|
{
|
|
|
title: '物料规格', key: 'model', align: 'center', minWidth: 140,
|
|
|
render: (h, params) => {
|
|
|
const { row } = params
|
|
|
let text = `${row.long ? row.long : 0}*${row.width ? row.width : 0}*${row.high ? row.high : 0}`
|
|
|
- return h('span', {}, text)
|
|
|
+ if(row.material_title =='选择物料'){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
+ return h('span', {}, text)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
{ title: '计量单位', key: 'unit', align: 'center', minWidth: 100 },
|
|
|
{
|
|
|
- title: '采购数量', key: 'num', align: 'center', minWidth: 120,slot:"numberSet"
|
|
|
+ title: '数量', key: 'num', align: 'center', minWidth: 120,slot:"numberSet"
|
|
|
// render: (h, params) => {
|
|
|
// const { row, index } = params
|
|
|
// const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
@@ -443,7 +611,10 @@ export default {
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
- return this.isCheck ? h('span', {}, currentRow.no_tax_price) : h('Input', {
|
|
|
+ if(row.material_title==='选择物料'){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
+ return this.isCheck ? h('span', {}, currentRow.no_tax_price) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.no_tax_price,
|
|
|
type: 'text'
|
|
@@ -461,13 +632,18 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
{
|
|
|
title: '税率', key: 'fax', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
- const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
- return this.isCheck ? h('span', {}, currentRow.fax) : h('Input', {
|
|
|
+ const currentRow = this.tableData[index]
|
|
|
+ if(row.material_title === '选择物料' ){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
+ return this.isCheck ? h('span', {}, currentRow.fax) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.fax,
|
|
|
type: 'text',
|
|
@@ -483,12 +659,17 @@ export default {
|
|
|
}
|
|
|
}, [h('span', { slot: 'append' }, '%')])
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
{
|
|
|
title: '含税单价', key: 'price', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
+ if(row.material_title === '选择物料' ){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
return this.isCheck ? h('span', {}, currentRow.price) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.price,
|
|
@@ -506,12 +687,16 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '无税金额', key: 'no_tax_amount', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
+ if(row.material_title === '选择物料' ){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
return this.isCheck ? h('span', {}, currentRow.no_tax_amount) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.no_tax_amount,
|
|
@@ -523,18 +708,22 @@ export default {
|
|
|
currentRow.no_tax_price = (1 * currentRow.no_tax_amount / currentRow.num).toFixed(2)
|
|
|
currentRow.price = (1 * currentRow.no_tax_price * (1 + 1 * currentRow.fax / 100)).toFixed(2)
|
|
|
currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
|
|
|
- currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_price).toFixed(2)
|
|
|
+ currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_amount).toFixed(2)
|
|
|
this.tableData.splice(index, 1, currentRow);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '税额', key: 'tax_amount', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
+ if(row.material_title === '选择物料' ){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
return this.isCheck ? h('span', {}, currentRow.tax_amount) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.tax_amount,
|
|
@@ -543,18 +732,24 @@ export default {
|
|
|
on: {
|
|
|
'on-change': (e) => {
|
|
|
currentRow.tax_amount = e.target.value
|
|
|
- currentRow.fax = (1 * currentRow.tax_amount / currentRow.no_tax_price).toFixed(2)
|
|
|
+ // currentRow.fax = (1 * currentRow.tax_amount / currentRow.no_tax_price).toFixed(2)
|
|
|
+ currentRow.no_tax_amount = (1*(currentRow.total_price-currentRow.tax_amount)).toFixed(2)
|
|
|
+ currentRow.no_tax_price = (1*(currentRow.no_tax_amount/currentRow.num)).toFixed(2)
|
|
|
this.tableData.splice(index, 1, currentRow);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '价格合计', key: 'total_price', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
+ if(row.material_title === '选择物料' ){
|
|
|
+ return h('span',{},'')
|
|
|
+ }else{
|
|
|
return this.isCheck ? h('span', {}, currentRow.total_price) : h('Input', {
|
|
|
props: {
|
|
|
value: currentRow.total_price,
|
|
@@ -572,10 +767,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ }
|
|
|
},
|
|
|
- { title: '操作', key: 'code', align: 'center', minWidth: 100, slot: 'setSlot' },
|
|
|
+ { title: '参照计划单号', key: 'project_number', align: 'center', minWidth: 100,slot:'project_number' },
|
|
|
+ { title: '项目编码', key: 'project_code', align: 'center', minWidth: 100,slot: "project_code" },
|
|
|
+ { title: '项目名称', key: 'project_title', align: 'center', minWidth: 100,slot: "project_title" },
|
|
|
+ { title: '操作', key: 'code', align: 'center', minWidth: 120, slot: 'setSlot' },
|
|
|
],
|
|
|
- tableData: [],
|
|
|
+ tableData: [{material_title:'选择物料',_disabled:true}],
|
|
|
showModal: false,
|
|
|
showProjectModal: false,
|
|
|
showSupplierModal: false,
|
|
@@ -712,6 +911,8 @@ export default {
|
|
|
usersList: [],
|
|
|
isCheck: false,
|
|
|
warningList: [],
|
|
|
+ purchase_data:[],
|
|
|
+ purchase_tableData:[],
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -727,12 +928,17 @@ export default {
|
|
|
this.axios({ method: 'get', url: '/api/supply_list', }).then((res) => { this.suppliersList = res.data.data }).catch((err) => { });
|
|
|
// 获取供应商分类
|
|
|
this.axios({ method: 'get', url: '/api/basic_supply_list', }).then((res) => { this.modalSupplierData.treeData[0].sub = res.data }).catch((err) => { });
|
|
|
- // 获取项目列表
|
|
|
- this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
|
|
|
- this.modalProjectData.tableData = res.data.data
|
|
|
- this.modal_project_total = res.data.total
|
|
|
- console.log(res);
|
|
|
+ // //获取项目列表
|
|
|
+ this.axios({ method: 'get', url: '/api/purchase_orders_list', }).then((res) => {
|
|
|
+ this.project_name = res.data.project_name;
|
|
|
+ this.project_number = res.data.project_number;
|
|
|
}).catch((err) => { });
|
|
|
+ // // 获取项目列表
|
|
|
+ // this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
|
|
|
+ // this.modalProjectData.tableData = res.data.data
|
|
|
+ // this.modal_project_total = res.data.total
|
|
|
+ // console.log(res);
|
|
|
+ // }).catch((err) => { });
|
|
|
// 获取紧急程度
|
|
|
this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
|
|
|
this.initModal()
|
|
@@ -746,6 +952,128 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ check(row){
|
|
|
+ console.log(row);
|
|
|
+ if(row.project_number!=='查看'){
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ let data=[];
|
|
|
+ this.purchase_data.forEach(v=>{
|
|
|
+ if(row.material_detail_id == v[0].material_detail_id){
|
|
|
+
|
|
|
+ v.forEach(m=>{
|
|
|
+ let obj ={};
|
|
|
+ obj.plan_no = m.plan_no;
|
|
|
+ obj.plan_type_title=m.plan_type_title;
|
|
|
+ obj.project_code = m.project_code;
|
|
|
+ obj.project_name=m.project_title;
|
|
|
+ obj.purchases_num = m.purchases_num;
|
|
|
+ data.push(obj)
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.material_name = row.material_title;
|
|
|
+ this.checkData = data;
|
|
|
+ this.showCheck = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selectRow(e){
|
|
|
+ this.selectChoose = e;
|
|
|
+ },
|
|
|
+ total_sure(){
|
|
|
+
|
|
|
+ //1项目信息 2数量 3税率
|
|
|
+ switch(this.total_type){
|
|
|
+ case 1:
|
|
|
+ this.tableData.map((v)=>{
|
|
|
+
|
|
|
+ this.selectChoose.map(m=>{
|
|
|
+ if(m.index == v.index ){
|
|
|
+ v.project_code =this.total_project_info.code;
|
|
|
+ v.project_title = this.total_project_info.name;
|
|
|
+ v._checked = true;
|
|
|
+ v.ad = true
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.tableData.map((v)=>{
|
|
|
+
|
|
|
+ this.selectChoose.map(m=>{
|
|
|
+ if(m.index == v.index ){
|
|
|
+
|
|
|
+ v.num =this.total_num;
|
|
|
+
|
|
|
+ v._checked = true;
|
|
|
+ v.ad = true
|
|
|
+ }
|
|
|
+
|
|
|
+ })})
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ this.tableData.map((v)=>{
|
|
|
+
|
|
|
+ this.selectChoose.map(m=>{
|
|
|
+ if(m.index == v.index ){
|
|
|
+
|
|
|
+ v.fax =this.total_fax;
|
|
|
+
|
|
|
+ v._checked = true;
|
|
|
+ v.ad = true
|
|
|
+ }
|
|
|
+
|
|
|
+ })})
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSummary({ columns, data }){
|
|
|
+ const sums = {};
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ const key = column.key;
|
|
|
+ if (index === 1) {
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: '合计'
|
|
|
+ };
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = data.map(item => Number(item[key]));
|
|
|
+ if (key == 'num'||key=='no_tax_amount'||key=='total_price'||key=='tax_amount') {
|
|
|
+ let v = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ // this.table_total_num = Number(JSON.parse(JSON.stringify(v)));
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value:v
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: ''
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return sums;
|
|
|
+
|
|
|
+ },
|
|
|
+ DropDownSort(val){
|
|
|
+if(this.selectChoose.length == 0){
|
|
|
+ return this.$Message.warning('请先选择物料')
|
|
|
+ }
|
|
|
+ this.showTotal = true;
|
|
|
+ this.total_type = val;
|
|
|
+ },
|
|
|
changenum(e){
|
|
|
currentRow.num = e.target.value
|
|
|
currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
|
|
@@ -847,9 +1175,8 @@ export default {
|
|
|
handleReference (type) {
|
|
|
this.$reference({
|
|
|
type,
|
|
|
- title: '参照请购单',
|
|
|
+ title: '参照采购计划',
|
|
|
then: (result, data) => {
|
|
|
- console.log(result)
|
|
|
result.forEach(element => {
|
|
|
element.num = 0
|
|
|
element.no_tax_price = 0
|
|
@@ -862,10 +1189,95 @@ export default {
|
|
|
// element.material_id = element.m_id
|
|
|
element.supply_id = this.searchData.supply_id
|
|
|
this.table_state = 1
|
|
|
- this.btn_disable = true
|
|
|
+
|
|
|
});
|
|
|
- this.tableData = [...this.tableData, ...result]
|
|
|
- this.searchData.residential_name = result[0].residential_name
|
|
|
+ let obj = {},newArr = [];
|
|
|
+ result.forEach((item,suffix)=>{
|
|
|
+ if(!obj[item.material_detail_id]){
|
|
|
+ let arr =[];
|
|
|
+ arr.push(item);
|
|
|
+ newArr.push(arr);
|
|
|
+ obj[item.material_detail_id]=item;
|
|
|
+ }else{
|
|
|
+ newArr.forEach((v,index)=>{
|
|
|
+ if(v[0].material_detail_id == item.material_detail_id){
|
|
|
+ v.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let copy_purchase_data = JSON.parse(JSON.stringify(this.purchase_data));
|
|
|
+ let title = [];
|
|
|
+ copy_purchase_data.forEach(m=>{
|
|
|
+ if(title.indexOf(m[0].material_detail_id)<0){
|
|
|
+ title.push(m[0].material_detail_id);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ let content = [];
|
|
|
+ newArr.forEach(v=>{
|
|
|
+ if(copy_purchase_data.length==0){
|
|
|
+
|
|
|
+ this.purchase_data.push(v)
|
|
|
+ }else{
|
|
|
+
|
|
|
+ this.purchase_data.forEach((m,index)=>{
|
|
|
+ let id=[];
|
|
|
+ let m_content=[];
|
|
|
+ let val =copy_purchase_data[index];
|
|
|
+ val.forEach(s=>{
|
|
|
+ id.push(s.id)
|
|
|
+ })
|
|
|
+
|
|
|
+ if(v[0].material_detail_id == m[0].material_detail_id){
|
|
|
+ m.forEach(mm=>{
|
|
|
+ v.forEach(vv=>{
|
|
|
+ if(mm.id == vv.id){
|
|
|
+ mm.purchases_num = 1*vv.purchases_num+1*mm.purchases_num
|
|
|
+ }
|
|
|
+ if(id.indexOf(vv.id)<0){
|
|
|
+ m_content.push(vv)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+ m.push(...m_content)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ if(title.indexOf(v[0].material_detail_id)<0){
|
|
|
+
|
|
|
+ content.push(v)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ this.purchase_data.push(...content);
|
|
|
+ this.purchase_tableData = [];
|
|
|
+
|
|
|
+ this.purchase_data.forEach(v=>{
|
|
|
+ let data = {...v[0]};
|
|
|
+ data.num = 0
|
|
|
+ data.no_tax_price = 0
|
|
|
+ data.fax = 0
|
|
|
+ data.price = 0
|
|
|
+ data.no_tax_amount = 0
|
|
|
+ data.tax_amount = 0
|
|
|
+ data.total_price = 0
|
|
|
+ data.project_number = '查看'
|
|
|
+ data.project_code = '查看'
|
|
|
+ data.project_title = '查看'
|
|
|
+ v.forEach(m=>{
|
|
|
+ data.num+=m.purchases_num*1;
|
|
|
+ })
|
|
|
+ this.purchase_tableData.push(data)
|
|
|
+ })
|
|
|
+ console.log(this.purchase_tableData);
|
|
|
+ this.tableData = [{material_title:'选择物料',_disabled:true}];
|
|
|
+ this.tableData.unshift(...this.purchase_tableData,...this.modalData.selectedData)
|
|
|
+ // this.searchData.residential_name = result[0].residential_name
|
|
|
// console.log(result)
|
|
|
}
|
|
|
})
|
|
@@ -876,10 +1288,27 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
handleSet (type, row, index) {
|
|
|
- this.tableData.splice(index, 1)
|
|
|
+ if(type==3){
|
|
|
+ if(row.project_number == '查看'){
|
|
|
+ let obj = JSON.parse(JSON.stringify(row));
|
|
|
+ obj.project_number = '';
|
|
|
+ this.tableData.splice(index+1,0,obj)
|
|
|
+ }else{
|
|
|
+ this.tableData.splice(index+1,0,row);}
|
|
|
+ }else if(type == 4){
|
|
|
+ this.tableData.splice(index, 1);
|
|
|
+ this.purchase_data.forEach((v,idx)=>{
|
|
|
+ if(row.material_detail_id == v[0].material_detail_id){
|
|
|
+ this.purchase_data.splice(idx,1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
},
|
|
|
handleSelect () {
|
|
|
this.modalData.selectedData.forEach(element => {
|
|
|
+ element.material_title = element.title
|
|
|
element.num = 0
|
|
|
element.no_tax_price = 0
|
|
|
element.fax = 0
|
|
@@ -887,16 +1316,22 @@ export default {
|
|
|
element.no_tax_amount = 0
|
|
|
element.tax_amount = 0
|
|
|
element.total_price = 0
|
|
|
- element.type_title = element.m_title
|
|
|
+ element.material_type = element.m_title
|
|
|
element.material_id = element.m_id
|
|
|
element.supply_id = this.searchData.supply_id
|
|
|
+ element.project_code =null;
|
|
|
+ element.project_title=null;
|
|
|
});
|
|
|
- this.tableData = [...this.tableData, ...this.modalData.selectedData]
|
|
|
+ // console.log(this.modalData.selectedData);
|
|
|
+
|
|
|
+ this.tableData.splice(this.tableData.length-1,0,...JSON.parse(JSON.stringify(this.modalData.selectedData)))
|
|
|
this.table_state = 0
|
|
|
- this.btn1_disable = true
|
|
|
this.tableData.map((item,index)=>{
|
|
|
item.residential_name = this.currentChoose.residential_name
|
|
|
- this.tableData.splice(index,1,item) })
|
|
|
+ this.tableData.splice(index,1,item) });
|
|
|
+ this.tableData.map((m,index)=>{
|
|
|
+ m.index = index
|
|
|
+ })
|
|
|
},
|
|
|
changeModalSize (e) {
|
|
|
this.modal_page_size = e;
|
|
@@ -1136,4 +1571,7 @@ export default {
|
|
|
/deep/ .ivu-table-wrapper {
|
|
|
overflow: visible;
|
|
|
} //穿透iview
|
|
|
+/deep/ .ivu-checkbox-disabled{
|
|
|
+ display: none!important;
|
|
|
+}
|
|
|
</style>
|