一开始为父组件的代码后为子组件要求只修改父组件的代码实现在选择业务类型后业务子类型的disabled状态为false

时间: 2024-10-23 14:19:15 浏览: 6
为了实现当选择业务类型后,业务子类型的 `disabled` 状态变为 `false`,你需要在父组件中监听业务类型的选择,并在选择后更新业务子类型的 `disabled` 状态。具体步骤如下: 1. **添加监听事件**:在父组件中添加一个方法来处理业务类型的变化,并在该方法中更新业务子类型的 `disabled` 状态。 2. **更新 `formConfig`**:在业务类型变化时,找到业务子类型的配置并将其 `disabled` 属性设为 `false`。 以下是修改后的父组件代码: ```html <template> <a-card :bordered="false"> <!-- 查询区域 --> <div class="table-page-search-wrapper" ref="searchContent"> <DynamicForm ref="dynamicForm" :formConfig="formConfig" @submit="searchConfig" @showMoreChange="showMoreChange" @resizeChange="showMoreChange" /> </div> <!-- 查询区域-END --> <!-- 操作按钮区域 --> <div class="table-operator"></div> <!-- 展示金额区域 --> <div class="moneyTotal"> <span>欠费金额(元):{{ arrearsMoney.toFixed(2) }}</span> <span>欠费用量(m³):{{ arrearsGas.toFixed(2) }}</span> </div> <!-- table区域-begin --> <div> <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 </div> <a-table ref="table" :size="tableSize" :scroll="{ x: true, y: tableHeight }" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="j-table-force-nowrap local-table" @change="handleTableChange" > <template slot="userSlot" slot-scope="text, record"> <a-tooltip placement="topLeft" v-if="text"> <template slot="title"> 户号:{{ record.householdNum }}<br> 户名:{{ record.householder }}<br> 地址:{{ record.address }} </template> <j-ellipsis-head :value="text" :classname="'blue'" :length="15"></j-ellipsis-head> </a-tooltip> </template> <template slot="amount" slot-scope="text, record"> <span v-if="record.billStatus === 0">{{ record.realPay || 0 }} / {{ record.amount }}</span> <span v-else>{{ record.amount }}</span> </template> <template slot="liquidatedAmount" slot-scope="text, record"> <span v-if="text || text == 0">{{ record.payedLiquidatedAmount.toFixed(2) }} / {{ text }}</span> <span v-else>-</span> </template> <template slot="publicNumSolt" slot-scope="text"> {{ text || (text == 0 ? 0 : '-') }} </template> <template slot="billStatusSlot" slot-scope="text, record"> <span :class="record.billStatus === 0 && record.billDelayDay && record.billDelayDay > 0 ? 'mark-red' : ''">{{ record.billStatus_dictText }}</span> </template> <template slot="billDelayDaySlot" slot-scope="text, record"> <span v-if="record.billStatus !== 0">-</span> <span v-else :class="record.billDelayDay > 0 ? 'mark-red' : ''">{{ record.billDelayDay }}</span> </template> <span slot="action" slot-scope="text, record"> <a @click="toDetail(record)">账单明细</a> <a-divider type="vertical" /> <a @click="toLiquidatedDamages(record)">违约金明细</a> </span> </a-table> <div class="selectedAndSetEmpty"> 已选择 {{ selectedRowKeys.length }} 项 <a-button @click="onClearSelected">清空</a-button> </div> <BottomSettingColumns :loading="loading" :settingColumns="settingColumns" :settingChecked="settingChecked" :serialNumber="serialNumber" @emitEvent="emitEvent" @changeSettingColumns="changeSettingColumns" /> </div> <biz-transaction-bill-item-list ref="billDetail"></biz-transaction-bill-item-list> <biz-liquidated-damages-item-list ref="liquidatedDamagesDetail"></biz-liquidated-damages-item-list> </a-card> </template> <script> import { initColumnsMixin } from '@/mixins/publicInitColumnsMixinNew'; import '@/assets/less/TableExpand.less'; import { mixinDevice } from '@/utils/mixin'; import { JeecgListMixin } from '@/mixins/JeecgListMixin'; import JDate from '@/components/jeecg/JDate.vue'; import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'; import BizTransactionBillItemList from './BizTransactionBillItemList.vue'; import BizLiquidatedDamagesItemList from './BizLiquidatedDamagesItemList.vue'; import JEllipsisHead from '@comp/jeecg/JEllipsisHead'; import { getAction, postAction } from '@/api/manage'; import moment from 'moment'; export default { name: 'BizTransactionBillList', mixins: [JeecgListMixin, mixinDevice, initColumnsMixin], components: { JDate, JSuperQuery, BizTransactionBillItemList, BizLiquidatedDamagesItemList, JEllipsisHead, }, props: { householdNum: { type: String, default: '', }, }, data() { return { formData: { configOrderMainType: '', configOrderSubType: '', }, formConfig: [ { label: '创建日期', type: 'date-custom', model: 'createTime_begin', props: { placeholder: '请选择开始时间' }, colSpan: { xl: 12, lg: 13, md: 15, sm: 24 }, model2: 'createTime_end', format: 'YYYY-MM-DD HH:mm:ss', format2: 'YYYY-MM-DD HH:mm:ss', isDate: true, }, { label: '表具编号', type: 'input', model: 'meterNum', props: { placeholder: '请输入表具编号' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, isDate: false, }, { label: '户名', type: 'input', model: 'householder', props: { placeholder: '请输入户名' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, isDate: false, }, { label: '户号', type: 'input', model: 'householdNum', props: { placeholder: '请输入户号' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, isDate: false, }, { label: '扣费时间', type: 'date-custom', model: 'billTime_begin', props: { placeholder: '请选择开始时间' }, colSpan: { xl: 12, lg: 13, md: 15, sm: 24 }, model2: 'billTime_end', format: 'YYYY-MM-DD HH:mm:ss', format2: 'YYYY-MM-DD HH:mm:ss', isDate: true, }, { label: '业务类型', type: 'dict-select', model: 'configOrderMainType', props: { placeholder: '请选择业务类型' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, dictCode: 'order_main_type', isDate: false, }, { label: '业务子类型', type: 'select', model: 'configOrderSubType', props: { placeholder: '请选择业务子类型' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, isDate: false, disabled: true, // 初始状态下禁用 }, { label: '扣费状态', type: 'dict-select', model: 'billStatus', props: { placeholder: '请选择扣费状态' }, colSpan: { xl: 6, lg: 7, md: 8, sm: 24 }, dictCode: 'biz_bill_status', isDate: false, }, ], description: '缴费账单管理界面', configOrderSubTypeList: [], btnSatus: false, // noCreate: true, // 表头 columns: [ { title: '账单号', align: 'center', width: 200, dataIndex: 'billId' }, { title: '户号', align: 'center', width: 150, dataIndex: 'householdNum', scopedSlots: { customRender: 'userSlot' } }, { title: '户名', align: 'center', width: 150, dataIndex: 'householder' }, { title: '表具编号', align: 'center', width: 150, dataIndex: 'meterNum' }, { title: '业务收费类型', align: 'center', width: 150, dataIndex: 'configOrderMainType_dictText' }, { title: '业务子类型', align: 'center', width: 150, dataIndex: 'configOrderSubType_dictText' }, { title: '上期读数(m³)', align: 'center', width: 150, dataIndex: 'preMeterRead', scopedSlots: { customRender: 'publicNumSolt' } }, { title: '本期读数(m³)', align: 'center', width: 150, dataIndex: 'curMeterRead', scopedSlots: { customRender: 'publicNumSolt' } }, { title: '已缴/总金额(元)', align: 'center', width: 150, scopedSlots: { customRender: 'amount' } }, { title: '违约金(元)', align: 'center', width: 150, dataIndex: 'liquidatedAmount', scopedSlots: { customRender: 'liquidatedAmount' } }, { title: '欠费用量(m³)', align: 'center', width: 150, dataIndex: 'debtGas' }, { title: '扣费状态', align: 'center', width: 150, scopedSlots: { customRender: 'billStatusSlot' } }, { title: '扣费时间', align: 'center', width: 150, dataIndex: 'billTime' }, { title: '逾期天数(天)', align: 'center', width: 150, scopedSlots: { customRender: 'billDelayDaySlot' } }, { title: '创建人', align: 'center', width: 150, dataIndex: 'createBy' }, { title: '创建日期', align: 'center', width: 150, dataIndex: 'createTime' }, { title: '操作', dataIndex: 'action', align: 'center', fixed: 'right', width: 147, scopedSlots: { customRender: 'action' } }, ], url: { list: '/web/bizTransactionBill/list', }, // 前端不传,由后端设置 isorter: { column: '', order: '' }, // 欠费用量 arrearsGas: 0, // 欠费金额 arrearsMoney: 0, dictOptions: {}, superFieldList: [], }; }, created() { this.excessHeight = 380; this.getSuperFieldList(); }, computed: { // 模拟Vuex getter isGasSearchShow() { return this.$store.getters.isGasSearchShow; }, }, methods: { loadOther() { if (this.householdNum) { this.btnSatus = true; this.queryParam.householdNum = this.householdNum; } }, updateTableHeight() { const headerHeight = 100; const footerHeight = 50; this.tableHeight = window.innerHeight - headerHeight - footerHeight; }, // 初始化默认值 initCreated() { if (!this.queryParam.householdNum) { this.queryParam.createTime_begin = moment().subtract(1, 'month').format('YYYY-MM-DD 00:00:00'); this.queryParam.createTime_end = moment().format('YYYY-MM-DD 23:59:59'); } this.queryParam = { ...this.queryParam }; }, // 获取欠费金额和欠费气量 getGasMoney() { getAction('/web/bizTransactionBill/arrearsGasAndMoney', this.queryParam).then((res) => { if (res.success) { this.arrearsGas = res.result.arrearsGas || 0; this.arrearsMoney = res.result.arrearsMoney || 0; } }); }, handelChange() { this.queryParam.configOrderSubType = undefined; // 更新业务子类型的 disabled 状态 this.updateConfigOrderSubTypeDisabled(); }, setConfigAct() { if (!this.isGasSearchShow) { this.formConfig = this.formConfig.filter((item) => item.model !== 'companyCode'); } const businessSubTypeItem = this.formConfig.find((item) => item.model === 'configOrderSubType'); const isRentalUserItem = this.formConfig.find((item) => item.model === 'isRentalUser'); const isLoneOldItem = this.formConfig.find((item) => item.model === 'isLoneOld'); const isornot = [{ value: '1', label: '是' }, { value: '0', label: '否' }]; if (isLoneOldItem) isLoneOldItem.options = isornot; if (isRentalUserItem) isRentalUserItem.options = isornot; const configOrderSubTypes = [ { value: 'subtype1', label: '工商户报装' }, { value: 'subtype2', label: '埋管' }, { value: 'subtype3', label: '检修' }, { value: 'subtype4', label: '系统扣费' }, ]; if (businessSubTypeItem) businessSubTypeItem.options = configOrderSubTypes; }, searchBillQuery() { this.searchQuery(); this.getGasMoney(); }, searchResetCustom() { if (this.householdNum) { this.queryParam = { householdNum: this.householdNum }; } else { this.queryParam = {}; } this.initCreated(); this.loadData(1); this.getGasMoney(); }, getConfigOrderSubTypeList() { if (this.queryParam.configOrderMainType) { getAction('/web/bizTransactionOrder/getOrderSubType', { configOrderMainType: this.queryParam.configOrderMainType }).then((res) => { if (res.code == 200) { this.configOrderSubTypeList = res.result; } }); } else { this.$message.warning('请选择业务类型!'); } }, initDictConfig() {}, getSuperFieldList() { let fieldList = []; fieldList.push({ type: 'string', value: 'meterNum', text: '表具编号' }); fieldList.push({ type: 'string', value: 'householdNum', text: '户号' }); fieldList.push({ type: 'string', value: 'companyCode', text: '公司编号' }); fieldList.push({ type: 'string', value: 'tranBillNum', text: '账单流水号' }); fieldList.push({ type: 'number', value: 'amount', text: '扣费金额' }); fieldList.push({ type: 'string', value: 'bizTypeCode', text: '服务编码' }); fieldList.push({ type: 'string', value: 'detail', text: '缴费明细' }); fieldList.push({ type: 'date', value: 'billTime', text: '扣费时间' }); fieldList.
阅读全文

相关推荐

最新推荐

recommend-type

vue中如何让子组件修改父组件数据

Vue 中子组件修改父组件数据 Vue 中子组件修改父组件数据是指在 Vue 中,子组件如何修改父组件的数据。这种情况在开发中经常遇到,...在实际开发中,我们需要根据具体情况选择合适的方式来实现子组件修改父组件数据。
recommend-type

父组件中vuex方法更新state子组件不能及时更新并渲染的完美解决方法

在Vue.js中,Vuex是最流行的状态管理器之一,但是在实际开发中,我们经常会遇到父组件中Vuex方法更新state子组件不能及时更新并渲染的问题。本文将详细介绍该问题的解决方法。 问题描述: 在父组件中,我们使用Vuex...
recommend-type

vue父组件向子组件动态传值的两种方法

在本文中,我们将介绍两种方法来实现父组件向子组件动态传值。 方法一:使用 Props 传值 在 Vue 中,我们可以使用 props 将数据从父组件传递给子组件。 props 是一个在 Vue 组件中定义的自定义属性,用于接收来自...
recommend-type

vue组件横向树实现代码

这段代码创建了一个名为 `transverseTree` 的 Vue 组件,它接受一个名为 `treeData` 的属性,这个属性应该是一个数组,包含了树形结构的数据。 ```html (column, index) in treeData"&gt; &lt;span class="root"&gt;{...
recommend-type

