Compare commits
3 Commits
9fd0101266
...
9ec6e7a515
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9ec6e7a515 | ||
![]() |
1aad791aa2 | ||
![]() |
1faedc0334 |
@ -1 +1,20 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
const preUrl = "/repair/so"
|
||||||
|
|
||||||
|
// 采购单\领料单 新增
|
||||||
|
export function createRepairSo(data){
|
||||||
|
return request({
|
||||||
|
url: preUrl + "/create",
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRepairSoPage(params){
|
||||||
|
return request({
|
||||||
|
url: preUrl + "/page",
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
<el-select v-model="partSelected" ref="selectTable" clearable style="width: 45rem">
|
<el-select v-model="partSelected" ref="selectTable" clearable style="width: 45rem">
|
||||||
<el-option style="display: none" v-for="part in partList" :key="part.id" :label="part.name" :value="part.id"/>
|
<el-option style="display: none" v-for="part in partList" :key="part.id" :label="part.name" :value="part.id"/>
|
||||||
<el-table :data="partList" style="width: 100%" @row-click="handleSelectionChange">
|
<el-table :data="partList" style="width: 100%" @row-click="handleSelectionChange">
|
||||||
<el-table-column label="序号" align="center">
|
<el-table-column label="序号" align="center" width="80">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<span>{{ scope.$index + 1 }}</span>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品名称" prop="name" />
|
<el-table-column label="商品名称" prop="name" width="120"/>
|
||||||
<el-table-column label="规格" prop="name" />
|
<el-table-column label="规格" prop="model" width="120"/>
|
||||||
<el-table-column label="商品编码" prop="name" />
|
<el-table-column label="商品编码" prop="code" width="120"/>
|
||||||
<el-table-column label="可用库存" prop="name" />
|
<el-table-column label="可用库存" prop="stock" width="80"/>
|
||||||
<el-table-column label="成本" prop="name" />
|
<el-table-column label="成本" prop="price" width="80"/>
|
||||||
<el-table-column label="仓库" prop="name" />
|
<el-table-column label="仓库" prop="warehouse" width="80"/>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
/>
|
/>
|
||||||
@ -26,8 +26,48 @@ export default {
|
|||||||
return{
|
return{
|
||||||
partSelected: null,
|
partSelected: null,
|
||||||
partList: [
|
partList: [
|
||||||
{id: 1, name: '张胜男', age:20, gender: 1},
|
{
|
||||||
{id: 2, name: '张胜妇', age:20, gender: 1}
|
id: 1,
|
||||||
|
tenantId: 1,
|
||||||
|
barCode: "12344564632463",
|
||||||
|
code: "12312312",
|
||||||
|
name: "测试1",
|
||||||
|
model: "12321",
|
||||||
|
price: "100",
|
||||||
|
type: "不知道",
|
||||||
|
unit: "个",
|
||||||
|
warehouse: "d1",
|
||||||
|
miniStock: 100,
|
||||||
|
maxStock: 100,
|
||||||
|
stock: 20,
|
||||||
|
img: '',
|
||||||
|
attribute: "123213123",
|
||||||
|
corpId: 1,
|
||||||
|
coverImage: '',
|
||||||
|
carModel: "大车",
|
||||||
|
remark: "没有",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
tenantId: 1,
|
||||||
|
barCode: "12344564632463",
|
||||||
|
code: "12312312",
|
||||||
|
name: "测试2",
|
||||||
|
model: "12321",
|
||||||
|
price: "10",
|
||||||
|
type: "不知道",
|
||||||
|
unit: "个",
|
||||||
|
warehouse: "d2",
|
||||||
|
miniStock: 10,
|
||||||
|
maxStock: 10,
|
||||||
|
stock: 5,
|
||||||
|
img: '',
|
||||||
|
attribute: "123213123",
|
||||||
|
corpId: 1,
|
||||||
|
coverImage: '',
|
||||||
|
carModel: "大车",
|
||||||
|
remark: "没有",
|
||||||
|
}
|
||||||
],
|
],
|
||||||
queryParams:{
|
queryParams:{
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
|
@ -10,6 +10,12 @@ import {getStaffList} from "@/api/company/staff";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StaffChoose",
|
name: "StaffChoose",
|
||||||
|
props:{
|
||||||
|
value: {
|
||||||
|
type: Object,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
staffList: [],
|
staffList: [],
|
||||||
@ -19,7 +25,14 @@ export default {
|
|||||||
watch:{
|
watch:{
|
||||||
staffSelected(val) {
|
staffSelected(val) {
|
||||||
const staff = this.staffList.find(item => item.id === val);
|
const staff = this.staffList.find(item => item.id === val);
|
||||||
this.$emit("selected", staff);
|
this.$emit("input", staff);
|
||||||
|
},
|
||||||
|
value(newVal){
|
||||||
|
if (newVal){
|
||||||
|
this.staffSelected = newVal.id
|
||||||
|
}else {
|
||||||
|
this.staffSelected = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -11,16 +11,29 @@ import {getBaseSupplierList} from "@/api/repair/supplier";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SupplierChoose",
|
name: "SupplierChoose",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: Object,
|
||||||
|
defaultValue: null
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
supplierSelected: undefined,
|
supplierSelected: undefined,
|
||||||
supplierList: null
|
supplierList: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
supplierSelected(val) {
|
supplierSelected(val) {
|
||||||
const supplier = this.supplierList.find(item => item.id === val);
|
const supplier = this.supplierList.find(item => item.id === val)
|
||||||
this.$emit("selected", supplier);
|
this.$emit("input", supplier);
|
||||||
|
},
|
||||||
|
value(newVal) {
|
||||||
|
if (newVal) {
|
||||||
|
this.supplierSelected = newVal.id
|
||||||
|
} else {
|
||||||
|
this.supplierSelected = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -51,7 +51,8 @@ export default {
|
|||||||
return JSON.parse(JSON.stringify(result))
|
return JSON.parse(JSON.stringify(result))
|
||||||
},
|
},
|
||||||
handleNodeClick(node){
|
handleNodeClick(node){
|
||||||
this.$emit("selected", node)
|
this.$emit("input", node.name)
|
||||||
|
this.$emit("change")
|
||||||
this.warehouseSelected = node.name
|
this.warehouseSelected = node.name
|
||||||
this.$refs.selectTree.blur()
|
this.$refs.selectTree.blur()
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="soByType && !goodsYes" label="供应商" prop="supplierId">
|
<el-form-item v-if="soByType && !goodsYes" label="供应商" prop="supplierId">
|
||||||
<SupplierChoose />
|
<SupplierChoose/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="goodsYes" label="关键字" prop="soNo">
|
<el-form-item v-if="goodsYes" label="关键字" prop="soNo">
|
||||||
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、商品名称或编码"/>
|
<el-input v-model="queryParams.soNo" style="width: 18rem" placeholder="请输入单号、商品名称或编码"/>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<el-option v-for="item in getStatus"
|
<el-option v-for="item in getStatus"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value" />
|
:value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!soByType" label="领料人" prop="userId">
|
<el-form-item v-if="!soByType" label="领料人" prop="userId">
|
||||||
@ -55,19 +55,19 @@
|
|||||||
<span>{{ scope.$index + 1 }}</span>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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" width="180" prop="name" />
|
<el-table-column label="商品名称" align="center" width="180" prop="name"/>
|
||||||
<el-table-column label="规格" align="center" width="180" prop="name" />
|
<el-table-column label="规格" align="center" width="180" prop="name"/>
|
||||||
<el-table-column label="商品编码" align="center" width="180" prop="name" />
|
<el-table-column label="商品编码" align="center" width="180" prop="name"/>
|
||||||
<el-table-column label="所属分类" align="center" width="150" prop="name" />
|
<el-table-column label="所属分类" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="数量" align="center" width="150" prop="name" />
|
<el-table-column label="数量" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="单位" align="center" width="150" prop="name" />
|
<el-table-column label="单位" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="成本" align="center" width="150" prop="name" />
|
<el-table-column label="成本" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="供应商" align="center" width="180" prop="name" />
|
<el-table-column label="供应商" align="center" width="180" prop="name"/>
|
||||||
<el-table-column label="仓库" align="center" width="150" prop="name" />
|
<el-table-column label="仓库" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="状态" align="center" width="150" prop="name" />
|
<el-table-column label="状态" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="时间" align="center" width="150" prop="name" />
|
<el-table-column label="时间" align="center" width="150" prop="name"/>
|
||||||
<el-table-column label="门店" align="center" width="180" prop="name" />
|
<el-table-column label="门店" align="center" width="180" prop="name"/>
|
||||||
<el-table-column label="操作" align="center" width="180" fixed="right">
|
<el-table-column label="操作" align="center" width="180" fixed="right">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit"
|
<el-button size="mini" type="text" icon="el-icon-edit"
|
||||||
@ -84,16 +84,16 @@
|
|||||||
<span>{{ scope.$index + 1 }}</span>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="itemCount" width="150" />
|
<el-table-column label="数量" align="center" prop="itemCount" width="150"/>
|
||||||
<el-table-column label="金额" align="center" prop="totalPrice" width="150" />
|
<el-table-column label="金额" align="center" prop="totalPrice" width="150"/>
|
||||||
<el-table-column :label="soByType ? '采购员' : '领料人'" align="center" prop="userName" width="150" />
|
<el-table-column :label="soByType ? '采购员' : '领料人'" align="center" prop="userName" width="150"/>
|
||||||
<el-table-column v-if="soByType" label="供应商" align="center" prop="supplierName" width="150" />
|
<el-table-column v-if="soByType" label="供应商" align="center" prop="supplierName" width="150"/>
|
||||||
<el-table-column :label="soByType ? '入库时间' : '领料时间'" align="center" prop="soTime" width="150" />
|
<el-table-column :label="soByType ? '入库时间' : '领料时间'" align="center" prop="soTime" width="150"/>
|
||||||
<el-table-column label="登记时间" align="center" prop="createTime" width="150" />
|
<el-table-column label="登记时间" align="center" prop="createTime" width="150"/>
|
||||||
<el-table-column label="门店" align="center" prop="corpName" width="180" />
|
<el-table-column label="门店" align="center" prop="corpName" width="180"/>
|
||||||
<el-table-column v-if="soByType" label="状态" align="center" prop="soStatus" width="150" />
|
<el-table-column v-if="soByType" label="状态" align="center" prop="soStatus" width="150"/>
|
||||||
<el-table-column label="备注" align="center" prop="remark" width="180" />
|
<el-table-column label="备注" align="center" prop="remark" width="180"/>
|
||||||
<el-table-column label="操作" fixed="right" width="180" align="center">
|
<el-table-column label="操作" fixed="right" width="180" align="center">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit"
|
<el-button size="mini" type="text" icon="el-icon-edit"
|
||||||
@ -117,21 +117,22 @@ import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
|
|||||||
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
|
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
|
||||||
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
|
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
|
||||||
import {DICT_TYPE} from "@/utils/dict";
|
import {DICT_TYPE} from "@/utils/dict";
|
||||||
|
import {getRepairSoPage} from "@/api/repair/stockOperate/stockOperate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SoIndex",
|
name: "SoIndex",
|
||||||
computed: {
|
computed: {
|
||||||
getStatus(){
|
getStatus() {
|
||||||
const data = this.getDictDatas(DICT_TYPE.REPAIR_SO_STATUS)
|
const data = this.getDictDatas(DICT_TYPE.REPAIR_SO_STATUS)
|
||||||
return data.filter(item => item.label.toString().indexOf("领料") === -1)
|
return data.filter(item => item.label.toString().indexOf("领料") === -1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components:{
|
components: {
|
||||||
StaffChoose,
|
StaffChoose,
|
||||||
SupplierChoose,
|
SupplierChoose,
|
||||||
CorpChoose
|
CorpChoose
|
||||||
},
|
},
|
||||||
props:{
|
props: {
|
||||||
soByType: {
|
soByType: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
@ -145,17 +146,18 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryParams:{
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
searchTimeArray:[],
|
searchTimeArray: [],
|
||||||
soNo: null,
|
soNo: null,
|
||||||
supplierId: null,
|
supplierId: null,
|
||||||
supplierName: null,
|
supplierName: null,
|
||||||
soStatus: null,
|
soStatus: null,
|
||||||
corpId: null,
|
corpId: null,
|
||||||
userId: null,
|
userId: null,
|
||||||
userName: null
|
userName: null,
|
||||||
|
soType: this.soByType ? "01" : "02"
|
||||||
},
|
},
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
list: [],
|
list: [],
|
||||||
@ -163,21 +165,36 @@ export default {
|
|||||||
total: 0
|
total: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.pageSo();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 分页
|
||||||
|
async pageSo() {
|
||||||
|
try {
|
||||||
|
this.loading = true
|
||||||
|
const res = await getRepairSoPage(this.queryParams)
|
||||||
|
this.list = res.data.records
|
||||||
|
this.total = res.data.total
|
||||||
|
}finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
// 搜索按钮
|
// 搜索按钮
|
||||||
handleQuery(){},
|
handleQuery() {
|
||||||
|
},
|
||||||
// 搜索重置
|
// 搜索重置
|
||||||
resetQuery(){
|
resetQuery() {
|
||||||
this.resetForm('queryForm')
|
this.resetForm('queryForm')
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 员工选择组件的回调
|
// 员工选择组件的回调
|
||||||
getStaff(data){
|
getStaff(data) {
|
||||||
this.queryParams.userId = data.id
|
this.queryParams.userId = data.id
|
||||||
this.queryParams.userName = data.name
|
this.queryParams.userName = data.name
|
||||||
},
|
},
|
||||||
// 门店选择
|
// 门店选择
|
||||||
getCompany(data){
|
getCompany(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<!-- 供应商 组件 -->
|
<!-- 供应商 组件 -->
|
||||||
<el-form-item v-if="soByType" label="供应商" prop="supplierId">
|
<el-form-item v-if="soByType" label="供应商" prop="supplier">
|
||||||
<SupplierChoose @selected="getSupplier"/>
|
<SupplierChoose v-model="formData.supplier"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 日期 内嵌 -->
|
<!-- 日期 内嵌 -->
|
||||||
<el-form-item label="日期" prop="soTime">
|
<el-form-item label="日期" prop="soTime">
|
||||||
@ -20,8 +20,8 @@
|
|||||||
<el-input disabled v-model="formData.soNo" style="width: 20rem"/>
|
<el-input disabled v-model="formData.soNo" style="width: 20rem"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 采购员/领料人 组件 -->
|
<!-- 采购员/领料人 组件 -->
|
||||||
<el-form-item :label="staffRole" prop="userId">
|
<el-form-item :label="staffRole" prop="user">
|
||||||
<StaffChoose @selected="getStaff"/>
|
<StaffChoose v-model="formData.user"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -36,20 +36,25 @@
|
|||||||
<!-- 商品表格 组件 -->
|
<!-- 商品表格 组件 -->
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<SoTable :part-list="partList" :so-by-type="soByType" @deleteItem="deleteItem"/>
|
<SoTable @tableData="tableData" :part-list="partList" :so-by-type="soByType" @deleteItem="deleteItem"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="2" style="margin-top: 1rem">
|
<el-row :gutter="4" style="margin-top: 1rem">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="应付金额" prop="totalPrice">
|
||||||
|
<el-input disabled v-model="formData.totalPrice"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<!-- 备注 -->
|
<!-- 备注 -->
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input style="width: 45rem"/>
|
<el-input style="width: 40rem" v-model="formData.remark"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 按钮操作 -->
|
<!-- 按钮操作 -->
|
||||||
<el-col :span="12" style="text-align: right">
|
<el-col :span="6" style="text-align: right">
|
||||||
<el-button v-if="soByType" type="danger">结算</el-button>
|
<el-button v-if="soByType" type="danger" @click="handleSubmit">结算</el-button>
|
||||||
<el-button v-else type="primary">确定</el-button>
|
<el-button v-else type="primary" @click="handleSubmit">确定</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -63,6 +68,7 @@ import PartChoose from "@/views/repair/Components/PartChoose.vue";
|
|||||||
import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue";
|
import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue";
|
||||||
import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
|
import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
|
||||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
||||||
|
import {createRepairSo} from "@/api/repair/stockOperate/stockOperate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SoInfo",
|
name: "SoInfo",
|
||||||
@ -77,26 +83,29 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
required: true
|
required: true
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
formData: {
|
formData: {
|
||||||
soNo: null,
|
soNo: null,
|
||||||
supplierId: null,
|
supplier: null,
|
||||||
supplierName: null,
|
|
||||||
soTime: Date.now(),
|
soTime: Date.now(),
|
||||||
userId: null,
|
user: null,
|
||||||
userName: null,
|
goodsList: [],
|
||||||
partList: []
|
totalPrice: null,
|
||||||
|
soType: this.soByType ? "01" : "02",
|
||||||
|
purchaseType: "01",
|
||||||
|
itemCount: 0,
|
||||||
|
soStatus: this.soByType ? "01" : "04",
|
||||||
|
remark: null,
|
||||||
},
|
},
|
||||||
staffRole: "采购员",
|
staffRole: "采购员",
|
||||||
partList: [],
|
partList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
|
this.init()
|
||||||
this.staffRole = this.soByType ? this.staffRole : "领料人"
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 得到选择的员工
|
// 得到选择的员工
|
||||||
@ -106,7 +115,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 得到选择的供应商
|
// 得到选择的供应商
|
||||||
getSupplier(data) {
|
getSupplier(data) {
|
||||||
console.log(data)
|
this.formData.supplierId = data.id
|
||||||
|
this.formData.supplierName = data.name
|
||||||
},
|
},
|
||||||
// 得到选择的商品
|
// 得到选择的商品
|
||||||
async getPart(data) {
|
async getPart(data) {
|
||||||
@ -124,6 +134,66 @@ export default {
|
|||||||
// 删除数据
|
// 删除数据
|
||||||
deleteItem(index) {
|
deleteItem(index) {
|
||||||
this.partList.splice(index, 1)
|
this.partList.splice(index, 1)
|
||||||
|
},
|
||||||
|
// 表格的数据
|
||||||
|
tableData(data){
|
||||||
|
this.formData.totalPrice = data.reduce((x, y) => {return x + y.totalPrice}, 0)
|
||||||
|
this.formData.itemCount = data.reduce((x, y) => {return x + y.count}, 0)
|
||||||
|
this.formData.goodsList = data.map(item => {
|
||||||
|
return {
|
||||||
|
goodsId: item.id,
|
||||||
|
goodsType: "0",
|
||||||
|
wareId: "0",
|
||||||
|
goodsCount: item.count,
|
||||||
|
goodsPrice: item.newPrice,
|
||||||
|
remark: item.remark
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 提交
|
||||||
|
async handleSubmit(){
|
||||||
|
try {
|
||||||
|
this.createInit()
|
||||||
|
await createRepairSo(this.formData)
|
||||||
|
this.$modal.msgSuccess("新增成功")
|
||||||
|
this.init()
|
||||||
|
}catch{
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 初始化
|
||||||
|
init(){
|
||||||
|
this.formData = {
|
||||||
|
soNo: null,
|
||||||
|
supplier: null,
|
||||||
|
soTime: Date.now(),
|
||||||
|
user: null,
|
||||||
|
goodsList: [],
|
||||||
|
totalPrice: null,
|
||||||
|
soType: this.soByType ? "01" : "02",
|
||||||
|
purchaseType: "01",
|
||||||
|
itemCount: 0,
|
||||||
|
soStatus: this.soByType ? "01" : "04",
|
||||||
|
remark: null,
|
||||||
|
}
|
||||||
|
this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
|
||||||
|
this.staffRole = this.soByType ? this.staffRole : "领料人"
|
||||||
|
this.partList = []
|
||||||
|
},
|
||||||
|
// 提交前的构建
|
||||||
|
createInit(){
|
||||||
|
const data = this.formData
|
||||||
|
this.formData = {
|
||||||
|
...data,
|
||||||
|
userId: data.user.id,
|
||||||
|
userName: data.user.name,
|
||||||
|
}
|
||||||
|
if (this.soByType){
|
||||||
|
this.formData = {
|
||||||
|
...data,
|
||||||
|
supplierId: data.supplier.id,
|
||||||
|
supplierName: data.supplier.name
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,62 @@
|
|||||||
<template>
|
<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"
|
||||||
|
:key="randomKey"
|
||||||
|
@cell-dblclick="editData"
|
||||||
|
>
|
||||||
<el-table-column label="序号" align="center">
|
<el-table-column label="序号" align="center">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<span>{{ scope.$index + 1 }}</span>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品名称" align="center" prop="name" width="200"/>
|
<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="180" prop="model"/>
|
||||||
<el-table-column label="商品编码" align="center" width="180"/>
|
<el-table-column label="商品编码" align="center" width="180" prop="code"/>
|
||||||
<el-table-column label="仓库" align="center" width="150"/>
|
<el-table-column label="仓库" align="center" width="150" prop="warehouse">
|
||||||
<el-table-column label="库存" align="center" width="150" />
|
<template slot-scope="scope">
|
||||||
<el-table-column label="单位" align="center" width="150"/>
|
<WarehouseChoose v-if="scope.row[scope.column.property + 'isShow'] && soByType"
|
||||||
<el-table-column label="数量" align="center" width="150"/>
|
:ref="scope.column.property"
|
||||||
<el-table-column :label="soByType ? '上次进价' : '成本'" align="center" width="150"/>
|
v-model="scope.row.warehouse"
|
||||||
<el-table-column v-if="soByType" label="采购进价" align="center" width="150"/>
|
@change="alterData(scope.row,scope.column)"
|
||||||
<el-table-column :label="soByType ? '采购金额' : '合计'" align="center" width="150"/>
|
/>
|
||||||
<el-table-column label="备注" align="center" width="180"/>
|
<span v-else>{{ scope.row.warehouse }}</span>
|
||||||
|
</template>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(scope.$index)"
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(scope.$index)"
|
||||||
@ -27,15 +68,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import WarehouseChoose from "@/views/repair/Components/WarehouseChoose.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SoTable",
|
name: "SoTable",
|
||||||
props:{
|
components: {WarehouseChoose},
|
||||||
soByType:{
|
props: {
|
||||||
|
soByType: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
partList:{
|
partList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
required: true
|
required: true
|
||||||
@ -45,13 +89,80 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
list: [],
|
list: [],
|
||||||
|
includeColumn: ['count', 'totalPrice'],
|
||||||
|
randomKey: Math.random(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
partList(val) {
|
||||||
|
if (val && val.length > 0) {
|
||||||
|
const data = val[val.length - 1]
|
||||||
|
const newData = {
|
||||||
|
...data,
|
||||||
|
count: 1,
|
||||||
|
totalPrice: data.price * 1,
|
||||||
|
remark: '',
|
||||||
|
newPrice: data.price,
|
||||||
|
}
|
||||||
|
this.list.push(newData)
|
||||||
|
}else {
|
||||||
|
this.list = []
|
||||||
|
this.refreshTable()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
handler(newVal, oldVal) {
|
||||||
|
this.$emit("tableData", newVal)
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 通知父组件,删除数据
|
// 通知父组件,删除数据
|
||||||
deleteItem(index){
|
deleteItem(index) {
|
||||||
this.$emit("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
|
||||||
|
},
|
||||||
|
editData(row, column) {
|
||||||
|
row[column.property + "isShow"] = true
|
||||||
|
//refreshTable是table数据改动时,刷新table的
|
||||||
|
this.refreshTable()
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// this.$refs[column.property] && this.$refs[column.property].focus()
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
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()
|
||||||
|
},
|
||||||
|
refreshTable() {
|
||||||
|
this.randomKey = Math.random()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user