341个人办公-工作动态-预览格式问题

This commit is contained in:
gaoyuanwei 2022-06-29 14:34:42 +08:00
parent 738ebda646
commit 592c506c23
2 changed files with 189 additions and 186 deletions

View File

@ -340,15 +340,15 @@
<script> <script>
// @ is an alias to /src // @ is an alias to /src
export default { export default {
data() { data () {
return { return {
fileUploadUrl: window.SITE_CONFIG.apiURL + "/upload", fileUploadUrl: window.SITE_CONFIG.apiURL + '/upload',
// //
queryData: { queryData: {
keyworld: "", keyworld: '',
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0
}, },
// //
tableData: [], tableData: [],
@ -359,307 +359,307 @@ export default {
// imageUrl: '', // imageUrl: '',
// //
addDataFrom: { addDataFrom: {
title: "", title: '',
note1: "", note1: '',
content: "", content: '',
imageUrl: "", imageUrl: '',
delFlag: 0, delFlag: 0
}, },
// //
addDataFromRules: { addDataFromRules: {
title: [{ required: true, message: "请输入标题", trigger: "blur" }], title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
note1: [{ required: true, message: "请输入摘要", trigger: "blur" }], note1: [{ required: true, message: '请输入摘要', trigger: 'blur' }],
content: [{ required: true, message: "请输入内容", trigger: "blur" }], content: [{ required: true, message: '请输入内容', trigger: 'blur' }],
imageUrl: [ imageUrl: [
{ required: true, message: "请输入图片地址", trigger: "blur" }, { required: true, message: '请输入图片地址', trigger: 'blur' }
], ]
}, },
editDataDialogVisabled: false, editDataDialogVisabled: false,
eidtDataForm: { eidtDataForm: {
title: "", title: '',
note1: "", note1: '',
content: "", content: '',
imageUrl: "", imageUrl: ''
}, },
eidtDataFromRules: { eidtDataFromRules: {
title: [{ required: true, message: "请输入标题", trigger: "blur" }], title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
note1: [{ required: true, message: "请输入摘要", trigger: "blur" }], note1: [{ required: true, message: '请输入摘要', trigger: 'blur' }],
content: [{ required: true, message: "请输入内容", trigger: "blur" }], content: [{ required: true, message: '请输入内容', trigger: 'blur' }],
imageUrl: [ imageUrl: [
{ required: true, message: "请输入图片地址", trigger: "blur" }, { required: true, message: '请输入图片地址', trigger: 'blur' }
], ]
}, },
perviewDataDialogVisabled: false, perviewDataDialogVisabled: false,
previewData: { previewData: {
title: "", title: '',
note1: "", note1: '',
content: "", content: '',
imageUrl: "", imageUrl: '',
delFlag: 0, delFlag: 0
}, },
previewImg: "", // previewImg: '', //
deleteDataArr: [], deleteDataArr: [],
dialogVisibleImg: false, dialogVisibleImg: false
}; }
}, },
created() { created () {
this.getTableData(); this.getTableData()
}, },
methods: { methods: {
tableChange(val) { tableChange (val) {
this.deleteDataArr = val.map((item) => item.id); this.deleteDataArr = val.map((item) => item.id)
console.log(this.deleteDataArr); console.log(this.deleteDataArr)
}, },
restTableData() { restTableData () {
this.queryData.keyworld = ""; this.queryData.keyworld = ''
this.getTableData(); this.getTableData()
}, },
showView(file) { showView (file) {
this.previewImg = file.url; this.previewImg = file.url
this.dialogVisibleImg = true; this.dialogVisibleImg = true
}, },
getTableData() { getTableData () {
this.$http this.$http
.get("/workdynamics/page", { .get('/workdynamics/page', {
params: { params: {
limit: this.queryData.pageSize, limit: this.queryData.pageSize,
page: this.queryData.pageIndex, page: this.queryData.pageIndex,
name: this.queryData.keyworld, name: this.queryData.keyworld
}, }
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.tableData = res.data.list; this.tableData = res.data.list
this.queryData.total = res.data.total; this.queryData.total = res.data.total
}) })
.catch(() => {}); .catch(() => {})
}, },
flashTableData() { flashTableData () {
this.queryData.pageIndex = 1; this.queryData.pageIndex = 1
this.getTableData(); this.getTableData()
}, },
// //
handleSizeChange(value) { handleSizeChange (value) {
this.queryData.pageSize = value; this.queryData.pageSize = value
this.getTableData(); this.getTableData()
}, },
// //
handleCurrentChange(val) { handleCurrentChange (val) {
this.queryData.pageIndex = val; this.queryData.pageIndex = val
this.getTableData(); this.getTableData()
}, },
// //
addDataDialogClose() { addDataDialogClose () {
this.$refs.addDataFormRef.resetFields(); this.$refs.addDataFormRef.resetFields()
this.addDataFrom.imageUrl = ""; this.addDataFrom.imageUrl = ''
this.$refs.addUpload.clearFiles(); this.$refs.addUpload.clearFiles()
// this.addDataFrom.imagesFiles = [] // this.addDataFrom.imagesFiles = []
// this.$refs.addDataFromUploadRef.clearFiles() // this.$refs.addDataFromUploadRef.clearFiles()
}, },
editDataDialogClose() { editDataDialogClose () {
this.$refs.editDataFormRef.resetFields(); this.$refs.editDataFormRef.resetFields()
this.eidtDataForm.imageUrl = ""; this.eidtDataForm.imageUrl = ''
this.$refs.editUpload.clearFiles(); this.$refs.editUpload.clearFiles()
}, },
// //
addDataDialogConfirm() { addDataDialogConfirm () {
this.$refs.addDataFormRef.validate(async (valid) => { this.$refs.addDataFormRef.validate(async (valid) => {
if (valid) { if (valid) {
//console.log("", this.addDataFrom); // console.log("", this.addDataFrom);
this.$http this.$http
.post("/workdynamics/insert", this.addDataFrom) .post('/workdynamics/insert', this.addDataFrom)
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.$message.success("新增成功"); this.$message.success('新增成功')
this.addDataDialogVisabled = false; this.addDataDialogVisabled = false
this.getTableData(); this.getTableData()
}) })
.catch(() => {}); .catch(() => {})
} else { } else {
this.$message.success("表单数据填写不完整"); this.$message.success('表单数据填写不完整')
} }
}); })
}, },
// //
handleExceed() { handleExceed () {
this.$message({ type: "error", message: "最多支持一张图片上传" }); this.$message({ type: 'error', message: '最多支持一张图片上传' })
}, },
// //
titleExceed(str) { titleExceed (str) {
if (str.length >= 200) { if (str.length >= 200) {
this.$message.error("标题文字不能超过200字"); this.$message.error('标题文字不能超过200字')
} }
}, },
// //
contentExceed(str) { contentExceed (str) {
if (str.length >= 2000) { if (str.length >= 2000) {
this.$message.error("内容文字不能超过2000字"); this.$message.error('内容文字不能超过2000字')
} }
}, },
// //
noteExceed(str) { noteExceed (str) {
if (str.length >= 1000) { if (str.length >= 1000) {
this.$message.error("摘要文字不能超过1000字"); this.$message.error('摘要文字不能超过1000字')
} }
}, },
// //
deleteData(row) { deleteData (row) {
console.log(row); console.log(row)
this.$confirm("此操作将删除当前数据, 是否继续?", "提示", { this.$confirm('此操作将删除当前数据, 是否继续?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning'
}) })
.then(async () => { .then(async () => {
let ids = []; let ids = []
if (this.deleteDataArr.length > 1) { if (this.deleteDataArr.length > 1) {
ids = this.deleteDataArr; ids = this.deleteDataArr
} else { } else {
ids = [row.id]; ids = [row.id]
} }
console.log(ids); console.log(ids)
this.$http this.$http
.delete("/workdynamics/delete", { .delete('/workdynamics/delete', {
data: ids, data: ids
}) })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.$message({ this.$message({
type: "success", type: 'success',
message: "删除成功!", message: '删除成功!'
}); })
this.getTableData(); this.getTableData()
}); })
}) })
.catch(() => { .catch(() => {
this.$message({ this.$message({
type: "info", type: 'info',
message: "已取消删除", message: '已取消删除'
}); })
}); })
}, },
// //
async openPreviewData(row) { async openPreviewData (row) {
console.log("预览预览", row); console.log('预览预览', row)
const { data: res } = await this.$http.get( const { data: res } = await this.$http.get(
`workdynamics/select/${row.id}` `workdynamics/select/${row.id}`
); )
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.previewData = res.data; this.previewData = res.data
this.perviewDataDialogVisabled = true; this.perviewDataDialogVisabled = true
}, },
perviewDataDialogClose() { perviewDataDialogClose () {
this.perviewDataDialogVisabled = false; this.perviewDataDialogVisabled = false
}, },
handleAvatarSuccess(res, file) { handleAvatarSuccess (res, file) {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.addDataFrom.imageUrl = res.data; this.addDataFrom.imageUrl = res.data
// this.imageUrl = URL.createObjectURL(file.raw); // this.imageUrl = URL.createObjectURL(file.raw);
}, },
beforeAvatarUpload(file) { beforeAvatarUpload (file) {
const isImage = const isImage =
file.type === "image/jpeg" || file.type === 'image/jpeg' ||
file.type === "image/jpg" || file.type === 'image/jpg' ||
file.type === "image/png"; file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2
if (!isImage) { if (!isImage) {
this.$message.error("上传头像图片只能是 JPG 格式!"); this.$message.error('上传头像图片只能是 JPG 格式!')
} }
if (!isLt2M) { if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 2MB!"); this.$message.error('上传头像图片大小不能超过 2MB!')
} }
return isImage && isLt2M; return isImage && isLt2M
}, },
eidtHandleAvatarSuccess(res, file) { eidtHandleAvatarSuccess (res, file) {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.eidtDataForm.imageUrl = res.data; this.eidtDataForm.imageUrl = res.data
// this.imageUrl = URL.createObjectURL(file.raw); // this.imageUrl = URL.createObjectURL(file.raw);
}, },
editBeforeAvatarUpload(file) { editBeforeAvatarUpload (file) {
const isImage = const isImage =
file.type === "image/jpeg" || file.type === 'image/jpeg' ||
file.type === "image/jpg" || file.type === 'image/jpg' ||
file.type === "image/png"; file.type === 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2
if (!isImage) { if (!isImage) {
this.$message.error("上传头像图片只能是 JPG 格式!"); this.$message.error('上传头像图片只能是 JPG 格式!')
} }
if (!isLt2M) { if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 2MB!"); this.$message.error('上传头像图片大小不能超过 2MB!')
} }
return isImage && isLt2M; return isImage && isLt2M
}, },
async openEditDialog(row) { async openEditDialog (row) {
const { data: res } = await this.$http.get( const { data: res } = await this.$http.get(
`workdynamics/select/${row.id}` `workdynamics/select/${row.id}`
); )
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.eidtDataForm = res.data; this.eidtDataForm = res.data
this.editDataDialogVisabled = true; this.editDataDialogVisabled = true
}, },
eidtDataDialogConfirm() { eidtDataDialogConfirm () {
this.$refs.editDataFormRef.validate(async (valid) => { this.$refs.editDataFormRef.validate(async (valid) => {
if (valid) { if (valid) {
console.log(this.eidtDataForm); console.log(this.eidtDataForm)
this.$http this.$http
.put("/workdynamics/update", this.eidtDataForm) .put('/workdynamics/update', this.eidtDataForm)
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg); return this.$message.error(res.msg)
} }
this.$message.success("编辑成功"); this.$message.success('编辑成功')
this.editDataDialogVisabled = false; this.editDataDialogVisabled = false
this.getTableData(); this.getTableData()
}) })
.catch(() => {}); .catch(() => {})
} else { } else {
this.$message.success("表单数据填写不完整"); this.$message.success('表单数据填写不完整')
} }
}); })
}, },
addUploadRemoveFile(file, fileList) { addUploadRemoveFile (file, fileList) {
this.$refs.addUpload.clearFiles(); this.$refs.addUpload.clearFiles()
this.addDataFrom.imageUrl = ""; this.addDataFrom.imageUrl = ''
},
editUploadRemoveFile(file, fileList) {
this.$refs.editUpload.clearFiles();
this.eidtDataForm.imageUrl = "";
}, },
editUploadRemoveFile (file, fileList) {
this.$refs.editUpload.clearFiles()
this.eidtDataForm.imageUrl = ''
}
}, },
computed: { computed: {
editDialogShowFileList() { editDialogShowFileList () {
if (this.eidtDataForm.imageUrl) { if (this.eidtDataForm.imageUrl) {
return [ return [
{ name: this.eidtDataForm.imageUrl, url: this.eidtDataForm.imageUrl }, { name: this.eidtDataForm.imageUrl, url: this.eidtDataForm.imageUrl }
]; ]
} }
}, }
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner, ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner,
@ -728,7 +728,7 @@ export default {
.preview-title { .preview-title {
width: 100%; width: 100%;
height: 90px; min-height: 90px;
//margin-top: -40px; //margin-top: -40px;
border-bottom: solid #c6c6c6 1px; border-bottom: solid #c6c6c6 1px;
.title-text { .title-text {
@ -752,7 +752,7 @@ export default {
} }
.preview-note { .preview-note {
width: 100%; width: 100%;
height: 100px; min-height: 100px;
text-align: left; text-align: left;
margin-top: 24px; margin-top: 24px;
text-indent: 2em; text-indent: 2em;

View File

@ -231,6 +231,7 @@
size="small" size="small"
pageSize="8" pageSize="8"
:total="total" :total="total"
v-model:current="page"
@change="handleCurrentChange" @change="handleCurrentChange"
/> />
</a-list> </a-list>
@ -248,7 +249,7 @@
import { import {
demandComment, demandComment,
demandCommentPage, demandCommentPage,
demandCommentDelete, // demandCommentDelete,
demandCommentApply, demandCommentApply,
} from '@/api/demandCenter' } from '@/api/demandCenter'
import { getUser, getUserInfo } from '@/api/home' import { getUser, getUserInfo } from '@/api/home'
@ -264,15 +265,15 @@
}) })
}) })
// //
const confirm = (item) => { // const confirm = (item) => {
console.log(item) // console.log(item)
evaluateDelete(item) // evaluateDelete(item)
} // }
const cancel = (e) => { // const cancel = (e) => {
console.log(e) // console.log(e)
message.error('已取消删除') // message.error('')
} // }
// const store = useStore() // const store = useStore()
const router = useRouter() const router = useRouter()
@ -322,14 +323,14 @@
// }) // })
// } // }
const evaluateDelete = (item) => { // const evaluateDelete = (item) => {
demandCommentDelete([item.id]).then((res) => { // demandCommentDelete([item.id]).then((res) => {
if (res.data.code == 0) { // if (res.data.code == 0) {
message.success('删除评论成功!') // message.success('')
} // }
evaluateList() // evaluateList()
}) // })
} // }
const evaluateList = () => { const evaluateList = () => {
const params = { const params = {
page: page.value, page: page.value,
@ -339,6 +340,7 @@
demandCommentPage(params).then((res) => { demandCommentPage(params).then((res) => {
evaluateData.value = res.data.data.list evaluateData.value = res.data.data.list
total.value = res.data.data.total total.value = res.data.data.total
console.log(evaluateData, 'evaluateData')
}) })
} }
@ -382,6 +384,7 @@
// formName.value = formData.value // formName.value = formData.value
const id = router.currentRoute.value.query.id const id = router.currentRoute.value.query.id
getDemandForm(id).then((res) => { getDemandForm(id).then((res) => {
console.log(res, 'res')
const { data } = res.data const { data } = res.data
formName.value.applyUserName = data.applyUserName formName.value.applyUserName = data.applyUserName
formName.value.applyUserPhone = data.applyUserPhone formName.value.applyUserPhone = data.applyUserPhone