Commit 59610ed461804d9b0d6c716a46812dc8df47a160

Authored by 史婷婷
1 parent 71249014

feat: 开发管理-代码格式化

Showing 1 changed file with 246 additions and 244 deletions
@@ -5,21 +5,23 @@ @@ -5,21 +5,23 @@
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ form.customer.name }}</text> 6 <text class="row customer">{{ form.customer.name }}</text>
7 <view :class="['status', `status_${form.status}`]" /> 7 <view :class="['status', `status_${form.status}`]" />
8 - <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshop ? form.workshop.name : '' }}</text> 8 + <view class="row"><text class="label">生产厂</text><text class="value">{{ form.workshop ?
  9 + form.workshop.name : '' }}</text>
9 </view> 10 </view>
10 - <view class="row"><text class="label">科办</text><text class="value">{{ form.office ? form.office.name : '' }}</text> 11 + <view class="row"><text class="label">科办</text><text class="value">{{ form.office ? form.office.name
  12 + : '' }}</text>
11 </view> 13 </view>
12 - <view class="row"><text class="label">客户类型</text><text  
13 - class="value">{{ getDicName('ENTERPRISE_TYPE', form.customerType, customerTypeOptions) }}</text> 14 + <view class="row"><text class="label">客户类型</text><text class="value">{{
  15 + getDicName('ENTERPRISE_TYPE', form.customerType, customerTypeOptions) }}</text>
14 </view> 16 </view>
15 - <view class="row"><text class="label">产品品种</text><text  
16 - class="value">{{ form.productVariety.name }}</text></view> 17 + <view class="row"><text class="label">产品品种</text><text class="value">{{ form.productVariety.name
  18 + }}</text></view>
17 <view class="row"><text class="label">月用量</text><text class="value">{{ form.monthlyUsage }}</text> 19 <view class="row"><text class="label">月用量</text><text class="value">{{ form.monthlyUsage }}</text>
18 </view> 20 </view>
19 <view class="row"><text class="label">目标量</text><text class="value">{{ form.targetQuantity }}</text> 21 <view class="row"><text class="label">目标量</text><text class="value">{{ form.targetQuantity }}</text>
20 </view> 22 </view>
21 <view class="row"><text class="label">行业</text><text class="value">{{ form.industry }}</text></view> 23 <view class="row"><text class="label">行业</text><text class="value">{{ form.industry }}</text></view>
22 - <view class="row"><text class="label">创建日期</text><text class="value">{{ form.createTime }}</text> 24 + <view class="row"><text class="label">创建日期</text><text class="value">{{ form.createTime }}</text>
23 </view> 25 </view>
24 </view> 26 </view>
25 <view class="section"> 27 <view class="section">
@@ -27,10 +29,10 @@ @@ -27,10 +29,10 @@
27 <view class="row"><text class="label">厚度</text><text class="value">{{ form.thickness }}</text> 29 <view class="row"><text class="label">厚度</text><text class="value">{{ form.thickness }}</text>
28 </view> 30 </view>
29 <view class="row"><text class="label">宽度</text><text class="value">{{ form.width }}</text></view> 31 <view class="row"><text class="label">宽度</text><text class="value">{{ form.width }}</text></view>
30 - <view class="row"><text class="label">材质要求</text><text  
31 - class="value">{{ form.materialRequire }}</text></view>  
32 - <view class="row"><text class="label">品质要求</text><text  
33 - class="value">{{ form.qualityRequire }}</text></view> 32 + <view class="row"><text class="label">材质要求</text><text class="value">{{ form.materialRequire
  33 + }}</text></view>
  34 + <view class="row"><text class="label">品质要求</text><text class="value">{{ form.qualityRequire
  35 + }}</text></view>
