edit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <el-button v-show="tool.checkAuth($route.name,'update') && nowUserid === data.createuserid" size="mini" type="primary" @click="onShow(dialogTableVisible = true)">
  4. {{ $t('编 辑') }}
  5. </el-button>
  6. <el-drawer
  7. :title="$t(`编辑任务`)"
  8. :visible.sync="dialogTableVisible"
  9. size="700px"
  10. direction="rtl"
  11. append-to-body
  12. :show-close="false"
  13. @close="onClose">
  14. <div class="drawer__panel">
  15. <el-row :gutter="10">
  16. <el-form :model="form" :rules="rules" ref="form" label-width="125px" label-position="right" size="mini">
  17. <el-col :span="24">
  18. <el-form-item :label="$t('任务标题') + ':'" prop="title">
  19. <el-input v-model="form.title" :placeholder="$t('请输入任务标题')" ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <!-- <el-col :span="20">
  23. <el-form-item :label="$t(`关联应用数据`)+':'" prop="tableName">
  24. <el-input v-model="form.tableName" :placeholder="$t(`请选择关联应用数据`)" @focus="$refs.applicationRef.dialogTableVisible = true;$refs.applicationRef.listData()" readonly></el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="4">
  28. <el-button type="primary" size="mini" @click="$refs.followRef.dialogTableVisible = true;$refs.followRef.listData()" :disabled="followParam.content.ownerid === ''">同步跟进内容</el-button>
  29. </el-col>-->
  30. <el-col :span="24">
  31. <el-form-item :label="$t('任务内容') + ':'" prop="remarks">
  32. <el-input class="normal-margin" v-model="form.remarks" :placeholder="$t('输入任务内容')" :autosize="{minRows:6}" type="textarea" show-word-limit maxlength="500" size="small"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="24">
  36. <el-form-item :label="$t('开始') + ':'" prop="starttime">
  37. <el-date-picker
  38. v-model="form.starttime"
  39. type="date"
  40. :placeholder="$t('选择日期')"
  41. value-format="yyyy-MM-dd"
  42. size="small">
  43. </el-date-picker>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="24">
  47. <el-form-item :label="$t('结束') + ':'" prop="endtime">
  48. <el-date-picker
  49. v-model="form.endtime"
  50. type="date"
  51. :placeholder="$t('选择日期')"
  52. value-format="yyyy-MM-dd"
  53. size="small">
  54. </el-date-picker>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="24">
  58. <el-form-item :label="$t('提醒时间') +':' + $t('结束前')" prop="remindday">
  59. <el-input :disabled="!form.endtime" v-model="form.remindday" size="small" style="width:90px"></el-input>
  60. <span> {{$t('天')}}</span>
  61. </el-form-item>
  62. </el-col>
  63. <!-- <el-col :span="24">
  64. <el-form-item :label="$t(`上传附件`)+':'" prop="remindday">
  65. <upload
  66. ref="upload"
  67. :folderid="folderid"
  68. :bindData="bindData"
  69. type="button">
  70. </upload>
  71. </el-form-item>
  72. </el-col>-->
  73. <el-col :span="24">
  74. <el-form-item :label="$t('执行人') + ':'" prop="leaderuserid">
  75. <el-popover
  76. placement="top"
  77. trigger="manual"
  78. width="400"
  79. v-model="leaderShow">
  80. <member ref="member" :param="param" :radio="true" @onSelect="setLeader" @onCancel="leaderShow = false"></member>
  81. <el-input :placeholder="$t('请输入内容')" readonly :value="$t(leader.name)" class="input-with-select" size="small" slot="reference" @focus="showMenber">
  82. </el-input>
  83. </el-popover>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="24">
  87. <el-form-item :label="$t('协助人') + ':'" prop="remindday">
  88. <el-popover
  89. placement="top"
  90. trigger="manual"
  91. width="400"
  92. v-model="assistShow">
  93. <member ref="memberAssist" :param="param" :implement="form.leaderuserid" :radio="false" @onSelect="setAssist" @onCancel="assistShow = false"></member>
  94. <el-input :placeholder="$t('请输入内容')" readonly :value="$t(assistPerson)" class="input-with-select" size="small" slot="reference" @focus="showMenberAssist">
  95. </el-input>
  96. </el-popover>
  97. </el-form-item>
  98. </el-col>
  99. </el-form>
  100. </el-row>
  101. </div>
  102. <div class="fixed__btn__panel">
  103. <el-button size="small" style="width:120px" @click="onClose">{{$t('取 消')}}</el-button>
  104. <el-button type="primary" size="small" style="width:120px" @click="validateInput">{{$t('确 定')}}</el-button>
  105. </div>
  106. </el-drawer>
  107. <applicationData ref="applicationRef" @selectApplication="selectApplication"></applicationData>
  108. <followData ref="followRef" :param="followParam" @follow="follow"></followData>
  109. </div>
  110. </template>
  111. <script>
  112. import member from '@/template/menber/index.vue'
  113. import upload from '@/components/upload/preview_upload.vue';
  114. import applicationData from "@/HManagement/task/components/applicationData";
  115. import followData from "@/HManagement/task/components/followData";
  116. export default {
  117. props:['data'],
  118. components:{
  119. upload,
  120. member,
  121. applicationData,
  122. followData
  123. },
  124. data () {
  125. return {
  126. leaderShow:false,
  127. assistShow:false,
  128. dialogTableVisible:false,
  129. folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
  130. nowUserid: JSON.parse(sessionStorage.getItem('active_account')).userid,
  131. form:{
  132. "sys_taskid":0,
  133. "title":"",
  134. "remarks":"",
  135. "starttime":"",
  136. "remindday":0,
  137. "ownertable":"",
  138. "ownerid":0,
  139. "endtime":"",
  140. "leaderuserid":"",
  141. "team":{
  142. "justuserids":true,
  143. "userids":[],
  144. }
  145. },
  146. rules: {
  147. title: [
  148. {required: true, message:this.$t('请输入任务标题'), trigger: 'blur'},
  149. ],
  150. starttime: [
  151. {required: true, message:this.$t('请选择开始时间'), trigger: 'change'},
  152. ],
  153. leaderuserid: [
  154. {required: true, message:this.$t('请选择执行人'), trigger: 'change'},
  155. ],
  156. },
  157. // 查询可选择人员参数
  158. param:{
  159. id:'20221018122201',
  160. content: {
  161. "ownertable":'sys_task',
  162. "ownerid":0,
  163. "pageSize":20,
  164. "where":{
  165. "condition":"",
  166. "withoutselect":0,
  167. }
  168. }
  169. },
  170. paramAssist:{
  171. id:'20221018122201',
  172. content: {
  173. "ownertable":'sys_task',
  174. "ownerid":0,
  175. "pageSize":20,
  176. "where":{
  177. "condition":"",
  178. "withoutselect":0,
  179. }
  180. }
  181. },
  182. errormsg:'',
  183. bindData:{},
  184. leader:{},
  185. assistPerson:'',
  186. assist:[],
  187. implement:'',
  188. /*跟进列表*/
  189. followParam:{
  190. "id": 20231207130504,
  191. "content": {
  192. "ownertable": "",
  193. "ownerid": ""
  194. },
  195. }
  196. }
  197. },
  198. methods:{
  199. onShow () {
  200. console.log(this.data,'data111')
  201. this.form = Object.assign({},this.form,this.data)
  202. this.$refs.applicationRef.value = 'sat_orderclue'
  203. this.$refs.applicationRef.onChange()
  204. this.followParam.content.ownerid = this.form.ownerid
  205. this.followParam.content.ownertable = this.form.ownertable
  206. this.leader = this.data.leader[0]?this.data.leader[0]:''
  207. this.implement = this.data.leader[0].userid
  208. this.form.leaderuserid = this.data.leader[0].userid
  209. this.assistList(this.data.sys_taskid)
  210. },
  211. validateInput () {
  212. this.$refs.form.validate((valid)=>{
  213. if (!valid) return false
  214. this.submit()
  215. })
  216. },
  217. setLeader (val) {
  218. this.leader = val[0]
  219. this.form.leaderuserid = val[0].userid
  220. this.implement = this.form.leaderuserid
  221. this.leaderShow = false
  222. },
  223. setAssist (val) {
  224. this.assistPerson = ''
  225. this.assist = []
  226. val.forEach((item,index)=>{
  227. if (index === 0){
  228. this.assistPerson = item.name
  229. }else {
  230. this.assistPerson = this.assistPerson + ',' + item.name
  231. }
  232. this.assist[index] = item.userid
  233. })
  234. this.assistShow = false
  235. },
  236. async submit () {
  237. this.form.team.userids = this.assist
  238. const res = await this.$api.requested({
  239. "id": 20221211112101,
  240. "content":this.form
  241. })
  242. this.tool.showMessage(res,()=>{
  243. this.param.content.ownerid = res.data.sys_taskid
  244. this.dialogTableVisible = false
  245. this.refresh()
  246. this.errormsg = ''
  247. this.$emit('onSuccess')
  248. /* this.insertAssist(res.data.sys_taskid)*/
  249. })
  250. },
  251. refresh () {
  252. this.form = {
  253. "sys_taskid":0,
  254. "title":"任务标题",
  255. "remarks":"任务说明",
  256. "starttime":"",
  257. "remindday":0,
  258. "ownertable":"",
  259. "ownerid":0,
  260. "endtime":""
  261. }
  262. },
  263. showMenber () {
  264. this.leaderShow = true
  265. this.assistShow = false
  266. this.param.content.ownerid = this.data.sys_taskid
  267. this.$refs.member.listData()
  268. // this.validateInput()
  269. },
  270. showMenberAssist () {
  271. this.assistShow = true
  272. this.leaderShow = false
  273. this.paramAssist.content.ownerid = this.data.sys_taskid
  274. this.$refs.memberAssist.listData()
  275. // this.validateInput()
  276. },
  277. async assistList(id){
  278. this.assistPerson = ''
  279. this.assist = []
  280. const res = await this.$api.requested({
  281. "id": 20220930103501,
  282. "content": {
  283. "ownertable":"sys_task",
  284. "ownerid":id
  285. }
  286. })
  287. let arr = []
  288. res.data[0].team.forEach((e,index)=>{
  289. if (e.isleader === 0){
  290. if (index === 1){
  291. this.assistPerson = e.name
  292. this.assist
  293. }else {
  294. this.assistPerson = this.assistPerson + ',' + e.name
  295. }
  296. }
  297. this.assist[index] = e.userid
  298. })
  299. },
  300. async insertAssist(id){
  301. const res = await this.$api.requested({
  302. "id": 20220930103601,
  303. "content": {
  304. "ownertable":"sys_task",
  305. "ownerid":id,
  306. "userids":this.assist,
  307. "justuserids":true
  308. }
  309. })
  310. this.$emit('onSuccess')
  311. },
  312. onClose(){
  313. this.dialogTableVisible = false
  314. this.leader = {}
  315. this.assistPerson = ''
  316. this.assist = []
  317. this.leaderShow = false
  318. this.assistShow = false
  319. this.$refs.form.resetFields()
  320. },
  321. selectApplication(ownerid,ownertable,data){
  322. this.followParam.content.ownertable = ownertable
  323. this.followParam.content.ownerid = ownerid
  324. this.form.ownertable = ownertable
  325. this.form.ownerid = ownerid
  326. this.form.tableName = ownertable === 'sat_orderclue'?'销售线索':ownertable === 'sa_customers'?'我的客户':ownertable === 'sa_project'?'项目商机':''
  327. },
  328. follow(content,type,contacts,data){
  329. if (this.form.tableName === '我的客户' || this.form.tableName === '项目商机'){
  330. if (contacts.length === 0){
  331. this.form.remarks = '跟进类型:'+type+'\n'+ content
  332. }else {
  333. let obj = ''
  334. contacts.forEach((item,index)=>{
  335. if (index === contacts.length -1){
  336. obj = obj + item
  337. }else {
  338. obj = obj + item + ','
  339. }
  340. })
  341. this.form.remarks = '跟进类型:'+type+'\n'+ '跟进对象:'+obj+'\n' + content
  342. }
  343. }else {
  344. this.form.remarks = '跟进类型:'+ data.followupmode+'\n'+ content
  345. }
  346. }
  347. }
  348. }
  349. </script>
  350. <style scoped>
  351. .task__label{
  352. color:rgb(173, 172, 172);
  353. }
  354. </style>