解决Vue2.x父组件与子组件之间的双向绑定问题

通过这种方式,我们可以实现父组件与子组件之间的双向绑定,实现在两个组件之间的数据同步。这种机制对构建复杂的Web应用程序至关重要。 本文介绍了如何使用Vue.js实现父组件与子组件之间的双向绑定问题的解决方案...
recommend-type

掌握Jive for Android SDK:示例应用的使用指南

资源摘要信息:"Jive for Android SDK 示例项目使用指南" Jive for Android SDK 是一个由 Jive 软件开发的开发套件,允许开发者在Android平台上集成Jive社区功能,如论坛、社交网络和内容管理等。Jive是一个企业社交软件平台,提供社交业务解决方案,允许企业创建和管理其内部和外部的社区和网络。这个示例项目则提供了一个基础框架,用于演示如何在Android应用程序中整合和使用Jive for Android SDK。 项目入门: 1. 项目依赖:开发者需要在项目的build.gradle文件中引入Jive for Android SDK的依赖项,才能使用SDK中的功能。开发者需要查阅Jive SDK的官方文档,以了解最新和完整的依赖配置方式。 2. wiki文档:Jive for Android SDK的wiki文档是使用该SDK的起点,为开发者提供详细的概念介绍、安装指南和API参考。这些文档是理解SDK工作原理和如何正确使用它的关键。 3. 许可证:Jive for Android SDK根据Apache许可证,版本2.0进行发布,意味着开发者可以自由地使用、修改和分享SDK,但必须遵守Apache许可证的条款。开发者必须理解许可证的规定,特别是关于保证、责任以及如何分发修改后的代码。 4. 贡献和CLA:如果开发者希望贡献代码到该项目,必须签署并提交Jive Software的贡献者许可协议(CLA),这是Jive软件的法律要求,以保护其知识产权。 Jive for Android SDK项目结构: 1. 示例代码:项目中可能包含一系列示例代码文件,展示如何实现常见的SDK功能,例如如何连接到Jive社区、如何检索内容、如何与用户互动等。 2. 配置文件:可能包含AndroidManifest.xml和其他配置文件,这些文件配置了应用的权限和所需的SDK设置。 3. 核心库文件:包含核心SDK功能的库文件,是实现Jive社区功能的基石。 Java标签说明: 该项目使用Java编程语言进行开发。Java是Android应用开发中最常用的编程语言之一,由于其跨平台、面向对象的特性和丰富的开源库支持,Java在Android应用开发中扮演了关键角色。 总结: 1. 本示例项目为开发者提供了一个了解和学习如何在Android应用中实现Jive社区功能的实用平台。 2. 项目管理遵循开源社区的标准操作流程,包括版权保护、代码贡献规则、以及许可证要求。 3. 开发者应当遵守Jive SDK的许可协议,并在贡献代码之前仔细阅读和理解CLA的内容。 4. 通过学习和使用该项目,开发者将能够利用Jive for Android SDK构建功能丰富的企业社交应用。 请注意,具体的项目文件名称列表 "jive-android-core-sdk-example-master" 指示了一个压缩包,包含所有上述资源。开发者应下载该项目并解压,以便探索源代码、查看示例、阅读wiki文档以及理解如何将Jive for Android SDK集成到他们的应用程序中。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

