|
<template>
|
<div ref="container" class="page-list-container">
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" :fixed-where="fixedWhere" @on-load-dropdown-after="onLoadDropdownAfter" @on-super-reset="onSuperReset">
|
<template slot="button-tool2-slot">
|
<el-select v-model="storage_Id" placeholder="请选择仓库" class="w-150" @change="onSelectChange">
|
<el-option v-for="(item, index) in storageList" :key="index" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
<el-select v-model="consignor_Id" placeholder="请选择货主" class="w-150" @change="onSelectChange">
|
<el-option v-for="(item, index) in consignorList" :key="index" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
<el-button type="primary" @click.native="inventoryting()">生成盘点单</el-button>
|
</template>
|
</yrt-data-list>
|
|
<el-dialog :visible.sync="dialogFormVisible" title="生成盘点数据" width="500px">
|
<el-form :model="form" :label-width="formLabelWidth">
|
<el-form-item label="仓库名称" class="no-margin">
|
{{ storageName }}
|
</el-form-item>
|
<el-form-item label="货主" class="margin-bottom-10">
|
{{ consignorName }}
|
</el-form-item>
|
<el-form-item label="盘点类型">
|
<el-select v-model="form.checkType" filterable clearable placeholder="请选择盘点类型" @change="currentSel">
|
<el-option v-for="item in checkTypeList" :key="item.id" :label="item.name" :value="item.name">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="是否盲盘">
|
<el-checkbox v-model="form.checked"></el-checkbox>
|
</el-form-item>
|
<el-form-item v-if="isdifference" label="差异天数" style="width:320px;">
|
<el-input v-model="form.input" :disabled="!isdifference" type="text" placeholder="请输天数"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormVisible=false">取 消</el-button>
|
<el-button type="primary" @click="confirmsubmit">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "storage-check-create-check",
|
components: {},
|
mixins: [baseLayout],
|
data() {
|
return {
|
id: "",
|
name: "",
|
isdifference: false, // 差异天数
|
checkTypeList: [], // 盘点类型
|
actionField: "",
|
dialogFormVisible: false,
|
|
storage_Id: null, // 选择仓库
|
consignor_Id: null, // 货主
|
storageName: null,
|
consignorName: null,
|
|
form: {
|
checkType: "常规盘",
|
input: "",
|
name: "",
|
region: "",
|
date1: "",
|
date2: "",
|
delivery: false,
|
type: [],
|
resource: "",
|
desc: "",
|
checked: false
|
},
|
formLabelWidth: "120px",
|
// 仓库下拉框数据列表
|
storageList: [],
|
// 货主下拉框数据列表
|
consignorList: [],
|
// 固定查询条件
|
fixedWhere: {}
|
};
|
},
|
computed: {},
|
created() {
|
this.loadCheckType();
|
},
|
activated() {
|
// SaaS模块权限
|
this.common.hasSaaSAuth("库存盘点", this.$refs.container);
|
},
|
methods: {
|
onLoadDropdownAfter(dropdownData) {
|
this.storageList = dropdownData["dropdown31"];
|
this.consignorList = dropdownData["dropdown797"];
|
},
|
currentSel(value) {
|
this.isdifference = false;
|
if (value === "动态盘") {
|
this.isdifference = true;
|
}
|
},
|
// 确定生成盘点单数据的
|
confirmsubmit() {
|
var storage_Id = this.storage_Id;
|
var consignor_Id = this.consignor_Id;
|
var where = this.getWhere();
|
var checkType = this.form.checkType;
|
var diffDate = this.form.input;
|
var ids = this.dataListSelections.map(item => item.productPosition_Id); // 选中ID
|
var isBlind = this.form.checked === true ? 1 : 0;
|
if (!diffDate) diffDate = 0;
|
if (!checkType) {
|
this.$message({
|
showClose: true,
|
message: "请输入盘点类型",
|
type: "error"
|
});
|
return;
|
}
|
if (checkType === "动态盘" && !diffDate) {
|
this.$message({
|
showClose: true,
|
message: "请输入差异天数",
|
type: "error"
|
});
|
return;
|
}
|
const url = "/api/storage/check/storageCheck";
|
let params = {
|
storage_Id: storage_Id,
|
consignor_Id: consignor_Id,
|
checkType: checkType,
|
diffDate: diffDate,
|
IsBlind: isBlind,
|
ids: ids,
|
idField: "productPosition_Id"
|
};
|
params = Object.assign(params, where);
|
const ref = this.dataList;
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
ref.loadData();
|
}
|
};
|
this.common.ajax(url, params, callback, ref);
|
|
this.dialogFormVisible = false;
|
},
|
getWhere() {
|
var storage_Id = this.storage_Id;
|
var consignor_Id = this.consignor_Id;
|
var _where = this.dataList.getAllWhere();
|
var fixedWhere = {};
|
if (storage_Id) {
|
fixedWhere.storage_Id = storage_Id;
|
}
|
if (consignor_Id) {
|
fixedWhere.consignor_Id = consignor_Id;
|
}
|
|
var where = {
|
fixedWhere: fixedWhere,
|
where: _where
|
};
|
|
return where;
|
},
|
loadCheckType() {
|
const url = "/api/storage/check/dropdown";
|
const params = {};
|
const callback = res => {
|
if (res.result) {
|
this.checkTypeList = res.data; // 盘点类型
|
}
|
};
|
this.common.ajax(url, params, callback);
|
},
|
// 校验并弹出输入页面
|
inventoryting() {
|
if (!this.storage_Id) {
|
this.$message.error("请选择仓库");
|
return;
|
}
|
if (!this.consignor_Id) {
|
this.$message.error("请选择货主");
|
return;
|
}
|
this.consignorName = this.consignorList.find(item => {
|
return item.consignor_Id === this.consignor_Id;
|
}).consignorName;
|
|
// 弹出框
|
this.dialogFormVisible = true;
|
},
|
// 改变仓库、货主
|
onSelectChange() {
|
var where = {};
|
if (this.storage_Id) {
|
this.storageName = this.storageList.find(item => {
|
return item.storage_Id === this.storage_Id;
|
}).storageName;
|
where.storage_Id = this.storage_Id;
|
}
|
if (this.consignor_Id) {
|
this.consignorName = this.consignorList.find(item => {
|
return item.consignor_Id === this.consignor_Id;
|
}).consignorName;
|
where.consignor_Id = this.consignor_Id;
|
}
|
this.fixedWhere = where;
|
this.$nextTick(() => {
|
this.dataList.loadData();
|
});
|
},
|
// 重置
|
onSuperReset() {
|
this.storage_Id = null;
|
this.consignor_Id = null;
|
}
|
}
|
};
|
</script>
|