editLog.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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' || $route.path === '/funnelProjectDetail'" :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' || $route.path === '/funnelProjectDetail'" :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' && $route.path === '/funnelProjectDetail'">
  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' || $route.path === '/funnelProjectDetail'">
  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' || $route.path === '/funnelProjectDetail'">
  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' || $route.path === '/funnelProjectDetail'">
  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' || $route.path === '/funnelProjectDetail'">
  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. <el-form-item :label="$t(`变更项目阶段`)" prop="squarestage" :rules="{ required: true, message: $t('请选择项目阶段'), trigger: 'change'}" v-if="$route.path === '/projectChangeDetail' || $route.path === '/funnelProjectDetail'">
  48. <el-select v-model="form.squarestage" :placeholder="$t(`请选择项目阶段`)" @focus="squarestageFocus" style="width: 100%" disabled>
  49. <el-option
  50. v-for="item in squarestageList"
  51. :key="item.stagename"
  52. :label="$t(item.stagename)"
  53. :value="item.stagename">
  54. </el-option>
  55. </el-select>
  56. </el-form-item>
  57. <div class="flex-align-center flex-between pionter" v-for="file in data.attinfos" :key="file.index">
  58. <div class="flex-align-center">
  59. <img width="30" :src="checkFileType(file.postfix) === 'file'?require('@/assets/file_icons/file.svg'):file.url" class="inline-16" alt="">
  60. <div class="file__link inline-16">
  61. <a :href="file.url">{{file.document}}</a>
  62. <p>{{(file.contentlength / 1024).toFixed(2)}}kb</p>
  63. </div>
  64. </div>
  65. <i style="color:red;" class="el-icon-delete" @click="deleteFile(file)"></i>
  66. </div>
  67. <upload
  68. :folderid="folderid"
  69. @upload="loading = true"
  70. btntype="icon"
  71. @onSuccess="onSuccess"
  72. :hidemediastock="false"
  73. :isFile="true"
  74. :bindData=" {ownertable: 'sys_datafollowup', ownerid: data.sys_datafollowupid,usetype: 'default'}"
  75. :bindDataFile="bindDataFile">
  76. </upload>
  77. </el-form>
  78. </div>
  79. <div class="fixed__btn__panel">
  80. <el-button size="small" @click="onClose" :disabled="loading">{{$t(`取 消`)}}</el-button>
  81. <el-button type="warning" size="small" @click="submitLog" :loading="loading">{{$t(`保 存`)}}</el-button>
  82. </div>
  83. </el-drawer>
  84. </div>
  85. </template>
  86. <script>
  87. import upload from '@/components/upload/hw_obs_upload.vue'
  88. import previewImage from '@/components/previewImage/index.vue'
  89. import contactsList from '@/template/projectChange/contactsList.vue'
  90. export default {
  91. props:['data','ownertable','status','disabled','isOperation','bindDataFile','editData'],
  92. components:{
  93. upload,
  94. previewImage,
  95. contactsList
  96. },
  97. data () {
  98. return {
  99. dialogFormVisible:false,
  100. loading:false,
  101. sys_enterpriseid:'',
  102. form:{
  103. content:'',
  104. type:'',
  105. dataextendContactsid:[],
  106. dataextend: {
  107. contactsid: [] // 跟进对象
  108. },//扩展参数
  109. squarestage:''
  110. },
  111. followUpType:[],
  112. selectTag:[],
  113. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  114. attachmentids:[],
  115. squarestageList:[]
  116. }
  117. },
  118. methods:{
  119. onShow () {
  120. this.form = Object.assign({},this.form,this.data)
  121. console.log(this.form,'表单数据')
  122. this.selectTag = this.form.contacts
  123. this.form.dataextendContactsid = this.form.dataextend.contactsid
  124. this.queryFollowUpType()
  125. },
  126. /*获取跟进类型*/
  127. async queryFollowUpType(){
  128. const res = await this.$store.dispatch('optiontypeselect','followuptype')
  129. this.followUpType = res.data
  130. },
  131. onSuccess(res) {
  132. res.attinfos = JSON.parse(res.attinfos)
  133. this.attachmentids = [...this.attachmentids,...res.attinfos.data]
  134. this.loading = false
  135. this.$emit('onSuccess')
  136. },
  137. // 更新接口
  138. submitLog () {
  139. if (this.squarestageList.length == 0){
  140. this.stageData()
  141. }else {
  142. this.squarestageList.forEach(item=>{
  143. if (item.stagename === this.form.squarestage){
  144. this.form.sa_project_stageid = item.sa_project_stageid
  145. }
  146. })
  147. }
  148. this.$refs.form.validate(async(valid)=>{
  149. if (!valid) return false
  150. let resource = this.$route.matched[1].meta.title
  151. let content = {}
  152. if (this.$route.path === '/projectChangeDetail' || $route.path === '/funnelProjectDetail'){
  153. content = {
  154. "sys_datafollowupid":this.data.sys_datafollowupid,
  155. "ownertable":this.ownertable,
  156. "ownerid":this.$route.query.id,
  157. "type":this.form.type,
  158. "content":this.form.content,
  159. "target":this.form.target,//目的
  160. "results":this.form.results,//结果
  161. "nextplan":this.form.nextplan,//下次跟进计划
  162. "dataextend": {
  163. "contactsid": this.form.dataextend.contactsid // 跟进对象
  164. },
  165. "resource":resource,
  166. "squarestage":this.form.squarestage,
  167. "sa_project_stageid":this.form.sa_project_stageid
  168. }
  169. }else {
  170. content = {
  171. "sys_datafollowupid":this.data.sys_datafollowupid,
  172. "ownertable":this.ownertable,
  173. "ownerid":this.$route.query.id,
  174. "type":this.form.type,
  175. "content":this.form.content,
  176. "target":this.form.target,//目的
  177. "results":this.form.results,//结果
  178. "nextplan":this.form.nextplan,//下次跟进计划
  179. "dataextend": {
  180. "contactsid": this.form.dataextend.contactsid // 跟进对象
  181. },
  182. "resource":resource,
  183. }
  184. }
  185. const res = await this.$api.requested({
  186. "id": 20220930121601,
  187. "content": content
  188. })
  189. this.tool.showMessage(res,()=>{
  190. this.form.content = ''
  191. this.dialogFormVisible = false
  192. this.$store.dispatch('bindFileToData',{
  193. "ownertable": 'sys_datafollowup',
  194. "ownerid": res.data.sys_datafollowupid,
  195. "usetype": 'default',
  196. "attachmentids": this.attachmentids
  197. }).then(rs=>{
  198. this.attachmentids = []
  199. this.squarestageList = []
  200. this.dialogFormVisible = false
  201. this.$emit('onSuccess')
  202. })
  203. })
  204. })
  205. },
  206. checkFileType (type) {
  207. let arr = ['JPG','JPEG','PNG']
  208. if (arr.includes(type.toUpperCase())) {
  209. return 'img'
  210. } else {
  211. return 'file'
  212. }
  213. },
  214. async deleteFile (row) {
  215. const res = await this.$api.requested({
  216. "classname": "system.attachment.Attachment",
  217. "method": "deleteFileLink",
  218. "content": {
  219. "linksids":[row.linksid]
  220. }
  221. })
  222. this.tool.showMessage(res,()=>{
  223. this.data.attinfos.forEach(item=>{
  224. if (item.rowindex == row.rowindex){
  225. console.log('删除')
  226. this.data.attinfos.splice(item,1)
  227. }
  228. })
  229. })
  230. },
  231. onSelect(row){
  232. this.selectTag = row
  233. this.form.dataextend.contactsid = row.map(item=>item.sys_phonebookid)
  234. this.form.dataextendContactsid = this.form.dataextend.contactsid
  235. this.$refs.form.validateField('dataextendContactsid')
  236. },
  237. closeTag(row){
  238. for (var i=0;i<this.selectTag.length;i++){
  239. if (row.contactsid === this.selectTag[i].contactsid){
  240. this.selectTag.splice(i,1)
  241. this.form.dataextend.contactsid.splice(i,1)
  242. this.form.dataextendContactsid.splice(i,1)
  243. break
  244. }
  245. }
  246. },
  247. onClose(){
  248. this.dialogFormVisible = false
  249. this.selectTag = []
  250. this.form.dataextend.contactsid = []
  251. this.form.dataextendContactsid = []
  252. this.squarestageList = []
  253. this.$refs.form.resetFields()
  254. },
  255. async squarestageFocus(){
  256. if (this.squarestageList.length == 0){
  257. this.stageData()
  258. }
  259. },
  260. /*获取阶段*/
  261. async stageData(){
  262. const res = await this.$api.requested({
  263. "id": 20221024102402,
  264. "content": {
  265. "sa_projectid":this.$route.query.id
  266. }
  267. })
  268. this.squarestageList = res.data
  269. this.squarestageList.forEach(item=>{
  270. if (item.stagename === this.form.squarestage){
  271. this.form.sa_project_stageid = item.sa_project_stageid
  272. }
  273. })
  274. },
  275. }
  276. }
  277. </script>
  278. <style>
  279. </style>
  280. <style scoped>
  281. .file__link,.file__link > a{
  282. color:#999;
  283. font-size: 12px;
  284. display:block;
  285. width: 100%;
  286. white-space: nowrap;
  287. overflow: hidden;
  288. text-overflow: ellipsis;
  289. }
  290. .pionter{
  291. margin:6px 0;
  292. padding: 10px;
  293. transition: .2s linear;
  294. cursor: pointer;
  295. border-radius: 5px;
  296. }
  297. .pionter:hover{
  298. box-shadow: 0 5px 10px rgb(0 0 0 / 10%);
  299. }
  300. /deep/ .el-form-item {
  301. margin-bottom: 10px;
  302. }
  303. /deep/ .el-form--label-top .el-form-item__label {
  304. float: none;
  305. display: inline-block;
  306. text-align: left;
  307. padding: 0 0 0px 0;
  308. }
  309. </style>