editLog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="inline-16">
  3. <el-button type="text" size="mini" @click="onShow(dialogFormVisible = true)" :disabled="status === '已结案' || status === '已失败'">
  4. <svg t="1727058404479" class="icon" viewBox="0 0 1024 1024" style="vertical-align: middle" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12347" width="14" height="14"><path d="M319.122286 565.101714a8.265143 8.265143 0 0 0-1.609143 2.852572l-51.2 188.928a32.109714 32.109714 0 0 0 39.277714 39.350857l187.538286-51.2h0.658286a8.118857 8.118857 0 0 0 5.851428-2.413714l501.540572-501.467429a80.457143 80.457143 0 0 0 23.04-57.344 98.011429 98.011429 0 0 0-29.257143-68.681143l-47.396572-47.469714a98.157714 98.157714 0 0 0-68.681143-29.257143 80.457143 80.457143 0 0 0-57.856 23.698286L319.853714 563.712c-0.512 0.512-0.365714 1.170286-0.731428 1.755429m632.685714-373.028572l-49.810286 49.810286-80.969143-81.92 49.078858-49.078857a23.332571 23.332571 0 0 1 31.744 2.267428l47.396571 47.469715a25.819429 25.819429 0 0 1 7.753143 17.993142 19.090286 19.090286 0 0 1-5.412572 13.604572m-543.524571 380.342857l361.764571-361.545143 80.457143 82.066286-360.521143 361.252571z m-65.828571 146.724571l26.185142-95.963428 69.778286 69.778286z m641.170285-328.704a34.742857 34.742857 0 0 0-34.596571 34.669715v467.894857a44.470857 44.470857 0 0 1-44.470857 44.397714H113.590857a44.544 44.544 0 0 1-44.470857-44.397714V130.486857a44.544 44.544 0 0 1 44.470857-44.470857h509.366857a34.596571 34.596571 0 0 0 0-69.193143H108.324571A108.544 108.544 0 0 0-0.073143 125.220571v773.558858a108.544 108.544 0 0 0 108.397714 108.397714h801.353143a108.470857 108.470857 0 0 0 108.397715-108.397714V426.130286a34.669714 34.669714 0 0 0-34.596572-34.450286" fill="#999999" p-id="12348"></path></svg>
  5. <span style="font-size: 14px;color: #333;margin-left: 5px;vertical-align: middle" >编辑</span></el-button>
  6. <el-drawer title="编辑跟进动态" size="600px" append-to-body :visible.sync="dialogFormVisible" @close="onClose">
  7. <div class="drawer__panel">
  8. <el-form ref="form" :model="form" label-position="top" label-width="80px">
  9. <el-form-item v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'" label="跟进类型" prop="type" :rules="{ required: true, message: '请选择跟进类型', trigger: 'change'}">
  10. <el-select v-model="form.type" placeholder="请选择" style="width: 100%">
  11. <el-option
  12. v-for="item in followUpType"
  13. :key="item.value"
  14. :label="item.label"
  15. :value="item.value">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'" label="跟进对象" prop="dataextend.contactsid" :rules="{ required: true, message: '请选择跟进对象', trigger: 'change'}">
  20. <el-tag
  21. style="float: left;margin-right: 5px;margin-bottom: 5px"
  22. v-for="tag in selectTag"
  23. :key="tag.index"
  24. closable
  25. @close="closeTag(tag)"
  26. :type="tag.type">
  27. {{tag.name}}
  28. </el-tag>
  29. <contactsList style="float: left" @onSelect="onSelect" ref="listData" :selects="form.dataextend.contactsid" :sys_enterpriseid="sys_enterpriseid"></contactsList>
  30. </el-form-item>
  31. <el-form-item label="跟进动态" prop="content" :rules="{ required: true, message: '请填写跟进动态', trigger: 'blur'}" v-if="$route.path !== '/projectChangeDetail' && $route.path !== '/customerDetail' && $route.path !== '/PublicCustomerDetail'">
  32. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.content" placeholder="请输入跟进动态" autocomplete="off"></el-input>
  33. </el-form-item>
  34. <el-form-item label="目的" prop="target" :rules="{ required: false, message: '请填写跟进目的', trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  35. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.target" placeholder="请输入跟进目的" autocomplete="off"></el-input>
  36. </el-form-item>
  37. <el-form-item label="过程" prop="content" :rules="{ required: false, message: '请填写跟进过程', trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  38. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.content" placeholder="请输入跟进过程" autocomplete="off"></el-input>
  39. </el-form-item>
  40. <el-form-item label="结果" prop="results" :rules="{ required: false, message: '请填写跟进结果', trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  41. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.results" placeholder="请输入跟进结果" autocomplete="off"></el-input>
  42. </el-form-item>
  43. <el-form-item label="下次跟进计划" prop="nextplan" :rules="{ required: false, message: '请填写下次跟进计划', trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  44. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.nextplan" placeholder="请输入下次跟进计划" autocomplete="off"></el-input>
  45. </el-form-item>
  46. <div class="flex-align-center flex-between pionter" v-for="file in data.attinfos" :key="file.index">
  47. <div class="flex-align-center">
  48. <img width="30" :src="checkFileType(file.postfix) === 'file'?require('@/assets/file_icons/file.svg'):file.url" class="inline-16" alt="">
  49. <div class="file__link inline-16">
  50. <a :href="file.url">{{file.document}}</a>
  51. <p>{{(file.contentlength / 1024).toFixed(2)}}kb</p>
  52. </div>
  53. </div>
  54. <i style="color:red;" class="el-icon-delete" @click="deleteFile(file)"></i>
  55. </div>
  56. <upload
  57. :folderid="folderid"
  58. @upload="loading = true"
  59. btntype="icon"
  60. @onSuccess="onSuccess"
  61. :hidemediastock="false"
  62. :bindData=" {ownertable: 'sys_datafollowup', ownerid: data.sys_datafollowupid,usetype: 'default'}">
  63. </upload>
  64. </el-form>
  65. </div>
  66. <div class="fixed__btn__panel">
  67. <el-button size="small" @click="onClose" :disabled="loading">取 消</el-button>
  68. <el-button type="warning" size="small" @click="submitLog" :loading="loading">保 存</el-button>
  69. </div>
  70. </el-drawer>
  71. </div>
  72. </template>
  73. <script>
  74. import upload from '@/components/upload/hw_obs_upload.vue'
  75. import previewImage from '@/components/previewImage/index.vue'
  76. import contactsList from '@/template/projectChange/contactsList.vue'
  77. export default {
  78. props:['data','ownertable','status'],
  79. components:{
  80. upload,
  81. previewImage,
  82. contactsList
  83. },
  84. data () {
  85. return {
  86. dialogFormVisible:false,
  87. loading:false,
  88. sys_enterpriseid:'',
  89. form:{
  90. content:'',
  91. type:'',
  92. dataextend: {
  93. contactsid: [] // 跟进对象
  94. }//扩展参数
  95. },
  96. followUpType:[],
  97. selectTag:[],
  98. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  99. attachmentids:[]
  100. }
  101. },
  102. methods:{
  103. onShow () {
  104. this.form = Object.assign({},this.form,this.data)
  105. console.log(this.form,'表单数据')
  106. this.selectTag = this.form.contacts
  107. this.queryFollowUpType()
  108. },
  109. /*获取跟进类型*/
  110. async queryFollowUpType(){
  111. const res = await this.$store.dispatch('optiontypeselect','followuptype')
  112. this.followUpType = res.data
  113. },
  114. onSuccess(res) {
  115. res.attinfos = JSON.parse(res.attinfos)
  116. this.attachmentids = [...this.attachmentids,...res.attinfos.data]
  117. this.loading = false
  118. this.$emit('onSuccess')
  119. },
  120. // 更新接口
  121. submitLog () {
  122. this.$refs.form.validate(async(valid)=>{
  123. if (!valid) return false
  124. const res = await this.$api.requested({
  125. "id": 20220930121601,
  126. "content": {
  127. "sys_datafollowupid":this.data.sys_datafollowupid,
  128. "ownertable":this.ownertable,
  129. "ownerid":this.$route.query.id,
  130. "type":this.form.type,
  131. "content":this.form.content,
  132. "target":this.form.target,//目的
  133. "results":this.form.results,//结果
  134. "nextplan":this.form.nextplan,//下次跟进计划
  135. "dataextend": {
  136. "contactsid": this.form.dataextend.contactsid // 跟进对象
  137. }
  138. }
  139. })
  140. this.tool.showMessage(res,()=>{
  141. this.form.content = ''
  142. this.dialogFormVisible = false
  143. this.$store.dispatch('bindFileToData',{
  144. "ownertable": 'sys_datafollowup',
  145. "ownerid": res.data.sys_datafollowupid,
  146. "usetype": 'default',
  147. "attachmentids": this.attachmentids
  148. }).then(rs=>{
  149. this.attachmentids = []
  150. this.dialogFormVisible = false
  151. this.$emit('onSuccess')
  152. })
  153. })
  154. })
  155. },
  156. checkFileType (type) {
  157. let arr = ['JPG','JPEG','PNG']
  158. if (arr.includes(type.toUpperCase())) {
  159. return 'img'
  160. } else {
  161. return 'file'
  162. }
  163. },
  164. async deleteFile (row) {
  165. const res = await this.$api.requested({
  166. "classname": "system.attachment.Attachment",
  167. "method": "deleteFileLink",
  168. "content": {
  169. "linksids":[row.linksid]
  170. }
  171. })
  172. this.tool.showMessage(res,()=>{
  173. this.data.attinfos.forEach(item=>{
  174. if (item.rowindex == row.rowindex){
  175. console.log('删除')
  176. this.data.attinfos.splice(item,1)
  177. }
  178. })
  179. })
  180. },
  181. onSelect(row){
  182. this.selectTag = row
  183. this.form.dataextend.contactsid = row.map(item=>item.sys_phonebookid)
  184. this.$refs.form.validateField('dataextend.contactsid')
  185. },
  186. closeTag(row){
  187. for (var i=0;i<this.selectTag.length;i++){
  188. if (row.contactsid === this.selectTag[i].contactsid){
  189. this.selectTag.splice(i,1)
  190. this.form.dataextend.contactsid.splice(i,1)
  191. break
  192. }
  193. }
  194. },
  195. onClose(){
  196. this.dialogFormVisible = false
  197. this.selectTag = []
  198. this.form.dataextend.contactsid = []
  199. this.$refs.form.resetFields()
  200. }
  201. }
  202. }
  203. </script>
  204. <style>
  205. </style>
  206. <style scoped>
  207. .file__link,.file__link > a{
  208. color:#999;
  209. font-size: 12px;
  210. display:block;
  211. width: 100%;
  212. white-space: nowrap;
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. }
  216. .pionter{
  217. margin:6px 0;
  218. padding: 10px;
  219. transition: .2s linear;
  220. cursor: pointer;
  221. border-radius: 5px;
  222. }
  223. .pionter:hover{
  224. box-shadow: 0 5px 10px rgb(0 0 0 / 10%);
  225. }
  226. /deep/ .el-form-item {
  227. margin-bottom: 10px;
  228. }
  229. /deep/ .el-form--label-top .el-form-item__label {
  230. float: none;
  231. display: inline-block;
  232. text-align: left;
  233. padding: 0 0 0px 0;
  234. }
  235. </style>