248f1b5f by renchao@pashanhoo.com

style:登记薄字典转换

1 parent 0feaffa7
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-10-20 10:17:28 4 * @LastEditTime: 2023-10-20 10:27:25
5 --> 5 -->
6 <template> 6 <template>
7 <div class="tableBox"> 7 <div class="tableBox">
...@@ -143,18 +143,23 @@ ...@@ -143,18 +143,23 @@
143 }, 143 },
144 methods: { 144 methods: {
145 getLable (prop, label) { 145 getLable (prop, label) {
146 let ztObj = { 146 const ztObj = {
147 0: '否', 147 0: '否',
148 1: '是' 148 1: '是'
149 } 149 };
150 if (['sfygdj', 'sfczjzhxz'].includes(prop)) { 150
151 return ztObj[label] 151 const strategies = {
152 } else if (prop == 'dyrlx') { 152 sfygdj: (label) => ztObj[label] || label,
153 let arr = this.dictData['A36'].filter(item => item.dcode === label) 153 sfczjzhxz: (label) => ztObj[label] || label,
154 return arr[0].dname; 154 dyrlx: (label) => {
155 } else { 155 let arr = this.dictData['A36'].filter(item => item.dcode === label);
156 return label 156 return arr.length > 0 ? arr[0].dname : label;
157 } 157 },
158 default: (label) => label
159 };
160
161 const strategy = strategies[prop] || strategies.default;
162 return strategy(label);
158 }, 163 },
159 openPrint () { 164 openPrint () {
160 this.render = true; 165 this.render = true;
......
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: miaofang 3 * @Autor: miaofang
4 * @LastEditTime: 2023-10-20 10:17:47 4 * @LastEditTime: 2023-10-20 10:28:07
5 --> 5 -->
6 <template> 6 <template>
7 <div class="djxxTable"> 7 <div class="djxxTable">
...@@ -156,18 +156,23 @@ ...@@ -156,18 +156,23 @@
156 }, 156 },
157 methods: { 157 methods: {
158 getLable (prop, label) { 158 getLable (prop, label) {
159 let ztObj = { 159 const ztObj = {
160 0: '否', 160 0: '否',
161 1: '是' 161 1: '是'
162 } 162 };
163 if (['sfygdj', 'sfczjzhxz'].includes(prop)) { 163
164 return ztObj[label] 164 const strategies = {
165 } else if (prop == 'dyrlx') { 165 sfygdj: (label) => ztObj[label] || label,
166 let arr = this.dictData['A36'].filter(item => item.dcode === label) 166 sfczjzhxz: (label) => ztObj[label] || label,
167 return arr[0].dname; 167 dyrlx: (label) => {
168 } else { 168 let arr = this.dictData['A36'].filter(item => item.dcode === label);
169 return label 169 return arr.length > 0 ? arr[0].dname : label;
170 } 170 },
171 default: (label) => label
172 };
173
174 const strategy = strategies[prop] || strategies.default;
175 return strategy(label);
171 }, 176 },
172 openPrint () { 177 openPrint () {
173 this.render = true; 178 this.render = true;
......