<template>
|
<section>
|
<!--工具条-->
|
<SearchBar
|
:Params="Params"
|
:ButtonList="DlgList.ListButton"
|
:SearchInfo="DlgList.SearchInfo"
|
:SearchDisable="DlgList.SearchDisable"
|
@OnLoad="GetParams()"
|
@CallBack="CallBack"
|
></SearchBar>
|
|
<!--列表-->
|
<el-table
|
:data="DlgList.List"
|
highlight-current-row
|
@current-change="DlgListSelect"
|
v-loading="DlgList.Visible"
|
@selection-change="DlgListCheck"
|
@select="selsChangeOne"
|
style="width: 100%"
|
ref="multipleTable"
|
>
|
<el-table-column type="selection" width="50"></el-table-column>
|
<el-table-column type="index" width="80"></el-table-column>
|
<el-table-column
|
prop="ProductCode"
|
label="商品编号"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="ProductName"
|
label="商品名称"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="PuchaseOrderNo"
|
label="采购编号"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="QuoteOrderNo"
|
label="报价编号"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="StatusName"
|
label="状态"
|
width
|
sortable
|
></el-table-column>
|
<!-- <el-table-column prop="DepartmentName" label="部门名称" width sortable></el-table-column> -->
|
<el-table-column
|
prop="Quantity"
|
label="数量"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="CheckNum"
|
label="审批数"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="PurchaseNum"
|
label="采购数"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="StorageNum"
|
label="入库数"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Price"
|
label="单价"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Discount"
|
label="折扣"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Amount"
|
label="总价"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="CreateTime"
|
label="创建时间"
|
:formatter="Com.ElTableTime"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column label="操作" width="150">
|
<template scope="scope">
|
<el-button
|
size="small"
|
class="jbtn"
|
@click="Detail(scope.$index, scope.row)"
|
>入库</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<!--工具条-->
|
<el-col :span="24" class="toolbar">
|
<el-pagination
|
layout="prev, pager, next"
|
@current-change="DlgListChangePageIndex"
|
:page-size="DlgList.PageSize"
|
:total="DlgList.Total"
|
style="float: right"
|
></el-pagination>
|
</el-col>
|
|
<!--入库窗口-->
|
<el-dialog
|
:title="DlgDetail.Title"
|
width="80%"
|
:visible.sync="DlgDetail.Visible"
|
v-model="DlgDetail.Form"
|
:close-on-click-modal="false"
|
>
|
<el-form
|
v-if="DlgDetail.Form.ListDetail != null"
|
:model="DlgDetail.Form.ListDetail[0]"
|
label-width="80px"
|
:inline="true"
|
>
|
<!-- <el-form-item label="所属组织" prop="CompanyName">
|
<el-input :disabled="true" v-model="DlgDetail.Form.ListDetail[0].CompanyName"></el-input>
|
</el-form-item>-->
|
<el-form-item label="所属仓库" prop="WareHouseName">
|
<el-input
|
:disabled="true"
|
v-model="DlgDetail.Form.ListDetail[0].WareHouseName"
|
></el-input>
|
</el-form-item>
|
<!-- <el-form-item label="部门名称" prop="DepartmentName">
|
<el-input :disabled="true" v-model="DlgDetail.Form.ListDetail[0].DepartmentName"></el-input>
|
</el-form-item>-->
|
<el-form-item label="采购员" prop="EmployeeName">
|
<el-input
|
:disabled="true"
|
v-model="DlgDetail.Form.ListDetail[0].EmployeeName"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="供应商" prop="SupplierName">
|
<el-input
|
:disabled="true"
|
v-model="DlgDetail.Form.ListDetail[0].SupplierName"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="入库类型" prop="OutInType">
|
<el-select
|
v-model="DlgDetail.Form.ListDetail[0].OutInType"
|
placeholder="请选择入库类型"
|
style="width: 200px"
|
>
|
<el-option
|
v-for="item in typeList"
|
:key="item.value"
|
:label="item.name"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="入库时间" prop="InTime">
|
<el-date-picker
|
v-model="DlgDetail.Form.ListDetail[0].InTime"
|
type="datetime"
|
placeholder="请选择入库时间"
|
align="right"
|
style="width: 205px"
|
></el-date-picker>
|
</el-form-item>
|
<el-form-item label="备注" prop="InRemark">
|
<el-input v-model="DlgDetail.Form.ListDetail[0].InRemark"></el-input>
|
</el-form-item>
|
</el-form>
|
<el-table
|
:data="DlgDetail.Form.ListDetail"
|
highlight-current-row
|
v-loading="DlgList.Visible"
|
style="width: 100%"
|
>
|
<el-table-column type="index" width="50"></el-table-column>
|
<el-table-column
|
prop="ProductCode"
|
label="商品编号"
|
width="180"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="ProductName"
|
label="商品名称"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="ProductSpec"
|
label="商品规格"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="DepartmentName"
|
label="申请部门"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="PurchaseUnit"
|
label="单位"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Price"
|
label="单价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Amount"
|
label="总价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="CheckNum"
|
label="审核数"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="StorageNum"
|
label="入库数"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="StatusName"
|
label="状态"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Remark"
|
label="备注"
|
width
|
sortable
|
></el-table-column>
|
<el-table-column prop="inputNum" label="实收数" width="120" sortable>
|
<template scope="scope">
|
<el-input-number
|
v-model="scope.row.inputNum"
|
auto-complete="off"
|
size="mini"
|
:min="1"
|
controls-position="right"
|
style="width: 100px"
|
></el-input-number>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="LocationId"
|
label="所在库位"
|
width="170"
|
sortable
|
>
|
<template scope="scope">
|
<el-select
|
v-model="scope.row.LocationId"
|
filterable
|
placeholder="请选择所在库位"
|
style="width: 150px"
|
clearable
|
>
|
<el-option
|
v-for="item in Params.LocationModules"
|
:key="item.Id"
|
:value="item.Id"
|
:label="item.LocationName"
|
>
|
<span style="float: left">{{ item.LocationName }}</span>
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div slot="footer" class="dialog-footer">
|
<el-button
|
type="primary"
|
@click.native="DlgDetailSubmit"
|
:loading="DlgDetail.Loading"
|
>提交</el-button
|
>
|
<el-button @click.native="DlgDetail.Visible = false">取消</el-button>
|
</div>
|
</el-dialog>
|
</section>
|
</template>
|
<style scoped>
|
.jbtn {
|
background-color: #f90;
|
color: #f3f7fc;
|
border: 1px solid #f90;
|
}
|
.jbtn:hover {
|
background-color: #f90;
|
}
|
</style>
|
<script>
|
import Com from "@/com/global";
|
import {
|
WMPurchaseQuoteDetailGetList,
|
WMPurchaseQuoteDetailAdd,
|
WMPurchaseQuoteDetailEdit,
|
WMPurchaseQuoteDetailDelete,
|
WMPurchaseQuoteDetailGetParams,
|
WMPurchaseQuoteDetailEnter,
|
getWMProductLocationGet,
|
} from "../../../api/api";
|
import { GetButtonList } from "../../../promissionRouter";
|
import SearchBar from "./SearchBar";
|
|
export default {
|
components: { SearchBar },
|
data() {
|
return {
|
Com: Com,
|
//控件参数
|
Params: {
|
TypeId: [],
|
DepartmentId: [],
|
PurchaseUnit: [],
|
SysOrgId: [],
|
Status: [],
|
PayType: [],
|
SupplierId: [],
|
LocationModules: [],
|
},
|
//列表窗口
|
DlgList: {
|
Loading: false,
|
Total: 0,
|
PageSize: 20,
|
PageIndex: 1,
|
List: [],
|
CheckRows: [],
|
SelectRow: null,
|
SearchInfo: {
|
Status: 80, //采购中
|
Id: undefined,
|
ProductCode: undefined,
|
PurchaseCode: undefined,
|
QuoteCode: undefined,
|
StartTime: undefined,
|
EndTime: undefined,
|
},
|
SearchDisable: {
|
Status: false,
|
},
|
ListButton: [],
|
},
|
//自定义窗口
|
//详情窗口
|
DlgDetail: {
|
Visible: false,
|
Loading: false,
|
Form: {},
|
PickerOptions: {},
|
},
|
typeList: [{ name: "普通采购", value: 1 }],
|
};
|
},
|
methods: {
|
//获取列表
|
GetList() {
|
let DlgList = this.DlgList;
|
DlgList.Visible = true;
|
//NProgress.start();
|
let prms = Object.assign(
|
{ PageIndex: DlgList.PageIndex },
|
DlgList.SearchInfo
|
);
|
WMPurchaseQuoteDetailGetList(prms).then((res) => {
|
DlgList.Total = res.data.response.dataCount;
|
DlgList.PageSize = res.data.response.PageSize;
|
DlgList.List = res.data.response.data;
|
DlgList.Visible = false;
|
//NProgress.done();
|
});
|
},
|
//搜索工具条回调
|
CallBack(Button, SearchBar) {
|
this.DlgList.SearchInfo = Object.assign({}, SearchBar.SearchInfo);
|
this[Button.Func].apply(this, this.DlgList.SearchInfo);
|
},
|
DlgListChangePageIndex(PageIndex) {
|
this.DlgList.PageIndex = PageIndex;
|
this.GetList();
|
},
|
selsChangeOne(selection, row) {
|
this.DlgList.SelectRow = row;
|
this.$refs.multipleTable.toggleRowSelection(row); //选中当前选择
|
this.DlgListSelect(row);
|
},
|
DlgListSelect(Row) {
|
this.DlgList.SelectRow = Row;
|
this.$refs.multipleTable.toggleRowSelection(Row); //选中当前选择
|
},
|
//列表选中
|
DlgListCheck: function (Rows) {
|
this.DlgList.CheckRows = Rows;
|
},
|
//获取参数
|
GetParams(FnLast) {
|
var Com = this.Com;
|
for (var i in this.Params) {
|
var arr = this.Params[i];
|
if (arr && arr.length > 0) {
|
FnLast && FnLast();
|
return;
|
}
|
break;
|
}
|
WMPurchaseQuoteDetailGetParams({}).then((res) => {
|
if (Com.IsEmpty(res)) {
|
return;
|
}
|
if (!res.data.success) {
|
this.$message({
|
message: res.data.msg,
|
type: "error",
|
});
|
}
|
var info = res.data.response;
|
let tTypeId = [];
|
let tDepartmentId = [];
|
let tPurchaseUnit = [];
|
let tSysOrgId = [];
|
let tStatus = [];
|
let tPayType = [];
|
let tSupplierId = [];
|
for (var i = 0, c = info.dicDepartmentId.length; i < c; i++) {
|
var it = info.dicDepartmentId[i];
|
tDepartmentId.push({ Value: it.Id, Text: it.Name || "" });
|
}
|
for (var i = 0, c = info.dicTypeId.length; i < c; i++) {
|
var it = info.dicTypeId[i];
|
tTypeId.push({ Value: it.Key, Text: it.Value || "" });
|
}
|
for (var i = 0, c = info.dicPurchaseUnit.length; i < c; i++) {
|
var it = info.dicPurchaseUnit[i];
|
tPurchaseUnit.push({ Value: it.Id, Text: it.Unit || "" });
|
}
|
for (var i = 0, c = info.dicSysOrgId.length; i < c; i++) {
|
var it = info.dicSysOrgId[i];
|
tSysOrgId.push({ Value: it.Id, Text: it.ShortName || "" });
|
}
|
for (var i = 0, c = info.dicStatus.length; i < c; i++) {
|
var it = info.dicStatus[i];
|
tStatus.push({ Value: it.Key, Text: it.Value || "" });
|
}
|
for (var i = 0, c = info.dicPayType.length; i < c; i++) {
|
var it = info.dicPayType[i];
|
tPayType.push({ Value: it.Key, Text: it.Value || "" });
|
}
|
for (var i = 0, c = info.dicSupplierId.length; i < c; i++) {
|
var it = info.dicSupplierId[i];
|
tSupplierId.push({ Value: it.Id, Text: it.Name || "" });
|
}
|
this.Params.TypeId = tTypeId;
|
this.Params.DepartmentId = tDepartmentId;
|
this.Params.PurchaseUnit = tPurchaseUnit;
|
this.Params.SysOrgId = tSysOrgId;
|
this.Params.Status = tStatus;
|
this.Params.PayType = tPayType;
|
this.Params.SupplierId = tSupplierId;
|
FnLast && FnLast();
|
});
|
},
|
//编辑:Json选中行
|
DlgEditJsonSelect(row) {
|
this.DlgEdit.SelectRow = row;
|
},
|
//显示详细界面
|
Detail: function (index, row) {
|
let rows = this.DlgList.CheckRows;
|
|
if (!row) {
|
if (!rows || !rows.length) {
|
this.$message({
|
message: "至少选择一行数据!",
|
type: "error",
|
});
|
return;
|
}
|
var OrderNo = rows[0].QuoteOrderNo;
|
for (var i = 0; i < rows.length; i++) {
|
if (OrderNo != rows[i].QuoteOrderNo) {
|
this.$message({
|
message: "请选择同报价编号的数据进行入库!",
|
type: "error",
|
});
|
return;
|
}
|
}
|
} else {
|
rows = [];
|
rows[0] = row;
|
}
|
this.GetParams(() => {
|
var dlg = this.DlgDetail;
|
dlg.Form = {};
|
dlg.Form.ListDetail = rows;
|
for (var i = 0, c = rows.length; i < c; i++) {
|
let row = rows[i];
|
row.LocationId = this.Params.LocationModules[0].Id;
|
if (!row.Discount || row.Discount <= 0) {
|
row.Discount = 100;
|
}
|
}
|
dlg.Visible = true;
|
});
|
},
|
//详细:提交
|
DlgDetailSubmit: function () {
|
let dlg = this.DlgDetail;
|
dlg.Loading = true;
|
WMPurchaseQuoteDetailEnter(dlg.Form).then((res) => {
|
dlg.Loading = false;
|
if (this.Com.IsEmpty(res)) {
|
return;
|
}
|
if (res.data.msg) {
|
this.$message({
|
message: res.data.msg,
|
type: res.data.success ? "success" : "error",
|
});
|
}
|
if (!res.data.success) {
|
return;
|
}
|
|
dlg.Visible = false;
|
this.GetList();
|
});
|
},
|
},
|
mounted() {
|
this.GetList();
|
|
//库位下拉列表
|
getWMProductLocationGet().then((res) => {
|
this.Params.LocationModules = res.data.response.locationList;
|
});
|
|
let routers = window.localStorage.router
|
? JSON.parse(window.localStorage.router)
|
: [];
|
this.DlgList.ListButton = GetButtonList(this.$route.path, routers);
|
},
|
};
|
</script>
|
|
<style scoped>
|
</style>
|