|
@@ -222,11 +222,41 @@
|
|
<HcNewCard v-if="menuKey === 'recycle'" action-size="lg">
|
|
<HcNewCard v-if="menuKey === 'recycle'" action-size="lg">
|
|
<template #header>
|
|
<template #header>
|
|
<div class="mr-5">{{ menuItem.label }}</div>
|
|
<div class="mr-5">{{ menuItem.label }}</div>
|
|
- <HcNewSwitch :datas="userTypeTab" :keys="userTypeKey" size="default" @change="userTypeChange" />
|
|
|
|
</template>
|
|
</template>
|
|
<template #extra>
|
|
<template #extra>
|
|
<HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" size="default" @change="tabTypeChange" />
|
|
<HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" size="default" @change="tabTypeChange" />
|
|
</template>
|
|
</template>
|
|
|
|
+ <template #search>
|
|
|
|
+ <div class="w-250px">
|
|
|
|
+ <hc-date-picker :dates="tabBetweenTime" clearable @change="tabBetweenTimeUpdate" />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ml-2 w-120px">
|
|
|
|
+ <el-select v-model="searchRecycleForm.userId" placeholder="操作人" filterable clearable block>
|
|
|
|
+ <el-option v-for="item in userData" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ml-2 w-130px">
|
|
|
|
+ <el-select v-model="searchRecycleForm.isData" placeholder="是否资料节点" filterable clearable block>
|
|
|
|
+ <el-option label="是" :value="1" />
|
|
|
|
+ <el-option label="否" :value="0" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ml-2 w-70">
|
|
|
|
+ <el-input v-model="searchRecycleForm.content" clearable placeholder="请输入删除位置/工程划分/文件题名" @keyup="keyUpEvent" />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ml-2">
|
|
|
|
+ <el-button type="primary" @click="searchRecleClick">
|
|
|
|
+ <hc-icon name="search-2" />
|
|
|
|
+ <span>搜索</span>
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="tabTypeKey === '0'" class="position-absolute right-0">
|
|
|
|
+ <el-button type="success" :disabled="RecycleCheckedKeys.length < 1" @click="recoverClick">
|
|
|
|
+ <hc-icon name="arrow-go-back" />
|
|
|
|
+ <span>恢复</span>
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
<HcTable
|
|
<HcTable
|
|
ref="recycleTableRef" :column="recycleTableColumn" :datas="recycleTableData" :loading="recycleTableLoading"
|
|
ref="recycleTableRef" :column="recycleTableColumn" :datas="recycleTableData" :loading="recycleTableLoading"
|
|
is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
|
|
is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
|
|
@@ -237,17 +267,15 @@
|
|
{{ row?.fileName }}
|
|
{{ row?.fileName }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
+ <template #isData="{ row }">
|
|
|
|
+ {{ row?.isData === 1 ? '是' : '否' }}
|
|
|
|
+ </template>
|
|
|
|
+ <template #action="{ row }">
|
|
|
|
+ <el-link type="success" @click="recoverClick(row)">恢复</el-link>
|
|
|
|
+ </template>
|
|
</HcTable>
|
|
</HcTable>
|
|
<template #action>
|
|
<template #action>
|
|
<div class="foot-recycle">
|
|
<div class="foot-recycle">
|
|
- <el-button
|
|
|
|
- :loading="recycleBtnLoading" hc-btn type="primary"
|
|
|
|
- :disabled="userTypeKey === '2'"
|
|
|
|
- @click="recycleBtnClick"
|
|
|
|
- >
|
|
|
|
- <HcIcon fill name="reply" />
|
|
|
|
- <span>恢复</span>
|
|
|
|
- </el-button>
|
|
|
|
<HcPages :pages="searchRecycleForm" @change="pageRecycleChange" />
|
|
<HcPages :pages="searchRecycleForm" @change="pageRecycleChange" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -259,11 +287,38 @@
|
|
<!-- {{ operationContent }} -->
|
|
<!-- {{ operationContent }} -->
|
|
<div v-html="saveData" />
|
|
<div v-html="saveData" />
|
|
</hc-new-dialog>
|
|
</hc-new-dialog>
|
|
|
|
+ <!-- 恢复提醒 -->
|
|
|
|
+ <hc-new-dialog v-model="recoverModal" title="恢复提醒" :loading="recoverLoading" @save="recoverSave">
|
|
|
|
+ <div class="felx-col flex items-center justify-start font-bold">
|
|
|
|
+ <div class="mr-4 text-28px">
|
|
|
|
+ <HcIcon name="error-warning" class="text-orange" />
|
|
|
|
+ </div>
|
|
|
|
+ <div v-if="showData.length > 0">
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ 【
|
|
|
|
+ <span v-for="(item, index) in showData" :key="item.id" class="mb-2">
|
|
|
|
+ {{ index === showData.length - 1 ? item.delRootName : `${item.delRootName}、` }}
|
|
|
|
+ </span>
|
|
|
|
+ 】
|
|
|
|
+ 存在多条删除信息
|
|
|
|
+ </div>
|
|
|
|
+ <p class="ml-5px"> 是否恢复“删除位置”下所有的节点或文件</p>
|
|
|
|
+ <el-radio-group v-model="recoverOperationData" class="ml-5px">
|
|
|
|
+ <el-radio :value="1">是</el-radio>
|
|
|
|
+ <el-radio :value="0">否</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </div>
|
|
|
|
+ <div v-else>
|
|
|
|
+ <span>确认是否恢复选择的节点</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <p v-if="showData.length > 0" class="mt-2 text-orange"> * 可以通过搜索栏查询“删除位置”下包含哪些节点,请确认后谨慎选择</p>
|
|
|
|
+ </hc-new-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { onMounted, ref } from 'vue'
|
|
|
|
|
|
+import { onActivated, onMounted, ref } from 'vue'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
import userApi from '~api/userInfo/index'
|
|
import userApi from '~api/userInfo/index'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
@@ -271,6 +326,7 @@ import avatarPng from '~src/assets/images/avatar.png'
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
import { arrIndex, formValidate, getArrValue, isPhone } from 'js-fast-way'
|
|
import { arrIndex, formValidate, getArrValue, isPhone } from 'js-fast-way'
|
|
import { getContractUserList } from '~api/other'
|
|
import { getContractUserList } from '~api/other'
|
|
|
|
+
|
|
import md5 from 'js-md5'
|
|
import md5 from 'js-md5'
|
|
|
|
|
|
//初始变量
|
|
//初始变量
|
|
@@ -354,6 +410,16 @@ const handleMenuValue = (item) => {
|
|
}
|
|
}
|
|
//获取用户列表
|
|
//获取用户列表
|
|
const userListData = ref([])
|
|
const userListData = ref([])
|
|
|
|
+const getUserData = async () => {
|
|
|
|
+ const { data } = await userApi.queryUser({
|
|
|
|
+ contractId: contractId.value,
|
|
|
|
+ isRecycleBin:tabTypeKey.value,
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ userData.value = getArrValue(data)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
const getUserListData = async () => {
|
|
const getUserListData = async () => {
|
|
const { data } = await getContractUserList({
|
|
const { data } = await getContractUserList({
|
|
contractId: contractId.value,
|
|
contractId: contractId.value,
|
|
@@ -363,10 +429,14 @@ const getUserListData = async () => {
|
|
//渲染完成
|
|
//渲染完成
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
menuObjItem()
|
|
menuObjItem()
|
|
- getPageTypeData(menuKey.value)
|
|
|
|
|
|
+ // getPageTypeData(menuKey.value)
|
|
|
|
+ getUserData()
|
|
getUserListData()
|
|
getUserListData()
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+onActivated(()=>{
|
|
|
|
+ getPageTypeData(menuKey.value)
|
|
|
|
+})
|
|
//根据类型,获取相关数据
|
|
//根据类型,获取相关数据
|
|
const getPageTypeData = (key) => {
|
|
const getPageTypeData = (key) => {
|
|
//编辑状态
|
|
//编辑状态
|
|
@@ -700,49 +770,75 @@ const tableOperationContent = (row) => {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-//个人和全部切换
|
|
|
|
-const userTypeKey = ref('1')
|
|
|
|
-const userTypeTab = ref([{ key: '1', name: '个人' }, { key: '2', name: '全部' }])
|
|
|
|
-const userTypeChange = (item) => {
|
|
|
|
- userTypeKey.value = item?.key
|
|
|
|
- if (item?.key === '1') {
|
|
|
|
- searchRecycleForm.value.createUserName = ''
|
|
|
|
- } else {
|
|
|
|
- searchRecycleForm.value.createUserName = 'ALL'
|
|
|
|
- }
|
|
|
|
- getRecycleTableData()
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
//结构类型tab数据和相关处理
|
|
//结构类型tab数据和相关处理
|
|
-const tabTypeKey = ref('1')
|
|
|
|
|
|
+const tabTypeKey = ref('0')
|
|
const tabTypeTab = ref([
|
|
const tabTypeTab = ref([
|
|
- { key: '1', name: '文件资料' },
|
|
|
|
- { key: '2', name: '工程划分' },
|
|
|
|
|
|
+ { key: '0', name: '删除台账' },
|
|
|
|
+ { key: '1', name: '恢复台账' },
|
|
])
|
|
])
|
|
const tabTypeChange = (item) => {
|
|
const tabTypeChange = (item) => {
|
|
tabTypeKey.value = item?.key
|
|
tabTypeKey.value = item?.key
|
|
tabTypeKey.value = item?.key
|
|
tabTypeKey.value = item?.key
|
|
searchRecycleForm.value.current = 1
|
|
searchRecycleForm.value.current = 1
|
|
- searchRecycleForm.value.delType = item?.key
|
|
|
|
|
|
+ searchRecycleForm.value.recycleType = item?.key
|
|
|
|
+
|
|
|
|
+ getUserData()
|
|
getRecycleTableData()
|
|
getRecycleTableData()
|
|
|
|
+ recycleTableColumn.value = tabTypeKey.value === '0' ? recycleTableColumn1 : recycleTableColumn2
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//搜索和分页数据
|
|
//搜索和分页数据
|
|
const searchRecycleForm = ref({
|
|
const searchRecycleForm = ref({
|
|
- projectId: projectId.value, contractId: contractId.value, createUserName: '',
|
|
|
|
- delType: tabTypeKey.value, current: 1, size: 20, total: 0,
|
|
|
|
|
|
+ projectId: projectId.value, contractId: contractId.value, userId: '',
|
|
|
|
+ recycleType: tabTypeKey.value, current: 1, size: 20, total: 0, content:'',
|
|
})
|
|
})
|
|
|
|
|
|
//表格数据
|
|
//表格数据
|
|
const recycleTableRef = ref(null)
|
|
const recycleTableRef = ref(null)
|
|
const recycleTableColumn = ref([
|
|
const recycleTableColumn = ref([
|
|
- { key: 'fileName', name: '删除内容' },
|
|
|
|
- { key: 'position', name: '父节点名称' },
|
|
|
|
- { key: 'createUserName', name: '操作人' },
|
|
|
|
|
|
+ { key: 'delRootName', name: '删除位置' },
|
|
|
|
+ { key: 'position', name: '工程划分' },
|
|
|
|
+ { key: 'isData', name: '是否资料节点', width: '100' },
|
|
|
|
+ { key: 'fileName', name: '文件题名(施工)' },
|
|
|
|
+ { key: 'jlFileName', name: '文件题名(监理)' },
|
|
|
|
+ { key: 'createUserName', name: '删除人' },
|
|
{ key: 'operationTime', name: '删除时间', align: 'center', width: '180' },
|
|
{ key: 'operationTime', name: '删除时间', align: 'center', width: '180' },
|
|
|
|
+ { key: 'action', name: '操作', width: '80' },
|
|
])
|
|
])
|
|
|
|
+const recycleTableColumn1 = [
|
|
|
|
+
|
|
|
|
+ { key: 'delRootName', name: '删除位置' },
|
|
|
|
+ { key: 'position', name: '工程划分' },
|
|
|
|
+ { key: 'isData', name: '是否资料节点', width: '100' },
|
|
|
|
+ { key: 'fileName', name: '文件题名(施工)' },
|
|
|
|
+ { key: 'jlFileName', name: '文件题名(监理)' },
|
|
|
|
+ { key: 'createUserName', name: '删除人' },
|
|
|
|
+ { key: 'operationTime', name: '删除时间', align: 'center', width: '180' },
|
|
|
|
+ { key: 'action', name: '操作', width: '80' },
|
|
|
|
+
|
|
|
|
+]
|
|
|
|
+const recycleTableColumn2 = [
|
|
|
|
+ { key: 'delRootName', name: '删除位置' },
|
|
|
|
+ { key: 'position', name: '工程划分' },
|
|
|
|
+ { key: 'isData', name: '是否资料节点', width: '100' },
|
|
|
|
+ { key: 'fileName', name: '文件题名(施工)' },
|
|
|
|
+ { key: 'jlFileName', name: '文件题名(监理)' },
|
|
|
|
+ { key: 'updateUserName', name: '恢复人' },
|
|
|
|
+ { key: 'updateTime', name: '恢复时间', align: 'center', width: '180' },
|
|
|
|
+ { key: 'delInfo', name: '删除信息' },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+]
|
|
const recycleTableLoading = ref(false)
|
|
const recycleTableLoading = ref(false)
|
|
-const recycleTableData = ref(null)
|
|
|
|
|
|
+const recycleTableData = ref([
|
|
|
|
+ { fileName: '文件名', createUserName: '创建人', operationTime: '操作时间' },
|
|
|
|
+ { fileName: '文件名', createUserName: '创建人', operationTime: '操作时间' },
|
|
|
|
+])
|
|
|
|
|
|
//分页被点击
|
|
//分页被点击
|
|
const pageRecycleChange = ({ current, size }) => {
|
|
const pageRecycleChange = ({ current, size }) => {
|
|
@@ -753,10 +849,10 @@ const pageRecycleChange = ({ current, size }) => {
|
|
|
|
|
|
//获取数据
|
|
//获取数据
|
|
const getRecycleTableData = async () => {
|
|
const getRecycleTableData = async () => {
|
|
- const { error, code, data } = await userApi.queryRecycleBinList({
|
|
|
|
|
|
+ const { error, code, data } = await userApi.recycleBinPage({
|
|
projectId: projectId.value,
|
|
projectId: projectId.value,
|
|
contractId: contractId.value,
|
|
contractId: contractId.value,
|
|
- delType: tabTypeKey.value,
|
|
|
|
|
|
+
|
|
...searchRecycleForm.value,
|
|
...searchRecycleForm.value,
|
|
})
|
|
})
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
@@ -774,46 +870,80 @@ const recycleTableSelectionChange = (val) => {
|
|
RecycleCheckedKeys.value = val
|
|
RecycleCheckedKeys.value = val
|
|
}
|
|
}
|
|
|
|
|
|
-//恢复
|
|
|
|
-const recycleBtnLoading = ref(false)
|
|
|
|
-const recycleBtnClick = async () => {
|
|
|
|
- const rows = RecycleCheckedKeys.value
|
|
|
|
- let hasUnoperableData = false
|
|
|
|
|
|
|
|
- // 遍历每一行数据,检查 status 字段
|
|
|
|
- for (const row of rows) {
|
|
|
|
- if (row.status === 2) {
|
|
|
|
- hasUnoperableData = true
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- // 如果存在 status = 2 的数据,则提示用户并返回
|
|
|
|
- if (hasUnoperableData) {
|
|
|
|
- window.$message.warning('存在不可操作的数据,请检查后再操作。')
|
|
|
|
- return
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+const tabBetweenTime = ref(null)
|
|
|
|
+
|
|
|
|
+const userData = ref([])
|
|
|
|
+
|
|
|
|
+//日期时间被选择
|
|
|
|
+const tabBetweenTimeUpdate = ({ arr, val, query }) => {
|
|
|
|
+ betweenTime.value = arr
|
|
|
|
+
|
|
|
|
+ if (arr.length > 0) {
|
|
|
|
+ searchRecycleForm.value.startTime = arr[0]
|
|
|
|
+ searchRecycleForm.value.endTime = arr[1]
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ searchRecycleForm.value.startTime = ''
|
|
|
|
+ searchRecycleForm.value.endTime = ''
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
+const searchRecleClick = () => {
|
|
|
|
+ getRecycleTableData()
|
|
|
|
+}
|
|
|
|
+const recoverModal = ref(false)
|
|
|
|
+const recoverClick = async (row)=>{
|
|
|
|
+ console.log(row, 'row')
|
|
|
|
+
|
|
|
|
+ if (RecycleCheckedKeys.value.length === 0) {
|
|
|
|
+ cheVal.value = [row]
|
|
|
|
+ } else {
|
|
|
|
+ cheVal.value = RecycleCheckedKeys.value
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ await getQueryOperation(row)
|
|
|
|
+ recoverModal.value = true
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+const showData = ref([])
|
|
|
|
+const getQueryOperation = async (row )=>{
|
|
|
|
+ const { error, code, data } = await userApi.queryOperation({
|
|
|
|
+ ids:cheVal.value.map(item => item.id).join(','),
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ showData.value = getArrValue(data)
|
|
|
|
+
|
|
|
|
|
|
- if (rows.length > 0) {
|
|
|
|
- //请求数据
|
|
|
|
- recycleBtnLoading.value = true
|
|
|
|
- const { error, code, msg } = await userApi.recycleBinRegain({
|
|
|
|
- projectId: projectId.value,
|
|
|
|
- contractId: contractId.value,
|
|
|
|
- delType: tabTypeKey.value,
|
|
|
|
- regainIds: rows,
|
|
|
|
- })
|
|
|
|
- recycleBtnLoading.value = false
|
|
|
|
- if (!error && code === 200) {
|
|
|
|
- window?.$message?.success('操作成功')
|
|
|
|
- searchRecycleForm.value.current = 1
|
|
|
|
- getRecycleTableData()
|
|
|
|
- } else {
|
|
|
|
- window?.$message?.error(msg || '操作失败')
|
|
|
|
- }
|
|
|
|
} else {
|
|
} else {
|
|
- window.$message?.warning('请先勾选要恢复的数据')
|
|
|
|
|
|
+ showData.value = []
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+const cheVal = ref([])
|
|
|
|
+const recoverLoading = ref(false)
|
|
|
|
+const recoverOperationData = ref(1)
|
|
|
|
+const recoverSave = async ()=>{
|
|
|
|
+ recoverLoading.value = true
|
|
|
|
+ const { error, code, msg } = await userApi.recover({
|
|
|
|
+ ids: cheVal.value.map(item => item.id).join(','),
|
|
|
|
+ recoverOperationData:recoverOperationData.value,
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ recoverLoading.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message.success(msg)
|
|
|
|
+ getRecycleTableData()
|
|
|
|
+ getUserData()
|
|
}
|
|
}
|
|
|
|
+ recoverModal.value = false
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|