Browse Source

reactor:解决v-if和自定义指令冲突的问题

zhangchong 1 tháng trước cách đây
mục cha
commit
ba2134ed5a

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ VITE_MODE_NAME=development
 # 防止部署多套系统到同一域名不同目录时,变量共用的问题 设置不同的前缀
 VITE_STORAGE_NAME=dev
 # 业务系统基础请求地址
-VITE_API_URL=http://110.188.24.28:50300
+VITE_API_URL=http://110.188.24.28:50100
 # 业务系统socket请求地址
 VITE_API_SOCKET_URL=http://110.188.24.28:50100/hubs/hotline
 # 业务系统文件上传上传请求地址

+ 6 - 0
src/directive/authDirective.ts

@@ -19,6 +19,9 @@ export function authDirective(app: App) {
 	// 多个权限验证,满足一个则显示(v-auths="[xxx,xxx]")
 	app.directive('auths', {
 		mounted(el, binding) {
+			if (!binding.value) {
+				el.parentNode && el.parentNode.removeChild(el);
+			}
 			let flag = false;
 			const stores = useUserInfo();
 			stores.userInfos.authBtnList?.map((val: string) => {
@@ -32,6 +35,9 @@ export function authDirective(app: App) {
 	// 多个权限验证,全部满足则显示(v-auth-all="[xxx,xxx]")
 	app.directive('auth-all', {
 		mounted(el, binding) {
+			if (!binding.value) {
+				el.parentNode && el.parentNode.removeChild(el);
+			}
 			const stores = useUserInfo();
 			const flag = judgementSameArr(binding.value, stores.userInfos.authBtnList);
 			if (!flag) el.parentNode.removeChild(el);

+ 2 - 2
src/views/business/delay/audit.vue

@@ -30,7 +30,7 @@
 						type="primary"
 						@click="onAuditBatch"
 						:disabled="isChecked"
-						v-if="state.queryParams.IsApply === 'false'"
+						v-show="state.queryParams.IsApply === 'false'"
 						:loading="state.loading"
 						v-auth="'business:delay:audit:batch'"
 						><SvgIcon name="ele-Edit" class="mr5" />批量审批<span v-if="checkTable.length">({{ checkTable.length }})</span>
@@ -121,7 +121,7 @@
 								@click="onAudit(row)"
 								title="审批"
 								v-auth="'business:delay:audit:todo'"
-								v-if="state.queryParams.IsApply === 'false'"
+								v-show="state.queryParams.IsApply === 'false'"
 							>
 								审批
 							</el-button>

+ 1 - 1
src/views/business/discern/YBApply.vue

@@ -119,7 +119,7 @@
 								@click="submitDiscern(row)"
 								title="发起甄别申请"
 								v-auth="'business:discern:apply:submit'"
-								v-if="row.isShowOperate"
+								v-show="row.isShowOperate"
 							>
 								发起甄别
 							</el-button>

+ 9 - 9
src/views/business/discern/ZGApply.vue

@@ -6,9 +6,9 @@
 				<el-tab-pane :name="1" label="中心话务甄别" v-if="userInfos.isCenter" :disabled="state.loading"></el-tab-pane>
 			</el-tabs>
 			<el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline :disabled="state.loading">
-				<el-form-item label="数据范围" prop="DataScope" v-if="state.queryParams.ScreenType === 0" v-auth="'business:discern:apply:dataScope'">
-					<el-segmented
-						:options="[
+					<el-form-item label="数据范围" prop="DataScope"  v-auth="'business:discern:apply:dataScope'" v-show="state.queryParams.ScreenType === 0">
+						<el-segmented
+							:options="[
 							{
 								value: 1,
 								label: '本级部门',
@@ -18,10 +18,10 @@
 								label: '全部',
 							},
 						]"
-						v-model="state.queryParams.DataScope"
-						@change="handleQuery"
-					/>
-				</el-form-item>
+							v-model="state.queryParams.DataScope"
+							@change="handleQuery"
+						/>
+					</el-form-item>
 				<el-form-item label="甄别退回" prop="ScreenSendBack">
 					<el-select v-model="state.queryParams.ScreenSendBack" placeholder="请选择甄别退回" @change="handleQuery">
 						<el-option :value="0" label="全部" />
@@ -129,7 +129,7 @@
 								@click="submitDiscern(row)"
 								title="发起甄别申请"
 								v-auth="'business:discern:apply:submit'"
-								v-if="row.isShowOperate"
+								v-show="row.isShowOperate"
 							>
 								发起甄别
 							</el-button>
@@ -139,7 +139,7 @@
 								@click="onEditApplyTime(row)"
 								title="修改甄别提起时限"
 								v-auth="'business:discern:apply:editApplyTime'"
-								v-if="row.isShowOperate"
+								v-show="row.isShowOperate"
 							>
 								修改提起时限
 							</el-button>

+ 1 - 1
src/views/business/order/index.vue

@@ -113,7 +113,7 @@
 						@click="onReturn(row)"
 						title="省工单退回"
 						v-auth="'business:order:return:province'"
-						v-if="
+						v-show="
 							row.isProvince &&
 							(row.actualHandleOrgCode === '001' || row.actualHandleOrgCode === null || row.actualHandleOrgCode === '' || row.status === 0) &&
 							row.status < 300 &&

+ 2 - 2
src/views/business/return/audit.vue

@@ -65,7 +65,7 @@
 						:disabled="isChecked"
 						:loading="state.loading"
 						v-auth="'business:return:audit:multiple'"
-						v-if="state.queryParams.AuditState === '1'"
+						v-show="state.queryParams.AuditState === '1'"
 						>批量审批<span v-if="checkTable.length">({{ checkTable.length }})</span>
 					</el-button>
 				</template>
@@ -129,7 +129,7 @@
 					</template>
 					<vxe-column title="操作" fixed="right" width="100" align="center">
 						<template #default="{ row }">
-							<el-button link type="primary" @click="onAudit(row)" title="退回特提" v-auth="'business:return:audit'" v-if="[0].includes(row.state)">
+							<el-button link type="primary" @click="onAudit(row)" title="退回特提" v-auth="'business:return:audit'" v-show="[0].includes(row.state)">
 								审批
 							</el-button>
 							<el-button link type="primary" @click="onAuditDetail(row)" title="查看审批详情" v-if="[1, 2].includes(row.state)"> 审批详情 </el-button>

+ 1 - 1
src/views/business/return/province.vue

@@ -53,7 +53,7 @@
 						@click="onAudit(row)"
 						title="退回审批"
 						v-auth="'business:return:audit:province'"
-						v-if="[0].includes(row.state)"
+						v-show="[0].includes(row.state)"
 					>
 						退回审批
 					</el-button>

+ 1 - 1
src/views/business/visit/index.vue

@@ -51,7 +51,7 @@
 						@click="updateVisitResult(row)"
 						title="修改回访结果"
 						v-auth="'business:visit:visitEdit'"
-						v-if="row.visitState === 30"
+						v-show="row.visitState === 30"
 					>
 						修改回访结果
 					</el-button>

+ 2 - 2
src/views/business/visit/reverse.vue

@@ -33,7 +33,7 @@
 						:disabled="isChecked"
 						:loading="state.loading"
 						v-auth="'business:visit:reverse:multiple'"
-						v-if="state.queryParams.IsIngString === 'true'"
+						v-show="state.queryParams.IsIngString === 'true'"
 						>批量扭转评判<span v-if="checkTable.length">({{ checkTable.length }})</span>
 					</el-button>
 				</template>
@@ -104,7 +104,7 @@
 								@click="onReverse(row)"
 								title="扭转评判"
 								v-auth="'business:visit:reverse'"
-								v-if="[0].includes(row.judgeState)"
+								v-show="[0].includes(row.judgeState)"
 							>
 								扭转评判
 							</el-button>

+ 3 - 3
src/views/business/visit/smart.vue

@@ -76,7 +76,7 @@
 							<el-button
 								link
 								type="primary"
-								v-if="[5].includes(row.taskState)"
+								v-show="[5].includes(row.taskState)"
 								@click="onTermination(row)"
 								title="终止回访任务"
 								v-auth="'business:visit:smart:termination'"
@@ -86,7 +86,7 @@
 							<el-button
 								link
 								type="primary"
-								v-if="[5].includes(row.taskState)"
+								v-show="[5].includes(row.taskState)"
 								@click="onStart(row)"
 								title="启动任务"
 								v-auth="'business:visit:smart:start'"
@@ -96,7 +96,7 @@
 							<el-button
 								link
 								type="primary"
-								v-if="[1, 2].includes(row.taskState)"
+								v-show="[1, 2].includes(row.taskState)"
 								@click="onPause(row)"
 								title="暂停任务"
 								v-auth="'business:visit:smart:pause'"

+ 1 - 1
src/views/home/components/Home-date.vue

@@ -8,7 +8,7 @@
 				><SvgIcon name="iconfont icon-daohang" class="mr5" size="18px" /> 一键登录到旧系统</el-button
 			>
 		</el-badge>
-		<el-button class="ml10" type="primary" @click="linkUrl" v-auth="'home:rxzf'"><SvgIcon name="iconfont icon-daohang" class="mr5" size="18px" /> 热线赋智</el-button>
+<!--		<el-button class="ml10" type="primary" @click="linkUrl" v-auth="'home:rxzf'"><SvgIcon name="iconfont icon-daohang" class="mr5" size="18px" /> 热线赋智</el-button>-->
 	</el-card>
 </template>
 <script setup lang="ts">

+ 2 - 2
src/views/quality/project/index.vue

@@ -24,10 +24,10 @@
 				}"
 			>
 				<template #buttons>
-					<el-button type="primary" @click="onProjectAdd" v-waves v-auth="'quality:project:add'">
+					<el-button type="primary" @click="onProjectAdd" v-auth="'quality:project:add'">
 						<SvgIcon name="ele-Plus" class="mr5" />新增质检项
 					</el-button>
-					<el-button type="danger" @click="onProjectDelete" v-waves v-auth="'quality:project:delete'" :disabled="isChecked">
+					<el-button type="danger" @click="onProjectDelete" v-auth="'quality:project:delete'" :disabled="isChecked">
 						<SvgIcon name="ele-Delete" class="mr5" />删除
 					</el-button>
 				</template>

+ 3 - 3
src/views/system/config/workflow/index.vue

@@ -70,7 +70,7 @@
 									type="danger"
 									@click="configClear(row)"
 									title="清除配置"
-									v-if="row.definition"
+									v-show="row.definition"
 									v-auth="'system:workflow:template:clear'"
 								>
 									清除配置
@@ -129,7 +129,7 @@
 								<el-button
 									link
 									type="success"
-									v-if="row.status === 0"
+									v-show="row.status === 0"
 									@click="onReleaseTemp(row)"
 									title="发布"
 									v-auth="'system:workflow:template:publish'"
@@ -139,7 +139,7 @@
 								<!-- 发布之后不能修改 -->
 								<el-button
 									link
-									v-if="row.status === 0"
+									v-show="row.status === 0"
 									type="danger"
 									@click="onDeleteTemp(row)"
 									title="删除"

+ 1 - 1
src/views/system/parameter/index.vue

@@ -22,7 +22,7 @@
 				}"
 			>
 				<template #buttons>
-					<el-button type="primary" @click="addParameter" v-waves v-auth="'system:parameter:add'">
+					<el-button type="primary" @click="addParameter" v-auth="'system:parameter:add'">
 						<SvgIcon name="ele-Plus" class="mr5" />新增参数
 					</el-button>
 				</template>

+ 4 - 4
src/views/system/roles/index.vue

@@ -69,16 +69,16 @@
 					<vxe-column field="state" title="状态" width="140"></vxe-column>
 					<vxe-column title="操作" fixed="right" width="250" align="center">
 						<template #default="{ row }">
-							<el-button link type="primary" @click="onOpenEditRole(row)" title="修改角色信息" v-auth="'system:role:edit'" v-if="!row.isDeleted">
+							<el-button link type="primary" @click="onOpenEditRole(row)" title="修改角色信息" v-auth="'system:role:edit'" v-show="!row.isDeleted">
 								修改
 							</el-button>
-							<el-button link type="success" @click="onPermissions(row)" title="分配角色权限" v-auth="'system:role:assign'" v-if="!row.isDeleted">
+							<el-button link type="success" @click="onPermissions(row)" title="分配角色权限" v-auth="'system:role:assign'" v-show="!row.isDeleted">
 								分配权限
 							</el-button>
-							<el-button link type="info" @click="onDataAuth(row)" v-auth="'system:role:dataAuth'" title="配置角色数据权限" v-if="!row.isDeleted">
+							<el-button link type="info" @click="onDataAuth(row)" v-auth="'system:role:dataAuth'" title="配置角色数据权限" v-show="!row.isDeleted">
 								数据权限
 							</el-button>
-							<el-button link type="danger" @click="onRowDel(row)" v-auth="'system:role:delete'" title="删除角色" v-if="!row.isDeleted">
+							<el-button link type="danger" @click="onRowDel(row)" v-auth="'system:role:delete'" title="删除角色" v-show="!row.isDeleted">
 								删除
 							</el-button>
 						</template>

+ 4 - 4
src/views/system/user/index.vue

@@ -106,16 +106,16 @@
 							<vxe-column field="state" title="状态" width="140"></vxe-column>
 							<vxe-column title="操作" fixed="right" width="230" align="center">
 								<template #default="{ row }">
-									<el-button link type="primary" @click="onOpenEditUser(row)" v-auth="'system:user:edit'" title="修改" v-if="!row.isDeleted">
+									<el-button link type="primary" @click="onOpenEditUser(row)" v-auth="'system:user:edit'" title="修改" v-show="!row.isDeleted">
 										修改
 									</el-button>
-									<el-button link type="primary" @click="onUnlock(row)" v-auth="'system:user:unlock'" title="解锁" v-if="!row.isDeleted">
+									<el-button link type="primary" @click="onUnlock(row)" v-auth="'system:user:unlock'" title="解锁" v-show="!row.isDeleted">
 										解锁
 									</el-button>
-									<el-button link type="warning" @click="onRestPwd(row)" title="重置密码" v-auth="'system:user:resetPwd'" v-if="!row.isDeleted">
+									<el-button link type="warning" @click="onRestPwd(row)" title="重置密码" v-auth="'system:user:resetPwd'" v-show="!row.isDeleted">
 										重置密码
 									</el-button>
-									<el-button link type="danger" @click="onRowDel(row)" v-auth="'system:user:delete'" title="删除" v-if="!row.isDeleted">
+									<el-button link type="danger" @click="onRowDel(row)" v-auth="'system:user:delete'" title="删除" v-show="!row.isDeleted">
 										删除
 									</el-button>
 								</template>

+ 3 - 3
src/views/tels/callLog/ybCallLog.vue

@@ -43,7 +43,7 @@
 						:disabled="isChecked"
 						:loading="state.loading"
 						v-auth="'tels:callLog:recordTransfer'"
-						v-if="['1', '2', '4'].includes(state.queryParams.type)"
+						v-show="['1', '2', '4'].includes(state.queryParams.type)"
 					>录音转写</el-button
 					>
 				</template>
@@ -242,10 +242,10 @@
 					</vxe-column>
 					<vxe-column title="操作" fixed="right" width="310" align="center" v-if="['1'].includes(state.queryParams.type)">
 						<template #default="{ row }">
-							<el-button link type="primary" @click="onCreate(row)" title="创建失联工单" v-auth="'tels:callLog:connectOrder'" v-if="!row.externalId">
+							<el-button link type="primary" @click="onCreate(row)" title="创建失联工单" v-auth="'tels:callLog:connectOrder'" v-show="!row.externalId">
 								失联工单
 							</el-button>
-							<el-button link type="primary" @click="onConnect(row)" title="关联业务" v-auth="'tels:callLog:connect'" v-if="!row.externalId">
+							<el-button link type="primary" @click="onConnect(row)" title="关联业务" v-auth="'tels:callLog:connect'" v-show="!row.externalId">
 								关联业务
 							</el-button>
 							<el-button type="primary" @click="onPlaySoundRecording(row)" title="播放录音" link v-if="row.recordingAbsolutePath && row.otherAccept"

+ 1 - 1
src/views/tels/callLog/zgCallLog.vue

@@ -102,7 +102,7 @@
 								@click="onCreate(row)"
 								title="创建失联工单"
 								v-auth="'tels:callLog:connectOrder'"
-								v-if="!row.orderId && row.callState !== 0"
+								v-show="!row.orderId && row.callState !== 0"
 							>
 								失联工单
 							</el-button>

+ 2 - 2
src/views/tels/restApply/index.vue

@@ -95,10 +95,10 @@
 					<vxe-column field="restReason" title="小休原因" min-width="140"></vxe-column>
 					<vxe-column title="操作" fixed="right" width="140" align="center">
 						<template #default="{ row }">
-							<el-button link type="primary" @click="onRecord(row)" v-auth="'system:workflow:record'" title="审批记录" v-if="row.workflowId">
+							<el-button link type="primary" @click="onRecord(row)" v-auth="'system:workflow:record'" title="审批记录" v-show="row.workflowId">
 								审批记录
 							</el-button>
-							<el-button link type="primary" @click="onSubmit(row)" v-auth="'system:workflow:handle'" title="审批" v-if="[0].includes(row.applyStatus)">
+							<el-button link type="primary" @click="onSubmit(row)" v-auth="'system:workflow:handle'" title="审批" v-show="[0].includes(row.applyStatus)">
 								审批
 							</el-button>
 						</template>

+ 2 - 2
src/views/todo/center/index.vue

@@ -32,8 +32,8 @@
 					<order-detail :order="row" @updateList="refreshList">{{ row.title }}</order-detail>
 				</template>
 				<template #action="{ row }">
-					<el-button link type="primary" @click="onSign(row)" title="签收工单" v-if="row.canSign" v-auth="'todo:center:sign'"> 签收 </el-button>
-					<el-button link type="success" @click="onOrderEdit(row)" title="编辑工单" v-if="row.canEdit" v-auth="'todo:center:edit'"> 修改 </el-button>
+					<el-button link type="primary" @click="onSign(row)" title="签收工单" v-show="row.canSign" v-auth="'todo:center:sign'"> 签收 </el-button>
+					<el-button link type="success" @click="onOrderEdit(row)" title="编辑工单" v-show="row.canEdit" v-auth="'todo:center:edit'"> 修改 </el-button>
 					<el-button link type="primary" @click="onMigration(row)" title="平级移动" v-auth="'todo:center:migration'"> 平级移动 </el-button>
 				</template>
 				<template #pager>

+ 1 - 1
src/views/todo/order/index.vue

@@ -16,7 +16,7 @@
 								label="快捷查询"
 								prop="QueryType"
 								v-auth="'todo:order:fastSearch'"
-								v-if="['ZiGong', 'LuZhou'].includes(themeConfig.appScope) && state.queryParams.IsHandled === 'false'"
+								v-show="['ZiGong', 'LuZhou'].includes(themeConfig.appScope) && state.queryParams.IsHandled === 'false'"
 							>
 								<el-segmented
 									:options="[

+ 1 - 1
src/views/todo/seats/accept/ybAccept.vue

@@ -458,7 +458,7 @@
 											type="primary"
 											@click="agentHandle(ruleFormRef)"
 											:loading="buttonLoading"
-											v-if="state.ruleForm?.canInsteadHandle && isSaveSuccess"
+											v-show="state.ruleForm?.canInsteadHandle && isSaveSuccess"
 											v-auth="'business:order:handle:instead'"
 											>代办</el-button
 										>

+ 1 - 1
src/views/todo/seats/accept/zgAccept.vue

@@ -383,7 +383,7 @@
 											type="primary"
 											@click="agentHandle(ruleFormRef)"
 											:loading="buttonLoading"
-											v-if="state.ruleForm?.canInsteadHandle && isSaveSuccess"
+											v-show="state.ruleForm?.canInsteadHandle && isSaveSuccess"
 											v-auth="'business:order:handle:instead'"
 											>代办</el-button
 										>

+ 2 - 2
src/views/todo/seats/index.vue

@@ -44,8 +44,8 @@
 						<order-detail :order="row" @updateList="refreshList">{{ row.title }}</order-detail>
 					</template>
 					<template #action="{ row }">
-						<el-button link type="success" @click="onOrderEdit(row)" title="编辑工单" v-if="row.canEdit" v-auth="'todo:seats:edit'"> 修改 </el-button>
-						<el-button link type="primary" @click="onSign(row)" title="签收工单" v-if="row.canSign" v-auth="'todo:seats:sign'"> 签收 </el-button>
+						<el-button link type="success" @click="onOrderEdit(row)" title="编辑工单" v-show="row.canEdit" v-auth="'todo:seats:edit'"> 修改 </el-button>
+						<el-button link type="primary" @click="onSign(row)" title="签收工单" v-show="row.canSign" v-auth="'todo:seats:sign'"> 签收 </el-button>
 					</template>
 					<template #pager>
 						<pagination