editLog.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div class="inline-16">
  3. <el-button v-if="isOperation" type="text" @click="onShow(dialogFormVisible = true)" size="mini">{{$t(`编辑`)}}</el-button>
  4. <el-button v-else type="text" size="mini" @click="onShow(dialogFormVisible = true)" :disabled="status === '已结案' || status === '已失败'">
  5. <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>
  6. <span style="font-size: 14px;color: #333;margin-left: 5px;vertical-align: middle" >{{$t(`编辑`)}}</span></el-button>
  7. <el-drawer :title="$t(`编辑跟进动态`)" size="600px" append-to-body :visible.sync="dialogFormVisible" @close="onClose">
  8. <div class="drawer__panel">
  9. <el-form ref="form" :model="form" label-position="top" :label-width="tool.onlyZh('80px')">
  10. <el-form-item v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'" :label="$t(`跟进类型`)" prop="type" :rules="{ required: true, message: $t('请选择跟进类型'), trigger: 'change'}">
  11. <el-select v-model="form.type" :placeholder="$t(`请选择`)" style="width: 100%">
  12. <el-option
  13. v-for="item in followUpType"
  14. :key="item.value"
  15. :label="$t(item.label)"
  16. :value="item.value">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'" :label="$t(`跟进对象`)" prop="dataextendContactsid" :rules="{ required: true, message: $t('请选择跟进对象'), trigger: 'change'}">
  21. <el-tag
  22. style="float: left;margin-right: 5px;margin-bottom: 5px"
  23. v-for="tag in selectTag"
  24. :key="tag.index"
  25. closable
  26. @close="closeTag(tag)"
  27. :type="tag.type">
  28. {{$t(tag.name)}}
  29. </el-tag>
  30. <contactsList style="float: left" @onSelect="onSelect" ref="listData" :selects="form.dataextend.contactsid" :sys_enterpriseid="sys_enterpriseid"></contactsList>
  31. </el-form-item>
  32. <el-form-item :label="$t(`跟进动态`)" prop="content" :rules="{ required: true, message: $t('请填写跟进动态'), trigger: 'blur'}" v-if="$route.path !== '/projectChangeDetail' && $route.path !== '/customerDetail' && $route.path !== '/PublicCustomerDetail'">
  33. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.content" :placeholder="$t(`请输入跟进动态`)" autocomplete="off"></el-input>
  34. </el-form-item>
  35. <el-form-item :label="$t(`目的`)" prop="target" :rules="{ required: false, message: $t('请填写跟进目的'), trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  36. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.target" :placeholder="$t(`请输入跟进目的`)" autocomplete="off"></el-input>
  37. </el-form-item>
  38. <el-form-item :label="$t(`过程`)" prop="content" :rules="{ required: false, message: $t('请填写跟进过程'), trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  39. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.content" :placeholder="$t(`请输入跟进过程`)" autocomplete="off"></el-input>
  40. </el-form-item>
  41. <el-form-item :label="$t(`结果`)" prop="results" :rules="{ required: false, message: $t('请填写跟进结果'), trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  42. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.results" :placeholder="$t(`请输入跟进结果`)" autocomplete="off"></el-input>
  43. </el-form-item>
  44. <el-form-item :label="$t(`下次跟进计划`)" prop="nextplan" :rules="{ required: false, message: $t('请填写下次跟进计划'), trigger: 'blur'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'">
  45. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 18 }" v-model="form.nextplan" :placeholder="$t(`请输入下次跟进计划`)" autocomplete="off"></el-input>
  46. </el-form-item>
  47. <div class="flex-align-center flex-between pionter" v-for="file in data.attinfos" :key="file.index">
  48. <div class="flex-align-center">
  49. <img width="30" :src="checkFileType(file.postfix) === 'file'?require('@/assets/file_icons/file.svg'):file.url" class="inline-16" alt="">
  50. <div class="file__link inline-16">
  51. <a :href="file.url">{{file.document}}</a>
  52. <p>{{(file.contentlength / 1024).toFixed(2)}}kb</p>
  53. </div>
  54. </div>
  55. <i style="color:red;" class="el-icon-delete" @click="deleteFile(file)"></i>
  56. </div>
  57. <upload
  58. :folderid="folderid"
  59. @upload="loading = true"
  60. btntype="icon"
  61. @onSuccess="onSuccess"
  62. :hidemediastock="false"
  63. :isFile="true"
  64. :bindData=" {ownertable: 'sys_datafollowup', ownerid: data.sys_datafollowupid,usetype: 'default'}"
  65. :bindDataFile="bindDataFile">
  66. </upload>
  67. </el-form>
  68. </div>
  69. <div class="fixed__btn__panel">
  70. <el-button size="small" @click="onClose" :disabled="loading">{{$t(`取 消`)}}</el-button>
  71. <el-button type="warning" size="small" @click="submitLog" :loading="loading">{{$t(`保 存`)}}</el-button>
  72. </div>
  73. </el-drawer>
  74. </div>
  75. </template>
  76. <script>
  77. import upload from '@/components/upload/hw_obs_upload.vue'
  78. import previewImage from '@/components/previewImage/index.vue'
  79. import contactsList from '@/template/projectChange/contactsList.vue'
  80. export default {
  81. props:['data','ownertable','status','disabled','isOperation','bindDataFile'],
  82. components:{
  83. upload,
  84. previewImage,
  85. contactsList
  86. },
  87. data () {
  88. return {
  89. dialogFormVisible:false,
  90. loading:false,
  91. sys_enterpriseid:'',
  92. form:{
  93. content:'',
  94. type:'',
  95. dataextendContactsid:[],
  96. dataextend: {
  97. contactsid: [] // 跟进对象
  98. }//扩展参数
  99. },
  100. followUpType:[],
  101. selectTag:[],
  102. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  103. attachmentids:[]
  104. }
  105. },
  106. methods:{
  107. onShow () {
  108. this.form = Object.assign({},this.form,this.data)
  109. console.log(this.form,'表单数据')
  110. this.selectTag = this.form.contacts
  111. this.form.dataextendContactsid = this.form.dataextend.contactsid
  112. this.queryFollowUpType()
  113. },
  114. /*获取跟进类型*/
  115. async queryFollowUpType(){
  116. const res = await this.$store.dispatch('optiontypeselect','followuptype')
  117. this.followUpType = res.data
  118. },
  119. onSuccess(res) {
  120. res.attinfos = JSON.parse(res.attinfos)
  121. this.attachmentids = [...this.attachmentids,...res.attinfos.data]
  122. this.loading = false
  123. this.$emit('onSuccess')
  124. },
  125. // 更新接口
  126. submitLog () {
  127. this.$refs.form.validate(async(valid)=>{
  128. if (!valid) return false
  129. let resource = this.$route.matched[1].meta.title
  130. const res = await this.$api.requested({
  131. "id": 20220930121601,
  132. "content": {
  133. "sys_datafollowupid":this.data.sys_datafollowupid,
  134. "ownertable":this.ownertable,
  135. "ownerid":this.$route.query.id,
  136. "type":this.form.type,
  137. "content":this.form.content,
  138. "target":this.form.target,//目的
  139. "results":this.form.results,//结果
  140. "nextplan":this.form.nextplan,//下次跟进计划
  141. "dataextend": {
  142. "contactsid": this.form.dataextend.contactsid // 跟进对象
  143. },
  144. "resource":resource
  145. }
  146. })
  147. this.tool.showMessage(res,()=>{
  148. this.form.content = ''
  149. this.dialogFormVisible = false
  150. this.$store.dispatch('bindFileToData',{
  151. "ownertable": 'sys_datafollowup',
  152. "ownerid": res.data.sys_datafollowupid,
  153. "usetype": 'default',
  154. "attachmentids": this.attachmentids
  155. }).then(rs=>{
  156. this.attachmentids = []
  157. this.dialogFormVisible = false
  158. this.$emit('onSuccess')
  159. })
  160. })
  161. })
  162. },
  163. checkFileType (type) {
  164. let arr = ['JPG','JPEG','PNG']
  165. if (arr.includes(type.toUpperCase())) {
  166. return 'img'
  167. } else {
  168. return 'file'
  169. }
  170. },
  171. async deleteFile (row) {
  172. const res = await this.$api.requested({
  173. "classname": "system.attachment.Attachment",
  174. "method": "deleteFileLink",
  175. "content": {
  176. "linksids":[row.linksid]
  177. }
  178. })
  179. this.tool.showMessage(res,()=>{
  180. this.data.attinfos.forEach(item=>{
  181. if (item.rowindex == row.rowindex){
  182. console.log('删除')
  183. this.data.attinfos.splice(item,1)
  184. }
  185. })
  186. })
  187. },
  188. onSelect(row){
  189. this.selectTag = row
  190. this.form.dataextend.contactsid = row.map(item=>item.sys_phonebookid)
  191. this.form.dataextendContactsid = this.form.dataextend.contactsid
  192. this.$refs.form.validateField('dataextendContactsid')
  193. },
  194. closeTag(row){
  195. for (var i=0;i<this.selectTag.length;i++){
  196. if (row.contactsid === this.selectTag[i].contactsid){
  197. this.selectTag.splice(i,1)
  198. this.form.dataextend.contactsid.splice(i,1)
  199. this.form.dataextendContactsid.splice(i,1)
  200. break
  201. }
  202. }
  203. },
  204. onClose(){
  205. this.dialogFormVisible = false
  206. this.selectTag = []
  207. this.form.dataextend.contactsid = []
  208. this.form.dataextendContactsid = []
  209. this.$refs.form.resetFields()
  210. }
  211. }
  212. }
  213. </script>
  214. <style>
  215. </style>
  216. <style scoped>
  217. .file__link,.file__link > a{
  218. color:#999;
  219. font-size: 12px;
  220. display:block;
  221. width: 100%;
  222. white-space: nowrap;
  223. overflow: hidden;
  224. text-overflow: ellipsis;
  225. }
  226. .pionter{
  227. margin:6px 0;
  228. padding: 10px;
  229. transition: .2s linear;
  230. cursor: pointer;
  231. border-radius: 5px;
  232. }
  233. .pionter:hover{
  234. box-shadow: 0 5px 10px rgb(0 0 0 / 10%);
  235. }
  236. /deep/ .el-form-item {
  237. margin-bottom: 10px;
  238. }
  239. /deep/ .el-form--label-top .el-form-item__label {
  240. float: none;
  241. display: inline-block;
  242. text-align: left;
  243. padding: 0 0 0px 0;
  244. }
  245. </style>