editLog.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="inline-16">
  3. <el-button icon="el-icon-edit" type="text" size="mini" @click="onShow(dialogFormVisible = true)">编 辑</el-button>
  4. <el-dialog title="编辑跟进动态" width="600px" append-to-body :visible.sync="dialogFormVisible">
  5. <el-form :model="form" label-position="top" label-width="80px">
  6. <el-form-item label="跟进动态">
  7. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.content" placeholder="请输入跟进动态" autocomplete="off"></el-input>
  8. </el-form-item>
  9. <div class="flex-align-center flex-between pionter" v-for="file in data.attinfos" :key="file.index">
  10. <div class="flex-align-center">
  11. <img width="30" :src="checkFileType(file.postfix) === 'file'?require('@/assets/file_icons/file.svg'):file.url" class="inline-16" alt="">
  12. <div class="file__link inline-16">
  13. <a :href="file.url">{{file.document}}</a>
  14. <p>{{(file.contentlength / 1024).toFixed(2)}}kb</p>
  15. </div>
  16. </div>
  17. <i style="color:red;" class="el-icon-delete" @click="deleteFile(file)"></i>
  18. </div>
  19. <upload
  20. :folderid="folderid"
  21. btntype="icon"
  22. @onSuccess="onSuccess"
  23. :hidemediastock="false"
  24. :bindData=" {ownertable: 'sys_datafollowup', ownerid: data.sys_datafollowupid,usetype: 'default'}">
  25. </upload>
  26. </el-form>
  27. <div slot="footer" class="dialog-footer">
  28. <el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
  29. <el-button type="warning" size="small" @click="submitLog">保 存</el-button>
  30. </div>
  31. </el-dialog>
  32. </div>
  33. </template>
  34. <script>
  35. import upload from '@/components/upload/hw_obs_upload.vue'
  36. import previewImage from '@/components/previewImage/index.vue'
  37. export default {
  38. props:['data','ownertable'],
  39. components:{
  40. upload,
  41. previewImage
  42. },
  43. data () {
  44. return {
  45. dialogFormVisible:false,
  46. form:{
  47. content:''
  48. },
  49. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  50. attachmentids:[]
  51. }
  52. },
  53. methods:{
  54. onShow () {
  55. this.form = Object.assign({},this.form,this.data)
  56. },
  57. onSuccess(res) {
  58. res.attinfos = JSON.parse(res.attinfos)
  59. this.attachmentids = [...this.attachmentids,...res.attinfos.data]
  60. this.$emit('onSuccess')
  61. },
  62. // 更新接口
  63. async submitLog () {
  64. const res = await this.$api.requested({
  65. "id": 20220930121601,
  66. "content": {
  67. "sys_datafollowupid":this.data.sys_datafollowupid,
  68. "ownertable":this.ownertable,
  69. "ownerid":this.$route.query.id,
  70. "type":"",
  71. "content":this.form.content
  72. }
  73. })
  74. this.tool.showMessage(res,()=>{
  75. this.form.content = ''
  76. this.dialogFormVisible = false
  77. this.$store.dispatch('bindFileToData',{
  78. "ownertable": 'sys_datafollowup',
  79. "ownerid": res.data.sys_datafollowupid,
  80. "usetype": 'default',
  81. "attachmentids": this.attachmentids
  82. }).then(rs=>{
  83. this.attachmentids = []
  84. this.dialogFormVisible = false
  85. this.$emit('onSuccess')
  86. })
  87. })
  88. },
  89. checkFileType (type) {
  90. let arr = ['JPG','JPEG','PNG']
  91. if (arr.includes(type.toUpperCase())) {
  92. return 'img'
  93. } else {
  94. return 'file'
  95. }
  96. },
  97. async deleteFile (row) {
  98. const res = await this.$api.requested({
  99. "classname": "system.attachment.Attachment",
  100. "method": "deleteFileLink",
  101. "content": {
  102. "linksids":[row.linksid]
  103. }
  104. })
  105. this.tool.showMessage(res,()=>{
  106. this.queryLogs()
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style>
  113. </style>
  114. <style scoped>
  115. .file__link,.file__link > a{
  116. color:#999;
  117. font-size: 12px;
  118. display:block;
  119. width: 100%;
  120. white-space: nowrap;
  121. overflow: hidden;
  122. text-overflow: ellipsis;
  123. }
  124. .pionter{
  125. margin:6px 0;
  126. padding: 10px;
  127. transition: .2s linear;
  128. cursor: pointer;
  129. border-radius: 5px;
  130. }
  131. .pionter:hover{
  132. box-shadow: 0 5px 10px rgb(0 0 0 / 10%);
  133. }
  134. </style>