|
@@ -1,9 +1,21 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <Toptitle :title="$route.query.type == 1 ? '新增请购单' : '请购单详情'">
|
|
|
+ <div style="height:93%">
|
|
|
+ <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"
|
|
|
+ >审批/弃审</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2"
|
|
|
+ >打开</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2"
|
|
|
+ >关闭</Button
|
|
|
+ >
|
|
|
+ <Button type="primary" ghost style="margin-right: 10px"
|
|
|
+ >栏目设置</Button
|
|
|
+ >
|
|
|
<Button @click="goBack" type="primary" ghost style="margin-right: 10px"
|
|
|
- >返回</Button
|
|
|
+ >取消</Button
|
|
|
>
|
|
|
<Button
|
|
|
@click="postData"
|
|
@@ -11,33 +23,29 @@
|
|
|
v-show="!isCheck"
|
|
|
ghost
|
|
|
style="margin-right: 10px"
|
|
|
- >确定</Button
|
|
|
+ >保存</Button
|
|
|
>
|
|
|
</slot>
|
|
|
</Toptitle>
|
|
|
+
|
|
|
<div class="content_topform">
|
|
|
- <Form :label-width="90" :model="searchData">
|
|
|
- <FormItem label="项目名称:">
|
|
|
+ <Form :label-width="100" :model="searchData" :rules="ruleValidate">
|
|
|
+
|
|
|
+ <FormItem label="计划单号:">
|
|
|
<Input
|
|
|
type="text"
|
|
|
size="small"
|
|
|
v-show="!isCheck"
|
|
|
- v-model="searchData.residential_name"
|
|
|
+ disabled
|
|
|
style="width: 200px; margin-top: 6px"
|
|
|
- placeholder="项目名称"
|
|
|
+ placeholder="自动生成计划单号"
|
|
|
>
|
|
|
- <span
|
|
|
- slot="append"
|
|
|
- style="cursor: pointer"
|
|
|
- @click="showProjectModal = true"
|
|
|
- >选择</span
|
|
|
- >
|
|
|
</Input>
|
|
|
- <span v-show="isCheck">{{ searchData.residential_name }}</span>
|
|
|
+ <span v-show="isCheck">{{ $route.query.plan_no }}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="请购类型:">
|
|
|
+ <FormItem label="采购计划类型:" :label-width='120'>
|
|
|
<Select
|
|
|
- v-model="searchData.type_id"
|
|
|
+ v-model="searchData.plan_type"
|
|
|
size="small"
|
|
|
clearable
|
|
|
v-show="!isCheck"
|
|
@@ -56,11 +64,11 @@
|
|
|
<span
|
|
|
v-for="item in purchaseTypeList"
|
|
|
:key="item.id"
|
|
|
- v-show="item.id == searchData.type_id && isCheck"
|
|
|
+ v-show="item.id == searchData.plan_type && isCheck"
|
|
|
>{{ item.title }}</span
|
|
|
>
|
|
|
</FormItem>
|
|
|
- <FormItem label="单据号:">
|
|
|
+ <!-- <FormItem label="单据号:">
|
|
|
<Input
|
|
|
type="text"
|
|
|
size="small"
|
|
@@ -72,19 +80,19 @@
|
|
|
>
|
|
|
</Input>
|
|
|
<span v-show="isCheck">{{ searchData.purchase_order_apply_no }}</span>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="制单时间:">
|
|
|
+ </FormItem> -->
|
|
|
+ <FormItem label="单据日期:" :prop="!isCheck?'time':''" :label-width='120'>
|
|
|
<DatePicker
|
|
|
type="date"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
|
style="width: 200px"
|
|
|
placeholder="年/月/日"
|
|
|
- v-model="searchData.time"
|
|
|
+ v-model="searchData.order_time"
|
|
|
></DatePicker>
|
|
|
- <span v-show="isCheck">{{ func.replaceDate(searchData.time) }}</span>
|
|
|
+ <span v-show="isCheck">{{ searchData.order_time?func.replaceDate(searchData.order_time).split(' ')[0]:'' }}</span>
|
|
|
</FormItem>
|
|
|
- <FormItem label="备注">
|
|
|
+ <FormItem label="备注:">
|
|
|
<Input
|
|
|
type="textarea"
|
|
|
v-show="!isCheck"
|
|
@@ -100,48 +108,109 @@
|
|
|
</div>
|
|
|
<div class="content_table">
|
|
|
<div class="content_table_btn">
|
|
|
- <span>请购清单</span>
|
|
|
- <Button
|
|
|
+ <h4>计划清单</h4>
|
|
|
+ <!-- <Button
|
|
|
@click="showModal = true"
|
|
|
type="primary"
|
|
|
v-show="!isCheck"
|
|
|
size="small"
|
|
|
style="margin-left: 10px"
|
|
|
>选择物料</Button
|
|
|
- >
|
|
|
+ > -->
|
|
|
+ <Dropdown trigger="click" style="margin-left: 20px" @on-click='DropDownSort' v-if="$route.query.type!=2">
|
|
|
+ <a href="javascript:void(0)">
|
|
|
+ 批量修改
|
|
|
+ <Icon type="ios-arrow-down"></Icon>
|
|
|
+ </a>
|
|
|
+ <DropdownMenu slot="list" >
|
|
|
+ <DropdownItem :name='1'>项目信息</DropdownItem>
|
|
|
+ <DropdownItem :name='2'>数量</DropdownItem>
|
|
|
+ <DropdownItem :name='3'>预计到货时间</DropdownItem>
|
|
|
+ <DropdownItem :name='4'>建议供应商</DropdownItem>
|
|
|
+ </DropdownMenu>
|
|
|
+ </Dropdown>
|
|
|
</div>
|
|
|
- <Table :columns="tableColumns" border :data="tableData">
|
|
|
+ <Table :columns="tableColumns" border :data="tableData" :max-height='500' show-summary :summary-method="handleSummary">
|
|
|
<template slot="materiel_specs" slot-scope="{ row }">
|
|
|
-
|
|
|
- <div>
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
{{ row.long ? row.long : 0 }}*{{ row.width ? row.width : 0 }}*{{
|
|
|
row.high ? row.high : 0
|
|
|
}}
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template slot="materiel_sort" slot-scope="{ index }">
|
|
|
- <Input
|
|
|
+ <template slot="materiel_sort" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <!-- <Input
|
|
|
type="text"
|
|
|
v-show="!isCheck"
|
|
|
+
|
|
|
size="small"
|
|
|
v-model="tableData[index].type_title"
|
|
|
placeholder="数量"
|
|
|
>
|
|
|
- </Input>
|
|
|
- <span v-show="isCheck">{{ tableData[index].type_title }}</span>
|
|
|
+ </Input> -->
|
|
|
+ <span >{{ tableData[index].material_type }}</span></div>
|
|
|
</template>
|
|
|
- <template slot="materiel_name" slot-scope="{ index }">
|
|
|
- <Input
|
|
|
- type="text"
|
|
|
+ <template slot="material_title" slot-scope="{ index }">
|
|
|
+ <span
|
|
|
+
|
|
|
v-show="!isCheck"
|
|
|
- size="small"
|
|
|
- v-model="tableData[index].title"
|
|
|
- placeholder="数量"
|
|
|
+
|
|
|
+ style="cursor: pointer;color:#2d8cf0"
|
|
|
+ @click="showModal = true"
|
|
|
+
|
|
|
>
|
|
|
- </Input>
|
|
|
+ {{tableData[index].material_title}}
|
|
|
+ </span>
|
|
|
<span v-show="isCheck">{{ tableData[index].title }}</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"
|
|
|
+ filterable
|
|
|
+ label-in-value
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="sitem in demo"
|
|
|
+ :key="sitem.id"
|
|
|
+ :label="sitem.label"
|
|
|
+ :value="sitem.value"
|
|
|
+ >
|
|
|
+ </Option>
|
|
|
+ </Select></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
|
|
|
+ v-show="!isCheck"
|
|
|
+ filterable
|
|
|
+ label-in-value
|
|
|
+ >
|
|
|
+ <Option
|
|
|
+ v-for="sitem in demo"
|
|
|
+ :key="sitem.id"
|
|
|
+ :label="sitem.label"
|
|
|
+ :value="sitem.value"
|
|
|
+ >
|
|
|
+ </Option>
|
|
|
+ </Select></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)"
|
|
@@ -154,17 +223,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<Input
|
|
|
- type="text"
|
|
|
v-show="!isCheck"
|
|
|
+
|
|
|
size="small"
|
|
|
v-model="tableData[index].num"
|
|
|
placeholder="数量"
|
|
|
>
|
|
|
</Input>
|
|
|
+ <!-- @on-change="table_total_num_change" -->
|
|
|
<span v-show="isCheck">{{ tableData[index].num }}</span>
|
|
|
- </Tooltip>
|
|
|
+ </Tooltip></div>
|
|
|
</template>
|
|
|
- <template slot="arrive_timeSet" slot-scope="{ index }">
|
|
|
+ <template slot="arrive_timeSet" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
<DatePicker
|
|
|
type="date"
|
|
|
size="small"
|
|
@@ -174,10 +246,12 @@
|
|
|
v-model="tableData[index].time"
|
|
|
></DatePicker>
|
|
|
<span v-show="isCheck">{{
|
|
|
- func.replaceDate(tableData[index].time)
|
|
|
- }}</span>
|
|
|
+ tableData[index].time?func.replaceDate(tableData[index].time).split(' ')[0]:''
|
|
|
+ }}</span></div>
|
|
|
</template>
|
|
|
- <template slot="supply_idSet" slot-scope="{ index }">
|
|
|
+ <template slot="supply_idSet" slot-scope="{ row,index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
<Select
|
|
|
v-model="tableData[index].supply_id"
|
|
|
size="small"
|
|
@@ -199,18 +273,27 @@
|
|
|
v-for="item in suppliersList"
|
|
|
:key="item.id"
|
|
|
v-show="item.id == tableData[index].supply_id && isCheck"
|
|
|
- >{{ item.title }}</span>
|
|
|
+ >{{ item.title }}</span></div>
|
|
|
</template>
|
|
|
<template slot="setSlot" slot-scope="{ row, index }">
|
|
|
+ <span v-if="row.material_title == '选择物料'"></span>
|
|
|
+ <div v-else>
|
|
|
+ <a
|
|
|
+ style="margin: 0 5px"
|
|
|
+ :disabled="row.state == 0"
|
|
|
+ v-show="!isCheck"
|
|
|
+ @click="handleSet(2, row, index)"
|
|
|
+ >复制</a>
|
|
|
<a
|
|
|
style="margin: 0 5px"
|
|
|
:disabled="row.state == 0"
|
|
|
v-show="!isCheck"
|
|
|
@click="handleSet(1, row, index)"
|
|
|
- >删除</a>
|
|
|
+ >删除</a></div>
|
|
|
</template>
|
|
|
</Table>
|
|
|
</div>
|
|
|
+
|
|
|
<Modal
|
|
|
v-model="showModal"
|
|
|
title="选择物料"
|
|
@@ -349,6 +432,50 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
+ <Modal
|
|
|
+ :width='400'
|
|
|
+ v-model="showTotal"
|
|
|
+ @on-ok='total_sure'
|
|
|
+ :title="total_type==1?'批量修改项目信息':total_type==2?'批量修改数量':total_type==3?'批量修改预计到货时间':'批量修改建议供应商'" >
|
|
|
+ <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 in demo" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <span>项目名称 : </span>
|
|
|
+ <Select v-model="total_project_info.name" style="width:200px">
|
|
|
+ <Option v-for="item in demo" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ <div v-if="total_type==2">
|
|
|
+ <span>数量 : </span><Input v-model="total_num" style="width:50%"/>
|
|
|
+ </div>
|
|
|
+ <div v-if="total_type == 3">
|
|
|
+ <span>预计到货时间 : </span>
|
|
|
+ <DatePicker
|
|
|
+ type="date"
|
|
|
+ size="small"
|
|
|
+ transfer
|
|
|
+ v-show="!isCheck"
|
|
|
+ placeholder="年/月/日"
|
|
|
+ v-model="total_time"
|
|
|
+ ></DatePicker>
|
|
|
+ </div>
|
|
|
+ <div v-if='total_type==4'>
|
|
|
+ <span>批量修改建议的供应商 : </span>
|
|
|
+ <Select v-model="total_supplier" style="width:200px">
|
|
|
+ <Option v-for="item in suppliersList" :value="item.id" :key="item.id" :label="item.title"></Option>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -363,15 +490,38 @@ export default {
|
|
|
// import引入的组件需要注入到对象中才能使用
|
|
|
data() {
|
|
|
// 这里存放数据
|
|
|
+ let vm = this
|
|
|
return {
|
|
|
+ selectAll:false,
|
|
|
+ ruleValidate: {
|
|
|
+ time: [
|
|
|
+ { required: true,type: 'all', message: '单据日期不能为空',trigger: 'change'}
|
|
|
+ ],},
|
|
|
+ table_total_num:0,
|
|
|
+ tableDataAlways:{material_title:'选择物料',_disabled:true},
|
|
|
+ total_num:'',
|
|
|
+ showTotal:false,
|
|
|
+ total_supplier:'',
|
|
|
+ total_time:"",
|
|
|
+ demo:[{label:'1',value:'2'}],
|
|
|
+ total_project_info:{
|
|
|
+ code:'',
|
|
|
+ name:''
|
|
|
+ },
|
|
|
+ total_type:'',
|
|
|
searchData: {
|
|
|
- type_id: "",
|
|
|
- time: null,
|
|
|
+ plan_type: "",
|
|
|
+ order_time: null,
|
|
|
remark: "",
|
|
|
},
|
|
|
purchaseTypeList: [],
|
|
|
tableColumns: [
|
|
|
{
|
|
|
+ align:'center',
|
|
|
+ width:100,
|
|
|
+ type:'selection'
|
|
|
+ },
|
|
|
+ {
|
|
|
title: "物料分类",
|
|
|
key: "type_title",
|
|
|
align: "center",
|
|
@@ -383,7 +533,7 @@ export default {
|
|
|
key: "title",
|
|
|
align: "center",
|
|
|
minWidth: 140,
|
|
|
- slot: "materiel_name",
|
|
|
+ slot: "material_title",
|
|
|
},
|
|
|
{
|
|
|
title: "物料规格",
|
|
@@ -399,8 +549,10 @@ export default {
|
|
|
slot: "materiel_specs",
|
|
|
},
|
|
|
{ title: "计量单位", key: "unit", align: "center", minWidth: 100 },
|
|
|
+ { title: "项目编码", key: "project_code", align: "center", minWidth: 120,slot: "project_code", },
|
|
|
+ { title: "项目名称", key: "project_title", align: "center", minWidth: 120 ,slot: "project_title",},
|
|
|
{
|
|
|
- title: "请购数量",
|
|
|
+ title: "数量",
|
|
|
key: "num",
|
|
|
align: "center",
|
|
|
minWidth: 100,
|
|
@@ -425,7 +577,7 @@ export default {
|
|
|
title: "操作",
|
|
|
key: "code",
|
|
|
align: "center",
|
|
|
- minWidth: 80,
|
|
|
+ minWidth: 120,
|
|
|
slot: "setSlot",
|
|
|
},
|
|
|
],
|
|
@@ -597,7 +749,7 @@ export default {
|
|
|
this.suppliersList = res.data.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
|
|
@@ -608,29 +760,165 @@ export default {
|
|
|
});
|
|
|
this.initModal();
|
|
|
this.initProjectModal();
|
|
|
+
|
|
|
},
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
- if (this.$route.query.purchase_order_apply_no != "") {
|
|
|
+ if (this.$route.query.type != 1) {
|
|
|
this.initData();
|
|
|
}
|
|
|
+ if(this.$route.query.type!=2){
|
|
|
+ this.tableData.push(this.tableDataAlways);
|
|
|
+ }
|
|
|
+ if(this.$route.query.type == 2){
|
|
|
+ this.tableColumns.pop();
|
|
|
+ this.tableColumns.push({
|
|
|
+ title: "状态",
|
|
|
+ key: "model",
|
|
|
+ align: "center",
|
|
|
+ minWidth: 100,
|
|
|
+ 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)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
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,
|
|
|
- },
|
|
|
+ renderChecked(h,{column,index}){
|
|
|
+
|
|
|
+ return h("span",
|
|
|
+ [ h("Checkbox", {
|
|
|
+ on:{
|
|
|
+ 'on-change':(val)=>{
|
|
|
+ if(val){
|
|
|
+
|
|
|
+ this.tableData.map(v=>{
|
|
|
+ v.isSelect = true;
|
|
|
+ })
|
|
|
+ this.modalData.selectedData.forEach(m=>{
|
|
|
+ m.isSelect = true;
|
|
|
+ })
|
|
|
+ this.$forceUpdate();
|
|
|
+ console.log(this.tableData);
|
|
|
+ }else{
|
|
|
+ this.tableData.map(v=>{
|
|
|
+ v.isSelect = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ props:{
|
|
|
+ value:this.selectAll
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ h("span",'全选'),
|
|
|
+ ]
|
|
|
+
|
|
|
+ )
|
|
|
+
|
|
|
+ },
|
|
|
+ total_sure(){
|
|
|
+ //1项目信息;2数量;3预计到货时间;4建议供应商
|
|
|
+ switch(this.total_type){
|
|
|
+ case 1:
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.tableData.map((v,index)=>{
|
|
|
+ v.num = JSON.parse(JSON.stringify(this.total_num));
|
|
|
+ if(index==(this.tableData.length-1)){
|
|
|
+ v.num = 0;
|
|
|
+ }
|
|
|
+ // this.$set(this.tableData.num,index,this.total_num)
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
- this.warehouse= res.data
|
|
|
- });
|
|
|
+
|
|
|
+ // this.table_total_num = Number(this.total_num)*(this.tableData.length-1);
|
|
|
+ this.$forceUpdate();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ this.tableData.map((v,index)=>{
|
|
|
+ v.time = this.func.replaceDate(parseInt(new Date(this.total_time).getTime() / 1000)) || "";
|
|
|
+ v.arrive_time = v.time;
|
|
|
+ // this.tableData[index].time = this.total_time;
|
|
|
+ })
|
|
|
+ console.log(this.tableData);
|
|
|
+ this.$forceUpdate();
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ this.tableData.map(v=>{
|
|
|
+ v.supply_id = this.total_supplier;
|
|
|
+ })
|
|
|
+ break
|
|
|
}
|
|
|
+ },
|
|
|
+ // table_total_num_change(val){
|
|
|
+ // this.table_total_num = 0;
|
|
|
+ // this.tableData.map(v=>{
|
|
|
+ // if(v.material_title!=='选择物料'){
|
|
|
+ // this.table_total_num+=Number(v.num)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // console.log(this.table_total_num)
|
|
|
+ // this.$forceUpdate();
|
|
|
+ // },
|
|
|
+ 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') {
|
|
|
+ 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){
|
|
|
+ this.showTotal = true;
|
|
|
+ this.total_type = val;
|
|
|
+ console.log(val)
|
|
|
+ },
|
|
|
+ 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
|
|
|
},
|
|
@@ -639,17 +927,19 @@ export default {
|
|
|
method: "get",
|
|
|
url: "/api/purchase_apply_detail",
|
|
|
params: {
|
|
|
- purchase_order_apply_no: this.$route.query.purchase_order_apply_no,
|
|
|
+ plan_no: this.$route.query.plan_no,
|
|
|
},
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- this.tableData = res.data.list;
|
|
|
+ // this.tableData = [{material_title:'选择物料'}]
|
|
|
+ this.tableData.unshift(...res.data.children);
|
|
|
this.searchData = res.data;
|
|
|
this.searchData.time = this.func.replaceDate(res.data.crt_time);
|
|
|
this.tableData.forEach((element) => {
|
|
|
element.time = this.func.replaceDate(element.arrive_time);
|
|
|
element.warehouse_list = []
|
|
|
});
|
|
|
+ console.log(this.tableData);
|
|
|
// for (let key in this.tableData) {
|
|
|
// this.axios({
|
|
|
// method: "get",
|
|
@@ -686,7 +976,12 @@ export default {
|
|
|
.catch((err) => {});
|
|
|
},
|
|
|
handleSet(type, row, index) {
|
|
|
- this.tableData.splice(index, 1);
|
|
|
+ if(type == 1){
|
|
|
+ this.tableData.splice(index, 1);
|
|
|
+ }else{
|
|
|
+ this.tableData.splice(index,0,row)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
handleSelection(selection, row) {
|
|
|
this.modalData.selectedData.push(row);
|
|
@@ -701,6 +996,7 @@ export default {
|
|
|
handleSelectionAll(selection) {
|
|
|
this.modalData.selectedData =
|
|
|
this.modalData.selectedData.concat(selection);
|
|
|
+ console.log(this.modalData.selectedData);
|
|
|
},
|
|
|
handleSelectionAllCancel() {
|
|
|
this.modalData.tableData.forEach((element) => {
|
|
@@ -778,8 +1074,12 @@ export default {
|
|
|
handleSelect() {
|
|
|
this.modalData.selectedData.forEach((element) => {
|
|
|
element.material_id = element.m_id;
|
|
|
- element.type_title = element.m_title;
|
|
|
- // element.arrive_time = this.func.replaceDate(element.arrive_time)
|
|
|
+ element.material_type = element.m_title;
|
|
|
+ element.material_title = element.title;
|
|
|
+ element.isSelect = false;
|
|
|
+ element.project_code =null;
|
|
|
+ element.project_title=null;
|
|
|
+ element.arrive_time = this.func.replaceDate(element.arrive_time)
|
|
|
element.num = null;
|
|
|
// element.arrive_time = null
|
|
|
element.supply_id = null;
|
|
@@ -790,6 +1090,7 @@ export default {
|
|
|
0,
|
|
|
...this.modalData.selectedData
|
|
|
);
|
|
|
+ console.log(this.tableData)
|
|
|
// console.log('this.modalData.selectedData :>> ', this.modalData.selectedData);
|
|
|
},
|
|
|
handleProjectSelect() {
|
|
@@ -800,14 +1101,20 @@ export default {
|
|
|
this.$router.go(-1);
|
|
|
},
|
|
|
postData() {
|
|
|
- this.searchData.crt_time =
|
|
|
- parseInt(new Date(this.searchData.time).getTime() / 1000) || "";
|
|
|
+ let objData = [];
|
|
|
+ objData =JSON.parse(JSON.stringify(this.tableData));
|
|
|
+ objData.pop();
|
|
|
+ this.searchData.order_time =
|
|
|
+ parseInt(new Date(this.searchData.order_time).getTime() / 1000) || "";
|
|
|
+ objData.map(v=>{
|
|
|
+ v.arrive_time = parseInt(new Date(v.time).getTime() / 1000) || "";
|
|
|
+ })
|
|
|
this.tableData.forEach((element) => {
|
|
|
element.arrive_time =
|
|
|
parseInt(new Date(element.time).getTime() / 1000) || "";
|
|
|
});
|
|
|
let url;
|
|
|
- if (this.$route.query.purchase_order_apply_no == "") {
|
|
|
+ if (this.$route.query.type == 1) {
|
|
|
url = "/api/purchase_apply_add";
|
|
|
} else {
|
|
|
url = "/api/purchase_apply_edit";
|
|
@@ -817,12 +1124,15 @@ export default {
|
|
|
url,
|
|
|
data: {
|
|
|
...this.searchData,
|
|
|
- list: this.tableData,
|
|
|
+ children:{...objData}
|
|
|
},
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- this.$Message.success(res.msg);
|
|
|
+ if(res.code == 200){
|
|
|
+ this.$Message.success(res.msg);
|
|
|
this.goBack();
|
|
|
+ }
|
|
|
+
|
|
|
})
|
|
|
.catch((err) => {});
|
|
|
},
|
|
@@ -858,7 +1168,7 @@ export default {
|
|
|
.content_table {
|
|
|
.content_table_btn {
|
|
|
display: flex;
|
|
|
- justify-content: flex-start;
|
|
|
+ justify-content: space-between;
|
|
|
align-items: center;
|
|
|
padding-bottom: 20px;
|
|
|
}
|
|
@@ -913,4 +1223,7 @@ export default {
|
|
|
/deep/ .ivu-table-wrapper {
|
|
|
overflow: visible;
|
|
|
} //穿透iview
|
|
|
+/deep/ .ivu-checkbox-disabled{
|
|
|
+ display: none!important;
|
|
|
+}
|
|
|
</style>
|