|
@@ -1,13 +1,14 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-dialog title="选择轮胎" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
|
|
|
- :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
|
|
|
+ :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
|
|
|
<el-row :style="{ height: rowHeight }">
|
|
|
- <el-col :span="5" style="height: 100%;overflow-y: auto">
|
|
|
+ <el-col :span="5">
|
|
|
<div>
|
|
|
<el-scrollbar>
|
|
|
<basic-container>
|
|
|
- <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
|
|
|
+ <avue-tree style="height: 66vh;overflow-y: auto" :option="treeOption"
|
|
|
+ :data="treeDataGoods" @node-click="nodeClick" />
|
|
|
</basic-container>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -15,9 +16,9 @@
|
|
|
<el-col :span="19">
|
|
|
<basic-container>
|
|
|
<avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="crud"
|
|
|
- @refresh-change="refreshChange" @selection-change="selectionChange" @search-change="goodsSearch"
|
|
|
- :page.sync="page" @on-load="onLoadfun"
|
|
|
- @resetColumn="resetCrud" @saveColumn="saveCrud">
|
|
|
+ @refresh-change="refreshChange" @selection-change="selectionChange"
|
|
|
+ @search-change="goodsSearch" :page.sync="page" @on-load="onLoadfun" @resetColumn="resetCrud"
|
|
|
+ @saveColumn="saveCrud">
|
|
|
<template slot="menuLeft">
|
|
|
<el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
|
|
|
<el-tab-pane label="查询结果" name="searchList" />
|
|
@@ -25,32 +26,42 @@
|
|
|
</el-tabs>
|
|
|
</template>
|
|
|
<template slot="goodsNum" slot-scope="{row}">
|
|
|
- <el-input-number v-model="row.goodsNum" size="small" :controls="false" :precision="0"
|
|
|
- @change="amountChange($event,row)" style="width: 100%" />
|
|
|
+ <el-input-number v-if="whetherFinancing != 1" v-model="row.goodsNum" size="small"
|
|
|
+ :controls="false" @change="amountChange('goodsNum', row)" style="width: 100%" />
|
|
|
+ <span v-else>{{ row.goodsNum }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="sendNumFinancing" slot-scope="{row}">
|
|
|
+ <el-input-number v-model="row.sendNumFinancing" size="small" :controls="false"
|
|
|
+ @change="amountChange('sendNumFinancing', row)" style="width: 100%" />
|
|
|
+ </template>
|
|
|
+ <template slot="sendNumHave" slot-scope="{row}">
|
|
|
+ <el-input-number v-model="row.sendNumHave" size="small" :controls="false"
|
|
|
+ @change="amountChange('sendNumHave', row)" style="width: 100%" />
|
|
|
</template>
|
|
|
<template slot="dot" slot-scope="{row}">
|
|
|
<!--使用allow-create属性即可通过在输入框中输入文字来创建新的条目。注意此时filterable必须为真。-->
|
|
|
<!--本例还使用了default-first-option属性, 在该属性打开的情况下,按下回车就可以选中当前选项列表中的第一个选项,-->
|
|
|
<!--无需使用鼠标或键盘方向键进行定位。-->
|
|
|
<!--allow-create filterable default-first-option-->
|
|
|
- <el-select v-model="row.dot" filterable default-first-option @focus="picihaolistfun(row.id)"
|
|
|
- @change="picihaolistChangefun($event,row)">
|
|
|
+ <el-select v-model="row.dot" filterable default-first-option
|
|
|
+ @focus="picihaolistfun(row.id)" @change="picihaolistChangefun($event, row)">
|
|
|
<el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
|
|
|
- :value="item.dot"></el-option>
|
|
|
+ :value="item.dot"></el-option>
|
|
|
</el-select>
|
|
|
<!--<span v-else>{{ row.dot }}</span>-->
|
|
|
</template>
|
|
|
<template slot="price" slot-scope="{row}">
|
|
|
<el-input-number v-model="row.price" size="small" :controls="false"
|
|
|
- style="width: 100%" />
|
|
|
+ style="width: 100%" />
|
|
|
</template>
|
|
|
<template slot-scope="scope" slot="menu">
|
|
|
<el-button type="text" icon="el-icon-edit" size="small"
|
|
|
- @click.stop="importStagList(scope.row, scope.index)" v-if="activeNameTabs == 'searchList'"
|
|
|
- :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
|
|
|
+ @click.stop="importStagList(scope.row, scope.index)"
|
|
|
+ v-if="activeNameTabs == 'searchList'"
|
|
|
+ :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
|
|
|
</el-button>
|
|
|
<el-button type="text" icon="el-icon-delete" size="small"
|
|
|
- @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
|
|
|
+ @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
@@ -58,213 +69,236 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
|
|
|
- <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
|
|
|
+ <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="importGoods" v-if="commodityData !== true"
|
|
|
+ :loading="saveLoading">导入</el-button>
|
|
|
<!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
|
|
|
<!-- :disabled="tableData.length !== 1">导入</el-button>-->
|
|
|
- </span>
|
|
|
+ </span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import commodityxsho from './commodityxsho.json'
|
|
|
-import {goodsPageDB} from "@/api/tirePartsMall/salesManagement/saleOrder";
|
|
|
-import {dotList} from '@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder'
|
|
|
-import {getCorpTypes} from "@/api/tirePartsMall/basicData/commodityInformation";
|
|
|
-
|
|
|
- export default {
|
|
|
- props:{
|
|
|
- // dialogVisible:{
|
|
|
- // type:Boolean,
|
|
|
- // default:false
|
|
|
- // },
|
|
|
- form:{
|
|
|
- type:Object,
|
|
|
- default:{}
|
|
|
- },
|
|
|
+import { goodsPageDB } from "@/api/tirePartsMall/salesManagement/saleOrder";
|
|
|
+import { dotList } from '@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder'
|
|
|
+import { getCorpTypes } from "@/api/tirePartsMall/basicData/commodityInformation";
|
|
|
+import { isProcurement } from "@/api/basicData/configuration";
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ // dialogVisible:{
|
|
|
+ // type:Boolean,
|
|
|
+ // default:false
|
|
|
+ // },
|
|
|
+ form: {
|
|
|
+ type: Object,
|
|
|
+ default: {}
|
|
|
},
|
|
|
- data(){
|
|
|
- return {
|
|
|
- dialogVisible:false,
|
|
|
- // 弹窗高度
|
|
|
- rowHeight: '',
|
|
|
- // 左侧选择
|
|
|
- treeOption:{
|
|
|
- addBtn: false,
|
|
|
- menu: false,
|
|
|
- size: "small",
|
|
|
- props: {
|
|
|
- labelText: "标题",
|
|
|
- label: "title",
|
|
|
- value: "id",
|
|
|
- }
|
|
|
- },
|
|
|
- // 左侧数据
|
|
|
- treeDataGoods: [],
|
|
|
- // 表格需要的配置
|
|
|
- optionTwo: commodityxsho,
|
|
|
- loading: false,
|
|
|
- // 商品列表数据合计
|
|
|
- goodsListShow: [],
|
|
|
- page: {
|
|
|
- pageSize: 10,
|
|
|
- currentPage: 1,
|
|
|
- total: 0,
|
|
|
- pageSizes: [10, 50, 100, 300, 500]
|
|
|
- },
|
|
|
- // tabs切换
|
|
|
- activeNameTabs:'searchList',
|
|
|
- // 批次号请求到的数据
|
|
|
- picihaolist:[],
|
|
|
- // 商品列表暂存
|
|
|
- goodsListSave: [],
|
|
|
- saveLoading: false,
|
|
|
- commodityData: false,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ whetherFinancing: 0,
|
|
|
+ dialogVisible: false,
|
|
|
+ // 弹窗高度
|
|
|
+ rowHeight: '',
|
|
|
+ // 左侧选择
|
|
|
+ treeOption: {
|
|
|
+ addBtn: false,
|
|
|
+ menu: false,
|
|
|
+ size: "small",
|
|
|
+ props: {
|
|
|
+ labelText: "标题",
|
|
|
+ label: "title",
|
|
|
+ value: "id",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 左侧数据
|
|
|
+ treeDataGoods: [],
|
|
|
+ // 表格需要的配置
|
|
|
+ optionTwo: commodityxsho,
|
|
|
+ loading: false,
|
|
|
+ // 商品列表数据合计
|
|
|
+ goodsListShow: [],
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0,
|
|
|
+ pageSizes: [10, 50, 100, 300, 500]
|
|
|
+ },
|
|
|
+ // tabs切换
|
|
|
+ activeNameTabs: 'searchList',
|
|
|
+ // 批次号请求到的数据
|
|
|
+ picihaolist: [],
|
|
|
+ // 商品列表暂存
|
|
|
+ goodsListSave: [],
|
|
|
+ saveLoading: false,
|
|
|
+ commodityData: false,
|
|
|
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ isProcurement({ "param": "whether.financing" }).then(res => {
|
|
|
+ if (res.data.data == 1) {
|
|
|
+ this.whetherFinancing = res.data.data
|
|
|
+ this.findObject(this.optionTwo.column, "inventoryFinancing").hide = false
|
|
|
+ this.findObject(this.optionTwo.column, "inventoryFinancing").showColumn = true
|
|
|
+ this.findObject(this.optionTwo.column, "inventoryHave").hide = false
|
|
|
+ this.findObject(this.optionTwo.column, "inventoryHave").showColumn = true
|
|
|
+ this.findObject(this.optionTwo.column, "sendNumFinancing").hide = false
|
|
|
+ this.findObject(this.optionTwo.column, "sendNumFinancing").showColumn = true
|
|
|
+ this.findObject(this.optionTwo.column, "sendNumHave").hide = false
|
|
|
+ this.findObject(this.optionTwo.column, "sendNumHave").showColumn = true
|
|
|
}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ closeGoods() {
|
|
|
+ this.treeDataGoods = [];
|
|
|
+ this.treeDeptId = "";
|
|
|
+ this.activeNameTabs = "searchList";
|
|
|
},
|
|
|
- created() {
|
|
|
+ //导入页左商品类型查询
|
|
|
+ nodeClick(data) {
|
|
|
+ this.treeDeptId = data.id;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoadfun(this.page, { goodsTypeId: this.treeDeptId });
|
|
|
},
|
|
|
- methods:{
|
|
|
- closeGoods() {
|
|
|
- this.treeDataGoods = [];
|
|
|
- this.treeDeptId = "";
|
|
|
- this.activeNameTabs = "searchList";
|
|
|
- },
|
|
|
- //导入页左商品类型查询
|
|
|
- nodeClick(data) {
|
|
|
- this.treeDeptId = data.id;
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoadfun(this.page, {goodsTypeId:this.treeDeptId});
|
|
|
- },
|
|
|
- //刷新触发
|
|
|
- refreshChange() {
|
|
|
- this.treeDeptId = ''
|
|
|
- this.page.currentPage = 1;
|
|
|
- this.onLoadfun(this.page);
|
|
|
- },
|
|
|
- //选中触发
|
|
|
- selectionChange(list) {
|
|
|
- this.tableData = list
|
|
|
- },
|
|
|
- // 点击搜索触发
|
|
|
- goodsSearch(params, done) {
|
|
|
- params = {
|
|
|
- ...params,
|
|
|
- goodsTypeId:this.treeDeptId,
|
|
|
- artsVision: this.form.belongToCorpId
|
|
|
- }
|
|
|
-
|
|
|
- // params.specificationAndModel = params.cname
|
|
|
- // delete params.cname
|
|
|
- this.onLoadfun(this.page, params);
|
|
|
- done()
|
|
|
- },
|
|
|
- // 标签页切换
|
|
|
- tabHandle(data) {
|
|
|
- if (data.name == 'searchList') {
|
|
|
- this.goodsListShow = this.data;
|
|
|
- this.page.total = this.pageList.total
|
|
|
- } else if (data.name == 'importStaging') {
|
|
|
- this.goodsListShow = this.goodsListSave;
|
|
|
- this.page.total = 0
|
|
|
- }
|
|
|
- },
|
|
|
- //导入轮胎弹窗列表查询
|
|
|
- onLoadfun(page, params = {}) {
|
|
|
- this.loading = true;
|
|
|
- goodsPageDB({
|
|
|
- ...params,
|
|
|
- current: page.currentPage,
|
|
|
- size: page.pageSize,
|
|
|
- stock:this.form.storageId,
|
|
|
- enableOrNot:1,
|
|
|
- }).then(res=>{
|
|
|
- const data = res.data.data;
|
|
|
- this.page.total = data.total;
|
|
|
- this.goodsListShow = data.records;
|
|
|
+ //刷新触发
|
|
|
+ refreshChange() {
|
|
|
+ this.treeDeptId = ''
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.onLoadfun(this.page);
|
|
|
+ },
|
|
|
+ //选中触发
|
|
|
+ selectionChange(list) {
|
|
|
+ this.tableData = list
|
|
|
+ },
|
|
|
+ // 点击搜索触发
|
|
|
+ goodsSearch(params, done) {
|
|
|
+ params = {
|
|
|
+ ...params,
|
|
|
+ goodsTypeId: this.treeDeptId,
|
|
|
+ artsVision: this.form.belongToCorpId
|
|
|
+ }
|
|
|
|
|
|
- for(let item of this.goodsListShow) {
|
|
|
- item.goodsNum = item.goodsNum?item.goodsNum:0
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
+ // params.specificationAndModel = params.cname
|
|
|
+ // delete params.cname
|
|
|
+ this.onLoadfun(this.page, params);
|
|
|
+ done()
|
|
|
+ },
|
|
|
+ // 标签页切换
|
|
|
+ tabHandle(data) {
|
|
|
+ if (data.name == 'searchList') {
|
|
|
+ this.goodsListShow = this.data;
|
|
|
+ this.page.total = this.pageList.total
|
|
|
+ } else if (data.name == 'importStaging') {
|
|
|
+ this.goodsListShow = this.goodsListSave;
|
|
|
+ this.page.total = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //导入轮胎弹窗列表查询
|
|
|
+ onLoadfun(page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ goodsPageDB({
|
|
|
+ ...params,
|
|
|
+ current: page.currentPage,
|
|
|
+ size: page.pageSize,
|
|
|
+ stock: this.form.storageId,
|
|
|
+ enableOrNot: 1,
|
|
|
+ }).then(res => {
|
|
|
+ res.data.data.records.forEach(item=>{
|
|
|
+ item.goodsNum = 0
|
|
|
+ item.sendNumFinancing = 0
|
|
|
+ item.sendNumHave = 0
|
|
|
})
|
|
|
- },
|
|
|
- // 弹框的重置
|
|
|
- resetCrud(){
|
|
|
- this.$message.success("重置成功");
|
|
|
- },
|
|
|
- // 弹窗的保存
|
|
|
- saveCrud(){
|
|
|
- this.$message.success("保存成功");
|
|
|
- },
|
|
|
- // 商品信息价格计算
|
|
|
- amountChange(value,row) {
|
|
|
- if(row.goodsNum>row.inventory){
|
|
|
- this.$set(row,'goodsNum','0')
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.goodsListShow = data.records;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 弹框的重置
|
|
|
+ resetCrud() {
|
|
|
+ this.$message.success("重置成功");
|
|
|
+ },
|
|
|
+ // 弹窗的保存
|
|
|
+ saveCrud() {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ },
|
|
|
+ // 商品信息价格计算
|
|
|
+ amountChange(name, row) {
|
|
|
+ if (name == 'goodsNum') {
|
|
|
+ if (row.goodsNum > row.inventory) {
|
|
|
+ this.$set(row, 'goodsNum', null)
|
|
|
this.$message.error("数量不能大于库存");
|
|
|
}
|
|
|
- if (value > 0) {
|
|
|
- this.$refs.crud.toggleRowSelection(row,true);
|
|
|
- }else {
|
|
|
- this.$refs.crud.toggleRowSelection(row,false);
|
|
|
+ }
|
|
|
+ if (name == 'sendNumFinancing') {
|
|
|
+ if (row.sendNumFinancing > row.inventoryFinancing) {
|
|
|
+ this.$set(row, 'sendNumFinancing', null)
|
|
|
+ // row.sendNumFinancing = null
|
|
|
+ this.$message.error("融资数量不能大于融资库存");
|
|
|
}
|
|
|
- // 价格
|
|
|
- // if (!row.price) {
|
|
|
- // row.price = 0;
|
|
|
- // }
|
|
|
- },
|
|
|
- // 批次号
|
|
|
- picihaolistChangefun(value,row){
|
|
|
- for (let item of this.picihaolist) {
|
|
|
- if (item.dot == value) {
|
|
|
- this.$set(row,'inventory',item.balanceQuantity)
|
|
|
- }
|
|
|
+ this.$set(row, 'goodsNum', Number(row.sendNumFinancing) + Number(row.sendNumHave))
|
|
|
+ }
|
|
|
+ if (name == 'sendNumHave') {
|
|
|
+ if (row.sendNumHave > row.inventoryHave) {
|
|
|
+ this.$set(row, 'sendNumHave', null)
|
|
|
+ this.$message.error("自有数量不能大于自有库存");
|
|
|
}
|
|
|
- },
|
|
|
- // 批次号获取数据
|
|
|
- picihaolistfun(goodsId){
|
|
|
- dotList({
|
|
|
- storageId:this.form.storageId,
|
|
|
- goodsId: goodsId
|
|
|
- }).then(res=>{
|
|
|
- this.picihaolist = res.data.data
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取左侧筛选
|
|
|
- getAllWorkDicts(){
|
|
|
- getCorpTypes().then(res => {
|
|
|
- this.treeDataGoods = res.data.data;
|
|
|
- });
|
|
|
- },
|
|
|
- importStagList(row, index, type) {
|
|
|
- this.goodsListSave.push(row);
|
|
|
- },
|
|
|
- removeStagList(row, index, type) {
|
|
|
- this.goodsListSave.splice(row.$index, 1)
|
|
|
- },
|
|
|
- //确认导入触发
|
|
|
- async importGoods() {
|
|
|
- // this.surplusRouteQuantityOption.push({ storageQuantity: '0' });
|
|
|
- if (this.goodsListSave.length > 0) {
|
|
|
- // this.goodsListSaveHandle()
|
|
|
- console.log(this.goodsListSave,242)
|
|
|
- this.$emit('tableDataHandle',this.goodsListSave)
|
|
|
- } else {
|
|
|
- if (this.tableData.length > 0) {
|
|
|
- // this.tableDataHandle()
|
|
|
- console.log(this.tableData,246)
|
|
|
- this.$emit('tableDataHandle',this.tableData)
|
|
|
- }
|
|
|
+ this.$set(row, 'goodsNum', Number(row.sendNumFinancing) + Number(row.sendNumHave))
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 批次号
|
|
|
+ picihaolistChangefun(value, row) {
|
|
|
+ for (let item of this.picihaolist) {
|
|
|
+ if (item.dot == value) {
|
|
|
+ this.$set(row, 'inventory', item.balanceQuantity)
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 批次号获取数据
|
|
|
+ picihaolistfun(goodsId) {
|
|
|
+ dotList({
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ goodsId: goodsId
|
|
|
+ }).then(res => {
|
|
|
+ this.picihaolist = res.data.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取左侧筛选
|
|
|
+ getAllWorkDicts() {
|
|
|
+ getCorpTypes().then(res => {
|
|
|
+ this.treeDataGoods = res.data.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ importStagList(row, index, type) {
|
|
|
+ this.goodsListSave.push(row);
|
|
|
+ },
|
|
|
+ removeStagList(row, index, type) {
|
|
|
+ this.goodsListSave.splice(row.$index, 1)
|
|
|
+ },
|
|
|
+ //确认导入触发
|
|
|
+ async importGoods() {
|
|
|
+ // this.surplusRouteQuantityOption.push({ storageQuantity: '0' });
|
|
|
+ if (this.goodsListSave.length > 0) {
|
|
|
+ // this.goodsListSaveHandle()
|
|
|
+ console.log(this.goodsListSave, 242)
|
|
|
+ this.$emit('tableDataHandle', this.goodsListSave)
|
|
|
+ } else {
|
|
|
+ if (this.tableData.length > 0) {
|
|
|
+ // this.tableDataHandle()
|
|
|
+ console.log(this.tableData, 246)
|
|
|
+ this.$emit('tableDataHandle', this.tableData)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped></style>
|