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
Python connects to MySQL to modify and query data...
Vue router transitions are a quick and easy way t...
Table of contents Congruent and Incongruent congr...
What is a carousel? Carousel: In a module or wind...
Table of contents 1. Preparation Pull the redis i...
Table of contents 1. Some concepts you need to un...
Let our users choose whether to move forward or ba...
Table of contents Overview Checking setTimeout() ...
In this post, we’ll use the :placeholder-shown ps...
Zabbix server environment platform ZABBIX version...
At present, most people who use Linux either use ...
I recently started learning the NestJs framework....
1. Install Howdy: howdy project address sudo add-...
This article shares the installation of MySQL 5.7...
The mysql 5.7.18 zip version of MySQL is not like...