|
|
@@ -1,33 +1,41 @@
|
|
|
<template>
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<j-form-container :disabled="formDisabled">
|
|
|
- <a-form-model ref="form" :model="model" layout="horizontal" :rules="validatorRules" slot="detail">
|
|
|
- <a-row :gutter="2" align="top" type="flex">
|
|
|
- <a-col :span="5" flex>
|
|
|
- <a-form-item label="" prop="depositoryList">
|
|
|
- <a-select v-model="model.depositoryId" style="width: 100%" placeholder="盘点仓库" :allowClear="true">
|
|
|
- <a-select-option v-for="(item, index) in depositoryList" :key="index" :value="item.id">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <!-- <a-col :span="5">
|
|
|
+ <a-form-model ref="form" :model="model" layout="inline" :rules="validatorRules" slot="detail">
|
|
|
+ <!-- <a-row :gutter="2" align="top" type="flex"> -->
|
|
|
+ <!-- <a-col :span="5" flex> -->
|
|
|
+ <a-form-item label="盘点仓库" prop="depositoryList">
|
|
|
+ <a-select :disabled="flag" v-model="model.depositoryId" style="width: 200px" placeholder="盘点仓库" :allowClear="true">
|
|
|
+ <a-select-option v-for="(item, index) in depositoryList" :key="index" :value="item.id">{{ item.name }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ <!-- </a-col> -->
|
|
|
+ <!-- <a-col :span="5" flex> -->
|
|
|
+ <a-form-item label="盘点单号" prop="depositoryList">
|
|
|
+ <a-input disabled v-model="model.code"></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="" prop="depositoryList">
|
|
|
+ <a-button :disabled="!model.depositoryId" @click="handleGoods" type="primary" icon="plus">添加商品</a-button>
|
|
|
+ </a-form-item>
|
|
|
+ <!-- </a-col> -->
|
|
|
+ <!-- <a-col :span="5">
|
|
|
<a-form-item label="" prop="supplierList">
|
|
|
<a-select v-model="model.supplierId" style="width: 100%" placeholder="供应商" :allowClear="true">
|
|
|
<a-select-option v-for="(item, index) in supplierList" :key="index" :value="item.id">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col> -->
|
|
|
- <!-- <a-col :span="5">
|
|
|
+ <!-- <a-col :span="5">
|
|
|
<a-form-item label="" prop="storageTypeList">
|
|
|
<a-select v-model="model.stockType" style="width: 100%" placeholder="入库类型" :allowClear="true">
|
|
|
<a-select-option v-for="(item, index) in storageTypeList" :key="index" :value="item.value">{{ item.title }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col> -->
|
|
|
- <a-col :span="6" style="margin-top:5px;">
|
|
|
- <a-button :disabled="!model.depositoryId" @click="handleGoods" type="primary" icon="plus">批量添加</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ <!-- <a-col :span="6"> -->
|
|
|
+
|
|
|
+ <!-- </a-col> -->
|
|
|
+ <!-- </a-row> -->
|
|
|
</a-form-model>
|
|
|
</j-form-container>
|
|
|
|
|
|
@@ -38,11 +46,11 @@
|
|
|
{{ record ? "启用" : "停用" }}
|
|
|
<!-- {{record}} -->
|
|
|
</span>
|
|
|
- <template slot="price" slot-scope="record">
|
|
|
+ <!-- <template slot="price" slot-scope="record">
|
|
|
<a-input-number :min="0" :placeholder="record.costPrice" v-model="record.costPrice"></a-input-number>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<template slot="num" slot-scope="record">
|
|
|
- <a-input-number :min="0" v-model="record.num"></a-input-number>
|
|
|
+ <a-input-number :disabled="flag" :min="0" :max="record.stockNum" v-model="record.num"></a-input-number>
|
|
|
</template>
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
<!-- <a @click="handleEdit(record)">修改</a>
|
|
|
@@ -50,7 +58,7 @@
|
|
|
<a @click="moreSet(record)">更多设置</a>
|
|
|
<a-divider type="vertical" /> -->
|
|
|
<a-popconfirm title="确定删除吗?" @confirm="() => deleteGoods(record.id)">
|
|
|
- <a>删除</a>
|
|
|
+ <a :disabled="flag">删除</a>
|
|
|
</a-popconfirm>
|
|
|
</span>
|
|
|
</a-table>
|
|
|
@@ -59,7 +67,7 @@
|
|
|
<a-row>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="备注" :label-col="labelCol">
|
|
|
- <a-textarea v-model="model.remarks" :rows="4" />
|
|
|
+ <a-textarea :disabled="flag" v-model="model.remarks" :rows="4" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
@@ -71,7 +79,8 @@
|
|
|
<script>
|
|
|
import {
|
|
|
httpAction,
|
|
|
- getAction
|
|
|
+ getAction,
|
|
|
+ postAction
|
|
|
} from "@/api/manage";
|
|
|
import {
|
|
|
validateDuplicateValue
|
|
|
@@ -94,10 +103,10 @@ export default {
|
|
|
required: false,
|
|
|
},
|
|
|
},
|
|
|
- watch:{
|
|
|
- "model.supplierId":function(newVal, oldVal){
|
|
|
- if (newVal!=oldVal) {
|
|
|
- this.dataSource = [];
|
|
|
+ watch: {
|
|
|
+ "model.supplierId": function (newVal, oldVal) {
|
|
|
+ if (newVal != oldVal) {
|
|
|
+ this.dataSource = [];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -114,15 +123,15 @@ export default {
|
|
|
status: 0,
|
|
|
num: 0,
|
|
|
// stockInfo: "",
|
|
|
- // stockType: 0,
|
|
|
+ stockType: 0,
|
|
|
// supplierId: "",
|
|
|
tenantId: "",
|
|
|
type: 3,
|
|
|
verifyAt: "",
|
|
|
verifyRemarks: "",
|
|
|
- verifyTime: ""
|
|
|
-
|
|
|
+ verifyTime: "",
|
|
|
},
|
|
|
+ flag: false,
|
|
|
labelCol: {
|
|
|
xs: {
|
|
|
span: 24,
|
|
|
@@ -156,6 +165,11 @@ export default {
|
|
|
},
|
|
|
// 表头
|
|
|
columns: [{
|
|
|
+ title: "商品条码",
|
|
|
+ align: "center",
|
|
|
+ dataIndex: "code",
|
|
|
+ },
|
|
|
+ {
|
|
|
title: "商品名称",
|
|
|
align: "center",
|
|
|
dataIndex: "name",
|
|
|
@@ -171,17 +185,17 @@ export default {
|
|
|
dataIndex: "spec",
|
|
|
},
|
|
|
{
|
|
|
- title: "成本价",
|
|
|
+ title: "库存数量",
|
|
|
align: "center",
|
|
|
- // dataIndex: "costPrice",
|
|
|
+ dataIndex: "stockNum",
|
|
|
scopedSlots: {
|
|
|
- customRender: "price"
|
|
|
+ customRender: "stockNum"
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- title: "出入库数量",
|
|
|
+ title: "实际库存",
|
|
|
align: "center",
|
|
|
- // dataIndex: "spec",
|
|
|
+ // dataIndex: "num",
|
|
|
scopedSlots: {
|
|
|
customRender: "num"
|
|
|
},
|
|
|
@@ -194,8 +208,6 @@ export default {
|
|
|
customRender: "action"
|
|
|
},
|
|
|
align: 'center',
|
|
|
- fixed: "right",
|
|
|
- width: 200,
|
|
|
}
|
|
|
],
|
|
|
url: {
|
|
|
@@ -261,27 +273,31 @@ export default {
|
|
|
console.log(this.dataSource);
|
|
|
},
|
|
|
add() {
|
|
|
- this.edit(this.modelDefault,1);
|
|
|
+ this.edit(this.modelDefault, 1);
|
|
|
},
|
|
|
- edit(record, type) {
|
|
|
- if (type) {
|
|
|
- return
|
|
|
- }
|
|
|
+ edit(record, type=false) {
|
|
|
+ console.log(type);
|
|
|
+ if (typeof type == 'boolean') {
|
|
|
+ this.flag = type
|
|
|
+ }
|
|
|
+ if (type===1) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.model = Object.assign({}, record);
|
|
|
this.model.stockType = this.model.stockType.toString()
|
|
|
console.log(this.model);
|
|
|
- getAction(`/kc/kcStockDetail/list?stockId=${this.model.code}`).then(res=>{
|
|
|
- console.log(res);
|
|
|
- if ( res.code==200 ) {
|
|
|
- this.dataSource = res.result.records
|
|
|
- this.dataSource.forEach(ele=>{
|
|
|
- ele.costPrice = ele.price
|
|
|
- })
|
|
|
- }
|
|
|
+ getAction(`/kc/kcStockDetail/list?stockId=${this.model.code}`).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.dataSource = res.result.records
|
|
|
+ this.dataSource.forEach(ele => {
|
|
|
+ ele.costPrice = ele.price
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
this.visible = true;
|
|
|
},
|
|
|
- submitForm() {
|
|
|
+ submitForm(flag) {
|
|
|
const that = this;
|
|
|
// 触发表单验证
|
|
|
|
|
|
@@ -299,15 +315,29 @@ export default {
|
|
|
}
|
|
|
this.model.stockDetailList = this.dataSource
|
|
|
this.model.stockDetailList.forEach(element => {
|
|
|
- element.supplierInGoodsId = element.supplierInGoodsId;
|
|
|
- element.price = element.costPrice;
|
|
|
+ if (!element.supplierInGoodsId) {
|
|
|
+ element.supplierInGoodsId = element.id;
|
|
|
+ }
|
|
|
+ // element.supplierInGoodsId = element.supplierInGoodsId;
|
|
|
+ element.price = 0;
|
|
|
element.num = Number(element.num);
|
|
|
});
|
|
|
httpAction(httpurl, this.model, method)
|
|
|
.then((res) => {
|
|
|
if (res.success) {
|
|
|
- that.$message.success(res.message);
|
|
|
that.$emit("ok");
|
|
|
+ that.$message.success(res.message);
|
|
|
+ if (flag) {
|
|
|
+ // this.model.status = 1
|
|
|
+ // postAction("/kc/kcStock/audit", this.model).then((res) => {
|
|
|
+ // if (res.success) {
|
|
|
+ // // this.loadData();
|
|
|
+ // that.$emit("ok");
|
|
|
+ // this.$message.success("审核成功");
|
|
|
+ // // this.examineVisible = false;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ }
|
|
|
} else {
|
|
|
that.$message.warning(res.message);
|
|
|
}
|