From ddd0bc26f55d400cd252743efe9ff3ef4664bea3 Mon Sep 17 00:00:00 2001 From: bonus <1203338439@qq.com> Date: Thu, 22 Aug 2024 10:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E7=BB=91=E5=AE=9A=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/purchase/binding.js | 21 +++++ src/components/TableModel/index.vue | 54 ++++-------- src/views/base/mixins/common.js | 75 +++++++++++++++++ .../binding/components/list-binding.vue | 82 +++++++++++++++++++ src/views/purchase/binding/config.js | 21 +++-- src/views/purchase/binding/index.vue | 75 +++++++++-------- .../purchase/binding/list-bind-config.js | 21 +++++ 7 files changed, 260 insertions(+), 89 deletions(-) create mode 100644 src/api/purchase/binding.js create mode 100644 src/views/base/mixins/common.js create mode 100644 src/views/purchase/binding/components/list-binding.vue create mode 100644 src/views/purchase/binding/list-bind-config.js diff --git a/src/api/purchase/binding.js b/src/api/purchase/binding.js new file mode 100644 index 0000000..75d382a --- /dev/null +++ b/src/api/purchase/binding.js @@ -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 + }) +} + + + + diff --git a/src/components/TableModel/index.vue b/src/components/TableModel/index.vue index f707c97..3222de2 100644 --- a/src/components/TableModel/index.vue +++ b/src/components/TableModel/index.vue @@ -197,11 +197,6 @@ export default { type: Boolean, default: true, }, - /** 传递参数 */ - sendParams: { - type: Object, - default: () => null - }, /** 是否显示查询按钮 */ showSearchBtn: { type: Boolean, @@ -272,7 +267,6 @@ export default { }, created() { - console.log(this.sendParams) this.columCheckList = this.columnsList.map(e => { this.$set(e, 'checked', true) return e @@ -281,23 +275,15 @@ export default { this.formLabel.map(e => { this.$set(this.queryParams, e.f_model, '') // 设置表单必填 - if(e.f_rule) { - this.$set(this.formRules, e.f_rule, [ - { - required: true, - message: `请填写${e.f_label}`, - trigger: 'blur' - } - ]) - } + this.$set(this.formRules, e.f_rule, [ + { + required: true, + message: `请填写${e.f_label}`, + trigger: 'blur' + } + ]) }) - if(this.sendParams !== null) { - 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]) - } */ - } + // Object.assign(this.queryParams, this.sendParams) this.getTableList() }, updated() { @@ -307,10 +293,10 @@ export default { methods: { /** 获取列表数据 */ async getTableList() { - if(Object.keys(this.formRules).length !== 0) { this.$refs.queryFormRef.validate(async valid => { if (valid) { this.loading = true + console.log(this.queryParams) const res = await this.requestApi(this.queryParams) this.loading = false 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() { @@ -365,6 +336,7 @@ export default { func, prop ) { + console.log(prop) this.queryParams[val] = e[e.length - 1] let setObj = {} // 合并 @@ -372,12 +344,13 @@ export default { Object.assign(setObj, prop) } // 设置id自增 - /* this.$set(setObj, 'id', this.idCount) - this.idCount++ */ + 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) @@ -387,6 +360,7 @@ export default { } this.tableList.unshift(setObj) console.log(this.tableList) + }, /** 动态设置操作列的列宽 */ getOperatorWidth() { diff --git a/src/views/base/mixins/common.js b/src/views/base/mixins/common.js new file mode 100644 index 0000000..cb42245 --- /dev/null +++ b/src/views/base/mixins/common.js @@ -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 + } + } +} diff --git a/src/views/purchase/binding/components/list-binding.vue b/src/views/purchase/binding/components/list-binding.vue new file mode 100644 index 0000000..59e893b --- /dev/null +++ b/src/views/purchase/binding/components/list-binding.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/views/purchase/binding/config.js b/src/views/purchase/binding/config.js index fe946b9..1f992b4 100644 --- a/src/views/purchase/binding/config.js +++ b/src/views/purchase/binding/config.js @@ -6,17 +6,16 @@ export const formLabel = [ { f_label: '状态', f_model: 'keyWord', f_type: 'ipt' }, ] export const columnsList = [ - { t_props: 'name', t_label: '到货时间', }, - { t_props: 'address', t_label: '采购单号' }, - { t_props: 'companyMan', t_label: '采购物资' }, - { t_props: 'mainPerson', 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: 'notes', t_label: '备注' }, + { 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: 'createTime', t_label: '操作时间' }, + { t_props: 'statusName', t_label: '状态' }, + { t_props: 'remark', t_label: '备注' }, ] export const dialogConfig = { diff --git a/src/views/purchase/binding/index.vue b/src/views/purchase/binding/index.vue index c73ecee..c051705 100644 --- a/src/views/purchase/binding/index.vue +++ b/src/views/purchase/binding/index.vue @@ -1,86 +1,85 @@