duy 1 тиждень тому
батько
коміт
7f4742c0e3

+ 35 - 9
src/views/tasks/components/hc-tasks-user/modules/user-modal.vue

@@ -1,9 +1,9 @@
 <template>
-    <hc-dialog v-model="isShow" ui="hc-tasks-user-modal" widths="1195px" title="选择任务人" @close="modalClose">
+    <hc-dialog v-model="isShow" ui="hc-tasks-user-modal" widths="1195px" title="选择任务人" :footer="!isView" @close="modalClose">
         <div class="card-div-1 h-full w-235px">
             <hc-body scrollbar padding="0">
                 <div class="hc-process-item">
-                    <div class="process setup" @click="processSetupClick">
+                    <div class="process setup" :class="{ disabled: isView }" @click="processSetupClick">
                         <div class="icon hc-flex-center">
                             <i class="i-hugeicons-flowchart-01" />
                         </div>
@@ -22,16 +22,21 @@
                             </div>
                             <div class="input-box">
                                 <div class="width-name">{{ item.name }}</div>
-                                <input v-model="item.name" class="input">
+                                <input 
+                                    v-model="item.name" 
+                                    class="input" 
+                                    :readonly="isView"
+                                    @click="isView ? null : fixedTypeClick(item)"
+                                >
                             </div>
-                            <div class="del-icon hc-flex-center" @click="fixedDelClick(item, index)">
+                            <div v-if="!isView" class="del-icon hc-flex-center" @click="fixedDelClick(item, index)">
                                 <i class="i-ri-delete-bin-2-line" />
                             </div>
                         </div>
                     </div>
                 </template>
                 <div class="hc-process-item">
-                    <div class="process add" @click="fixedAddClick">
+                    <div v-if="!isView" class="process add" @click="fixedAddClick">
                         <div class="icon hc-flex-center">
                             <i class="i-iconoir-plus" />
                         </div>
@@ -103,12 +108,12 @@
                             <span>已选择{{ fixedItem?.userList?.length || 0 }}人</span>
                         </template>
                         <template #extra>
-                            <el-button type="warning" size="small" @click="fixedUserSortClick">调整排序</el-button>
+                            <el-button v-if="!isView" type="warning" size="small" @click="fixedUserSortClick">调整排序</el-button>
                         </template>
                         <div class="hc-tasks-user-cur-box" :class="`type-${fixedItem.type}`">
                             <template v-for="(item, index) in fixedItem?.userList" :key="index">
                                 <div class="hc-tasks-user-item">
-                                    <el-tag closable @close="fixedItemUserListDel(index)">
+                                    <el-tag :closable="!isView" @close="fixedItemUserListDel(index)">
                                         <i class="i-ri-user-3-fill mr-5px" />
                                         <span>{{ item.userName }}</span>
                                     </el-tag>
@@ -116,7 +121,7 @@
                             </template>
                         </div>
                         <template #action>
-                            <el-button block size="default" type="success" @click="singleSaveClick">保存</el-button>
+                            <el-button v-if="!isView" block size="default" type="success" @click="singleSaveClick">保存</el-button>
                         </template>
                     </hc-card>
                     <div v-else class="card-empty-no">
@@ -155,6 +160,10 @@ const props = defineProps({
         type: Object,
         default: () => ({}),
     },
+    isView:{
+        type: Boolean,
+        default: false,
+    },
 })
 
 const emit = defineEmits(['finish', 'close'])
@@ -169,7 +178,10 @@ const dataInfo = ref(props.datas)
 watch(() => props.datas, (data) => {
     dataInfo.value = getObjValue(data)
 }, { deep: true, immediate: true })
-
+const isView = ref(props.isView)
+watch(() => props.isView, (data) => {
+    isView.value = data
+}, { deep: true, immediate: true })
 //监听数据
 const fixedData = ref([])
 watch(() => props.data, (data) => {
@@ -219,6 +231,8 @@ const getProcessIcon = (item) => {
 
 //流程类型切换
 const fixedTypeClick = (item) => {
+    if (isView.value) return
+
     item.type = item.type === 1 ? 2 : 1
 }
 
@@ -497,4 +511,16 @@ const modalClose = () => {
     flex: 1;
     min-width: 205px;
 }
+/* 添加禁用状态样式 */
+.disabled {
+    cursor: not-allowed !important;  /* 鼠标变为禁止样式 */
+    opacity: 0.6;  /* 降低透明度表示禁用 */
+    pointer-events: none;  /* 阻止鼠标事件穿透 */
+}
+
+/* 针对删除图标和添加按钮的额外样式调整 */
+.del-icon.disabled,
+.process.add.disabled {
+    filter: grayscale(100%);  /* 转为灰度进一步表示禁用 */
+}
 </style>