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

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

View File

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