| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- <template>
- <div>
- <el-button v-show="tool.checkAuth($route.name,'update') && nowUserid === data.createuserid" size="mini" type="primary" @click="onShow(dialogTableVisible = true)">
- {{ $t('编 辑') }}
- </el-button>
- <el-drawer
- :title="$t(`编辑任务`)"
- :visible.sync="dialogTableVisible"
- size="700px"
- direction="rtl"
- append-to-body
- :show-close="false"
- @close="onClose">
- <div class="drawer__panel">
- <el-row :gutter="10">
- <el-form :model="form" :rules="rules" ref="form" label-width="125px" label-position="right" size="mini">
- <el-col :span="24">
- <el-form-item :label="$t('任务标题') + ':'" prop="title">
- <el-input v-model="form.title" :placeholder="$t('请输入任务标题')" ></el-input>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="20">
- <el-form-item :label="$t(`关联应用数据`)+':'" prop="tableName">
- <el-input v-model="form.tableName" :placeholder="$t(`请选择关联应用数据`)" @focus="$refs.applicationRef.dialogTableVisible = true;$refs.applicationRef.listData()" readonly></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" size="mini" @click="$refs.followRef.dialogTableVisible = true;$refs.followRef.listData()" :disabled="followParam.content.ownerid === ''">同步跟进内容</el-button>
- </el-col>-->
- <el-col :span="24">
- <el-form-item :label="$t('任务内容') + ':'" prop="remarks">
- <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>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('开始') + ':'" prop="starttime">
- <el-date-picker
- v-model="form.starttime"
- type="date"
- :placeholder="$t('选择日期')"
- value-format="yyyy-MM-dd"
- size="small">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('结束') + ':'" prop="endtime">
- <el-date-picker
- v-model="form.endtime"
- type="date"
- :placeholder="$t('选择日期')"
- value-format="yyyy-MM-dd"
- size="small">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('提醒时间') +':' + $t('结束前')" prop="remindday">
- <el-input :disabled="!form.endtime" v-model="form.remindday" size="small" style="width:90px"></el-input>
- <span> {{$t('天')}}</span>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="24">
- <el-form-item :label="$t(`上传附件`)+':'" prop="remindday">
- <upload
- ref="upload"
- :folderid="folderid"
- :bindData="bindData"
- type="button">
- </upload>
- </el-form-item>
- </el-col>-->
- <el-col :span="24">
- <el-form-item :label="$t('执行人') + ':'" prop="leaderuserid">
- <el-popover
- placement="top"
- trigger="manual"
- width="400"
- v-model="leaderShow">
- <member ref="member" :param="param" :radio="true" @onSelect="setLeader" @onCancel="leaderShow = false"></member>
- <el-input :placeholder="$t('请输入内容')" readonly :value="$t(leader.name)" class="input-with-select" size="small" slot="reference" @focus="showMenber">
- </el-input>
- </el-popover>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item :label="$t('协助人') + ':'" prop="remindday">
- <el-popover
- placement="top"
- trigger="manual"
- width="400"
- v-model="assistShow">
- <member ref="memberAssist" :param="param" :implement="form.leaderuserid" :radio="false" @onSelect="setAssist" @onCancel="assistShow = false"></member>
- <el-input :placeholder="$t('请输入内容')" readonly :value="$t(assistPerson)" class="input-with-select" size="small" slot="reference" @focus="showMenberAssist">
- </el-input>
- </el-popover>
- </el-form-item>
- </el-col>
- </el-form>
- </el-row>
- </div>
- <div class="fixed__btn__panel">
- <el-button size="small" style="width:120px" @click="onClose">{{$t('取 消')}}</el-button>
- <el-button type="primary" size="small" style="width:120px" @click="validateInput">{{$t('确 定')}}</el-button>
- </div>
- </el-drawer>
- <applicationData ref="applicationRef" @selectApplication="selectApplication"></applicationData>
- <followData ref="followRef" :param="followParam" @follow="follow"></followData>
- </div>
- </template>
- <script>
- import member from '@/template/menber/index.vue'
- import upload from '@/components/upload/preview_upload.vue';
- import applicationData from "@/HManagement/task/components/applicationData";
- import followData from "@/HManagement/task/components/followData";
- export default {
- props:['data'],
- components:{
- upload,
- member,
- applicationData,
- followData
- },
- data () {
- return {
- leaderShow:false,
- assistShow:false,
- dialogTableVisible:false,
- folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
- nowUserid: JSON.parse(sessionStorage.getItem('active_account')).userid,
- form:{
- "sys_taskid":0,
- "title":"",
- "remarks":"",
- "starttime":"",
- "remindday":0,
- "ownertable":"",
- "ownerid":0,
- "endtime":"",
- "leaderuserid":"",
- "team":{
- "justuserids":true,
- "userids":[],
- }
- },
- rules: {
- title: [
- {required: true, message:this.$t('请输入任务标题'), trigger: 'blur'},
- ],
- starttime: [
- {required: true, message:this.$t('请选择开始时间'), trigger: 'change'},
- ],
- leaderuserid: [
- {required: true, message:this.$t('请选择执行人'), trigger: 'change'},
- ],
- },
- // 查询可选择人员参数
- param:{
- id:'20221018122201',
- content: {
- "ownertable":'sys_task',
- "ownerid":0,
- "pageSize":20,
- "where":{
- "condition":"",
- "withoutselect":0,
- }
- }
- },
- paramAssist:{
- id:'20221018122201',
- content: {
- "ownertable":'sys_task',
- "ownerid":0,
- "pageSize":20,
- "where":{
- "condition":"",
- "withoutselect":0,
- }
- }
- },
- errormsg:'',
- bindData:{},
- leader:{},
- assistPerson:'',
- assist:[],
- implement:'',
- /*跟进列表*/
- followParam:{
- "id": 20231207130504,
- "content": {
- "ownertable": "",
- "ownerid": ""
- },
- }
- }
- },
- methods:{
- onShow () {
- console.log(this.data,'data111')
- this.form = Object.assign({},this.form,this.data)
- this.$refs.applicationRef.value = 'sat_orderclue'
- this.$refs.applicationRef.onChange()
- this.followParam.content.ownerid = this.form.ownerid
- this.followParam.content.ownertable = this.form.ownertable
- this.leader = this.data.leader[0]?this.data.leader[0]:''
- this.implement = this.data.leader[0].userid
- this.form.leaderuserid = this.data.leader[0].userid
- this.assistList(this.data.sys_taskid)
- },
- validateInput () {
- this.$refs.form.validate((valid)=>{
- if (!valid) return false
- this.submit()
- })
- },
- setLeader (val) {
- this.leader = val[0]
- this.form.leaderuserid = val[0].userid
- this.implement = this.form.leaderuserid
- this.leaderShow = false
- },
- setAssist (val) {
- this.assistPerson = ''
- this.assist = []
- val.forEach((item,index)=>{
- if (index === 0){
- this.assistPerson = item.name
- }else {
- this.assistPerson = this.assistPerson + ',' + item.name
- }
- this.assist[index] = item.userid
- })
- this.assistShow = false
- },
- async submit () {
- this.form.team.userids = this.assist
- const res = await this.$api.requested({
- "id": 20221211112101,
- "content":this.form
- })
- this.tool.showMessage(res,()=>{
- this.param.content.ownerid = res.data.sys_taskid
- this.dialogTableVisible = false
- this.refresh()
- this.errormsg = ''
- this.$emit('onSuccess')
- /* this.insertAssist(res.data.sys_taskid)*/
- })
- },
- refresh () {
- this.form = {
- "sys_taskid":0,
- "title":"任务标题",
- "remarks":"任务说明",
- "starttime":"",
- "remindday":0,
- "ownertable":"",
- "ownerid":0,
- "endtime":""
- }
- },
- showMenber () {
- this.leaderShow = true
- this.assistShow = false
- this.param.content.ownerid = this.data.sys_taskid
- this.$refs.member.listData()
- // this.validateInput()
- },
- showMenberAssist () {
- this.assistShow = true
- this.leaderShow = false
- this.paramAssist.content.ownerid = this.data.sys_taskid
- this.$refs.memberAssist.listData()
- // this.validateInput()
- },
- async assistList(id){
- this.assistPerson = ''
- this.assist = []
- const res = await this.$api.requested({
- "id": 20220930103501,
- "content": {
- "ownertable":"sys_task",
- "ownerid":id
- }
- })
- let arr = []
- res.data[0].team.forEach((e,index)=>{
- if (e.isleader === 0){
- if (index === 1){
- this.assistPerson = e.name
- this.assist
- }else {
- this.assistPerson = this.assistPerson + ',' + e.name
- }
- }
- this.assist[index] = e.userid
- })
- },
- async insertAssist(id){
- const res = await this.$api.requested({
- "id": 20220930103601,
- "content": {
- "ownertable":"sys_task",
- "ownerid":id,
- "userids":this.assist,
- "justuserids":true
- }
- })
- this.$emit('onSuccess')
- },
- onClose(){
- this.dialogTableVisible = false
- this.leader = {}
- this.assistPerson = ''
- this.assist = []
- this.leaderShow = false
- this.assistShow = false
- this.$refs.form.resetFields()
- },
- selectApplication(ownerid,ownertable,data){
- this.followParam.content.ownertable = ownertable
- this.followParam.content.ownerid = ownerid
- this.form.ownertable = ownertable
- this.form.ownerid = ownerid
- this.form.tableName = ownertable === 'sat_orderclue'?'销售线索':ownertable === 'sa_customers'?'我的客户':ownertable === 'sa_project'?'项目商机':''
- },
- follow(content,type,contacts,data){
- if (this.form.tableName === '我的客户' || this.form.tableName === '项目商机'){
- if (contacts.length === 0){
- this.form.remarks = '跟进类型:'+type+'\n'+ content
- }else {
- let obj = ''
- contacts.forEach((item,index)=>{
- if (index === contacts.length -1){
- obj = obj + item
- }else {
- obj = obj + item + ','
- }
- })
- this.form.remarks = '跟进类型:'+type+'\n'+ '跟进对象:'+obj+'\n' + content
- }
- }else {
- this.form.remarks = '跟进类型:'+ data.followupmode+'\n'+ content
- }
- }
- }
- }
- </script>
- <style scoped>
- .task__label{
- color:rgb(173, 172, 172);
- }
- </style>
|