|
|
@@ -0,0 +1,168 @@
|
|
|
+<template>
|
|
|
+ <el-drawer
|
|
|
+ :title="$t('施工日志模板设置')"
|
|
|
+ :visible.sync="drawerVisible"
|
|
|
+ size="600px"
|
|
|
+ append-to-body
|
|
|
+ :before-close="handleClose">
|
|
|
+ <div style="padding: 20px">
|
|
|
+ <!-- 企业 Logo -->
|
|
|
+ <div class="construction-card" shadow="never">
|
|
|
+ <div slot="header" class="card-header">
|
|
|
+ <span>{{ $t('企业 Logo') }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="logo-section">
|
|
|
+ <template v-if="logoList.length > 0">
|
|
|
+ <div class="logo-preview">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ circle
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="delete-btn"
|
|
|
+ @click="deleteLogo"
|
|
|
+ ></el-button>
|
|
|
+ <img :src="logoList[0].url" style="max-width: 300px; max-height: 200px; border-radius: 4px;" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <uploadFile
|
|
|
+ :folderid="folderid"
|
|
|
+ accept=".JPG,.PNG,.jpg,.png"
|
|
|
+ btntype="image"
|
|
|
+ :bindData="{ownertable:'sys_enterprise', ownerid:enterpriseId, usetype:'constructionlogo'}"
|
|
|
+ @onSuccess="logoUploadSuccess"
|
|
|
+ ></uploadFile>
|
|
|
+ </template>
|
|
|
+ <p class="hint">{{ $t('建议上传图片大小 1024x1024px,大小不超过 2M,格式为 JPG/PNG') }}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 结束语模版 -->
|
|
|
+ <div class="construction-card" shadow="never">
|
|
|
+ <div slot="header" class="card-header">
|
|
|
+ <span>{{ $t('结束语模版') }}</span>
|
|
|
+ </div>
|
|
|
+ <Editor ref="editor" :id="editorId" :content="closingStatement" height="300px"></Editor>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 保存 -->
|
|
|
+ <div style="text-align: center; margin-top: 20px">
|
|
|
+ <el-button type="primary" @click="save" :loading="saving">{{ $t('保存') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-drawer>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import uploadFile from '@/components/upload/hw_obs_upload.vue'
|
|
|
+import Editor from '@/components/my-editor/Editor.vue'
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: { uploadFile, Editor },
|
|
|
+ props: ['data'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ drawerVisible: false,
|
|
|
+ folderid: JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
|
|
|
+ enterpriseId: '',
|
|
|
+ logoList: [],
|
|
|
+ closingStatement: '',
|
|
|
+ editorId: 'construction-log-editor-' + Date.now(),
|
|
|
+ saving: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ openDrawer() {
|
|
|
+ this.drawerVisible = true
|
|
|
+ this.enterpriseId = this.data.sys_enterpriseid
|
|
|
+ this.closingStatement = this.data.construction_log_template || ''
|
|
|
+ this.queryLogoAttachment()
|
|
|
+ },
|
|
|
+ handleClose(done) {
|
|
|
+ this.drawerVisible = false
|
|
|
+ },
|
|
|
+ async queryLogoAttachment() {
|
|
|
+ this.enterpriseId = this.data.sys_enterpriseid
|
|
|
+ if (!this.enterpriseId) return
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ classname: 'system.attachment.Attachment',
|
|
|
+ method: 'queryFileLink',
|
|
|
+ content: {
|
|
|
+ ownertable: 'sys_enterprise',
|
|
|
+ ownerid: this.enterpriseId,
|
|
|
+ usetype: 'constructionlogo'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ this.logoList = res.data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async logoUploadSuccess() {
|
|
|
+ await this.queryLogoAttachment()
|
|
|
+ },
|
|
|
+ async deleteLogo() {
|
|
|
+ if (this.logoList.length === 0) return
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ classname: 'system.attachment.Attachment',
|
|
|
+ method: 'deleteFileLink',
|
|
|
+ content: {
|
|
|
+ linksids: [this.logoList[0].linksid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.logoList = []
|
|
|
+ this.$message.success(this.$t('删除成功'))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async save() {
|
|
|
+ this.saving = true
|
|
|
+ let editorContent = ''
|
|
|
+ if (this.$refs.editor) {
|
|
|
+ editorContent = this.$refs.editor.html || ''
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ id: 2026051116180002,
|
|
|
+ content: {
|
|
|
+ sa_agentsid: this.$route.query.id,
|
|
|
+ construction_log_template: editorContent
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.saving = false
|
|
|
+ this.tool.showMessage(res, () => {
|
|
|
+ this.$message.success(this.$t('保存成功'))
|
|
|
+ this.drawerVisible = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.construction-card {
|
|
|
+ margin-bottom: 0;
|
|
|
+}
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+.logo-section {
|
|
|
+ padding: 10px 0;
|
|
|
+}
|
|
|
+.logo-preview {
|
|
|
+ position: relative;
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
+.delete-btn {
|
|
|
+ position: absolute;
|
|
|
+ top: -10px;
|
|
|
+ right: -10px;
|
|
|
+ z-index: 1;
|
|
|
+}
|
|
|
+.hint {
|
|
|
+ color: #999;
|
|
|
+ font-size: 12px;
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+</style>
|