fix : 修复页面细节

This commit is contained in:
2024-05-30 16:05:09 +08:00
parent 2ab4eb1a7e
commit 94528cfa06
18 changed files with 412 additions and 301 deletions

View File

@@ -8,13 +8,16 @@
</template>
<script setup lang="jsx">
const router = useRouter()
const route = useRoute()
const searchConfig = reactive([
{
label: '名称',
label: '项目名称',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入名称查询',
placeholder: '请输入项目名称查询',
clearable: true,
filterable: true,
checkStrictly: true
@@ -82,13 +85,13 @@ const tableConfig = reactive({
}
],
api: '/workflow/mosr/expense/ledger',
params: {},
params: {
projectId:route.query.id
},
btns: [
{name: '上传费用', key: 'add', color: '#DED0B2',auth: ''}
]
})
const router = useRouter()
const route = useRoute()
const tableIns=ref()
const headBtnClick = (key) => {
switch (key) {

View File

@@ -1,20 +1,11 @@
<template>
<el-form :model="attachment" inline class="query-form" ref="queryForm" rules="rules">
<el-form :model="attachment" inline class="query-form">
<el-form-item label="标签" prop="tag">
<el-select v-model="attachment.tag" placeholder="请选择标签" clearable filterable style="width: 200px">
<el-option
v-for="item in tagsOption"
:key="item.label"
:label="item.value"
:value="item.label"
/>
</el-select>
<el-input v-model="attachment.tag" placeholder="请输入标签" clearable style="width: 200px"/>
</el-form-item>
<el-form-item>
<el-button @click="handleSearch(queryForm)" color="#DED0B2">搜索</el-button>
<el-button color="#DED0B2" :disabled="!attachment.tag" style="padding: 0" title="请先选择标签再上传附件!">
<file-upload @getFile="getFile" :disabled="!attachment.tag"/>
</el-button>
<el-button @click="handleSearch" color="#DED0B2">搜索</el-button>
<el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>
</el-form-item>
</el-form>
<el-card style="width: 100%">
@@ -29,7 +20,7 @@
<script setup lang="jsx">
import {downloadFile} from "@/api/project-demand";
import {getImplementationAttachment,searchFile} from "@/api/project-manage";
import {getImplementationAttachment} from "@/api/project-manage";
import {ElNotification} from "element-plus";
const route = useRoute()
@@ -37,11 +28,6 @@ const router = useRouter()
const attachment = reactive({
tag: ''
})
const rules = reactive({
tag: [{required: true, message: '请选择标签', trigger: 'blur'}]
})
const queryForm = ref()
const tagsOption = ref([])
const tableConfig = reactive({
columns: [
{
@@ -71,6 +57,7 @@ const tableConfig = reactive({
prop: 'oper',
label: '操作',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
return (
<div>
@@ -84,58 +71,39 @@ const tableConfig = reactive({
const showTable = ref(true)
const otherFileList = ref([])
const compositeParam = (item) => {
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: attachment.tag,
const handleSearch = () => {
let params
if (attachment.tag) {
params = {
projectId: route.query.id,
tag: attachment.tag
}
} else {
params = {
projectId: route.query.id
}
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
otherFileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getTagsOption = (id = route.query.id) => {
if (!route.query.id) return
getImplementationAttachment(id).then(res => {
getImplementationAttachment(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
showTable.value = false
if (res.code === 1000) {
tagsOption.value = res.data
otherFileList.value = res.data
nextTick(() => {
showTable.value = true
})
}
})
}
const handleSearch = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let tagName = ''
tagsOption.value.forEach(item => {
if (item.label === attachment.tag) {
tagName = item.value
}
})
searchFile(route.query.id, tagName).then(res => {
showTable.value = false
if (res.code === 1000) {
otherFileList.value = res.data
nextTick(() => {
showTable.value = true
})
}
})
const handleUpload = () => {
router.push({
name: 'Implementation/upload',
query: {
id: route.query.id
}
})
}
const handleDownload = (row) => {
@@ -147,7 +115,7 @@ const handleDownload = (row) => {
a.click()
})
}
getTagsOption()
handleSearch()
</script>
<style scoped>

View File

@@ -14,11 +14,11 @@ import {reactive, shallowRef} from "vue";
const router = useRouter()
const searchConfig = reactive([
{
label: '名称',
label: '项目名称',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入名称查询',
placeholder: '请输入项目名称查询',
clearable: true,
filterable: true,
checkStrictly: true

View File

@@ -12,11 +12,11 @@ import {reactive} from "vue";
const searchConfig = reactive([
{
label: '名称',
label: '需求名称',
prop: 'requirementName',
component: 'el-input',
props: {
placeholder: '请输入名称查询',
placeholder: '请输入需求名称查询',
clearable: true,
filterable: true,
checkStrictly: true

View File

@@ -1,22 +1,46 @@
<template>
<baseTitle title="标签名称"></baseTitle>
<el-input v-model="tagName" placeholder="请输入标签名称"/>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 400px"/>
</el-form-item>
</el-form>
<baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getOtherFile"/>
<file-upload @getFile="getFile"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="otherFileList" :isSettingCol="false" :pagination="false">
:data="fileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
</fvTable>
</el-card>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button>
</div>
</template>
<script setup lang="jsx">
const tagName = ref('')
const otherFileList = ref([])
import {uploadAttachment} from "@/api/project-manage";
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const fileList = ref([])
const formData = ref({
tagName:''
})
const tableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '附件名称',
@@ -47,8 +71,70 @@ const tableConfig = reactive({
]
})
const showTable = ref(true)
const getOtherFile = () => {
const tagForm = ref()
const name = ref(router.currentRoute.value.name)
const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
})
const compositeParam = (item) => {
let tag = ''
if (name.value === 'Implementation/upload') {
tag = '项目实施'
}
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: tag,
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId,
tag: item.tag
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
fileList: files,
projectId: route.query.id,
tag: formData.value.tagName
}
console.log('params', params)
let res = await uploadAttachment(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Implementation/attachment',
query:{
id: route.query.id
}
})
}
})
}
</script>

View File

@@ -1,7 +1,7 @@
<template>
<baseTitle title="上传费用"></baseTitle>
<el-form :model="tableForm" :rules="rules">
<el-table :data="tableForm.tableData" style="width: 100%">
<el-form :model="tableData" ref="form" :rules="rules">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="projectName" label="项目名称">
<template #default="scope">
<el-form-item prop="projectName">
@@ -12,38 +12,60 @@
</el-table-column>
<el-table-column prop="time" label="时间">
<template #default="scope">
<el-date-picker
v-model="scope.row.time"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择时间"
>
</el-date-picker>
<el-form-item prop="time">
<el-date-picker
v-model="scope.row.time"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="选择时间"
>
</el-date-picker>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="projectCost" label="项目费用">
<template #default="scope">
<el-input v-model="scope.row.projectCost" placeholder="请输入项目费用" clearable>
</el-input>
<el-form-item prop="projectCost">
<el-select v-model="scope.row.projectCost" placeholder="请选择费用性质" clearable filterable>
<el-option
v-for="item in cacheStore.getDict('project_cost')"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="researchStage" label="研发阶段">
<template #default="scope">
<el-input v-model="scope.row.researchStage" placeholder="请选择研发阶段" clearable>
</el-input>
<el-form-item prop="researchStage">
<el-select v-model="scope.row.researchStage" placeholder="请选择研发阶段" clearable filterable>
<el-option
v-for="item in cacheStore.getDict('research_stage')"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="digest" label="摘要">
<template #default="scope">
<el-input v-model="scope.row.digest" placeholder="请输入摘要" clearable>
</el-input>
<el-form-item prop="digest">
<el-input v-model="scope.row.digest" placeholder="请输入摘要" clearable>
</el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="afterTax" label="税后余额(元)">
<template #default="scope">
<el-input v-model="scope.row.afterTax" placeholder="请输入税后余额" clearable>
</el-input>
<el-form-item prop="afterTax">
<el-input v-model="scope.row.afterTax" placeholder="请输入税后余额" clearable>
</el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="oper" label="操作">
@@ -57,7 +79,7 @@
<el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button>
</div>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit">提交</el-button>
<el-button color="#DED0B2" @click="handleSubmit(form)">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
</template>
@@ -67,26 +89,45 @@ import {ElNotification} from "element-plus";
import {addLedger} from "@/api/project-manage";
import {useTagsView} from '@/stores/tagsview.js'
import {useRoute} from "vue-router";
import {useCacheStore} from '@/stores/cache.js'
const cacheStore = useCacheStore()
const route = useRoute()
const tagsViewStore = useTagsView()
const formData = ref({})
const form = ref()
const rules = reactive({
auditOpinion: [{required: true, message: '请输入审核意见', trigger: 'blur'}],
})
const tableForm = reactive({
tableData: [
{
projectId: route.query.id,
projectName: '',
time: '',
projectCost: '',
researchStage: '',
digest: '',
afterTax: ''
}
]
projectName: [{required: true, message: '请输入项目名称', trigger:["blur", 'change']}],
time: [{required: true, message: '请选择时间', trigger: 'blur'}],
projectCost: [{required: true, message: '请输入项目费用', trigger: 'blur'}],
researchStage: [{required: true, message: '请输入研发阶段', trigger: 'blur'}],
digest: [{required: true, message: '请输入摘要', trigger: 'blur'}],
afterTax: [{required: true, message: '请输入税后余额', trigger: 'blur'}]
})
const tableData=ref([
{
projectId: route.query.id,
projectName: '',
time: '',
projectCost: '',
researchStage: '',
digest: '',
afterTax: ''
}
])
// const tableForm = reactive({
// tableData: [
// {
// projectId: route.query.id,
// projectName: '',
// time: '',
// projectCost: '',
// researchStage: '',
// digest: '',
// afterTax: ''
// }
// ]
// })
const handleAdd = () => {
let row = {
projectId: route.query.id,
@@ -97,30 +138,29 @@ const handleAdd = () => {
digest: '',
afterTax: ''
}
tableForm.tableData.push(row)
tableData.value.push(row)
}
const handleDelete = (index) => {
tableForm.tableData.splice(index, 1)
tableData.value.splice(index, 1)
}
const handleSubmit = (instance) => {
// if (!instance) return
// instance.validate(async (valid) => {
// if (!valid) return
let params = {}
console.log('params', tableForm.tableData)
const res = addLedger(tableForm.tableData)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
console.log('params', tableData.value)
// const res = addLedger(tableData.value)
// ElNotification({
// title: '提示',
// message: res.msg,
// type: res.code === 1000 ? 'success' : 'error'
// })
// if (res.code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// router.push({
// name: 'Implementation'
// })
// }
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Implementation'
})
}
// })
}
const handleBack = () => {
history.back()