Files
td_official/src/views/design/Professional/index.vue
2025-08-20 19:21:52 +08:00

232 lines
7.5 KiB
Vue

<template>
<div class="p-6 bg-gray-50 Professional">
<transition>
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="never">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="电话" prop="phone">
<el-input v-model="queryParams.phone" placeholder="请输入电话" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="professionalList">
<el-table-column label="序号" align="center" type="index" width="100" />
<el-table-column label="提资人" align="center" prop="userName" />
<el-table-column label="专业" align="center" prop="userMajorName" />
<el-table-column label="电话" align="center" prop="phone" />
<el-table-column label="邮箱" align="center" prop="email" />
<el-table-column label="流程状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="wf_business_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['design:extract:query']">审核</el-button>
<el-button link type="primary" icon="Download" @click="handleDownload(scope.row)" v-hasPermi="['design:extract:export']">导出</el-button
><el-button
link
type="warning"
icon="View"
v-if="scope.row.status != 'draft'"
v-hasPermi="['design:extract:query']"
@click="handleViewInfo(scope.row)"
>查看流程</el-button
><el-button
link
type="warning"
icon="View"
v-if="scope.row.status != 'draft'"
v-hasPermi="['design:extract:query']"
@click="handleFile(scope.row)"
>查看文件</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<el-dialog title="文件列表" v-model="viewVisible" width="800px">
<el-table :loading="loadingFlie" :data="fileList" style="width: 100%" border>
<el-table-column prop="fileName" label="文件名称" align="center">
<template #default="scope">
<el-link
:key="scope.row.fileId"
:href="scope.row.fileUrl"
target="_blank"
:type="scope.row.status == '1' ? 'primary' : 'info'"
:underline="false"
>
{{ scope.row.fileName }}
</el-link>
</template>
</el-table-column>
<el-table-column label="版本号" align="center" width="120" prop="version"> </el-table-column>
<el-table-column label="文件类型" width="120" align="center">
<template #default="scope">
<el-tag type="success" v-if="scope.row.type == 1">过程图纸</el-tag>
<el-tag type="primary" v-if="scope.row.type == 3">蓝图</el-tag>
<el-tag type="danger" v-if="scope.row.type == 4">作废图纸</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="170" align="center">
<template #default="scope">
<el-button type="success" v-if="viewFlie == 'finish'" link icon="View" @click="handleViewFile(scope.row)"> 查看 </el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<span>
<el-button type="primary" @click="viewVisible = false">关闭</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup name="DataCollectionForm" lang="ts">
import { ref, reactive, computed, onMounted } from 'vue';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
import { extractList, getFileList } from '@/api/design/Professional';
// 获取用户 store
const userStore = useUserStoreHook();
const total = ref(0);
// 从 store 中获取当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const professionalList = ref([]);
const showSearch = ref(true);
const loading = ref(false);
const loadingFlie = ref(false);
const viewVisible = ref(false); //文件列表展示
const viewFlie = ref('');
const fileList = ref([]);
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: currentProject.value?.id,
phone: undefined,
status: undefined,
params: {}
}
});
const queryFormRef = ref<ElFormInstance>();
const { queryParams } = toRefs(data);
// 查询提资清单表
const getList = async () => {
let res = await extractList({ ...queryParams.value });
if (res.code == 200) {
professionalList.value = res.rows;
total.value = res.total; //默认第一个
}
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 新增按钮操作 */
const handleAdd = (row) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/approval/Professional/indexEdit`,
query: {
id: row.id,
type: 'add'
}
});
};
const handleViewInfo = (row) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/approval/Professional/indexEdit`,
query: {
id: row.id,
type: 'view'
}
});
};
const handleUpdate = (row) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `/approval/Professional/indexEdit`,
query: {
id: row.id,
type: 'update'
}
});
};
const handleDownload = (row) => {
// 导出接口
proxy?.download(
'design/extract/exportWord',
{
id: row.id
},
`互提资料.zip`
);
};
const handleViewFile = (row) => {
window.open(row.fileUrl, '_blank');
};
const handleFile = async (row) => {
// 查看文件
viewFlie.value = row.status;
viewVisible.value = true;
loadingFlie.value = true;
let res = await getFileList(row.id);
if (res.code == 200) {
fileList.value = res.data;
}
loadingFlie.value = false;
};
// 页面挂载时初始化数据
onMounted(() => {
getList();
});
//监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
(nid, oid) => {
queryParams.value.projectId = nid;
getList();
}
);
onUnmounted(() => {
listeningProject();
});
</script>
<style lang="scss">
.Professional {
.el-tabs__header {
height: 84vh !important;
}
}
</style>