Recently, I encountered a requirement to set permissions for certain fields to display in other forms, such as displaying the amount that needs to be hidden as "***". 1. Get the amount authority 2. Filter the fields that meet the conditions through filter 3. Return the hidden style Look at the code: //For the rest, just look at what I marked. //scope.row gets the current row <template slot-scope="scope"> <template v-if="item.formType == 'label'"> <el-button v-if="item.link!=undefined" type="text" size="small" @click="handleColumnClick(item.link,scope.row)"> //filter is not generally used for filtering| //showLabelValue is not written out //The filter corresponding to one parameter of the method has two parameters //The first one is the value returned by the previous column //The N-1th one is the value you want to pass {{ scope.row | showLabelValue(item) | canViewAmount(canViewAmount,xtType,item) }} </el-button> <template v-else> {{ scope.row | showLabelValue(item) | canViewAmount(canViewAmount,xtType,item) }} </template> </template> </template> export default { filters: //row is the data returned by scope.rowshowLabelValue(row,item){ return 'value' } //value, canView permission, xtType which page, item list data //If showLabelValue returns value, the corresponding canViewAmount parameter value is 'value' canViewAmount(value, canView, xtType, item) { //If the conditions are met, "***" will be displayed (just display), and the content saved to the database is still the original list if (!canView && xtType == 'salesOrder') { if (item.field == 'priceNoTax' || item.field == 'amountNoTax' || item.field == 'price' || item.field == 'amount') { return '***' } } if (!canView && xtType == 'project') { if (item.field == 'amount' || item.field == 'amountNoTax') { return '***' } } return value } }, SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
>>: Detailed explanation of the use of IF(), IFNULL(), NULLIF(), and ISNULL() functions in MySQL
I rewrote my personal website recently. I bought ...
Component Basics 1 Component Reuse Components are...
Preface This article mainly introduces the releva...
1. Dynamic parameters Starting from 2.6.0, you ca...
When faced with a SQL statement that is not optim...
Last weekend, a brother project was preparing to ...
Overview This article will introduce the MVC arch...
Table of contents Multiple conditional statements...
<br />Original link: http://www.dudo.org/art...
I took the bus to work a few days ago. Based on m...
Overview of MySQL Partitioned Tables We often enc...
Solution: Just set the link's target attribute...
ARGB is a color mode, which is the RGB color mode...
Introduction Animation allows you to easily imple...
In the nginx process model, tasks such as traffic...