106106 </template >
107107 <div class =" status-tag" >
108108 <el-tag type =" warning" v-if =" isWorkFlow(item.type)" style =" height : 22px " >
109- {{ $t('views.application.workflow') }}</ el-tag
110- >
109+ {{ $t('views.application.workflow') }}
110+ </ el-tag >
111111 <el-tag class =" blue-tag" v-else style =" height : 22px " >
112112 {{ $t('views.application.simple') }}
113113 </el-tag >
@@ -180,6 +180,8 @@ import { isWorkFlow } from '@/utils/application'
180180import { ValidType , ValidCount } from ' @/enums/common'
181181import { t } from ' @/locales'
182182import useStore from ' @/stores'
183+ import { reject } from ' lodash'
184+
183185const elUploadRef = ref <any >()
184186const { application, user, common } = useStore ()
185187const router = useRouter ()
@@ -195,6 +197,7 @@ const paginationConfig = reactive({
195197 page_size: 30 ,
196198 total: 0
197199})
200+
198201interface UserOption {
199202 label: string
200203 value: string
@@ -210,27 +213,29 @@ const apiInputParams = ref([])
210213
211214function copyApplication(row : any ) {
212215 application .asyncGetApplicationDetail (row .id , loading ).then ((res : any ) => {
213- CopyApplicationDialogRef .value .open ({ ... res .data , model_id: res .data .model })
216+ if (res ?.data ) {
217+ CopyApplicationDialogRef .value .open ({ ... res .data , model_id: res .data .model })
218+ }
214219 })
215220}
216221
217222const is_show_copy_button = (row : any ) => {
218223 return user .userInfo ? user .userInfo .id == row .user_id : false
219224}
225+
220226function settingApplication(row : any ) {
221227 if (isWorkFlow (row .type )) {
222228 router .push ({ path: ` /application/${row .id }/workflow ` })
223229 } else {
224230 router .push ({ path: ` /application/${row .id }/${row .type }/setting ` })
225231 }
226232}
233+
227234const exportApplication = (application : any ) => {
228235 applicationApi .exportApplication (application .id , application .name , loading ).catch ((e ) => {
229236 if (e .response .status !== 403 ) {
230237 e .response .data .text ().then ((res : string ) => {
231- MsgError (
232- ` ${t (' views.application.tip.ExportError' )}:${JSON .parse (res ).message } `
233- )
238+ MsgError (` ${t (' views.application.tip.ExportError' )}:${JSON .parse (res ).message } ` )
234239 })
235240 }
236241 })
@@ -239,35 +244,40 @@ const importApplication = (file: any) => {
239244 const formData = new FormData ()
240245 formData .append (' file' , file .raw , file .name )
241246 elUploadRef .value .clearFiles ()
242- applicationApi .importApplication (formData , loading ).then ((ok ) => {
243- searchHandle ()
244- })
247+ applicationApi
248+ .importApplication (formData , loading )
249+ .then (async (res : any ) => {
250+ if (res ?.data ) {
251+ searchHandle ()
252+ }
253+ })
254+ .catch ((e ) => {
255+ if (e .code === 400 ) {
256+ MsgConfirm (t (' common.tip' ), t (' views.application.tip.professionalMessage' ), {
257+ cancelButtonText: t (' common.confirm' ),
258+ confirmButtonText: t (' common.professional' )
259+ }).then (() => {
260+ window .open (' https://maxkb.cn/pricing.html' , ' _blank' )
261+ })
262+ }
263+ })
245264}
265+
246266function openCreateDialog() {
247- if (user .isEnterprise ()) {
248- CreateApplicationDialogRef .value .open ()
249- } else {
250- MsgConfirm (
251- t (' common.tip' ),
252- t (' views.application.tip.professionalMessage' ),
253- {
254- cancelButtonText: t (' common.confirm' ),
255- confirmButtonText: t (' common.professional' )
267+ common
268+ .asyncGetValid (ValidType .Application , ValidCount .Application , loading )
269+ .then (async (res : any ) => {
270+ if (res ?.data ) {
271+ CreateApplicationDialogRef .value .open ()
272+ } else if (res ?.code === 400 ) {
273+ MsgConfirm (t (' common.tip' ), t (' views.application.tip.professionalMessage' ), {
274+ cancelButtonText: t (' common.confirm' ),
275+ confirmButtonText: t (' common.professional' )
276+ }).then (() => {
277+ window .open (' https://maxkb.cn/pricing.html' , ' _blank' )
278+ })
256279 }
257- )
258- .then (() => {
259- window .open (' https://maxkb.cn/pricing.html' , ' _blank' )
260- })
261- .catch (() => {
262- common
263- .asyncGetValid (ValidType .Application , ValidCount .Application , loading )
264- .then (async (res : any ) => {
265- if (res ?.data ) {
266- CreateApplicationDialogRef .value .open ()
267- }
268- })
269- })
270- }
280+ })
271281}
272282
273283function searchHandle() {
@@ -361,6 +371,7 @@ function getList() {
361371 paginationConfig .total = res .data .total
362372 })
363373}
374+
364375function getUserList() {
365376 applicationApi .getUserList (' APPLICATION' , loading ).then ((res ) => {
366377 if (res .data ) {
@@ -394,33 +405,39 @@ onMounted(() => {
394405 background : var (--el-disabled-bg-color );
395406 border-radius : 8px ;
396407 box-sizing : border-box ;
408+
397409 & :hover {
398410 border : 1px solid var (--el-card-bg-color );
399411 background-color : var (--el-card-bg-color );
400412 }
413+
401414 .card-add-button {
402415 & :hover {
403416 border-radius : 4px ;
404417 background : var (--app-text-color-light-1 );
405418 }
419+
406420 :deep (.el-upload ) {
407421 display : block ;
408422 width : 100% ;
409423 color : var (--el-text-color-regular );
410424 }
411425 }
412426}
427+
413428.application-card {
414429 .status-tag {
415430 position : absolute ;
416431 right : 16px ;
417432 top : 15px ;
418433 }
419434}
435+
420436.dropdown-custom-switch {
421437 padding : 5px 11px ;
422438 font-size : 14px ;
423439 font-weight : 400 ;
440+
424441 span {
425442 margin-right : 26px ;
426443 }
0 commit comments