layUI In the table if else The number will be displayed in Chinese

When the data is put into the table for list display, it is inevitable to carry out work similar to dictionary code conversion , For example, in the database user The gender attribute in the table , In the table, for the convenience of reading operation, it is generally used 0,1 Instead of women , The two male characters , But the data must be converted and displayed after it is sent to the front desk ( Of course, it can also be converted in the background ~), If you don't convert, as shown in the figure below :
 Insert picture description here

It's easy to convert the code , Only need layUI Add if Sentence judgment is enough , The code is as follows :

var oaUserHolidyTable = tablePlus.render('oaUserHolidy-table', '/oa/userholidy', {
			formId: 'oaUserHolidy-query-form',
			cols: [[
				{type: 'numbers', width: 50, title: ' Serial number ', align: "center"},
                {field: 'name', title: ' user name ', align: "center"},
                {field: 'gender', title: ' Gender ', align: "center", templet: function(d){if(d.gender == 1){return ' male '}else{return ' Woman '}}},
                {field: 'status', title: ' state ', align: "center" },
				{title: " operation ", width: 120, align: "center",}
			]],
			page: true,
			queryTool: queryTool,
			cellTool: cellTool
		});

The compiled page is shown below :
 Insert picture description here


《END》