34 <view class="row"><text class="label">同行</text><text class="value">{{ form.peer }}</text></view> 36 <view class="row"><text class="label">同行</text><text class="value">{{ form.peer }}</text></view>
35 </view> 37 </view>
36 <view class="section"> 38 <view class="section">
@@ -45,269 +47,269 @@ @@ -45,269 +47,269 @@
45 </view> 47 </view>
46 </view> 48 </view>
47 </scroll-view> 49 </scroll-view>
48 - <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> 50 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
49 </view> 51 </view>
50 </template> 52 </template>
51 53
52 <script> 54 <script>
53 - import {  
54 - getDetailApi,  
55 - cancelApi  
56 - } from '@/api/devManage.js'  
57 - import {  
58 - getDicName  
59 - } from '@/utils/dic.js'  
60 - import {  
61 - getDicByCodeApi  
62 - } from '@/api/base.js'  
63 - import DetailButtons from '@/components/detail-buttons/index.vue' 55 +import {
  56 + getDetailApi,
  57 + cancelApi
  58 +} from '@/api/devManage.js'
  59 +import {
  60 + getDicName
  61 +} from '@/utils/dic.js'
  62 +import {
  63 + getDicByCodeApi
  64 +} from '@/api/base.js'
  65 +import DetailButtons from '@/components/detail-buttons/index.vue'
