@@ -55,7 +55,6 @@ class Material extends Common
|
|||||||
$insert_info['create_time'] = $param['create_time'];
|
$insert_info['create_time'] = $param['create_time'];
|
||||||
|
|
||||||
db('materials_info')->insert($insert_info);
|
db('materials_info')->insert($insert_info);
|
||||||
return $this->sendSuccess('添加成功');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,44 +79,24 @@ class Material extends Common
|
|||||||
//项目基础信息
|
//项目基础信息
|
||||||
else if (1 == $param['materials_class'] )
|
else if (1 == $param['materials_class'] )
|
||||||
{
|
{
|
||||||
$currPage = empty($param['currPage']) ? 1 : $param['currPage'];
|
$MaterialsInfoList = db('materials_info')
|
||||||
$pageSize = empty($param['pageSize']) ? 10 : $param['pageSize'];
|
->alias('p')
|
||||||
|
|
||||||
$countQuery = db('materials_info')->alias('p')
|
|
||||||
->where('p.materials_class', $param['materials_class'])
|
|
||||||
->where('p.materials_owner', $param['materials_owner']);
|
|
||||||
$listQuery = db('materials_info')->alias('p')
|
|
||||||
->join('materials_type s', 's.type_id = p.materials_type', 'left')
|
->join('materials_type s', 's.type_id = p.materials_type', 'left')
|
||||||
->where('p.materials_class', $param['materials_class'])
|
->where('p.materials_class', $param['materials_class'])
|
||||||
->where('p.materials_owner', $param['materials_owner']);
|
->where('p.materials_owner', $param['materials_owner']);
|
||||||
|
|
||||||
if (!empty($param['materials_type'])) {
|
if (isset($param['materials_type']) && is_array($param['materials_type']) && count($param['materials_type']) > 0) {
|
||||||
if (is_array($param['materials_type'])) {
|
$MaterialsInfoList->whereIn('p.materials_type', $param['materials_type']);
|
||||||
$countQuery->whereIn('p.materials_type', $param['materials_type']);
|
} elseif (isset($param['materials_type'])) {
|
||||||
$listQuery->whereIn('p.materials_type', $param['materials_type']);
|
$MaterialsInfoList->where('p.materials_type', $param['materials_type']);
|
||||||
} else {
|
|
||||||
$countQuery->where('p.materials_type', $param['materials_type']);
|
|
||||||
$listQuery->where('p.materials_type', $param['materials_type']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($param['start_time'])) {
|
$MaterialsInfoList = $MaterialsInfoList
|
||||||
$countQuery->where('p.create_time', '>=', $param['start_time']);
|
|
||||||
$listQuery->where('p.create_time', '>=', $param['start_time']);
|
|
||||||
}
|
|
||||||
if (!empty($param['end_time'])) {
|
|
||||||
$countQuery->where('p.create_time', '<=', $param['end_time']);
|
|
||||||
$listQuery->where('p.create_time', '<=', $param['end_time']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$total = $countQuery->count();
|
|
||||||
$list = $listQuery
|
|
||||||
->page($currPage, $pageSize)
|
|
||||||
->order('p.create_time desc')
|
->order('p.create_time desc')
|
||||||
->field('p.*, s.type_name as materials_type_name')
|
->field('p.*, s.type_name as materials_type_name')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
return $this->sendSuccess(['list' => $list, 'total' => $total]);
|
return $this->sendSuccess($MaterialsInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//问题单信息
|
//问题单信息
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Role extends Common
|
|||||||
$results = db('system_router')->alias('router')
|
$results = db('system_router')->alias('router')
|
||||||
->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT')
|
->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT')
|
||||||
->field('router.*, GROUP_CONCAT(system_role.role_name) as roles')
|
->field('router.*, GROUP_CONCAT(system_role.role_name) as roles')
|
||||||
->group('router.id')
|
->group('router.path')
|
||||||
->select();
|
->select();
|
||||||
$this->sendSuccess($results);
|
$this->sendSuccess($results);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class Material extends Common
|
|||||||
$insert_info['create_time'] = $param['create_time'];
|
$insert_info['create_time'] = $param['create_time'];
|
||||||
|
|
||||||
db('materials_info')->insert($insert_info);
|
db('materials_info')->insert($insert_info);
|
||||||
return $this->sendSuccess('添加成功');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -79,38 +78,15 @@ class Material extends Common
|
|||||||
//项目基础信息
|
//项目基础信息
|
||||||
else if (1 == $param['materials_class'] )
|
else if (1 == $param['materials_class'] )
|
||||||
{
|
{
|
||||||
$currPage = empty($param['currPage']) ? 1 : $param['currPage'];
|
$MaterialsInfoList = db('materials_info')->alias('p')
|
||||||
$pageSize = empty($param['pageSize']) ? 10 : $param['pageSize'];
|
->join('materials_type s', 's.type_id =p.materials_type', 'left')
|
||||||
|
|
||||||
$countQuery = db('materials_info')->alias('p')
|
|
||||||
->where('p.materials_class', $param['materials_class'])
|
->where('p.materials_class', $param['materials_class'])
|
||||||
->where('p.materials_owner', $param['materials_owner']);
|
->where('p.materials_owner', $param['materials_owner'])
|
||||||
$listQuery = db('materials_info')->alias('p')
|
->where('p.materials_type', $param['materials_type'])
|
||||||
->join('materials_type s', 's.type_id = p.materials_type', 'left')
|
|
||||||
->where('p.materials_class', $param['materials_class'])
|
|
||||||
->where('p.materials_owner', $param['materials_owner']);
|
|
||||||
|
|
||||||
if (!empty($param['materials_type'])) {
|
|
||||||
$countQuery->where('p.materials_type', $param['materials_type']);
|
|
||||||
$listQuery->where('p.materials_type', $param['materials_type']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($param['start_time'])) {
|
|
||||||
$countQuery->where('p.create_time', '>=', $param['start_time']);
|
|
||||||
$listQuery->where('p.create_time', '>=', $param['start_time']);
|
|
||||||
}
|
|
||||||
if (!empty($param['end_time'])) {
|
|
||||||
$countQuery->where('p.create_time', '<=', $param['end_time']);
|
|
||||||
$listQuery->where('p.create_time', '<=', $param['end_time']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$total = $countQuery->count();
|
|
||||||
$list = $listQuery
|
|
||||||
->page($currPage, $pageSize)
|
|
||||||
->order('p.create_time desc')
|
->order('p.create_time desc')
|
||||||
->field('p.*, s.type_name as materials_type_name')
|
->field('p.*, s.type_name as materials_type_name')
|
||||||
->select();
|
->select();
|
||||||
return $this->sendSuccess(['list' => $list, 'total' => $total]);
|
return $this->sendSuccess($MaterialsInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//问题单信息
|
//问题单信息
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Role extends Common
|
|||||||
$results = db('system_router')->alias('router')
|
$results = db('system_router')->alias('router')
|
||||||
->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT')
|
->join('system_role', 'system_role.router_id = router.id OR system_role.router_id LIKE concat(router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id) OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\') OR system_role.router_id LIKE concat(\'%,\', router.id, \',%\')', 'LEFT')
|
||||||
->field('router.*, GROUP_CONCAT(system_role.role_name) as roles')
|
->field('router.*, GROUP_CONCAT(system_role.role_name) as roles')
|
||||||
->group('router.id')
|
->group('router.path')
|
||||||
->select();
|
->select();
|
||||||
$this->sendSuccess($results);
|
$this->sendSuccess($results);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,118 +1,58 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div slot="header" class="clearfix" style="display: flex; align-items: center; justify-content: space-between;">
|
<div slot="header" class="clearfix" v-if="edid_authority == true">
|
||||||
<div class="filter-bar">
|
<el-button style="float: right; " size="mini" class="el-icon-circle-plus-outline" type="primary"
|
||||||
<el-date-picker
|
@click="createMaterials">添加</el-button>
|
||||||
v-model="filter.dateRange"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="至"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
size="small"
|
|
||||||
style="width: 240px;"/>
|
|
||||||
<el-select v-model="filter.materials_type" placeholder="资料类型" clearable size="small" style="width: 160px; margin-left: 10px;">
|
|
||||||
<el-option label="全部" value=""/>
|
|
||||||
<el-option v-for="item in materials_type_list" :key="item.type_id" :label="item.type_name" :value="item.type_id"/>
|
|
||||||
</el-select>
|
|
||||||
<el-button type="primary" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="handleQuery">查询</el-button>
|
|
||||||
<el-button size="small" icon="el-icon-refresh" style="margin-left: 4px;" @click="handleReset">重置</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="edid_authority == true">
|
<el-table :data="materials_info_list" border fit highlight-current-row
|
||||||
<el-button size="mini" class="el-icon-circle-plus-outline" type="primary" @click="createMaterials">添加</el-button>
|
style="width: 100%; margin-left: 2px; margin-top: 20px;" height="80vh">
|
||||||
</div>
|
<el-table-column prop="materials_id" label="ID" align="left">
|
||||||
</div>
|
</el-table-column>
|
||||||
<el-table
|
<el-table-column prop="materials_type_name" label="资料类型" align="left">
|
||||||
v-if="query_triggered"
|
</el-table-column>
|
||||||
:data="materials_info_list"
|
<el-table-column prop="materials_intro" label="资料简介" align="left">
|
||||||
border
|
</el-table-column>
|
||||||
fit
|
<el-table-column prop="create_time" label="时间" align="left">
|
||||||
highlight-current-row
|
</el-table-column>
|
||||||
style="width: 100%; margin-left: 2px; margin-top: 20px;"
|
|
||||||
height="80vh">
|
|
||||||
<el-table-column prop="materials_id" label="ID" align="left"/>
|
|
||||||
<el-table-column prop="materials_type_name" label="资料类型" align="left"/>
|
|
||||||
<el-table-column prop="materials_intro" label="资料简介" align="left"/>
|
|
||||||
<el-table-column prop="create_time" label="时间" align="left"/>
|
|
||||||
|
|
||||||
<el-table-column fixed="right" label="操作" width="250px">
|
<el-table-column fixed="right" label="操作" width="250px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button class="el-icon-view" v-if="scope.row.contract_url != ''" @click="showImg(scope.row)"
|
||||||
v-if="scope.row.contract_url != ''"
|
size="mini" type="primary"></el-button>
|
||||||
class="el-icon-view"
|
<el-button @click="update(scope.row)" size="mini" class="el-icon-edit" type="primary"
|
||||||
size="mini"
|
v-if="edid_authority == true"></el-button>
|
||||||
type="primary"
|
<el-button class="el-icon-delete" @click="handleClick(scope.row)" size="mini"
|
||||||
@click="showImg(scope.row)"/>
|
type="danger"></el-button>
|
||||||
<el-button
|
|
||||||
v-if="edid_authority == true"
|
|
||||||
size="mini"
|
|
||||||
class="el-icon-edit"
|
|
||||||
type="primary"
|
|
||||||
@click="update(scope.row)"/>
|
|
||||||
<el-button
|
|
||||||
class="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
type="danger"
|
|
||||||
@click="handleClick(scope.row)"/>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
|
||||||
v-if="query_triggered"
|
|
||||||
:total="total"
|
|
||||||
:page-size="pageSize"
|
|
||||||
:current-page.sync="currPage"
|
|
||||||
:page-sizes="[10, 20, 50, 100]"
|
|
||||||
style="margin-top: 15px; text-align: right;"
|
|
||||||
background
|
|
||||||
layout="total, prev, pager, next, sizes, jumper"
|
|
||||||
@size-change="handleSizeChange"
|
|
||||||
@current-change="handleCurrentChange"/>
|
|
||||||
<div v-if="!query_triggered" style="text-align: center; margin-top: 80px; color: #909399;">
|
|
||||||
请选择筛选条件后点击查询
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 添加合同信息对话框 -->
|
<!-- 添加合同信息对话框 -->
|
||||||
<el-dialog
|
<el-dialog title="添加文件" :visible.sync="dialogVisibleCreateMaterials" :close-on-click-modal="false" width="30%"
|
||||||
:visible.sync="dialogVisibleCreateMaterials"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
title="添加文件"
|
|
||||||
width="30%"
|
|
||||||
append-to-body>
|
append-to-body>
|
||||||
<el-form :model="newMaterials" label-width="80px">
|
<el-form :model="newMaterials" label-width="80px">
|
||||||
<el-form-item label="文件简介">
|
<el-form-item label="文件简介">
|
||||||
<el-input v-model="newMaterials.materials_intro"/>
|
<el-input v-model="newMaterials.materials_intro"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="资料类型">
|
<el-form-item label="资料类型">
|
||||||
<el-select v-model="newMaterials.materials_type" filterable placeholder="资料类型" style="width: 100%;">
|
<el-select v-model="newMaterials.materials_type" filterable placeholder="资料类型" style="width: 100%;">
|
||||||
<el-option
|
<el-option v-for="item in materials_type_list" :key="item.type_id" :label="item.type_name"
|
||||||
v-for="item in materials_type_list"
|
:value="item.type_id">
|
||||||
:key="item.type_id"
|
</el-option>
|
||||||
:label="item.type_name"
|
|
||||||
:value="item.type_id"/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="文件时间">
|
<el-form-item label="文件时间">
|
||||||
<el-date-picker
|
<el-date-picker v-model="newMaterials.create_time" type="date" format="yyyy-MM-dd"
|
||||||
v-model="newMaterials.create_time"
|
value-format="yyyy-MM-dd" placeholder="选择日期时间">
|
||||||
type="date"
|
</el-date-picker>
|
||||||
format="yyyy-MM-dd"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="选择日期时间"/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="添加文件">
|
<el-form-item label="添加文件">
|
||||||
<el-upload
|
<el-upload class="upload-demo" :action="upload_url" :on-preview="handlePreview"
|
||||||
:action="upload_url"
|
:on-remove="handleRemove" :on-success="handleNewSuccess" :before-upload="beforeUpload"
|
||||||
:on-preview="handlePreview"
|
:file-list="fileList" accept=".jpg,.jpeg,.png,.pdf,.pptx,.xlsx,.xls,.docx,.doc,.ppt,.zip,.rar">
|
||||||
:on-remove="handleRemove"
|
|
||||||
:on-success="handleNewSuccess"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
:file-list="fileList"
|
|
||||||
class="upload-demo"
|
|
||||||
accept=".jpg,.jpeg,.png,.pdf,.pptx,.xlsx,.xls,.docx,.doc,.ppt,.zip,.rar">
|
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
<div slot="tip" class="el-upload__tip">
|
<div slot="tip" class="el-upload__tip">
|
||||||
支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB
|
支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB
|
||||||
@@ -127,50 +67,32 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 编辑协议对话框 -->
|
<!-- 编辑协议对话框 -->
|
||||||
<el-dialog
|
<el-dialog title="编辑协议信息" :visible.sync="dialogVisibleEditMaterials" :close-on-click-modal="false" width="30%"
|
||||||
:visible.sync="dialogVisibleEditMaterials"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
title="编辑协议信息"
|
|
||||||
width="30%"
|
|
||||||
append-to-body>
|
append-to-body>
|
||||||
<el-form :model="editMaterials" label-width="80px">
|
<el-form :model="editMaterials" label-width="80px">
|
||||||
<el-form-item label="文件简介">
|
<el-form-item label="文件简介">
|
||||||
<el-input v-model="editMaterials.materials_intro"/>
|
<el-input v-model="editMaterials.materials_intro"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="文件时间">
|
<el-form-item label="文件时间">
|
||||||
<el-date-picker
|
<el-date-picker v-model="editMaterials.create_time" type="date" format="yyyy-MM-dd"
|
||||||
v-model="editMaterials.create_time"
|
value-format="yyyy-MM-dd" placeholder="选择日期时间">
|
||||||
type="date"
|
</el-date-picker>
|
||||||
format="yyyy-MM-dd"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
placeholder="选择日期时间"/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="资料类型">
|
<el-form-item label="资料类型">
|
||||||
<el-select
|
<el-select v-model="editMaterials.materials_type" filterable placeholder="资料类型"
|
||||||
v-model="editMaterials.materials_type"
|
|
||||||
filterable
|
|
||||||
placeholder="资料类型"
|
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<el-option
|
<el-option v-for="item in materials_type_list" :key="item.type_id" :label="item.type_name"
|
||||||
v-for="item in materials_type_list"
|
:value="item.type_id">
|
||||||
:key="item.type_id"
|
</el-option>
|
||||||
:label="item.type_name"
|
|
||||||
:value="item.type_id"/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="添加文件">
|
<el-form-item label="添加文件">
|
||||||
<el-upload
|
<el-upload class="upload-demo" :action="upload_url" :on-preview="handlePreview"
|
||||||
:action="upload_url"
|
:on-remove="handleRemove" :on-success="handleNewSuccess" :before-upload="beforeUpload"
|
||||||
:on-preview="handlePreview"
|
:file-list="fileList" accept=".jpg,.jpeg,.png,.pdf,.pptx,.xlsx,.xls,.docx,.doc,.ppt,.zip,.rar">
|
||||||
:on-remove="handleRemove"
|
|
||||||
:on-success="handleNewSuccess"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
:file-list="fileList"
|
|
||||||
class="upload-demo"
|
|
||||||
accept=".jpg,.jpeg,.png,.pdf,.pptx,.xlsx,.xls,.docx,.doc,.ppt,.zip,.rar">
|
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
<div slot="tip" class="el-upload__tip">
|
<div slot="tip" class="el-upload__tip">
|
||||||
支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB
|
支持jpg/jpeg/png/pdf/pptx/xlsx/xls/docx/doc/ppt/zip/rar文件,不超过100MB
|
||||||
@@ -185,9 +107,9 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 显示文件对话框 -->
|
<!-- 显示文件对话框 -->
|
||||||
<el-dialog :visible.sync="dialogVisibleShowFile" title="文件信息" width="80%" append-to-body>
|
<el-dialog title="文件信息" :visible.sync="dialogVisibleShowFile" width="80%" append-to-body>
|
||||||
<img v-if="isImage" :src="previewUrl" alt="Preview" style="max-width: 40%; max-height: 30%;">
|
<img v-if="isImage" :src="previewUrl" alt="Preview" style="max-width: 40%; max-height: 30%;">
|
||||||
<iframe v-else-if="isPDF" :src="previewUrl" frameborder="0" style="width: 100%; height: 600px;"/>
|
<iframe v-else-if="isPDF" :src="previewUrl" frameborder="0" style="width: 100%; height: 600px;"></iframe>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<p>该文件类型({{ fileExtension }})需要下载后查看</p>
|
<p>该文件类型({{ fileExtension }})需要下载后查看</p>
|
||||||
<el-button type="primary" @click="downloadFile(previewUrl)">
|
<el-button type="primary" @click="downloadFile(previewUrl)">
|
||||||
@@ -204,44 +126,34 @@
|
|||||||
import project from '@/api/project'
|
import project from '@/api/project'
|
||||||
import material from '@/api/material'
|
import material from '@/api/material'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Materials',
|
name: 'Materials',
|
||||||
// materials_class 资料分类 1项目 2问题 3story 4task
|
//materials_class 资料分类 1项目 2问题 3story 4task
|
||||||
// materials_type 具体文件属性,技术文件,会议纪要,问题描述等
|
//materials_type 具体文件属性,技术文件,会议纪要,问题描述等
|
||||||
// materials_owner:资料属于那个项目或问题或story或task
|
//materials_owner:资料属于那个项目或问题或story或task
|
||||||
props: {
|
props: ['materials_class', 'materials_owner', 'materials_type', 'edid_authority'],
|
||||||
materials_class: { type: Number, default: 1 },
|
|
||||||
materials_owner: { type: [Number, String], default: 0 },
|
|
||||||
materials_type: { type: [Number, Array], default: undefined },
|
|
||||||
edid_authority: { type: Boolean, default: false }
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
upload_url: process.env.BASE_WMS_API + '/upload/uploadFile',
|
upload_url: process.env.BASE_WMS_API + '/upload/uploadFile',
|
||||||
materials_info_list: [],
|
materials_info_list: [],
|
||||||
fileExtension: '',
|
fileExtension: '', // 新增文件类型显示
|
||||||
isImage: false,
|
isImage: false,
|
||||||
isPDF: false,
|
isPDF: false,
|
||||||
materials_type_list: [],
|
materials_type_list: [],
|
||||||
materials_url: '',
|
materials_url: '',
|
||||||
fileName: '',
|
fileName: '',
|
||||||
currentFileName: '',
|
currentFileName: '',
|
||||||
query_triggered: false,
|
|
||||||
total: 0,
|
|
||||||
currPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
filter: {
|
|
||||||
dateRange: null,
|
|
||||||
materials_type: ''
|
|
||||||
},
|
|
||||||
newMaterials: {
|
newMaterials: {
|
||||||
materials_intro: '',
|
materials_intro: '',
|
||||||
|
materials_intro: 0,
|
||||||
create_time: '',
|
create_time: '',
|
||||||
project_id: 0
|
project_id: 0
|
||||||
},
|
},
|
||||||
editMaterials: {
|
editMaterials: {
|
||||||
materials_id: '',
|
materials_id: '',
|
||||||
|
materials_intro: 0,
|
||||||
materials_intro: '',
|
materials_intro: '',
|
||||||
create_time: '',
|
create_time: '',
|
||||||
project_id: 0,
|
project_id: 0,
|
||||||
@@ -249,14 +161,12 @@ export default {
|
|||||||
},
|
},
|
||||||
dialogVisibleCreateMaterials: false,
|
dialogVisibleCreateMaterials: false,
|
||||||
dialogVisibleEditMaterials: false,
|
dialogVisibleEditMaterials: false,
|
||||||
dialogVisibleShowFile: false
|
dialogVisibleShowFile: false,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.get_materials_info_list()
|
||||||
this.get_material_type_list()
|
this.get_material_type_list()
|
||||||
if (!Array.isArray(this.materials_type)) {
|
|
||||||
this.filter.materials_type = this.materials_type
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
@@ -270,54 +180,34 @@ export default {
|
|||||||
this.$message({
|
this.$message({
|
||||||
message: res.data.message,
|
message: res.data.message,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
});
|
||||||
this.get_materials_info_list()
|
this.get_materials_info_list()
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: res.data.message,
|
message: res.data.message,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除'
|
message: '已取消删除'
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
// 新增下载方法
|
||||||
|
// 在下载方法中添加文件名保留
|
||||||
downloadFile(url) {
|
downloadFile(url) {
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a');
|
||||||
link.href = url
|
link.href = url;
|
||||||
link.setAttribute('download', this.currentFileName)
|
link.setAttribute('download', this.currentFileName); // 使用数据库中的文件名
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link);
|
||||||
link.click()
|
link.click();
|
||||||
document.body.removeChild(link)
|
document.body.removeChild(link);
|
||||||
},
|
|
||||||
handleQuery() {
|
|
||||||
this.currPage = 1
|
|
||||||
this.query_triggered = true
|
|
||||||
this.get_materials_info_list()
|
|
||||||
},
|
|
||||||
handleReset() {
|
|
||||||
this.filter.dateRange = null
|
|
||||||
this.filter.materials_type = ''
|
|
||||||
this.currPage = 1
|
|
||||||
this.pageSize = 10
|
|
||||||
this.total = 0
|
|
||||||
this.query_triggered = false
|
|
||||||
this.materials_info_list = []
|
|
||||||
},
|
|
||||||
handleSizeChange(val) {
|
|
||||||
this.pageSize = val
|
|
||||||
this.currPage = 1
|
|
||||||
this.get_materials_info_list()
|
|
||||||
},
|
|
||||||
handleCurrentChange(val) {
|
|
||||||
this.currPage = val
|
|
||||||
this.get_materials_info_list()
|
|
||||||
},
|
},
|
||||||
confirmEdit() {
|
confirmEdit() {
|
||||||
|
// 获取表单数据
|
||||||
const formData = {
|
const formData = {
|
||||||
materials_id: this.editMaterials.materials_id,
|
materials_id: this.editMaterials.materials_id,
|
||||||
create_time: this.editMaterials.create_time,
|
create_time: this.editMaterials.create_time,
|
||||||
@@ -325,22 +215,22 @@ export default {
|
|||||||
materials_intro: this.editMaterials.materials_intro,
|
materials_intro: this.editMaterials.materials_intro,
|
||||||
materials_type: this.editMaterials.materials_type,
|
materials_type: this.editMaterials.materials_type,
|
||||||
materials_file_name: this.fileName
|
materials_file_name: this.fileName
|
||||||
}
|
};
|
||||||
|
|
||||||
console.log(formData)
|
console.log(formData);
|
||||||
|
|
||||||
|
// 调用后端接口更新数据
|
||||||
project.EditProjectMaterialsInfo(formData).then(response => {
|
project.EditProjectMaterialsInfo(formData).then(response => {
|
||||||
if (response.data.code === 20000) {
|
if (response.data.code === 20000) {
|
||||||
this.$message.success('更新成功')
|
this.$message.success('更新成功')
|
||||||
this.dialogVisibleEditMaterials = false
|
this.dialogVisibleEditMaterials = false
|
||||||
this.get_materials_info_list()
|
this.get_materials_info_list() // 刷新资产列表
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('更新失败:' + response.data.message)
|
this.$message.error('更新失败:' + response.data.message)
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error)
|
|
||||||
this.$message.error('请求失败,请稍后重试')
|
this.$message.error('请求失败,请稍后重试')
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
update(row) {
|
update(row) {
|
||||||
@@ -352,10 +242,11 @@ export default {
|
|||||||
this.editMaterials.materials_type = row.materials_type
|
this.editMaterials.materials_type = row.materials_type
|
||||||
this.dialogVisibleEditMaterials = true
|
this.dialogVisibleEditMaterials = true
|
||||||
|
|
||||||
this.fileList = []
|
// 清空文件列表
|
||||||
|
this.fileList = [];
|
||||||
|
|
||||||
const url = this.editMaterials.materials_url
|
const url = this.editMaterials.materials_url
|
||||||
const ext = url.split('.').pop().toLowerCase()
|
const ext = url.split('.').pop().toLowerCase();
|
||||||
|
|
||||||
if (ext === 'jpg' || ext === 'jpeg' || ext === 'png') {
|
if (ext === 'jpg' || ext === 'jpeg' || ext === 'png') {
|
||||||
this.isImage = true
|
this.isImage = true
|
||||||
@@ -363,6 +254,8 @@ export default {
|
|||||||
} else if (ext === 'pdf') {
|
} else if (ext === 'pdf') {
|
||||||
this.isImage = false
|
this.isImage = false
|
||||||
this.isPDF = true
|
this.isPDF = true
|
||||||
|
} else if (ext === '') {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('不支持的文件类型预览')
|
this.$message.error('不支持的文件类型预览')
|
||||||
}
|
}
|
||||||
@@ -391,20 +284,20 @@ export default {
|
|||||||
'jpg', 'jpeg', 'png', 'pdf',
|
'jpg', 'jpeg', 'png', 'pdf',
|
||||||
'pptx', 'xlsx', 'xls', 'docx',
|
'pptx', 'xlsx', 'xls', 'docx',
|
||||||
'doc', 'ppt', 'zip', 'rar'
|
'doc', 'ppt', 'zip', 'rar'
|
||||||
]
|
];
|
||||||
const extension = file.name.split('.').pop().toLowerCase()
|
const extension = file.name.split('.').pop().toLowerCase();
|
||||||
const isAllowed = allowedExtensions.includes(extension)
|
const isAllowed = allowedExtensions.includes(extension);
|
||||||
const isLt100M = file.size / 1024 / 1024 < 100
|
const isLt100M = file.size / 1024 / 1024 < 100;
|
||||||
|
|
||||||
if (!isAllowed) {
|
if (!isAllowed) {
|
||||||
this.$message.error('不支持的文件类型!')
|
this.$message.error('不支持的文件类型!');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
if (!isLt100M) {
|
if (!isLt100M) {
|
||||||
this.$message.error('文件大小不能超过100MB!')
|
this.$message.error('文件大小不能超过100MB!');
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
showImg(row) {
|
showImg(row) {
|
||||||
@@ -412,9 +305,8 @@ export default {
|
|||||||
const ext = url.split('.').pop().toLowerCase()
|
const ext = url.split('.').pop().toLowerCase()
|
||||||
this.currentFileName = row.materials_file_name
|
this.currentFileName = row.materials_file_name
|
||||||
this.isImage = false
|
this.isImage = false
|
||||||
this.isPDF = true
|
|
||||||
this.isPDF = false
|
this.isPDF = false
|
||||||
this.fileExtension = ext
|
this.fileExtension = ext // 记录文件扩展名
|
||||||
|
|
||||||
if (['jpg', 'jpeg', 'png'].includes(ext)) {
|
if (['jpg', 'jpeg', 'png'].includes(ext)) {
|
||||||
this.previewUrl = process.env.BASE_WMS_FILE + url
|
this.previewUrl = process.env.BASE_WMS_FILE + url
|
||||||
@@ -423,20 +315,20 @@ export default {
|
|||||||
this.previewUrl = process.env.BASE_WMS_FILE + url
|
this.previewUrl = process.env.BASE_WMS_FILE + url
|
||||||
this.isPDF = true
|
this.isPDF = true
|
||||||
} else {
|
} else {
|
||||||
this.previewUrl = process.env.BASE_WMS_FILE + url
|
this.previewUrl = process.env.BASE_WMS_FILE + url // 必须设置预览URL
|
||||||
}
|
}
|
||||||
this.dialogVisibleShowFile = true
|
this.dialogVisibleShowFile = true
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmAddMaterials() {
|
confirmAddMaterials() {
|
||||||
if (this.newMaterials.materials_intro.trim() === '') {
|
if (this.newMaterials.materials_intro.trim() === '') {
|
||||||
this.$message.warning('请输入文件描述')
|
this.$message.warning('请输入文件描述');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
console.log(this.materials_url)
|
console.log(this.materials_url)
|
||||||
if (this.materials_url.trim() === '') {
|
if (this.materials_url.trim() === '') {
|
||||||
this.$message.warning('请选择文件')
|
this.$message.warning('请选择文件');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var param = {
|
var param = {
|
||||||
@@ -447,68 +339,47 @@ export default {
|
|||||||
materials_url: this.materials_url,
|
materials_url: this.materials_url,
|
||||||
materials_file_name: this.fileName,
|
materials_file_name: this.fileName,
|
||||||
create_time: this.newMaterials.create_time
|
create_time: this.newMaterials.create_time
|
||||||
}
|
};
|
||||||
|
|
||||||
material.AddMaterialsInfo(param).then(response => {
|
material.AddMaterialsInfo(param).then(response => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '添加成功'
|
message: '添加成功'
|
||||||
})
|
});
|
||||||
this.dialogVisibleCreateMaterials = false
|
|
||||||
this.query_triggered = true
|
|
||||||
this.currPage = 1
|
|
||||||
this.get_materials_info_list()
|
this.get_materials_info_list()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error)
|
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '添加失败,请重试' + error.toString()
|
message: '添加失败,请重试' + error.toString()
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
this.dialogVisibleCreateMaterials = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
get_materials_info_list() {
|
get_materials_info_list() {
|
||||||
var param = {
|
var param = {
|
||||||
materials_owner: this.materials_owner,
|
materials_owner: this.materials_owner,
|
||||||
materials_class: this.materials_class,
|
materials_class: this.materials_class,
|
||||||
currPage: this.currPage,
|
materials_type: this.materials_type
|
||||||
pageSize: this.pageSize
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.filter.materials_type !== '') {
|
|
||||||
param.materials_type = this.filter.materials_type
|
|
||||||
} else if (!Array.isArray(this.materials_type)) {
|
|
||||||
param.materials_type = this.materials_type
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.filter.dateRange && this.filter.dateRange.length === 2) {
|
|
||||||
param.start_time = this.filter.dateRange[0]
|
|
||||||
param.end_time = this.filter.dateRange[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
material.GetMaterialsInfo(param).then(response => {
|
material.GetMaterialsInfo(param).then(response => {
|
||||||
const data = response.data.data
|
this.materials_info_list = response.data.data
|
||||||
if (data && data.list !== undefined) {
|
console.log(this.materials_info_list);
|
||||||
this.materials_info_list = data.list
|
|
||||||
this.total = data.total
|
|
||||||
} else {
|
|
||||||
this.materials_info_list = data
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
get_material_type_list() {
|
get_material_type_list() {
|
||||||
material.GetMaterialsType().then(response => {
|
material.GetMaterialsType().then(response => {
|
||||||
this.materials_type_list = response.data.data
|
this.materials_type_list = response.data.data
|
||||||
|
//console.log(this.issue_type_list);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
createMaterials() {
|
createMaterials() {
|
||||||
this.newMaterials.materials_intro = ''
|
this.newMaterials.materials_intro = ''
|
||||||
this.newMaterials.create_time = ''
|
this.newMaterials.create_time = ''
|
||||||
this.newMaterials.materials_type = this.filter.materials_type || ''
|
|
||||||
this.materials_url = ''
|
this.materials_url = ''
|
||||||
this.fileList = []
|
this.fileList = [];
|
||||||
this.dialogVisibleCreateMaterials = true
|
this.dialogVisibleCreateMaterials = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user