【JavaFX性能分析】:如何识别并解决自定义组件的瓶颈

![Java JavaFX 组件自定义](https://files.codingninjas.in/article_images/javafx-line-chart-1-1658465351.jpg) # 1. JavaFX自定义组件性能挑战概述 JavaFX是Sun公司推出的Java GUI工具包,用以构建和部署富客户端应用。与Swing相比,JavaFX更注重于提供现代的,丰富的用户界面体验,以及时尚的图形和动画效果。尽管如此,开发者在使用JavaFX进行自定义组件开发时,往往会面临性能上的挑战。这种性能挑战主要来自于用户对界面流畅度、交互响应时间及资源占用等性能指标的高要求。 本章
recommend-type

iframe引入天地图

iframe是一种HTML标签,它允许你在网页上嵌入另一个网页的内容,就像是把一个网页作为小部件插入到另一个网页中。如果你想在网站上引入天地图,你可以按照以下步骤操作: 1. 首先,访问天地图官方网站 (http://tianmap.com/) 获取API密钥,这通常需要注册并申请。 2. 在你的HTML页面中,创建一个新的`<iframe>`元素,并设置其`src`属性。例如,包含API参数的URL可能是类似这样的: ```html <iframe src="https://web.tianmap.com/maps?service=map&v=webapi&key=YOUR_
recommend-type

Python中的贝叶斯建模与概率编程指南

资源摘要信息: 《Python中的贝叶斯建模与概率编程》 本文档集提供了一系列关于在Python环境下使用贝叶斯建模和概率编程的资源,涵盖了从基本概念到高级应用的广泛知识。贝叶斯建模是一种统计建模方法,它使用贝叶斯定理来更新对不确定参数的概率估计。概率编程是一种编程范式,允许开发者使用高度抽象的语言来描述概率模型,并利用算法自动进行推理和学习。 知识点一:贝叶斯定理基础 贝叶斯定理是概率论中的一个基本定理,它描述了两个条件概率之间的关系。在贝叶斯建模中,该定理用于基于先验知识和新证据来更新对未知参数的信念。公式表示为P(A|B) = (P(B|A) * P(A)) / P(B),其中P(A|B)是在事件B发生的条件下事件A发生的条件概率;P(B|A)是在事件A发生的条件下事件B发生的条件概率;P(A)和P(B)分别是事件A和事件B的边缘概率。 知识点二:贝叶斯建模原理 贝叶斯建模是一种从数据中学习概率模型的方法,它考虑了参数的不确定性。在贝叶斯框架中,模型参数被视为随机变量,并赋予一个先验分布来表示在观察数据之前的信念。通过观察到的数据,可以计算参数的后验分布,即在给定数据的条件下参数的概率分布。 知识点三:概率编程语言 概率编程语言(PPL)是一种支持概率模型描述和推理的编程语言。这些语言通常具有高级抽象,允许用户以数学模型的形式指定问题,并自动执行计算。流行的概率编程语言包括PyMC3、Stan和TensorFlow Probability等,它们通常与Python结合使用。 知识点四:PyMC3应用 PyMC3是一个Python库,用于贝叶斯统计建模和概率编程。它提供了构建和执行贝叶斯模型的工具,包括随机变量的定义、概率分布的实现以及后验分布的推断。PyMC3利用了自动微分变分推断(ADVI)和马尔可夫链蒙特卡洛(MCMC)算法来高效地进行模型推断。 知识点五:斯坦模型(Stan Model) Stan是一种概率编程语言,专注于统计建模,其名称来源于统计学家Stanislaw Ulam。它设计用来进行高效的概率推理,支持多种推断算法,如NUTS(No-U-Turn采样器)和L-BFGS优化器。Stan模型可以使用其自己的语法进行编码,然后通过接口如Python的PyStan模块进行交互。 知识点六:贝叶斯模型推断方法 贝叶斯模型推断的目的是从先验分布和观测数据中得到后验分布。常用的方法包括马尔可夫链蒙特卡洛(MCMC)方法,如吉布斯采样和Metropolis-Hastings算法,以及变分推断,如自动微分变分推断(ADVI)。这些方法通过迭代地采样或优化来逼近后验分布。 知识点七:贝叶斯模型在实际问题中的应用 贝叶斯模型广泛应用于机器学习、数据科学和统计推断中。在实际问题中,它可以帮助解决分类问题、回归分析、时间序列预测、异常检测等任务。贝叶斯方法的优势在于其灵活性和能够自然地处理不确定性和模型不确定性。 知识点八:贝叶斯建模的挑战与展望 虽然贝叶斯建模提供了强大的统计推断工具,但它也面临着计算复杂性和高维参数空间的挑战。此外,选择合适的先验分布和理解模型结果同样具有挑战性。随着算法和计算能力的发展,贝叶斯方法的应用范围和效率得到了极大的提升,预计未来会在更多领域得到广泛应用。 这些知识点覆盖了从贝叶斯建模和概率编程的基础理论到实践应用的全方位内容,为希望深入理解和应用这一领域的研究者和从业者提供了宝贵的资源和工具。通过这些资源,用户可以学习如何利用Python进行贝叶斯模型的构建和推断,进而解决复杂的统计问题。