新购绑定列表

This commit is contained in:
bonus 2024-08-22 10:13:27 +08:00
parent 4b65169ad2
commit ddd0bc26f5
7 changed files with 260 additions and 89 deletions

View File

@ -0,0 +1,21 @@
/**
* 新购到货管理页面 API
*/
import request from '@/utils/request'
/** 新购到货查询 */
export const queryPurchaseBindListApi = (data) => {
return request.get('/task/purchase/bind/list', {
params: data
})
}
/** 新购到货查询 */
export const queryPurchaseBindDetailsApi = (data) => {
return request.get('/task/purchase/bind/detailsList', {
params: data
})
}

View File

@ -197,11 +197,6 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
/** 传递参数 */
sendParams: {
type: Object,
default: () => null
},
/** 是否显示查询按钮 */ /** 是否显示查询按钮 */
showSearchBtn: { showSearchBtn: {
type: Boolean, type: Boolean,
@ -272,7 +267,6 @@ export default {
}, },
created() { created() {
console.log(this.sendParams)
this.columCheckList = this.columnsList.map(e => { this.columCheckList = this.columnsList.map(e => {
this.$set(e, 'checked', true) this.$set(e, 'checked', true)
return e return e
@ -281,7 +275,6 @@ export default {
this.formLabel.map(e => { this.formLabel.map(e => {
this.$set(this.queryParams, e.f_model, '') this.$set(this.queryParams, e.f_model, '')
// //
if(e.f_rule) {
this.$set(this.formRules, e.f_rule, [ this.$set(this.formRules, e.f_rule, [
{ {
required: true, required: true,
@ -289,15 +282,8 @@ export default {
trigger: 'blur' trigger: 'blur'
} }
]) ])
}
}) })
if(this.sendParams !== null) { // Object.assign(this.queryParams, this.sendParams)
Object.assign(this.queryParams, this.sendParams)
/* for(let key in this.sendParams) {
console.log(key, this.sendParams[key])
this.$set(this.queryParams, key, this.sendParams[key])
} */
}
this.getTableList() this.getTableList()
}, },
updated() { updated() {
@ -307,10 +293,10 @@ export default {
methods: { methods: {
/** 获取列表数据 */ /** 获取列表数据 */
async getTableList() { async getTableList() {
if(Object.keys(this.formRules).length !== 0) {
this.$refs.queryFormRef.validate(async valid => { this.$refs.queryFormRef.validate(async valid => {
if (valid) { if (valid) {
this.loading = true this.loading = true
console.log(this.queryParams)
const res = await this.requestApi(this.queryParams) const res = await this.requestApi(this.queryParams)
this.loading = false this.loading = false
console.log(res, '列表数据') console.log(res, '列表数据')
@ -325,21 +311,6 @@ export default {
} }
} }
}) })
} else {
this.loading = true
const res = await this.requestApi(this.queryParams)
this.loading = false
console.log(res, '列表数据')
if (res.code === 200) {
if (res.data) {
this.tableList = res.data.rows
this.total = res.data.total
} else {
this.tableList = res.rows
this.total = res.total
}
}
}
}, },
/** 查询按钮 */ /** 查询按钮 */
handleQuery() { handleQuery() {
@ -365,6 +336,7 @@ export default {
func, func,
prop prop
) { ) {
console.log(prop)
this.queryParams[val] = e[e.length - 1] this.queryParams[val] = e[e.length - 1]
let setObj = {} let setObj = {}
// //
@ -372,12 +344,13 @@ export default {
Object.assign(setObj, prop) Object.assign(setObj, prop)
} }
// id // id
/* this.$set(setObj, 'id', this.idCount) this.$set(setObj, 'id', this.idCount)
this.idCount++ */ this.idCount++
// //
func({ func({
id: e[e.length - 1] id: e[e.length - 1]
}).then(res => { }).then(res => {
console.log(res)
this.$set(setObj, 'name', res.data.parentName) this.$set(setObj, 'name', res.data.parentName)
this.$set(setObj, 'unitName', res.data.unitName) this.$set(setObj, 'unitName', res.data.unitName)
this.$set(setObj, 'typeName', res.data.name) this.$set(setObj, 'typeName', res.data.name)
@ -387,6 +360,7 @@ export default {
} }
this.tableList.unshift(setObj) this.tableList.unshift(setObj)
console.log(this.tableList) console.log(this.tableList)
}, },
/** 动态设置操作列的列宽 */ /** 动态设置操作列的列宽 */
getOperatorWidth() { getOperatorWidth() {

View File

@ -0,0 +1,75 @@
export const commonMixin = {
data() {
return {
// 修改时的数据源
editParams: null,
}
},
methods: {
/** 新建 */
handleAddData() {
this.editParams = null
this.dialogConfig.outerTitle = this.addDialogTitle
this.dialogConfig.outerVisible = true
},
/** 删除 */
handleDeleteData(id, method) {
this.$modal.confirm('是否确定删除').then(() => {
console.log('确定删除--', id)
method(id).then(res => {
console.log(res)
if(res.code === 200) {
// this.$message.msgSuccess('操作成功!')
this.$refs.tableRef.getTableList()
}
}).catch(err => {})
})
},
/** 编辑 */
handleEditData(data) {
this.editParams = data
this.dialogConfig.outerTitle = this.editDialogTitle
this.dialogConfig.outerVisible = true
},
/** 导入数据 */
handleImportData() {
console.log('导入--')
},
/** 导出数据 */
handleExportData(data, url, fileName, queryParams) {
this.download(
url,
{
...queryParams,
dataCondition: data
},
`${fileName}_${new Date().getTime()}.xlsx`,
)
},
/** 关闭外侧弹框 */
closeDialogOuter() {
this.dialogConfig.outerVisible = false
},
/** 关闭内侧弹框 */
closeDialogInner() {
this.dialogConfig.innerVisible = false
},
/** 关闭弹框 由表单组件通知父组件关闭弹框的自定义事件 */
closeDialog(type) {
this.dialogConfig.outerVisible = false
if(type) {
this.$refs.tableRef.getTableList()
}
},
/** 手机号脱密处理 */
phoneCrypto(phoneNumber) {
let reg = /^(1[3-9][0-9])\d{4}(\d{4}$)/
let isMobile = reg.test(phoneNumber)
if (isMobile) {
return phoneNumber.replace(reg, "$1****$2")
}
return phoneNumber
}
}
}

View File

@ -0,0 +1,82 @@
<template>
<!-- 新购绑定页面 -->
<div class="app-container">
<PageHeader
v-if="isShowComponent !== 'Index'"
:pageContent="pageContent"
@goBack="goBack"
/>
<!-- 列表 -->
<TableModel
:formLabel="formLabel"
:columnsList="columnsList"
:request-api="queryPurchaseBindDetailsApi"
:tableQueryParams="sendParams"
ref="tableRef"
v-if="isShowComponent === 'Index'"
>
<template slot="handle" slot-scope="{ data }">
<el-button
type="danger"
size="mini"
@click="toggleBinding(data)"
>绑定</el-button
>
</template>
</TableModel>
</div>
</template>
<script>
import PageHeader from '@/components/pageHeader'
import { columnsList, dialogConfig, formLabel } from '../list-bind-config'
import { commonMixin } from '../../mixins/common'
import {
queryPurchaseBindDetailsApi
} from '@/api/purchase/binding'
export default {
name: 'arrivalBindingManage',
mixins: [commonMixin], //
components: { PageHeader },
props:{
sendParams: {
type: Object,
default: () => null,
}
},
created() {
console.log(this.sendParams,'this.sendParams')
},
methods: {
queryPurchaseBindDetailsApi,
goBack() {
this.isShowComponent = 'Index'
},
toggleBinding(data) {
this.sendData = data
console.log(data)
this.isShowComponent = 'list-binding'
}
},
data() {
return {
formLabel,
columnsList,
dialogConfig,
isShowComponent: 'Index',
pageContent: '新购绑定物资列表',
sendData: undefined
}
},
}
</script>

View File

@ -6,17 +6,16 @@ export const formLabel = [
{ f_label: '状态', f_model: 'keyWord', f_type: 'ipt' }, { f_label: '状态', f_model: 'keyWord', f_type: 'ipt' },
] ]
export const columnsList = [ export const columnsList = [
{ t_props: 'name', t_label: '到货时间', }, { t_props: 'arrivalTime', t_label: '到货时间', },
{ t_props: 'address', t_label: '采购单号' }, { t_props: 'purchaseCode', t_label: '采购单号' },
{ t_props: 'companyMan', t_label: '采购物资' }, { t_props: 'purchaseMaterial', t_label: '采购物资' },
{ t_props: 'mainPerson', t_label: '采购数量' }, { t_props: 'purchaseNum', t_label: '采购数量' },
{ t_props: 'phone', t_label: '采购价格(含税)', }, { t_props: 'purchasePrice', t_label: '采购价格(含税)', },
{ t_props: 'scopeBusiness', t_label: '采购价格(不含税)' }, { t_props: 'notaxPrice', t_label: '采购价格(不含税)' },
{ t_props: 'picUrl', t_label: '税率', }, { t_props: 'createBy', t_label: '操作人' },
{ t_props: 'notes', t_label: '操作人' }, { t_props: 'createTime', t_label: '操作时间' },
{ t_props: 'notes', t_label: '操作时间' }, { t_props: 'statusName', t_label: '状态' },
{ t_props: 'notes', t_label: '状态' }, { t_props: 'remark', t_label: '备注' },
{ t_props: 'notes', t_label: '备注' },
] ]
export const dialogConfig = { export const dialogConfig = {

View File

@ -1,86 +1,85 @@
<template> <template>
<!-- 往来单位管理页面 --> <!-- 新购绑定页面 -->
<div class="app-container"> <div class="app-container">
<PageHeader
v-if="isShowComponent !== 'Index'"
:pageContent="pageContent"
@goBack="goBack"
/>
<!-- 列表 --> <!-- 列表 -->
<TableModel <TableModel
:formLabel="formLabel" :formLabel="formLabel"
:columnsList="columnsList" :columnsList="columnsList"
:request-api="queryStorageConfigListApi" :request-api="queryPurchaseBindListApi"
ref="tableRef" ref="tableRef"
v-if="isShowComponent === 'Index'"
> >
<template slot="btn" slot-scope="{ queryParams }"> <template slot="btn" slot-scope="{ queryParams }">
<el-button @click="handleExportData(queryParams, 'base/customer/export', '往来单位清单')" <el-button @click="handleExportData(queryParams, 'base/customer/export', '新购绑定清单')"
>导出</el-button >导出</el-button
> >
</template> </template>
<template slot="handle" slot-scope="{ data }"> <template slot="handle" slot-scope="{ data }">
<!-- <el-button
type="warning"
size="mini"
>解绑</el-button
>-->
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click="handleEditData(data)" @click="handleEditData(data)"
>编辑</el-button >查看</el-button
> >
<el-button <el-button
type="danger" type="danger"
size="mini" size="mini"
@click="handleDeleteData(data.id, delStorageConfigListApi)" @click="toggleBinding(data)"
>删除</el-button >绑定</el-button
> >
</template> </template>
<!-- <template slot="isActive" slot-scope="{ data }">
{{ data.isActive == '1' ? '启用' : '不启用' }}
</template>
<template slot="phone" slot-scope="{ data }">
{{ phoneCrypto(data.phone) }}
</template>-->
</TableModel> </TableModel>
<!-- 新增以及修改时的弹框 --> <list-binding
<DialogModel v-if="isShowComponent === 'list-binding'"
:dialogConfig="dialogConfig" :sendParams='sendParams'
@closeDialogOuter="closeDialogOuter"
> >
<template slot="outerContent">
<!-- 新增以及修改数据的表单组件 --> </list-binding>
<FormBinding
@closeDialog="closeDialog"
:editParams="editParams"
/>
</template>
</DialogModel>
</div> </div>
</template> </template>
<script> <script>
import PageHeader from '@/components/pageHeader'
import { columnsList, dialogConfig, formLabel } from './config' import { columnsList, dialogConfig, formLabel } from './config'
import { commonMixin } from '../mixins/common' import { commonMixin } from '../mixins/common'
import FormBinding from './components/form-binding.vue' import ListBinding from './components/list-binding.vue'
import { import {
queryStorageConfigListApi, queryPurchaseBindListApi
delStorageConfigListApi } from '@/api/purchase/binding'
} from '@/api/material/storageConfig'
export default { export default {
name: 'arrivalBindingManage', name: 'arrivalBindingManage',
mixins: [commonMixin], // mixins: [commonMixin], //
components: { FormBinding }, components: { ListBinding, PageHeader },
methods: { methods: {
queryStorageConfigListApi, queryPurchaseBindListApi,
delStorageConfigListApi goBack() {
this.isShowComponent = 'Index'
},
toggleBinding(data) {
this.sendParams = {taskId:data.id}
console.log(data)
this.isShowComponent = 'list-binding'
}
}, },
data() { data() {
return { return {
formLabel, formLabel,
columnsList, columnsList,
dialogConfig, dialogConfig,
addDialogTitle: '新建仓库', // isShowComponent: 'Index',
editDialogTitle: '修改仓库', // pageContent: '新购绑定任务列表',
sendParams: {}
} }
}, },
} }

View File

@ -0,0 +1,21 @@
export const formLabel = [
{ f_label: '关键字', f_model: 'keyWord', f_type: 'ipt' },
{ f_label: '状态', f_model: 'keyWord', f_type: 'ipt' },
]
export const columnsList = [
{ t_props: 'arrivalTime', t_label: '物资名称', },
{ t_props: 'purchaseCode', t_label: '规格型号' },
{ t_props: 'purchaseMaterial', t_label: '到货数量' },
{ t_props: 'purchaseNum', t_label: '计量单位' },
{ t_props: 'purchasePrice', t_label: '供应商', },
{ t_props: 'notaxPrice', t_label: '出厂日期' },
{ t_props: 'createBy', t_label: '附件' },
{ t_props: 'status', t_label: '状态' },
]
export const dialogConfig = {
outerWidth: '80%',
outerTitle: '',
outerVisible: false,
}