新购到货管理模块联调

This commit is contained in:
FrancisHu 2024-08-20 18:07:30 +08:00
parent abef4c1176
commit f7e6a328b0
8 changed files with 375 additions and 205 deletions

View File

@ -17,18 +17,24 @@ export const queryFactoryListApi = (data) => {
})
}
/** 物资厂家新增 */
export const addSupplierListApi = (data) => {
return request.post('/base/masupplier/add', data)
/** 类型规格查询 */
export const queryTypeListApi = (data) => {
return request.get('/purchase/bpm_purchase_info/cascader', {
params: data
})
}
/** 物资厂家修改 */
export const updateSupplierListApi = (data) => {
return request.post('/base/masupplier/update', data)
/** 根据value查询单位 */
export const queryMeterByVal = (data) => {
return request.get(`/purchase/bpm_purchase_info/cascaderById`, {
params: data
})
}
/** 物资厂家删除 */
export const delSupplierListApi = (id) => {
return request.delete(`/base/masupplier/${id}`)
/** 新购到货新增 */
export const addArrivalApi = (data) => {
return request.post('/purchase/bpm_purchase_info/add', data)
}

View File

@ -9,6 +9,7 @@
:inline="true"
label-width="100px"
v-show="showSearch"
:rules="formRules"
>
<el-form-item
v-for="(item, v) in formLabel"
@ -44,7 +45,7 @@
:options="item.f_selList"
:props="item.optionProps"
:show-all-levels="false"
clearable
@change="handleCas($event, item.f_model, cascaderFunc, extraTableProp)"
style="width: 240px"
/>
<el-date-picker
@ -61,14 +62,23 @@
style="width: 240px"
></el-input-number>
</el-form-item>
<el-form-item>
<el-form-item v-if="showBtnCrews">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
v-if="showSearchBtn"
>查询</el-button
>
<el-button
type="success"
icon="el-icon-edit"
size="mini"
@click="handleFill"
v-if="!showSearchBtn"
>填充</el-button
>
<el-button
type="warning"
icon="el-icon-refresh"
@ -187,7 +197,23 @@ export default {
type: Boolean,
default: true,
},
/** 是否显示查询按钮 */
showSearchBtn: {
type: Boolean,
default: true,
},
showBtnCrews: {
type: Boolean,
default: true,
},
cascaderFunc: {
type: Function,
default: () => null
},
extraTableProp: {
type: Object,
default: () => null
}
},
computed: {
/* 根据操作栏控制表头是否显示 */
@ -208,6 +234,10 @@ export default {
},
data() {
return {
//
formRules: {
},
loading: false,
//
queryParams: {
@ -217,7 +247,7 @@ export default {
//
tableList: [],
//
idList: undefined,
msgList: undefined,
//
total: 0,
//
@ -232,6 +262,7 @@ export default {
columCheckList: [],
//
dynamicWidth: 0,
idCount: 1
}
},
@ -243,6 +274,14 @@ export default {
/* 生成查询参数 */
this.formLabel.map(e => {
this.$set(this.queryParams, e.f_model, '')
//
this.$set(this.formRules, e.f_rule, [
{
required: true,
message: `请填写${e.f_label}`,
trigger: 'blur'
}
])
})
// Object.assign(this.queryParams, this.sendParams)
this.getTableList()
@ -254,6 +293,8 @@ export default {
methods: {
/** 获取列表数据 */
async getTableList() {
this.$refs.queryFormRef.validate(async valid => {
if (valid) {
this.loading = true
console.log(this.queryParams)
const res = await this.requestApi(this.queryParams)
@ -268,11 +309,19 @@ export default {
this.total = res.total
}
}
}
})
},
/** 查询按钮 */
handleQuery() {
this.getTableList()
},
/** 填充按钮 */
handleFill() {
/* this.tableList.forEach(obj => {
Object.assign(obj, this.formLabel)
}) */
},
/** 重置按钮 */
resetQuery() {
this.$refs.queryFormRef.resetFields()
@ -280,6 +329,39 @@ export default {
this.queryParams.pageSize = 10
this.getTableList()
},
/** 级联选择只选最后一级 */
handleCas(
e,
val,
func,
prop
) {
console.log(prop)
this.queryParams[val] = e[e.length - 1]
let setObj = {}
//
if(prop) {
Object.assign(setObj, prop)
}
// id
this.$set(setObj, 'id', this.idCount)
this.idCount++
//
func({
id: e[e.length - 1]
}).then(res => {
console.log(res)
this.$set(setObj, 'name', res.data.parentName)
this.$set(setObj, 'unitName', res.data.unitName)
this.$set(setObj, 'typeName', res.data.name)
}).catch(err => {})
for(let key in this.queryParams) {
this.$set(setObj, key, this.queryParams[key])
}
this.tableList.unshift(setObj)
console.log(this.tableList)
},
/** 动态设置操作列的列宽 */
getOperatorWidth() {
const operatorColumn =
@ -313,9 +395,8 @@ export default {
},
handleSelectionChange(e) {
this.idList = e.map(item => item.id)
console.log(this.idList)
this.$emit('transIdList', this.idList)
this.msgList = e
this.$emit('transIdList', this.msgList)
}
},

View File

@ -1,21 +1,25 @@
<template>
<!-- 往来单位 人员配置 表单组件 -->
<div>
<!-- 表格 -->
<TableModel
:formLabel="formLabelAdd"
:columnsList="columnsListAdd"
:request-api="queryContactUnitsListApi"
ref="tableRef"
style="display: flex; flex-direction: column"
:show-btn-crews="false"
:cascader-func="queryMeterByVal"
:extra-table-prop="extraProp"
@transIdList="getIdList"
>
<template slot="btn" slot-scope="{ queryParams }">
<el-button type="primary"
>绑定</el-button>
<el-button type="primary" @click="save"
>保存</el-button>
<!-- <el-button @click="handleExportData(queryParams, 'base/agreement/export', '物资清单')"
>导出</el-button>-->
</template>
<template slot="handle" slot-scope="{ data }">
<el-button
<!-- <el-button
type="info"
size="mini"
v-if="data.level === '4'"
@ -26,55 +30,180 @@
size="mini"
@click="handleEditData(data)"
>编辑</el-button
>
<!-- <el-button
>-->
<el-button
type="danger"
size="mini"
@click="handleDeleteMaType(data.id, delSingleMa)"
@click="delMa(data)"
>删除</el-button
>-->
>
</template>
<template slot="typeId" slot-scope="{ data }">
{{ data.typeName }}
</template>
<template slot="purchasePrice" slot-scope="{ data }">
<el-input v-model="data.purchasePrice"></el-input>
</template>
<template slot="notaxPrice" slot-scope="{ data }">
<el-input v-model="data.notaxPrice"></el-input>
</template>
<template slot="productDate" slot-scope="{ data }">
<el-date-picker
style="width: 100%"
v-model="data.productDate"
value-format="yyyy-MM-dd"
type="date"
/>
</template>
<template slot="supplierId" slot-scope="{ data }">
<el-select
v-model="data.supplierId"
>
<el-option
v-for="item in sendRange"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</template>
<template slot="taxRate" slot-scope="{ data }">
<el-input-number
style="width: 100%"
controls-position="right"
v-model="data.taxRate"
:min="0"
></el-input-number>
</template>
<template slot="files" slot-scope="{ data }">
<h5
style="color: #02A7F0; cursor: pointer; font-weight: normal"
@click="handleEditData(data)"
>报告管理</h5>
</template>
<!-- <template slot="url" slot-scope="{ data }">
<img :src="data.url" style="width: 50px; height: 50px">
</template>-->
</TableModel>
<!-- 弹框 -->
<DialogModel
:dialogConfig="dialogConfig"
@closeDialogOuter="closeDialogOuter"
>
<template slot="outerContent">
<!-- 新增以及修改数据的表单组件 -->
<FormArrival
@closeDialog="closeDialog"
:editParams="editParams"
/>
</template>
</DialogModel>
</div>
</template>
<script>
import { formLabelAdd, columnsListAdd, dialogConfigAdd } from '../config-add'
import { columnsListAdd, dialogConfigAdd } from '../config-add'
import { dialogConfig } from '../config-arrival'
import { commonMixin } from '../../mixins/common'
import {
queryFactoryListApi
queryFactoryListApi,
queryMeterByVal
} from '@/api/purchase/arrival'
import {
queryPurchaseArrivalListApi,
addArrivalApi
} from '@/api/purchase/arrival'
import FormArrival from '../components/form-arrival.vue'
export default {
name: 'AddArrival',
components: { FormArrival },
mixins: [commonMixin], //
props: {
sendRange: {
type: Array,
default: () => null
},
sendCascader: {
type: Array,
default: () => null
}
},
created() {
queryFactoryListApi().then(res => {
this.factoryRange = res.data.map(item => {
return {
label: item.name,
value: item.id
}
})
})
// console.log(this.sendRange)
},
mounted() {
},
data() {
return {
formLabelAdd,
formLabelAdd: [
{ f_label: '到货日期', f_model: 'arrivalTime', f_type: 'date', f_rule: 'arrivalTime' },
{ f_label: '物资厂家', f_model: 'supplierId', f_type: 'sel', f_selList: this.sendRange },
{ f_label: '出厂日期', f_model: 'productDate', f_type: 'date' },
{ f_label: '税率', f_model: 'taxRate', f_type: 'num' },
{ f_label: '类型规格', f_model: 'typeId', f_type: 'selCas', f_rule: 'typeId', f_selList: this.sendCascader },
{ f_label: '备注', f_model: 'remark', f_type: 'ipt' },
],
dialogConfig,
columnsListAdd,
dialogConfigAdd,
factoryRange: []
exportList: [],
editDialogTitle: '新购验收报告管理', //
extraProp: {
purchasePrice: '',
notaxPrice: ''
},
priceDex: 100
}
},
methods: {
queryPurchaseArrivalListApi,
queryMeterByVal,
getIdList(idList) {
this.exportList = idList
},
//
delMa(data) {
this.$modal
.confirm('是否确认删除所选择的数据项?')
.then(() => {
this.$refs.tableRef.tableList.forEach((item, index) => {
if(item.type === data.type) {
this.$refs.tableRef.tableList.splice(index, 1)
}
})
})
.catch(() => {})
},
save() {
if(this.exportList.length === 0) {
this.$modal.msgError('请选择需要保存的机具')
} else {
this.exportList.forEach(item => {
item.purchasePrice = item.purchasePrice * this.priceDex
item.notaxPrice = item.notaxPrice * this.priceDex
item.bpmPurchaseDetailsList = {
name: item.name,
typeId: item.typeId,
unitName: item.unitName,
purchasePrice: item.purchasePrice,
notaxPrice: item.notaxPrice,
taxRate: item.taxRate,
supplierId: item.supplierId,
productDate: item.productDate
}
})
console.log(this.exportList)
//
addArrivalApi(this.exportList).then(res => {
console.log(res)
this.exportList.forEach(item => {
item.purchasePrice = item.purchasePrice / this.priceDex
item.notaxPrice = item.notaxPrice / this.priceDex
})
}).catch(err => {})
}
}
},
}
</script>

View File

@ -1,93 +1,46 @@
<template>
<!-- 协议管理 新增编辑 表单组件 -->
<div>
<el-form
label-width="100px"
size="medium"
ref="supplierParamsRef"
:model="supplierParams"
:rules="supplierParamsRules"
<TableModel
:columnsList="columnsList"
:show-btn-crews="false"
ref="tableRef"
:show-sel="false"
>
<el-row type="flex" justify="space-between" :gutter="24">
<el-col :span="12">
<el-form-item label="厂家名称" prop="name">
<el-input v-model="supplierParams.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厂家地址" prop="address">
<el-input v-model="supplierParams.address" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="法人代表" prop="companyMan">
<el-input v-model="supplierParams.companyMan" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主要联系人" prop="mainPerson">
<el-input v-model="supplierParams.mainPerson" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="联系人电话" prop="phone">
<el-input v-model="supplierParams.phone" :maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="notes">
<el-input type="textarea" v-model="supplierParams.notes" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="营业执照" prop="picUrl">
<el-upload
:http-request="(obj) => uploadData(obj)"
action="#"
:file-list="fileList"
:on-exceed="fileExceed"
:on-remove="handleRemove"
:class="{ disabled: uploadDisabled }"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:limit="1"
>
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="主要营业范围" prop="scopeBusiness">
<el-input type="textarea" v-model="supplierParams.scopeBusiness" />
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="success" @click="onSubmit">确认</el-button>
<template slot="handle" slot-scope="{ data }">
<el-button
@click="
() => {
this.$emit('closeDialog')
}
"
>取消</el-button
type="primary"
size="mini"
>查看</el-button
>
</el-form-item>
</el-form>
<el-button
type="danger"
size="mini"
>上传</el-button
>
</template>
<!-- <template slot="picUrl" slot-scope="{ data }">
&lt;!&ndash; <img :src="data.picUrl" style="width: 50px; height: 50px" alt="">&ndash;&gt;
<h4
style="color: #02A7F0; cursor: pointer"
v-if="data.picUrl === '' || data.picUrl === null"
@click="handleEditData(data)"
>上传</h4>
<h4
style="color: #02A7F0; cursor: pointer"
v-else
@click="openUrl(data.picUrl)"
>查看</h4>
</template>
<template slot="phone" slot-scope="{ data }">
{{ phoneCrypto(data.phone) }}
</template>-->
</TableModel>
</div>
</template>
<script>
import {
addSupplierListApi,
updateSupplierListApi
} from '@/api/material/masupplier'
import { columnsList } from '../config-arrival'
import {
fileUpLoad,
imgUpLoad
@ -105,42 +58,17 @@ export default {
},
mounted() {
console.log(this.editParams)
if (this.editParams) {
Object.assign(this.supplierParams, this.editParams)
this.subSort = 2
} else {
this.subSort = 1
}
},
data() {
return {
columnsList,
subSort: '', // 1 / 2
supplierParams: {
name: undefined, //
address: undefined, //
companyMan: undefined, //
mainPerson: undefined, //
phone: undefined, //
notes: undefined, //
scopeBusiness: undefined, //
picUrl: undefined, //
},
//
picList: [],
//
picNameList: [],
//
fileList: [],
//
supplierParamsRules: {
name: [
{
required: true,
message: '请输入厂家名称',
trigger: 'blur',
},
]
},
}
},
computed: {
@ -159,11 +87,6 @@ export default {
this.picNameList.push(res.data.name.split('_')[0])
}).catch(err => {})
},
/** 文件变化 */
dataChange(e) {
console.log(e)
this.fileList.push(e.raw)
},
/** 移除文件 */
handleRemove(file) {
console.log(file)
@ -177,30 +100,7 @@ export default {
},
/** 确认按钮 */
onSubmit() {
this.supplierParams.picUrl = this.picList.join()
console.log(this.supplierParams)
this.$refs.supplierParamsRef.validate((valid) => {
if (valid) {
console.log('校验通过', this.supplierParams, this.subSort)
// 1. Api
if(this.subSort === 1) {
addSupplierListApi(this.supplierParams).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
} else if(this.subSort === 2) {
console.log(this.supplierParams)
updateSupplierListApi(this.supplierParams).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
}
// 2.
this.$emit('closeDialog', true)
}
})
},
},
}

View File

@ -1,26 +1,25 @@
import {
queryFactoryListApi
} from '@/api/purchase/arrival'
querySupplierListApi
} from '@/api/material/masupplier'
export const formLabelAdd = [
{ f_label: '到货日期', f_model: 'startTime', f_type: 'date' },
{ f_label: '物资厂家', f_model: 'startTime', f_type: 'sel', f_selList: this.factoryRange },
{ f_label: '出场日期', f_model: 'endTime', f_type: 'date' },
{ f_label: '税率', f_model: 'keyWord', f_type: 'num' },
{ f_label: '物资厂家', f_model: 'supplierId', f_type: 'sel', },
{ f_label: '出厂日期', f_model: 'productDate', f_type: 'date' },
{ f_label: '税率', f_model: 'taxRate', f_type: 'num' },
{ f_label: '类型规格', f_model: 'keyWord', f_type: 'ipt' },
{ f_label: '备注', f_model: 'keyWord', f_type: 'ipt' },
]
export const columnsListAdd = [
{ t_props: 'name', t_label: '物资名称', },
{ t_props: 'address', t_label: '规格型号' },
{ t_props: 'companyMan', t_label: '单位' },
{ t_props: 'phone', t_label: '购置单价(含税)', },
{ t_props: 'scopeBusiness', t_label: '购置单价(不含税)' },
{ t_props: 'picUrl', t_label: '税率', },
{ t_props: 'notes', t_label: '供应商' },
{ t_props: 'notes', t_label: '出场日期' },
{ t_props: 'notes', t_label: '相关配套资料' },
{ t_props: 'typeId', t_label: '规格型号', t_slot: 'typeId' },
{ t_props: 'unitName', t_label: '单位' },
{ t_props: 'purchasePrice', t_label: '单价(含税)', t_slot: 'purchasePrice' },
{ t_props: 'notaxPrice', t_label: '单价(不含税)', t_slot: 'notaxPrice' },
{ t_props: 'taxRate', t_label: '税率', t_slot: 'taxRate' },
{ t_props: 'supplierId', t_label: '物资厂家', t_slot: 'supplierId' },
{ t_props: 'productDate', t_label: '出厂日期', t_slot: 'productDate' },
{ t_props: 'files', t_label: '相关配套资料', t_slot: 'files' },
]
export const dialogConfigAdd = {
outerWidth: '80%',

View File

@ -0,0 +1,14 @@
export const columnsList = [
{ t_props: 'name', t_label: '报告类型', },
{ t_props: 'typeId', t_label: '合格证', },
{ t_props: 'unitName', t_label: '类型名称' },
{ t_props: 'purchasePrice', t_label: '规格型号', },
{ t_props: 'notaxPrice', t_label: '报告日期', },
{ t_props: 'taxRate', t_label: '截止有效期', },
]
export const dialogConfig = {
outerWidth: '80%',
outerTitle: '',
outerVisible: false,
}

View File

@ -67,6 +67,8 @@
<add-arrival
v-if="isShowComponent === 'add-arrival'"
:send-range="factoryRange"
:send-cascader="cascaderRange"
>
</add-arrival>
@ -81,15 +83,47 @@ import { commonMixin } from '../mixins/common'
import FormArrival from './components/form-arrival.vue'
import AddArrival from './components/add-arrival.vue'
import {
queryPurchaseArrivalListApi
queryPurchaseArrivalListApi,
queryTypeListApi
} from '@/api/purchase/arrival'
import {
querySupplierListApi
} from '@/api/material/masupplier'
export default {
name: 'purchaseArrivalManage',
mixins: [commonMixin], //
components: { FormArrival, PageHeader, AddArrival },
created() {
//
querySupplierListApi().then(res => {
this.factoryRange = res.rows.map(item => {
return {
label: item.name,
value: item.id
}
})
}).catch(err => {})
//
queryTypeListApi().then(res => {
res.data.forEach(lv1 => {
if(!lv1.children) {
lv1.disabled = true
} else {
lv1.children.forEach(lv2 => {
if(!lv2.children) {
lv2.disabled = true
} else {
lv2.children.forEach(lv3 => {
if(!lv3.children) {
lv3.disabled = true
}
})
}
})
}
})
this.cascaderRange = res.data
}).catch(err => {})
},
methods: {
queryPurchaseArrivalListApi,
@ -106,6 +140,8 @@ export default {
dialogConfig,
addDialogTitle: '新建到货管理', //
editDialogTitle: '修改到货管理', //
factoryRange: [],
cascaderRange: []
}
},
}

View File

@ -57,6 +57,11 @@ export const commonMixin = {
this.dialogConfig.outerTitle = this.editDialogTitle
this.dialogConfig.outerVisible = true
},
handleEditDataAdd(data) {
this.editParams = data
this.dialogConfigAdd.outerTitle = this.editDialogTitle
this.dialogConfigAdd.outerVisible = true
},
/** 导入数据 */
handleImportData() {
console.log('导入--')