|
@@ -5,15 +5,21 @@
|
|
|
<Button @click="handleReference(5,1)"
|
|
|
type="primary"
|
|
|
ghost
|
|
|
- style="margin-right:10px;">参照采购单</Button>
|
|
|
+ style="margin-right:10px;"
|
|
|
+ v-show="!isCheck"
|
|
|
+ :disabled='$route.query.is_refer == 0?true:btn1_disable'>参照采购单</Button>
|
|
|
<Button @click="handleReference(6,2)"
|
|
|
type="primary"
|
|
|
ghost
|
|
|
- style="margin-right:10px;">参照到货单</Button>
|
|
|
+ style="margin-right:10px;"
|
|
|
+ v-show="!isCheck"
|
|
|
+ :disabled="$route.query.is_refer == 0?true:btn2_disable">参照到货单</Button>
|
|
|
<Button @click="handleReference(7,3)"
|
|
|
type="primary"
|
|
|
ghost
|
|
|
- style="margin-right:10px;">参照质检单</Button>
|
|
|
+ style="margin-right:10px;"
|
|
|
+ v-show="!isCheck"
|
|
|
+ :disabled="$route.query.is_refer == 0?true:btn3_disable">参照质检单</Button>
|
|
|
<Button @click="goBack"
|
|
|
type="primary"
|
|
|
ghost
|
|
@@ -21,6 +27,7 @@
|
|
|
<Button @click="postData"
|
|
|
type="primary"
|
|
|
ghost
|
|
|
+ v-show="!isCheck"
|
|
|
style="margin-right:10px;">确定</Button>
|
|
|
</slot>
|
|
|
</Toptitle>
|
|
@@ -30,24 +37,28 @@
|
|
|
<FormItem label="项目名称:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
- v-model="searchData.client_name"
|
|
|
+ v-model="searchData.residential_name"
|
|
|
+ v-show="!isCheck"
|
|
|
style="width: 200px;margin-top:6px"
|
|
|
placeholder="项目名称">
|
|
|
<span slot="append"
|
|
|
style="cursor:pointer;"
|
|
|
@click="showProjectModal=true">选择</span>
|
|
|
</Input>
|
|
|
+ <span v-show="isCheck">{{searchData.residential_name}}</span>
|
|
|
</FormItem>
|
|
|
<FormItem label="供应商名称:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
v-model="searchData.supply_title"
|
|
|
style="width: 200px;margin-top:6px"
|
|
|
+ v-show="!isCheck"
|
|
|
placeholder="供应商名称">
|
|
|
<span slot="append"
|
|
|
style="cursor:pointer;"
|
|
|
@click="showSupplierModal=true">选择</span>
|
|
|
</Input>
|
|
|
+ <span v-show="isCheck">{{searchData.supply_title}}</span>
|
|
|
</FormItem>
|
|
|
<FormItem label="仓库:">
|
|
|
<Select v-model="searchData.warehouse_id"
|
|
@@ -55,6 +66,7 @@
|
|
|
clearable
|
|
|
filterable
|
|
|
label-in-value
|
|
|
+ v-show="!isCheck"
|
|
|
style="width: 200px">
|
|
|
<Option v-for="(sitem) in warehouseList"
|
|
|
:key="sitem.id"
|
|
@@ -62,20 +74,24 @@
|
|
|
:value="sitem.id">
|
|
|
</Option>
|
|
|
</Select>
|
|
|
+ <span v-show="isCheck">{{searchData.warehouse_title}}</span>
|
|
|
</FormItem>
|
|
|
<FormItem label="单据号:">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
readonly
|
|
|
+ v-show="!isCheck"
|
|
|
v-model="searchData.order_in_no"
|
|
|
style="width: 200px"
|
|
|
placeholder="自动生成" />
|
|
|
+ <span v-show="isCheck">{{searchData.order_in_no}}</span>
|
|
|
</FormItem>
|
|
|
<FormItem label="入库类型:">
|
|
|
<Select v-model="searchData.type_id"
|
|
|
size="small"
|
|
|
clearable
|
|
|
filterable
|
|
|
+ v-show="!isCheck"
|
|
|
label-in-value
|
|
|
style="width: 200px">
|
|
|
<Option v-for="(sitem) in purchaseTypeList"
|
|
@@ -84,6 +100,7 @@
|
|
|
:value="sitem.id">
|
|
|
</Option>
|
|
|
</Select>
|
|
|
+ <span v-show="isCheck">{{searchData.type_id == 1 ?'采购入库':'库存入库'}}</span>
|
|
|
</FormItem>
|
|
|
<!-- <FormItem label="制单人:">
|
|
|
<Input type="text"
|
|
@@ -96,15 +113,19 @@
|
|
|
<DatePicker type="date"
|
|
|
size="small"
|
|
|
style="width: 200px"
|
|
|
+ v-show="!isCheck"
|
|
|
placeholder="年/月/日"
|
|
|
v-model="searchData.crt_time"></DatePicker>
|
|
|
+ <span v-show="isCheck">{{func.replaceDate(searchData.crt_time)}}</span>
|
|
|
</FormItem>
|
|
|
<FormItem label="备注:">
|
|
|
<Input type="textarea"
|
|
|
size="small"
|
|
|
v-model="searchData.remark"
|
|
|
+ v-show="!isCheck"
|
|
|
style="width: 200px"
|
|
|
placeholder="备注" />
|
|
|
+ <span v-show="isCheck">{{searchData.remark}}</span>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</div>
|
|
@@ -115,15 +136,41 @@
|
|
|
<Button @click="showModal=true"
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
- style="margin-left:10px;">选择物料</Button>
|
|
|
+ style="margin-left:10px;"
|
|
|
+ v-show="!isCheck"
|
|
|
+ :disabled="$route.query.is_refer == 1?true:btn_disable">选择物料</Button>
|
|
|
</div>
|
|
|
<div class="content_table_btn_right">
|
|
|
</div>
|
|
|
</div>
|
|
|
<Table :columns="tableColumns"
|
|
|
border
|
|
|
- :data="tableData">
|
|
|
-
|
|
|
+ :data="tableData"
|
|
|
+ show-summary :summary-method="handleSummary"
|
|
|
+ >
|
|
|
+ <template slot="numberSet" slot-scope="{row , index }">
|
|
|
+ <Tooltip
|
|
|
+ placement="left"
|
|
|
+ @on-popper-show="handleToolShow(index, row)"
|
|
|
+ >
|
|
|
+ <div slot="content">
|
|
|
+ <div>
|
|
|
+ <div v-for="(_item,_index) in warehouse" :key="_index">
|
|
|
+ {{_item.warehouse_title}}:{{_item.num}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Input
|
|
|
+ type="text"
|
|
|
+ v-show="!isCheck"
|
|
|
+ size="small"
|
|
|
+ v-model="tableData[index].num"
|
|
|
+ placeholder="数量"
|
|
|
+ >
|
|
|
+ </Input>
|
|
|
+ <span v-show="isCheck">{{ tableData[index].num }}</span>
|
|
|
+ </Tooltip>
|
|
|
+ </template>
|
|
|
<template slot="setSlot"
|
|
|
slot-scope="{row,index}">
|
|
|
<a style="margin:0 5px"
|
|
@@ -304,9 +351,14 @@ export default {
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
+ isCheck:false,
|
|
|
+ btn1_disable:false,
|
|
|
+ btn_disable:false,
|
|
|
+ btn2_disable:false,
|
|
|
+ btn3_disable:false,
|
|
|
fax_modify: '',
|
|
|
searchData: {
|
|
|
- client_name: ''
|
|
|
+ residential_name: ''
|
|
|
},
|
|
|
modalProjectData: {
|
|
|
title: '',
|
|
@@ -364,30 +416,30 @@ export default {
|
|
|
},
|
|
|
{ title: '计量单位', key: 'unit', align: 'center', minWidth: 100 },
|
|
|
{
|
|
|
- title: '入库数量', key: 'num', align: 'center', minWidth: 120,
|
|
|
- render: (h, params) => {
|
|
|
- const { row, index } = params
|
|
|
- const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
|
- return this.$route.query.type == 2 ? h('span', {}, currentRow.num)
|
|
|
- : h('Input', {
|
|
|
- props: {
|
|
|
- value: currentRow.num,
|
|
|
- type: 'text'
|
|
|
- },
|
|
|
- on: {
|
|
|
- 'on-change': (e) => {
|
|
|
- currentRow.num = e.target.value
|
|
|
- // currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
|
|
|
- // currentRow.no_tax_amount = (1 * currentRow.no_tax_price * currentRow.num).toFixed(2)
|
|
|
- // currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_amount).toFixed(2)
|
|
|
- this.tableData.splice(index, 1, currentRow);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ 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]))
|
|
|
+ // return this.$route.query.type == 2 ? h('span', {}, currentRow.num)
|
|
|
+ // : h('Input', {
|
|
|
+ // props: {
|
|
|
+ // value: currentRow.num,
|
|
|
+ // type: 'text'
|
|
|
+ // },
|
|
|
+ // on: {
|
|
|
+ // 'on-change': (e) => {
|
|
|
+ // currentRow.num = e.target.value
|
|
|
+ // // currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
|
|
|
+ // // currentRow.no_tax_amount = (1 * currentRow.no_tax_price * currentRow.num).toFixed(2)
|
|
|
+ // // currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_amount).toFixed(2)
|
|
|
+ // this.tableData.splice(index, 1, currentRow);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
},
|
|
|
{
|
|
|
- title: '入库价格', key: 'total_price', align: 'center', minWidth: 120,
|
|
|
+ title: '单价', key: 'total_price', align: 'center', minWidth: 120,
|
|
|
render: (h, params) => {
|
|
|
const { row, index } = params
|
|
|
const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
|
|
@@ -407,8 +459,20 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ title: "金额", key: "total", align: "center", minWidth: 100,
|
|
|
+ render: (h, params) => {
|
|
|
+ const { row, index } = params;
|
|
|
+ const currentRow = JSON.parse(
|
|
|
+ JSON.stringify(this.tableData[index])
|
|
|
+ );
|
|
|
+
|
|
|
+ return h("span", {},currentRow.total_price&¤tRow.num?currentRow.total_price*currentRow.num:0)
|
|
|
+ }
|
|
|
+ },
|
|
|
{ title: '操作', key: 'code', align: 'center', minWidth: 100, slot: 'setSlot' },
|
|
|
],
|
|
|
+ is_refer:'',
|
|
|
tableData: [],
|
|
|
showModal: false,
|
|
|
showProjectModal: false,
|
|
@@ -449,7 +513,7 @@ export default {
|
|
|
])
|
|
|
}
|
|
|
},
|
|
|
- { title: '项目名称', key: 'client_name', align: 'center', minWidth: 100 },
|
|
|
+ { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 100 },
|
|
|
{ title: '紧急程度', align: 'center', key: 'warning_state', minWidth: 80, slot: 'basicTypeSet', },
|
|
|
{
|
|
|
title: '创建时间', key: 'crt_time', align: 'center', minWidth: 110,
|
|
@@ -545,10 +609,14 @@ export default {
|
|
|
warehouseList: [],
|
|
|
purchaseTypeList: [],
|
|
|
warningList: [],
|
|
|
+ warehouse:'',
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created () {
|
|
|
+ this.$route.query.type == 2
|
|
|
+ ? (this.isCheck = true)
|
|
|
+ : (this.isCheck = false);
|
|
|
// 获取采购类型
|
|
|
this.axios({ method: 'get', url: '/api/basic_order_in_list', }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
|
|
|
// 获取基础物料类型
|
|
@@ -577,6 +645,79 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleToolShow(index, row) {
|
|
|
+ if (this.warehouse) {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.axios
|
|
|
+ .get("/api/warehouse_stock_number", {
|
|
|
+ params: {
|
|
|
+ material_id: row.material_id,
|
|
|
+ material_detail_id: row.material_detail_id,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.warehouse= res.data
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.warehouse.num = this.warehouseTotal[index].num;
|
|
|
+ // this.warehouse.warehouseName = this.warehouseTotal[index].warehouseName
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSummary ({ columns, data }) {
|
|
|
+ const sums = {};
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ const key = column.key;
|
|
|
+ if (index === 0) {
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: '总价'
|
|
|
+ };
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let val = data;
|
|
|
+ for(let i in val){
|
|
|
+ val[i].total = val[i].total_price*val[i].num;
|
|
|
+ }
|
|
|
+ const values = val.map(item => Number(item[key]));
|
|
|
+ if (index === 6) {
|
|
|
+ const v = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: v
|
|
|
+ };
|
|
|
+ }else if(index===4){
|
|
|
+ const v = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: v
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ sums[key] = {
|
|
|
+ key,
|
|
|
+ value: ''
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return sums;
|
|
|
+ },
|
|
|
initData (order_in_no) {
|
|
|
this.axios({
|
|
|
method: 'get',
|
|
@@ -587,6 +728,7 @@ export default {
|
|
|
const data = JSON.parse(JSON.stringify(res.data))
|
|
|
delete data.list
|
|
|
this.searchData = data
|
|
|
+ console.log(this.searchData)
|
|
|
}).catch((err) => { });
|
|
|
},
|
|
|
postData () {
|
|
@@ -606,7 +748,8 @@ export default {
|
|
|
url: '/api/warehouse_order_in_add',
|
|
|
data: {
|
|
|
...obj,
|
|
|
- list: this.tableData
|
|
|
+ list: this.tableData,
|
|
|
+ is_refer:this.is_refer
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
this.$Message.success(res.msg)
|
|
@@ -620,7 +763,8 @@ export default {
|
|
|
data: {
|
|
|
order_in_no: this.$route.query.order_in_no,
|
|
|
...obj,
|
|
|
- list: this.tableData
|
|
|
+ list: this.tableData,
|
|
|
+ is_refer:this.is_refer
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
this.$Message.success(res.msg)
|
|
@@ -635,6 +779,19 @@ export default {
|
|
|
title, refer_type,
|
|
|
then: (result, data) => {
|
|
|
this.tableData = [...this.tableData, ...result]
|
|
|
+ this.is_refer = 1
|
|
|
+ this.btn_disable = true
|
|
|
+ if(type === 5){
|
|
|
+ this.btn2_disable = true
|
|
|
+ this.btn3_disable = true
|
|
|
+ }
|
|
|
+ else if(type === 6){
|
|
|
+ this.btn1_disable = true
|
|
|
+ this.btn3_disable = true
|
|
|
+ }else{
|
|
|
+ this.btn1_disable = true
|
|
|
+ this.btn2_disable = true
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -647,6 +804,10 @@ export default {
|
|
|
element.type == 0
|
|
|
});
|
|
|
this.tableData = [...this.tableData, ...this.modalData.selectedData]
|
|
|
+ this.is_refer = 0
|
|
|
+ this.btn1_disable = true
|
|
|
+ this.btn2_disable = true
|
|
|
+ this.btn3_disable = true
|
|
|
},
|
|
|
handleTreeSlect (array, row) {
|
|
|
row.id && this.axios({
|
|
@@ -722,7 +883,7 @@ export default {
|
|
|
},
|
|
|
goBack () { this.$router.go(-1) },
|
|
|
handleProjectSelect () {
|
|
|
- this.searchData.client_name = this.currentChoose.client_name
|
|
|
+ this.searchData.residential_name = this.currentChoose.residential_name
|
|
|
this.searchData.order_no = this.currentChoose.order_no
|
|
|
},
|
|
|
handleSupplierSelect () {
|