64 66
65 - export default {  
66 - name: 'DevManageDetail',  
67 - components: {  
68 - DetailButtons 67 +export default {
  68 + name: 'DevManageDetail',
  69 + components: {
  70 + DetailButtons
  71 + },
  72 + data() {
  73 + return {
  74 + form: {
  75 + workshop: {},
  76 + office: {},
  77 + customer: {},
  78 + customerType: '',
  79 + chargeUserId: '',
  80 + chargeUserIdName: '',
  81 + productVariety: {},
  82 + monthlyUsage: '',
  83 + targetQuantity: '',
  84 + industry: '',
  85 + mark: '',
  86 + thickness: '',
  87 + width: '',
  88 + materialRequire: '',
  89 + qualityRequire: '',
  90 + peer: '',
  91 + pricingMode: '',
  92 + settleDays: '',
  93 + createTime: '',
  94 + status: ''
  95 + },
  96 + customerTypeOptions: [],
  97 + todoType: '',
  98 + buttons: [{
  99 + text: '编辑',
  100 + visible: true,
  101 + variant: 'outline',
  102 + event: 'edit',
  103 + },
  104 + {
  105 + text: '审核详情',
  106 + visible: true,
  107 + variant: 'outline',
  108 + event: 'auditDetail'
  109 + },
  110 + {
  111 + text: '审核',
  112 + visible: true,
  113 + variant: 'primary',
  114 + event: 'audit'
  115 + },
  116 + {
  117 + text: '取消',
  118 + visible: true,
  119 + variant: 'outline',
  120 + event: 'cancel',
  121 + style: {
  122 + color: 'rgba(0,0,0,0.9)',
  123 + border: '1px solid #DCDCDC'
  124 + }
  125 + }
  126 + ],
  127 + }
  128 + },
  129 + computed: {
  130 + displayButtons() {
  131 + const s = Number(this.form && this.form.status || 0)
  132 + const t = this.todoType || ''
  133 + return [
  134 + { ...this.buttons[0], visible: (s === 3 && t === '' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:modify')) },
  135 + { ...this.buttons[1], visible: this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:reviewDetail') },
  136 + { ...this.buttons[2], visible: (s === 1 && t === 'WAIT' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:review')) },
  137 + { ...this.buttons[3], visible: (s === 3 && t === '' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:close')) }
  138 + ]
  139 + }
  140 + },
  141 + created() {
  142 + this.loadCustomerTypeOptions()
  143 + },
  144 + onShow() {
  145 + uni.$on('dev_manage_detail_reload', this.onReload)
  146 + },
  147 + onUnload() {
  148 + uni.$off('dev_manage_detail_reload', this.onReload)
  149 + },
  150 + onLoad(query) {
  151 + const id = (query && (query.id || query.code)) || ''
  152 + const t = (query && (query.todoType)) || ''
  153 + this.todoType = t
  154 + if (id) this.loadDetail(id)
  155 + },
  156 + methods: {
  157 + onReload(payload) {
  158 + const id = (payload && (payload.id || payload.code)) || this.form.id || this.form.code || ''
  159 + if (id) this.loadDetail(id)
  160 + },
  161 + async loadDetail(id) {
  162 + try {
  163 + const res = await getDetailApi(id)
  164 + console.log('getDetailApi res', res)
  165 + const data = res.data || {};
  166 + this.form = {
  167 + ...data
  168 + }
  169 + } catch (e) {
  170 + console.error('loadDetail error', e)
  171 + }
69 }, 172 },
70 - data() {  
71 - return {  
72 - form: {  
73 - workshop: {},  
74 - office: {},  
75 - customer: {},  
76 - customerType: '',  
77 - chargeUserId: '',  
78 - chargeUserIdName: '',  
79 - productVariety: {},  
80 - monthlyUsage: '',  
81 - targetQuantity: '',  
82 - industry: '',  
83 - mark: '',  
84 - thickness: '',  
85 - width: '',  
86 - materialRequire: '',  
87 - qualityRequire: '',  
88 - peer: '',  
89 - pricingMode: '',  
90 - settleDays: '',  
91 - createTime: '',  
92 - status: ''  
93 - },  
94 - customerTypeOptions: [],  
95 - todoType: '',  
96 - buttons: [{  
97 - text: '编辑',  
98 - visible: true,  
99 - variant: 'outline',  
100 - event: 'edit',  
101 - },  
102 - {  
103 - text: '审核详情',  
104 - visible: true,  
105 - variant: 'outline',  
106 - event: 'auditDetail'  
107 - },  
108 - {  
109 - text: '审核',  
110 - visible: true,  
111 - variant: 'primary',  
112 - event: 'audit'  
113 - },  
114 - {  
115 - text: '取消',  
116 - visible: true,  
117 - variant: 'outline',  
118 - event: 'cancel',  
119 - style: {  
120 - color: 'rgba(0,0,0,0.9)',  
121 - border: '1px solid #DCDCDC'  
122 - }  
123 - }  
124 - ],  
125 - }  
126 - },  
127 - computed: {  
128 - displayButtons() {  
129 - const s = Number(this.form && this.form.status || 0)  
130 - const t = this.todoType || ''  
131 - return [  
132 - { ...this.buttons[0], visible: (s === 3 && t === '' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:modify')) },  
133 - { ...this.buttons[1], visible: this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:reviewDetail') },  
134 - { ...this.buttons[2], visible: (s === 1 && t === 'WAIT' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:review')) },  
135 - { ...this.buttons[3], visible: (s === 3 && t === '' && this.$auth.hasPermi('customer-dev-manage:customer-dev-plan:close')) }  
136 - ]  
137 - }  
138 - },  
139 - created() {  
140 - this.loadCustomerTypeOptions() 173 + async loadCustomerTypeOptions() {
  174 + try {
  175 + const res = await getDicByCodeApi('ENTERPRISE_TYPE')
  176 + const list = res.data || []
  177 + this.customerTypeOptions = Array.isArray(list) ? list : []
  178 + } catch (e) {
  179 + this.customerTypeOptions = []
  180 + }
141 }, 181 },
142 - onShow() {  
143 - uni.$on('dev_manage_detail_reload', this.onReload) 182 + getDicName: getDicName,
  183 + handleButtonClick(btn) {
  184 + if (!btn || btn.disabled) return
  185 + if (typeof btn.onClick === 'function') return btn.onClick(this.form, btn.params)
  186 + const e = btn.event || ''
  187 + if (e === 'edit') return this.onEdit(btn && btn.params)
  188 + if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)
  189 + if (e === 'audit') return this.onAudit(btn && btn.params)
  190 + if (e === 'cancel') return this.onCancel(btn && btn.params)
144 }, 191 },
145 - onUnload() {  
146 - uni.$off('dev_manage_detail_reload', this.onReload) 192 + onEdit() {
  193 + const id = this.form.id || this.form.code || ''
  194 + const query = id ? ('?id=' + encodeURIComponent(id)) : ''
  195 + uni.navigateTo({
  196 + url: '/pages/dev_manage/modify' + query
  197 + })
147 }, 198 },
148 - onLoad(query) {  
149 - const id = (query && (query.id || query.code)) || ''  
150 - const t = (query && (query.todoType)) || ''  
151 - this.todoType = t  
152 - if (id) this.loadDetail(id)  
153 - },  
154 - methods: {  
155 - onReload(payload) {  
156 - const id = (payload && (payload.id || payload.code)) || this.form.id || this.form.code || ''  
157 - if (id) this.loadDetail(id)  
158 - },  
159 - async loadDetail(id) {  
160 - try {  
161 - const res = await getDetailApi(id)  
162 - console.log('getDetailApi res', res)  
163 - const data = res.data || {};  
164 - this.form = {  
165 - ...data 199 + onAuditDetail() {
  200 + const CACHE_KEY = 'sourceBusinessId';
  201 + uni.setStorageSync(CACHE_KEY, this.form.id)
  202 + uni.navigateTo({ url: '/pages/flow/audit_detail' })
  203 + },
  204 + onAudit() {
  205 + const CACHE_KEY = 'sourceBusinessId';
  206 + uni.setStorageSync(CACHE_KEY, this.form.id);
  207 + uni.navigateTo({ url: '/pages/flow/audit' })
  208 + },
  209 + onCancel() {
  210 + const id = this.form && (this.form.id || this.form.code) || ''
  211 + if (!id) return
  212 + uni.showModal({
  213 + title: '系统提示',
  214 + content: '是否确定取消该流程?',
  215 + confirmText: '确定',
  216 + cancelText: '取消',
  217 + success: (res) => {
  218 + if (res && res.confirm) {
  219 + cancelApi(id).then(() => {
  220 + uni.showToast({ title: '已取消', icon: 'none' })
  221 + setTimeout(() => {
  222 + uni.redirectTo({ url: '/pages/dev_manage/index' })
  223 + }, 300)
  224 + }).catch(() => {
  225 + uni.showToast({ title: '取消失败', icon: 'none' })
  226 + })
166 } 227 }
167 - } catch (e) {  
168 - console.error('loadDetail error', e)  
169 - }  
170 - },  
171 - async loadCustomerTypeOptions() {  
172 - try {  
173 - const res = await getDicByCodeApi('ENTERPRISE_TYPE')  
174 - const list = res.data || []  
175 - this.customerTypeOptions = Array.isArray(list) ? list : []  
176 - } catch (e) {  
177 - this.customerTypeOptions = []  
178 } 228 }
179 - },  
180 - getDicName: getDicName,  
181 - handleButtonClick(btn) {  
182 - if (!btn || btn.disabled) return  
183 - if (typeof btn.onClick === 'function') return btn.onClick(this.form, btn.params)  
184 - const e = btn.event || ''  
185 - if (e === 'edit') return this.onEdit(btn && btn.params)  
186 - if (e === 'auditDetail') return this.onAuditDetail(btn && btn.params)  
187 - if (e === 'audit') return this.onAudit(btn && btn.params)  
188 - if (e === 'cancel') return this.onCancel(btn && btn.params)  
189 - },  
190 - onEdit() {  
191 - const id = this.form.id || this.form.code || ''  
192 - const query = id ? ('?id=' + encodeURIComponent(id)) : ''  
193 - uni.navigateTo({  
194 - url: '/pages/dev_manage/modify' + query  
195 - })  
196 - },  
197 - onAuditDetail() {  
198 - const CACHE_KEY = 'sourceBusinessId';  
199 - uni.setStorageSync(CACHE_KEY, this.form.id)  
200 - uni.navigateTo({ url: '/pages/flow/audit_detail' })  
201 - },  
202 - onAudit() {  
203 - const CACHE_KEY = 'sourceBusinessId';  
204 - uni.setStorageSync(CACHE_KEY, this.form.id);  
205 - uni.navigateTo({ url: '/pages/flow/audit' })  
206 - },  
207 - onCancel() {  
208 - const id = this.form && (this.form.id || this.form.code) || ''  
209 - if (!id) return  
210 - uni.showModal({  
211 - title: '系统提示',  
212 - content: '是否确定取消该流程?',  
213 - confirmText: '确定',  
214 - cancelText: '取消',  
215 - success: (res) => {  
216 - if (res && res.confirm) {  
217 - cancelApi(id).then(() => {  
218 - uni.showToast({ title: '已取消', icon: 'none' })  
219 - setTimeout(() => {  
220 - uni.redirectTo({ url: '/pages/dev_manage/index' })  
221 - }, 300)  
222 - }).catch(() => {  
223 - uni.showToast({ title: '取消失败', icon: 'none' })  
224 - })  
225 - }  
226 - }  
227 - })  
228 - } 229 + })
229 } 230 }
230 } 231 }
  232 +}
231 </script> 233 </script>
232 234
233 <style lang="scss" scoped> 235 <style lang="scss" scoped>
234 - .page {  
235 - display: flex;  
236 - flex-direction: column;  
237 - height: 100%;  
238 - }  
239 -  
240 - .scroll {  
241 - flex: 1;  
242 - padding: 8rpx 0 144rpx 0;  
243 - } 236 +.page {
  237 + display: flex;
  238 + flex-direction: column;
  239 + height: 100%;
  240 +}
244 241
245 - .detail-page {  
246 - background: #f3f3f3;  
247 - } 242 +.scroll {
  243 + flex: 1;
  244 + padding: 8rpx 0 144rpx 0;
  245 +}
248 246
249 - .section {  
250 - padding: 32rpx;  
251 - background: #fff;  
252 - margin-bottom: 20rpx;  
253 - position: relative; 247 +.detail-page {
  248 + background: #f3f3f3;
  249 +}
254 250
255 - .status {  
256 - position: absolute;  
257 - top: 16rpx;  
258 - right: 52rpx;  
259 - width: 180rpx;  
260 - height: 146rpx;  
261 - background-repeat: no-repeat;  
262 - background-size: 100% 100%;  
263 - background-position: center; 251 +.section {
  252 + padding: 32rpx;
  253 + background: #fff;
  254 + margin-bottom: 20rpx;
  255 + position: relative;
264 256
265 - &_1 {  
266 - background-image: url('~@/static/images/dev_manage/status_1.png');  
267 - } 257 + .status {
  258 + position: absolute;
  259 + top: 16rpx;
  260 + right: 52rpx;
  261 + width: 180rpx;
  262 + height: 146rpx;
  263 + background-repeat: no-repeat;
  264 + background-size: 100% 100%;
  265 + background-position: center;
268 266
269 - &_2 {  
270 - background-image: url('~@/static/images/dev_manage/status_2.png');  
271 - } 267 + &_1 {
  268 + background-image: url('~@/static/images/dev_manage/status_1.png');
  269 + }
272 270
273 - &_3 {  
274 - background-image: url('~@/static/images/dev_manage/status_3.png');  
275 - } 271 + &_2 {
  272 + background-image: url('~@/static/images/dev_manage/status_2.png');
  273 + }
276 274
277 - &_4 {  
278 - background-image: url('~@/static/images/dev_manage/status_4.png');  
279 - } 275 + &_3 {
  276 + background-image: url('~@/static/images/dev_manage/status_3.png');
  277 + }
280 278
  279 + &_4 {
  280 + background-image: url('~@/static/images/dev_manage/status_4.png');
281 } 281 }
282 282
283 - .row {  
284 - display: flex;  
285 - margin-bottom: 28rpx; 283 + }
286 284
287 - &:last-child {  
288 - margin-bottom: 0;  
289 - } 285 + .row {
  286 + display: flex;
  287 + margin-bottom: 28rpx;
290 288
291 - &.customer {  
292 - font-size: 36rpx;  
293 - font-weight: 600;  
294 - color: rgba(0, 0, 0, 0.9);  
295 - } 289 + &:last-child {
  290 + margin-bottom: 0;
  291 + }
296 292
297 - .label {  
298 - width: 120rpx;  
299 - line-height: 32rpx;  
300 - font-size: 28rpx;  
301 - color: rgba(0, 0, 0, 0.6);  
302 - } 293 + &.customer {
  294 + font-size: 36rpx;
  295 + font-weight: 600;
  296 + color: rgba(0, 0, 0, 0.9);
  297 + }
303 298
304 - .value {  
305 - flex: 1;  
306 - line-height: 32rpx;  
307 - font-size: 28rpx;  
308 - color: rgba(0, 0, 0, 0.9);  
309 - text-align: right;  
310 - } 299 + .label {
  300 + width: 120rpx;
  301 + line-height: 32rpx;
  302 + font-size: 28rpx;
  303 + color: rgba(0, 0, 0, 0.6);
  304 + }
  305 +
  306 + .value {
  307 + flex: 1;
  308 + line-height: 32rpx;
  309 + font-size: 28rpx;
  310 + color: rgba(0, 0, 0, 0.9);
  311 + text-align: right;
311 } 312 }
312 } 313 }
  314 +}
313 </style> 315 </style>