|
@@ -1,7 +1,19 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <Toptitle :title="$route.query.type==1?'新增采购订单':$route.query.type==2?'查看采购单':'编辑采购单'">
|
|
|
+ <Toptitle :title="$route.query.type==1?'新增采购订单':$route.query.type==2?'查看采购订单':$route.query.type==3?'编辑采购订单':'复制采购订单'">
|
|
|
<slot name="titleButton">
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="examine"
|
|
|
+ >{{searchData.state==0?'审批':'弃审'}}</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="typeChange(1)"
|
|
|
+ >打开</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="typeChange(0)"
|
|
|
+ >关闭</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px"
|
|
|
+ >栏目设置</Button
|
|
|
+ >
|
|
|
<Button @click="handleReference(1)"
|
|
|
type="primary"
|
|
|
v-show="!isCheck"
|
|
@@ -19,10 +31,11 @@
|
|
|
style="margin-right:10px;">确定</Button>
|
|
|
</slot>
|
|
|
</Toptitle>
|
|
|
+ <div style="height:90%;overflow:auto">
|
|
|
<div class="content_topform">
|
|
|
<Form :label-width="120"
|
|
|
:model="searchData">
|
|
|
- <FormItem label="订单号:" :label-width='80'>
|
|
|
+ <FormItem label="订单号:" :label-width="$route.query.type!=2?80:NaN">
|
|
|
<Input type="text"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -31,7 +44,7 @@
|
|
|
style="width: 200px;margin-top:6px"
|
|
|
placeholder="自动生成订单号">
|
|
|
</Input>
|
|
|
- <span v-show="isCheck">{{searchData.order_no}}</span>
|
|
|
+ <span v-show="isCheck">{{order_no}}</span>
|
|
|
</FormItem>
|
|
|
<!-- <FormItem label="项目名称:">
|
|
|
<Input type="text"
|
|
@@ -59,7 +72,7 @@
|
|
|
</Input>
|
|
|
<span v-show="isCheck">{{searchData.supply_title}}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="采购订单类型:" style="margin-left:100px">
|
|
|
+ <FormItem label="采购订单类型:" :style="$route.query.type!=2?{marginLeft:'150px'}:{}">
|
|
|
<Select v-model="searchData.basics_purchase_id"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
@@ -111,7 +124,7 @@
|
|
|
v-model="searchData.order_time"></DatePicker>
|
|
|
<span v-show="isCheck">{{searchData.order_time?func.replaceDate(searchData.order_time).split(' ')[0]:''}}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="预计到货日期:" style="margin-left:30px">
|
|
|
+ <FormItem label="预计到货日期:" :style="$route.query.type!=2?{marginLeft:'30px'}:{}">
|
|
|
<DatePicker type="date"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
@@ -120,7 +133,19 @@
|
|
|
v-model="searchData.arrive_time"></DatePicker>
|
|
|
<span v-show="isCheck">{{searchData.arrive_time?func.replaceDate(searchData.arrive_time).split(' ')[0]:''}}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="备注:" :label-width='80'>
|
|
|
+ <FormItem label='制单人:' v-if="$route.query.type==2">
|
|
|
+ <span>{{searchData.user_name}}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label='审批人:' v-if="$route.query.type==2">
|
|
|
+ <span>{{searchData.check_name?searchData.check_name:''}}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label='审批状态:' v-if="$route.query.type==2">
|
|
|
+ <span>{{searchData.state==0?'未审批':'已审批'}}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label='订单创建时间:' v-if="$route.query.type==2">
|
|
|
+ <span>{{searchData.crt_time?func.replaceDate(searchData.crt_time):''}}</span>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="备注:" :label-width="$route.query.type!=2?80:NaN">
|
|
|
<Input type="textarea"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
@@ -141,7 +166,7 @@
|
|
|
size="small"
|
|
|
style="margin-left:10px;"
|
|
|
:disabled="$route.query.is_refer == 0?true:btn_disable">选择物料</Button> -->
|
|
|
- <div ><span>参照计划单号:</span><span v-for="(item,index) in plan_no" :key="index" style="margin-right:10px">{{item}}{{index+1==plan_no.length?'':','}}</span></div>
|
|
|
+ <div style="display:flex"><span style="width:100px">参照计划单号:</span><span v-if="$route.query.type!=1">{{searchData.plan_no}}</span><div v-else><span v-for="(item,index) in plan_no" :key="index" style="margin-right:10px">{{item}}{{index+1==plan_no.length?'':','}}</span></div></div>
|
|
|
</div>
|
|
|
<div class="content_table_btn_right"
|
|
|
v-show="!isCheck">
|
|
@@ -280,6 +305,7 @@
|
|
|
</template>
|
|
|
</Table>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
<Modal v-model="showModal"
|
|
|
title="选择物料"
|
|
|
width='80'
|
|
@@ -935,6 +961,7 @@ export default {
|
|
|
purchase_data:[],
|
|
|
purchase_tableData:[],
|
|
|
plan_no:[],
|
|
|
+ order_no:'',
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -969,11 +996,63 @@ export default {
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted () {
|
|
|
+ if(this.$route.query.type == 6){
|
|
|
+ this.order_no = '';
|
|
|
+ }else{
|
|
|
+ this.order_no = this.$route.query.order_no;
|
|
|
+ }
|
|
|
if (this.$route.query.order_no != '') {
|
|
|
this.initData(this.$route.query.order_no)
|
|
|
+ };
|
|
|
+ if(this.$route.query.type == 2){
|
|
|
+ this.tableColumns.pop();
|
|
|
+ this.tableColumns.push({
|
|
|
+ title: "状态",
|
|
|
+ key: "lock",
|
|
|
+ align: "center",
|
|
|
+ minWidth: 100,
|
|
|
+ render: (h, params) => {
|
|
|
+ const { row } = params
|
|
|
+ let text = row.lock==1?'打开':'关闭'
|
|
|
+ return h('span', {
|
|
|
+ }, text)
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ examine(){
|
|
|
+
|
|
|
+ let state='';
|
|
|
+
|
|
|
+ if(this.searchData.state == 0){
|
|
|
+ state = 1;
|
|
|
+ }else{
|
|
|
+ state = 0;
|
|
|
+ }
|
|
|
+ this.axios.get('/api/purchase_check',{params:{state,order_no:this.$route.query.order_no}}).then((res)=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.initData(this.$route.query.order_no)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ typeChange(val){
|
|
|
+ if(this.selectChoose.length==0){
|
|
|
+ return this.$Message.warning("请先选择物料")
|
|
|
+ }
|
|
|
+ let id=[];
|
|
|
+ this.selectChoose.forEach(v=>{
|
|
|
+ id.push(v.id);
|
|
|
+ })
|
|
|
+ let state = val;
|
|
|
+ this.axios.post('/api/purchase_switch',{id,state}).then((res)=>{
|
|
|
+ if(res.code==200){
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.initData(this.$route.query.order_no);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
selectChange(row,index){
|
|
|
if(!row.copy&&!row.edit){
|
|
|
this.tableData[index].change = true;
|
|
@@ -1144,11 +1223,14 @@ if(this.selectChoose.length == 0){
|
|
|
if(this.$route.query.type==2){
|
|
|
this.tableData = []
|
|
|
}
|
|
|
-
|
|
|
+ console.log(this.tableData);
|
|
|
this.tableData=res.data.list;
|
|
|
const data = JSON.parse(JSON.stringify(res.data))
|
|
|
delete data.list
|
|
|
this.searchData = data
|
|
|
+ if(this.$route.query.type==6){
|
|
|
+ this.searchData.order_no = '';
|
|
|
+ }
|
|
|
this.searchData.crt_time = this.func.replaceDate(this.searchData.crt_time)
|
|
|
this.searchData.arrive_time = this.func.replaceDate(this.searchData.arrive_time)
|
|
|
this.searchData.order_time = this.func.replaceDate(this.searchData.order_time)
|
|
@@ -1165,7 +1247,7 @@ if(this.selectChoose.length == 0){
|
|
|
element.total_price = (1 * element.price * element.num).toFixed(2)
|
|
|
element.tax_amount = (1 * element.total_price - 1 * element.no_tax_amount).toFixed(2)
|
|
|
});
|
|
|
- if(this.$route.query.type!==2){
|
|
|
+ if(this.$route.query.type!=2){
|
|
|
this.tableData.push({material_title:'选择物料',_disabled:true})
|
|
|
}
|
|
|
console.log(this.tableData)
|