This commit is contained in:
PQZ 2024-09-19 16:14:17 +08:00
commit 572ddb6269
13 changed files with 602 additions and 145 deletions

View File

@ -102,3 +102,11 @@ export function getCompanyList(){
method: 'get'
})
}
// 当前登录用户的门店信息
export function getNowCompany(){
return request({
url: "/base/company/now",
method: "get"
})
}

View File

@ -1 +1,21 @@
import request from '@/utils/request'
const preUrl = '/repair/st'
// 新增
export function createSt(data){
return request({
url: preUrl + "/create",
method: "post",
data
})
}
// 分页查
export function getStPage(params){
return request({
url: preUrl + "/page",
method: "get",
params
})
}

View File

@ -1 +1,12 @@
import request from '@/utils/request'
const preUrl = "/repair/sti"
// 调拨单子表 分页
export function getStiPage(params){
return request({
url: preUrl + "/page",
method: "get",
params
})
}

View File

@ -133,7 +133,8 @@ export default {
},
data() {
return {
tenantCode:"lighting",
tenantCode:"lighting", // TODO
// tenantCode:"lanan",
codeUrl: "",
//
captchaEnable: false,

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-select class="main-select-tree" clearable ref="selectTree" v-model="warehouseSelected">
<el-select class="main-select-tree" clearable ref="selectTree" v-model="warehouseSelected" @blur="$emit('input-blur', $event)">
<el-option v-for="warehouse in optionData(warehouseList)"
:key="warehouse.value"
:label="warehouse.label"

View File

@ -13,7 +13,7 @@
</el-date-picker>
</el-form-item>
<el-form-item v-if="soByType && !goodsYes" label="供应商" prop="supplierId">
<SupplierChoose v-model="queryParams.supplierId"/>
<SupplierChoose v-model="queryParams.supplier"/>
</el-form-item>
<el-form-item v-if="goodsYes" label="关键字" prop="soNo">
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、商品名称或编码"/>
@ -30,10 +30,10 @@
</el-select>
</el-form-item>
<el-form-item v-if="!soByType" label="领料人" prop="userId">
<StaffChoose v-model="queryParams.userId" @selected="getStaff"/>
<StaffChoose v-model="queryParams.user" @selected="getStaff"/>
</el-form-item>
<el-form-item :label="soByType ? '采购门店' : '领料门店'" prop="corpId">
<CorpChoose v-model="queryParams.corpId" @selected="getCompany"/>
<CorpChoose v-model="queryParams.corp" @selected="getCompany"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
@ -105,9 +105,9 @@
<el-table-column label="备注" align="center" prop="remark" width="180"/>
<el-table-column label="操作" fixed="right" width="180" align="center">
<template v-slot="scope">
<!-- <el-button size="mini" type="text" icon="el-icon-edit"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- <el-button size="mini" type="text" icon="el-icon-edit"-->
<!-- >修改-->
<!-- </el-button>-->
<el-button size="mini" type="text" icon="el-icon-close" @click="handleVoidSo(scope.row)"
>作废
</el-button>
@ -155,6 +155,17 @@ export default {
required: false
}
},
watch: {
'queryParams.supplier'(val) {
this.queryParams.supplierId = val ? val.id : null
},
'queryParams.corp'(val) {
this.queryParams.corpId = val ? val.id : null
},
'queryParams.user'(val) {
this.queryParams.userId = val ? val.id : null
}
},
data() {
return {
queryParams: {
@ -162,10 +173,13 @@ export default {
pageSize: 10,
searchTimeArray: [],
soNo: null,
supplier: null,
supplierId: null,
supplierName: null,
soStatus: null,
corp: null,
corpId: null,
user: null,
userId: null,
userName: null,
soType: this.soByType ? "01" : "02",
@ -217,6 +231,9 @@ export default {
//
resetQuery() {
this.resetForm('queryForm')
this.queryParams.supplier = null
this.queryParams.corp = null
this.queryParams.user = null
this.handleQuery()
},
//
@ -245,7 +262,8 @@ export default {
await voidSo(this.formData)
this.$modal.msgSuccess("作废成功")
await this.pageSo()
}catch{}
} catch {
}
}
}
}

View File

@ -5,8 +5,9 @@
:show-overflow-tooltip="true"
show-summary
:summary-method="getSummaries"
:key="randomKey"
@cell-dblclick="editData"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
>
<el-table-column label="序号" align="center">
<template scope="scope">
@ -17,45 +18,32 @@
<el-table-column label="规格" align="center" width="180" prop="model"/>
<el-table-column label="商品编码" align="center" width="180" prop="code"/>
<el-table-column label="仓库" align="center" width="150" prop="warehouse">
<template slot-scope="scope">
<WarehouseChoose v-if="scope.row[scope.column.property + 'isShow'] && soByType"
:ref="scope.column.property"
v-model="scope.row.warehouse"
@change="alterData(scope.row,scope.column)"
/>
<span v-else>{{ scope.row.warehouse }}</span>
</template>
<div class="item" slot-scope="scope">
<WarehouseChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.warehouse" />
<span class="item__txt">{{ scope.row.warehouse }}</span>
</div>
</el-table-column>
<el-table-column label="库存" align="center" width="150" prop="stock"/>
<el-table-column label="单位" align="center" width="150" prop="unit"/>
<el-table-column label="数量" align="center" width="150" prop="count">
<template slot-scope="scope">
<el-input v-if="scope.row[scope.column.property + 'isShow']"
:ref="scope.column.property"
v-model="scope.row.count"
@blur="alterData(scope.row,scope.column)"></el-input>
<span v-else>{{ scope.row.count }}</span>
</template>
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.count" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.count }}</span>
</div>
</el-table-column>
<el-table-column :label="soByType ? '上次进价' : '成本'" align="center" width="150" prop="price"/>
<el-table-column v-if="soByType" label="采购单价" align="center" width="150" prop="newPrice">
<template slot-scope="scope">
<el-input v-if="scope.row[scope.column.property + 'isShow'] && soByType"
:ref="scope.column.property"
v-model="scope.row.newPrice"
@blur="alterData(scope.row,scope.column)"></el-input>
<span v-else>{{ scope.row.newPrice }}</span>
</template>
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.newPrice" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.newPrice }}</span>
</div>
</el-table-column>
<el-table-column :label="soByType ? '采购金额' : '合计'" align="center" width="150" prop="totalPrice"/>
<el-table-column label="备注" align="center" width="180" prop="remark">
<template slot-scope="scope">
<el-input v-if="scope.row[scope.column.property + 'isShow']"
:ref="scope.column.property"
v-model="scope.row.remark"
@blur="alterData(scope.row,scope.column)"></el-input>
<span v-else>{{ scope.row.remark }}</span>
</template>
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.remark }}</span>
</div>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template v-slot="scope">
@ -90,7 +78,10 @@ export default {
loading: false,
list: [],
includeColumn: ['count', 'totalPrice'],
randomKey: Math.random(),
//
editProp: this.soByType ? ['warehouse', 'count', 'newPrice', 'remark'] : ['count', 'remark'],
// cell
clickCellMap: {}
}
},
watch: {
@ -107,7 +98,6 @@ export default {
this.list.push(newData)
}else {
this.list = []
this.refreshTable()
}
},
list: {
@ -146,27 +136,93 @@ export default {
});
return sums
},
editData(row, column) {
row[column.property + "isShow"] = true
//refreshTabletabletable
this.refreshTable()
// this.$nextTick(() => {
// this.$refs[column.property] && this.$refs[column.property].focus()
// })
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
alterData(row, column) {
row[column.property + "isShow"] = false
const data = this.list.find(item => item.id === row.id)
data.totalPrice = data.newPrice * data.count
this.refreshTable()
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
refreshTable() {
this.randomKey = Math.random()
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save (row) {
//
row.totalPrice = row.count * row.newPrice
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
}
}
}
</script>
<style scoped lang="scss">
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style>

View File

@ -13,16 +13,16 @@
</el-date-picker>
</el-form-item>
<el-form-item v-if="soByType" label="供应商" prop="supplierId">
<SupplierChoose v-model="queryParams.supplierId" />
<SupplierChoose v-model="queryParams.supplier" />
</el-form-item>
<el-form-item label="单据号" prop="soNo">
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、备注"/>
</el-form-item>
<el-form-item v-if="!soByType" label="领料人" prop="userId">
<StaffChoose v-model="queryParams.userId" @selected="getStaff"/>
<StaffChoose v-model="queryParams.user" @selected="getStaff"/>
</el-form-item>
<el-form-item :label="soByType ? '采购门店' : '领料门店'" prop="corpId">
<CorpChoose v-model="queryParams.corpId" />
<CorpChoose v-model="queryParams.corp" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
@ -81,6 +81,17 @@ export default {
required: true
},
},
watch:{
'queryParams.supplier'(val){
this.queryParams.supplierId = val ? val.id : null
},
'queryParams.corp'(val){
this.queryParams.corpId = val ? val.id : null
},
'queryParams.user'(val){
this.queryParams.userId = val ? val.id : null
}
},
data() {
return {
queryParams:{
@ -88,9 +99,12 @@ export default {
pageSize: 10,
searchTimeArray:[],
soNo: null,
supplier: null,
supplierId: null,
supplierName: null,
corp: null,
corpId: null,
user: null,
userId: null,
userName: null,
soType: this.soByType ? "01" : "02",
@ -130,6 +144,9 @@ export default {
//
handleResetQuery(){
this.resetForm('queryForm')
this.queryParams.supplier = null
this.queryParams.corp = null
this.queryParams.user = null
this.handleQuery()
}
}

View File

@ -19,7 +19,7 @@
<el-input v-model="queryParams.standard" style="width: 18rem" placeholder="请输入规格"/>
</el-form-item>
<el-form-item :label="soByType ? '采购门店' : '领料门店'" prop="corpId">
<CorpChoose v-model="queryParams.corpId" />
<CorpChoose v-model="queryParams.corp" />
</el-form-item>
<el-form-item v-if="soByType" label="所属库位" prop="warehouseId">
<WarehouseChoose v-model="queryParams.warehouseId" @selected="getWarehouse"/>
@ -81,6 +81,11 @@ export default {
required: true
},
},
watch:{
'queryParams.corp'(val){
this.queryParams.corpId = val ? val.id : null
}
},
data() {
return {
queryParams:{
@ -90,7 +95,8 @@ export default {
soNo: null,
corpId: null,
soiType: this.soByType ? "01" : "02",
warehouseId: null
warehouseId: null,
corp: null,
},
showSearch: true,
loading: false,
@ -124,6 +130,7 @@ export default {
//
handleResetQuery(){
this.resetForm('queryForm')
this.queryParams.corp = null
this.handleQuery()
}
}

View File

@ -13,20 +13,21 @@
<el-form-item :label="stByType ? '单据号' : '关键字'" prop="soNo">
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、备注"/>
</el-form-item>
<el-form-item label="调出门店" prop="corpId">
<CorpChoose />
<el-form-item label="调出门店" prop="outCorpId">
<CorpChoose v-model="queryParams.outCorp"/>
</el-form-item>
<el-form-item label="调入门店" prop="corpId">
<CorpChoose />
<el-form-item label="调入门店" prop="inCorpId">
<CorpChoose v-model="queryParams.inCorp"/>
</el-form-item>
<el-form-item label="审核状态" prop="">
<el-form-item label="审核状态" prop="stStatus">
<el-select v-model="queryParams.stStatus">
<el-option v-for="item in this.getDictDatas(DICT_TYPE.REPAIR_ST_STATUS)" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in this.getDictDatas(DICT_TYPE.REPAIR_ST_STATUS)" :key="item.value" :label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search">搜索</el-button>
<el-button icon="el-icon-refresh">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
@ -38,27 +39,27 @@
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="单号" align="center" prop="soNo" width="180" />
<el-table-column label="调出门店" align="center" prop="corpName" width="180" />
<el-table-column label="调入门店" align="center" prop="corpName" width="180" />
<el-table-column label="调拨数量" align="center" prop="itemCount" width="150" />
<el-table-column v-if="stByType" label="调拨成本" align="center" prop="itemCount" width="150" />
<el-table-column label="调拨总额" align="center" prop="itemCount" width="150" />
<el-table-column v-if="stByType" label="差额" align="center" prop="itemCount" width="150" />
<el-table-column v-if="stByType" label="本次优惠" align="center" prop="itemCount" width="150" />
<el-table-column v-if="stByType" label="本次收款" align="center" prop="itemCount" width="150" />
<el-table-column v-if="stByType" label="本次欠款" align="center" prop="itemCount" width="150" />
<el-table-column label="调拨日期" align="center" prop="itemCount" width="150" />
<el-table-column label="调拨人" align="center" prop="itemCount" width="150" />
<el-table-column v-if="!stByType" label="审核日期" align="center" prop="itemCount" width="150" />
<el-table-column label="状态" align="center" prop="itemCount" width="150" />
<el-table-column label="备注" align="center" prop="itemCount" width="180" />
<el-table-column v-if="!stByType" label="退回备注" align="center" prop="itemCount" width="180" />
<el-table-column label="单号" align="center" prop="stNo" width="200"/>
<el-table-column label="调出门店" align="center" prop="outCorpId" width="180"/>
<el-table-column label="调入门店" align="center" prop="inCorpId" width="180"/>
<el-table-column label="调拨数量" align="center" prop="itemCount" width="150"/>
<el-table-column v-if="stByType" label="调拨成本" align="center" prop="totalPrice" width="150"/>
<el-table-column label="调拨总额" align="center" prop="totalPrice" width="150"/>
<el-table-column v-if="stByType" label="差额" align="center" prop="itemCount" width="150"/>
<el-table-column v-if="stByType" label="本次优惠" align="center" prop="discountPrice" width="150"/>
<el-table-column v-if="stByType" label="本次收款" align="center" prop="thisCollection" width="150"/>
<el-table-column v-if="stByType" label="本次欠款" align="center" prop="thisDebt" width="150"/>
<el-table-column label="调拨日期" align="center" prop="stTime" width="150"/>
<el-table-column label="调拨人" align="center" prop="userName" width="150"/>
<el-table-column v-if="!stByType" label="审核日期" align="center" prop="itemCount" width="150"/>
<el-table-column label="状态" align="center" prop="stStatus" width="150"/>
<el-table-column label="备注" align="center" prop="remark" width="180"/>
<el-table-column v-if="!stByType" label="退回备注" align="center" prop="remark" width="180"/>
<el-table-column label="操作" fixed="right" width="180" align="center">
<template v-if="stByType" v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit"
>修改
</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-edit"-->
<!-- >修改-->
<!-- </el-button>-->
<el-button size="mini" type="text" icon="el-icon-close"
>作废
</el-button>
@ -73,28 +74,45 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
<pagination style="margin-bottom: 2rem" v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
/>
</div>
</template>
<script>
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
import {getStPage} from "@/api/repair/stockTransfer/stockTransfer";
export default {
name: "StIndex",
components: {CorpChoose},
props:{
stByType:{
props: {
stByType: {
type: Boolean,
defaultValue: true,
required: true
}
},
watch:{
'queryParams.outCorp'(val){
this.queryParams.outCorpId = val ? val.id : null
},
'queryParams.inCorp'(val){
this.queryParams.inCorpId = val ? val.id : null
}
},
data() {
return {
queryParams:{
stStatus: null
queryParams: {
pageNo: 1,
pageSize: 10,
stStatus: null,
outCorp: null,
outCorpId: null,
inCorp:null,
inCorpId: null,
searchTimeArray: [],
stNo: null,
},
showSearch: true,
loading: false,
@ -102,7 +120,26 @@ export default {
total: 0
}
},
methods: {}
mounted() {
this.getList()
},
methods: {
async getList() {
const res = await getStPage(this.queryParams)
this.list = res.data.records
this.total = res.data.total
},
handleQuery() {
this.queryParams.pageNo = 1
this.getList()
},
handleReset() {
this.resetForm('queryForm')
this.queryParams.outCorp = null
this.queryParams.inCorp = null
this.handleQuery()
}
}
}
</script>

View File

@ -3,15 +3,15 @@
<el-form :model="formData" size="small" :inline="true" label-width="80px">
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="调出门店">
<CorpChoose/>
<el-form-item label="调出门店" prop="oldCorp">
<CorpChoose v-model="formData.oldCorp"/>
</el-form-item>
<el-form-item label="调入门店">
<CorpChoose/>
<el-form-item label="调入门店" prop="newCorp">
<CorpChoose v-model="formData.newCorp"/>
</el-form-item>
<el-form-item label="日期">
<el-form-item label="日期" prop="stTime">
<el-date-picker
v-model="formData"
v-model="formData.stTime"
type="date"
placeholder="选择日期">
</el-date-picker>
@ -19,43 +19,43 @@
<el-form-item label="单据编号" prop="stNo">
<el-input disabled v-model="formData.stNo" style="width: 20rem"/>
</el-form-item>
<el-form-item label="调拨人">
<StaffChoose @selected="getStaff"/>
<el-form-item label="调拨人" prop="user">
<StaffChoose v-model="formData.user"/>
</el-form-item>
<el-form-item label="选择商品">
<el-form-item label="选择商品" prop="goodsList">
<PartChoose @selected="getPart"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<StTable :part-list="partList" @deleteItem="deleteItem"/>
<StTable @tableData="tableData" :part-list="partList" @deleteItem="deleteItem"/>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-top: 1rem">
<el-col :span="24">
<el-form-item label="应收金额">
<el-input v-model="formData"/>
<el-form-item label="应收金额" prop="totalPrice">
<el-input disabled v-model="formData.totalPrice"/>
</el-form-item>
<el-form-item label="优惠金额">
<el-input v-model="formData"/>
<el-form-item label="优惠金额" prop="discountPrice">
<el-input v-model="formData.discountPrice" @blur="handleDiscountPriceChange"/>
</el-form-item>
<el-form-item label="本次收款">
<el-input v-model="formData"/>
<el-form-item label="本次收款" prop="thisCollection">
<el-input v-model="formData.thisCollection" @blur="handleThisCollection"/>
</el-form-item>
<el-form-item label="本次欠款">
<el-input v-model="formData"/>
<el-form-item label="本次欠款" prop="thisDebt">
<el-input disabled v-model="formData.thisDebt"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="备注">
<el-input style="width: 45rem"/>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" style="width: 45rem"/>
</el-form-item>
</el-col>
<el-col :span="12" style="text-align: right">
<el-button type="danger">结算</el-button>
<el-button type="danger" @click="handleSubmit">结算</el-button>
</el-col>
</el-row>
</el-form>
@ -68,6 +68,8 @@ import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
import PartChoose from "@/views/repair/Components/PartChoose.vue";
import StTable from "@/views/repair/stockTransfer/Components/StTable.vue";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {getNowCompany} from "@/api/base/company";
import {createSt} from "@/api/repair/stockTransfer/stockTransfer";
export default {
name: "StInfo",
@ -81,20 +83,35 @@ export default {
return {
formData: {
stNo: null,
newCorp: null,
oldCorp: null,
stTime: Date.now(),
user: null,
goodsList: [],
totalPrice: 0,
discountPrice: 0,
thisCollection: 0,
thisDebt: 0,
remark: null,
itemCount: 0,
stStatus: "01"
},
partList: []
}
},
mounted() {
this.formData.stNo = createUniqueCodeByHead("DB")
this.init()
},
methods: {
//
getStaff(data) {
// TODO init
async companyInit() {
try {
const res = await getNowCompany()
} catch {
}
},
//
async getPart(data){
async getPart(data) {
const flag = this.partList.find(item => item.id === data.id)
if (flag) {
try {
@ -107,8 +124,80 @@ export default {
}
},
//
deleteItem(index){
deleteItem(index) {
this.partList.splice(index, 1)
},
//
tableData(data) {
const tempPrice = data.reduce((x, y) => {
return x + y.totalPrice
}, 0)
const itemCount = data.reduce((x, y) => {
return x + y.goodsCount
}, 0)
this.formData.totalPrice = tempPrice
this.formData.thisDebt = tempPrice
this.formData.itemCount = itemCount
this.formData.goodsList = data.map(item => {
return {
...item,
goodsId: item.id,
goodsCount: item.goodsCount,
goodsPrice: item.goodsPrice,
remark: item.remark
}
})
},
//
handleDiscountPriceChange() {
this.formData.thisDebt -= this.formData.discountPrice
},
//
handleThisCollection() {
this.formData.thisDebt -= this.formData.thisCollection
},
//
async handleSubmit() {
try {
this.createInit()
await createSt(this.formData)
this.$modal.msgSuccess("新增成功")
this.init()
} catch {
}
},
//
createInit() {
const data = this.formData
this.formData = {
...data,
outCorpId: data.oldCorp.id,
inCorpId: data.newCorp.id,
userId: data.user.id,
userName: data.user.name,
}
},
//
init(){
// TODO
this.companyInit()
this.formData = {
stNo: null,
newCorp: null,
oldCorp: null,
stTime: Date.now(),
user: null,
goodsList: [],
totalPrice: 0,
discountPrice: 0,
thisCollection: 0,
thisDebt: 0,
remark: null,
itemCount: 0,
stStatus: "01"
}
this.formData.stNo = createUniqueCodeByHead("DB")
this.partList = []
}
}
}

View File

@ -1,20 +1,42 @@
<template>
<el-table v-loading="loading" :data="partList" :stripe="true" :show-overflow-tooltip="true">
<el-table v-loading="loading"
:data="list" :stripe="true"
:show-overflow-tooltip="true" show-summary
:summary-method="getSummaries"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
>
<el-table-column label="序号" align="center">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" prop="name" width="200"/>
<el-table-column label="规格" align="center" width="180"/>
<el-table-column label="单位" align="center" width="150"/>
<el-table-column label="原库位" align="center" width="150"/>
<el-table-column label="账上数量" align="center" width="150"/>
<el-table-column label="调拨数量" align="center" width="150"/>
<el-table-column label="参考成本" align="center" width="150"/>
<el-table-column label="结算单价" align="center" width="150"/>
<el-table-column label="结算金额" align="center" width="150"/>
<el-table-column label="备注" align="center" width="180"/>
<el-table-column label="规格" align="center" width="180" prop="model"/>
<el-table-column label="单位" align="center" width="150" prop="unit"/>
<el-table-column label="原库位" align="center" width="150" prop="warehouse"/>
<el-table-column label="账上数量" align="center" width="150" prop="stock"/>
<el-table-column label="调拨数量" align="center" width="150" prop="goodsCount">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.goodsCount" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.goodsCount }}</span>
</div>
</el-table-column>
<el-table-column label="参考成本" align="center" width="150" prop="price"/>
<el-table-column label="结算单价" align="center" width="150" prop="goodsPrice">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.goodsPrice" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.goodsPrice }}</span>
</div>
</el-table-column>
<el-table-column label="结算金额" align="center" width="150" prop="totalPrice"/>
<el-table-column label="备注" align="center" width="180" prop="remark">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark" placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.remark }}</span>
</div>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(scope.$index)"
@ -28,8 +50,8 @@
<script>
export default {
name: "StTable",
props:{
partList:{
props: {
partList: {
type: Array,
defaultValue: false,
required: true
@ -39,17 +61,152 @@ export default {
return {
loading: false,
list: [],
//
includeColumn: ['goodsCount', 'totalPrice'],
//
editProp: ['goodsCount', 'goodsPrice', 'remark'],
// cell
clickCellMap: {}
}
},
watch: {
partList(val) {
if (val && val.length > 0) {
const data = val[val.length - 1]
const newData = {
...data,
goodsCount: 1,
totalPrice: data.price * 1,
remark: '',
goodsPrice: data.price,
}
this.list.push(newData)
} else {
this.list = []
}
},
list: {
handler(val) {
this.$emit("tableData", val)
},
deep: true
},
},
methods: {
//
deleteItem(index){
deleteItem(index) {
this.$emit("deleteItem", index)
},
getSummaries(param) {
const {columns, data} = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (this.includeColumn.includes(column.property)) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums
},
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save (row) {
//
row.totalPrice = row.goodsCount * row.goodsPrice
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
}
}
}
</script>
<style scoped lang="scss">
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style>

View File

@ -13,15 +13,15 @@
<el-form-item label="关键字" prop="soNo">
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、商品名称或编码"/>
</el-form-item>
<el-form-item label="调出门店" prop="corpId">
<CorpChoose />
<el-form-item label="调出门店" prop="outCorpId">
<CorpChoose v-model="queryParams.outCorp" />
</el-form-item>
<el-form-item label="调入门店" prop="corpId">
<CorpChoose />
<el-form-item label="调入门店" prop="inCorpId">
<CorpChoose v-model="queryParams.inCorp"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search">搜索</el-button>
<el-button icon="el-icon-refresh">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
@ -38,8 +38,8 @@
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="单号" align="center" prop="soNo" width="180" />
<el-table-column label="商品名称" align="center" prop="soNo" width="180" />
<el-table-column label="单号" align="center" prop="stId" width="180" />
<el-table-column label="商品名称" align="center" prop="goodsId" width="180" />
<el-table-column label="规格" align="center" prop="soNo" width="180" />
<el-table-column label="商品编码" align="center" prop="soNo" width="180" />
<el-table-column v-if="!stByType" label="条形码" align="center" prop="soNo" width="180" />
@ -54,7 +54,7 @@
<el-table-column label="调入门店" align="center" prop="itemCount" width="180" />
<el-table-column label="调入仓库" align="center" prop="itemCount" width="180" />
<el-table-column label="调拨时间" align="center" prop="itemCount" width="180" />
<el-table-column label="备注" align="center" prop="itemCount" width="180" />
<el-table-column label="备注" align="center" prop="remark" width="180" />
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
/>
@ -62,6 +62,7 @@
</template>
<script>
import {getStiPage} from "@/api/repair/stockTransfer/stockTransferItem";
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
export default {
@ -74,16 +75,51 @@ export default {
required: true
}
},
watch:{
'queryParams.outCorp'(val){
this.queryParams.outCorpId = val ? val.id : null
},
'queryParams.inCorp'(val){
this.queryParams.inCorpId = val ? val.id : null
}
},
data() {
return {
queryParams: {},
queryParams: {
pageNo: 1,
pageSize: 10,
searchTimeArray: [],
outCorp: null,
outCorpId: null,
inCorp: null,
inCorpId: null
},
showSearch: true,
loading: false,
list: [],
total: 0,
}
},
methods: {}
mounted() {
this.getList()
},
methods: {
async getList(){
const res = await getStiPage(this.queryParams)
this.list = res.data.records
this.total = res.data.total
},
handleQuery(){
this.queryParams.pageNo = 1
this.getList()
},
handleReset(){
this.resetForm("queryForm")
this.queryParams.outCorp = null
this.queryParams.inCorp = null
this.handleQuery()
}
}
}
</script>