Forráskód Böngészése

任务新建页面新增上传附件,销售线索字段新增erp订单号

qymljy 1 éve
szülő
commit
c27cce0aaa

+ 89 - 4
src/HManagement/task/modules/add.vue

@@ -96,11 +96,28 @@
                 </el-popover>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <el-form-item  :label="$t(`上传附件`)+':'">
+                <uploadFile
+                    @uploadGet="loading = true"
+                    ref="uploadRef"
+                    class="inline-16"
+                    :folderid="folderid"
+                    :bindData="{
+                    ownertable: 'sys_task',
+                    ownerid: ownerid,
+                    usetype: 'default',
+                  }"
+                    :ownerid="ownerid"
+                    @onSuccess="uploadSuccess"
+                ></uploadFile>
+              </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 size="small" style="width:120px" @click="dialogTableVisible = false">{{$t('取 消')}}</el-button>
         <el-button type="primary" size="small" style="width:120px" @click="validateInput">{{$t('确 定')}}</el-button>
       </div>
     </el-drawer>
@@ -114,13 +131,15 @@ 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";
+import uploadFile from "@/template/upload/index";
 export default {
 	props:['ownertable'],
 	components:{
 		upload,
 		member,
     applicationData,
-    followData
+    followData,
+    uploadFile
 	},
 	data () {
 		return {
@@ -181,7 +200,12 @@ export default {
           "ownertable": "",
           "ownerid": ""
         },
-      }
+      },
+      attachmentids:[],
+      loading:false,
+      ownerid: "000001",
+      listFile:[],
+      linksids:[]
 		}
 	},
 	methods:{
@@ -224,6 +248,7 @@ export default {
           "usetype": 'default',
         }
         this.$refs['upload'].toUpload()*/
+        this.batchBinding(res.data.sys_taskid)
         this.$emit('onSuccess')
 				this.dialogTableVisible = false
 				this.onClose()
@@ -273,7 +298,13 @@ export default {
       this.assist = []
       this.leaderShow = false
       this.assistShow = false
+      this.$refs.uploadRef.listFile = []
+      this.$refs.uploadRef.filelist = []
+      this.$refs.uploadRef.count = 0
+      this.$refs.uploadRef.oldCount = 0
+      this.$refs.uploadRef.$refs.uploadMy.clearFiles()
       this.$refs.form.resetFields()
+      this.batchDeletion()
     },
     selectApplication(ownerid,ownertable,data){
       this.followParam.content.ownertable = ownertable
@@ -301,7 +332,61 @@ export default {
         this.form.remarks = '跟进类型:'+ data.followupmode+'\n'+ content
       }
 
-    }
+    },
+    async uploadSuccess(res1){
+      this.listFile = []
+      this.attachmentids = res1.data.attachmentids
+      const res = await this.$api.requested({
+        classname: "system.attachment.Attachment",
+        method: "queryFileLink",
+        content: {
+          ownertable: "sys_task",
+          ownerid: this.ownerid,
+          usetype: "",
+        },
+      });
+      this.$refs.uploadRef.listFile = res.data.map((item) => {
+        return {
+          name: item.document,
+          url: item.url,
+          linksid: item.linksid,
+          attachmentid:item.attachmentid
+        };
+      });
+      this.listFile = this.$refs.uploadRef.listFile
+      this.loading = false;
+    },
+    /*批量绑定*/
+    async batchBinding(id){
+      this.attachmentids = []
+      this.listFile.forEach((item,index)=>{
+        this.attachmentids[index] = item.attachmentid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        "content": {
+          "ownertable": "sys_task",
+          "ownerid": id,
+          "usetype": "default",
+          "attachmentids": this.attachmentids
+        }
+      })
+    },
+    /*批量删除*/
+    async batchDeletion(){
+      this.linksids = []
+      this.listFile.forEach((item,index)=>{
+        this.linksids[index] = item.linksid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "deleteFileLink",
+        "content": {
+          "linksids": this.linksids
+        }
+      })
+    },
 	}
 }
 

+ 90 - 5
src/components/normal-basic-layout-new/details/modules/task/addTask.vue

@@ -100,6 +100,23 @@
                 </el-popover>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <el-form-item  :label="$t(`上传附件`)+':'">
+                <uploadFile
+                    @uploadGet="loading = true"
+                    ref="uploadRef"
+                    class="inline-16"
+                    :folderid="folderid"
+                    :bindData="{
+                    ownertable: 'sys_task',
+                    ownerid: ownerid,
+                    usetype: 'default',
+                  }"
+                    :ownerid="ownerid"
+                    @onSuccess="uploadSuccess"
+                ></uploadFile>
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-row>
       </div>
@@ -118,12 +135,14 @@ import member from '@/template/menber/index'
 import upload from '@/components/upload/preview_upload.vue';
 
 import followData from "@/HManagement/task/components/followData";
+import uploadFile from "@/template/upload/index";
 export default {
 	props:['ownertable','status','typeTask','followData','ownerid'],
 	components:{
 		upload,
 		member,
-    followData
+    followData,
+    uploadFile
 	},
 	data () {
 		return {
@@ -196,7 +215,12 @@ export default {
           "ownertable": "",
           "ownerid": ""
         },
-      }
+      },
+      attachmentids:[],
+      loading:false,
+      ownerid: "000001",
+      listFile:[],
+      linksids:[]
 		}
 	},
 	methods:{
@@ -280,6 +304,7 @@ export default {
           "usetype": 'default',
         }
         this.$refs['upload'].toUpload()*/
+        this.batchBinding(res.data.sys_taskid)
         this.$emit('onSuccess',this.ownertable,this.ownerid)
 				this.dialogTableVisible = false
 				this.refresh()
@@ -290,8 +315,8 @@ export default {
 		refresh () {
 			this.form = {
 				"sys_taskid":0,
-        "title":'任务标题',
-        "remarks":'任务说明',
+        "title":'',
+        "remarks":'',
         "starttime":"",
         "remindday":0,
         "ownertable":"",
@@ -327,6 +352,12 @@ export default {
       this.leaderShow = false
       this.dialogTableVisible = false
       this.form.remarks = ''
+      this.$refs.uploadRef.listFile = []
+      this.$refs.uploadRef.filelist = []
+      this.$refs.uploadRef.count = 0
+      this.$refs.uploadRef.oldCount = 0
+      this.$refs.uploadRef.$refs.uploadMy.clearFiles()
+      this.batchDeletion()
     },
     follow(content,type,contacts){
       if (this.typeTask === '我的客户' || this.typeTask === '项目商机' || this.typeTask === '公海客户' || this.ownertable === 'sys_enterprise_contacts' || this.ownertable === 'sa_project_contacts'){
@@ -350,7 +381,61 @@ export default {
         this.form.remarks = content
       }
 
-    }
+    },
+    async uploadSuccess(res1){
+      this.listFile = []
+      this.attachmentids = res1.data.attachmentids
+      const res = await this.$api.requested({
+        classname: "system.attachment.Attachment",
+        method: "queryFileLink",
+        content: {
+          ownertable: "sys_task",
+          ownerid: this.ownerid,
+          usetype: "",
+        },
+      });
+      this.$refs.uploadRef.listFile = res.data.map((item) => {
+        return {
+          name: item.document,
+          url: item.url,
+          linksid: item.linksid,
+          attachmentid:item.attachmentid
+        };
+      });
+      this.listFile = this.$refs.uploadRef.listFile
+      this.loading = false;
+    },
+    /*批量绑定*/
+    async batchBinding(id){
+      this.attachmentids = []
+      this.listFile.forEach((item,index)=>{
+        this.attachmentids[index] = item.attachmentid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        "content": {
+          "ownertable": "sys_task",
+          "ownerid": id,
+          "usetype": "default",
+          "attachmentids": this.attachmentids
+        }
+      })
+    },
+    /*批量删除*/
+    async batchDeletion(){
+      this.linksids = []
+      this.listFile.forEach((item,index)=>{
+        this.linksids[index] = item.linksid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "deleteFileLink",
+        "content": {
+          "linksids": this.linksids
+        }
+      })
+    },
 		/*onCancel (done) {
       console.log("关闭")
       this.assistShow = false

+ 90 - 5
src/components/normal-basic-layout/details/modules/task/addTask.vue

@@ -100,6 +100,23 @@
                 </el-popover>
               </el-form-item>
             </el-col>
+            <el-col :span="24">
+              <el-form-item  :label="$t(`上传附件`)+':'">
+                <uploadFile
+                    @uploadGet="loading = true"
+                    ref="uploadRef"
+                    class="inline-16"
+                    :folderid="folderid"
+                    :bindData="{
+                    ownertable: 'sys_task',
+                    ownerid: ownerid,
+                    usetype: 'default',
+                  }"
+                    :ownerid="ownerid"
+                    @onSuccess="uploadSuccess"
+                ></uploadFile>
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-row>
       </div>
@@ -118,12 +135,14 @@ import member from '@/template/menber/index'
 import upload from '@/components/upload/preview_upload.vue';
 
 import followData from "@/HManagement/task/components/followData";
+import uploadFile from "@/template/upload/index";
 export default {
 	props:['ownertable','status','typeTask','followData','disabled'],
 	components:{
 		upload,
 		member,
-    followData
+    followData,
+    uploadFile
 	},
 	data () {
 		return {
@@ -196,7 +215,12 @@ export default {
           "ownertable": "",
           "ownerid": ""
         },
-      }
+      },
+      attachmentids:[],
+      loading:false,
+      ownerid: "000001",
+      listFile:[],
+      linksids:[]
 		}
 	},
 	methods:{
@@ -276,6 +300,7 @@ export default {
           "usetype": 'default',
         }
         this.$refs['upload'].toUpload()*/
+        this.batchBinding(res.data.sys_taskid)
         this.$emit('onSuccess')
 				this.dialogTableVisible = false
 				this.refresh()
@@ -286,8 +311,8 @@ export default {
 		refresh () {
 			this.form = {
 				"sys_taskid":0,
-        "title":this.$t('任务标题'),
-        "remarks":this.$t('任务说明'),
+        "title":'',
+        "remarks":'',
         "starttime":"",
         "remindday":0,
         "ownertable":"",
@@ -323,6 +348,12 @@ export default {
       this.leaderShow = false
       this.dialogTableVisible = false
       this.form.remarks = ''
+      this.$refs.uploadRef.listFile = []
+      this.$refs.uploadRef.filelist = []
+      this.$refs.uploadRef.count = 0
+      this.$refs.uploadRef.oldCount = 0
+      this.$refs.uploadRef.$refs.uploadMy.clearFiles()
+      this.batchDeletion()
     },
     follow(content,type,contacts){
       if (this.typeTask === '我的客户' || this.typeTask === '项目商机' || this.typeTask === '公海客户'){
@@ -346,7 +377,61 @@ export default {
         this.form.remarks = content
       }
 
-    }
+    },
+    async uploadSuccess(res1){
+      this.listFile = []
+      this.attachmentids = res1.data.attachmentids
+      const res = await this.$api.requested({
+        classname: "system.attachment.Attachment",
+        method: "queryFileLink",
+        content: {
+          ownertable: "sys_task",
+          ownerid: this.ownerid,
+          usetype: "",
+        },
+      });
+      this.$refs.uploadRef.listFile = res.data.map((item) => {
+        return {
+          name: item.document,
+          url: item.url,
+          linksid: item.linksid,
+          attachmentid:item.attachmentid
+        };
+      });
+      this.listFile = this.$refs.uploadRef.listFile
+      this.loading = false;
+    },
+    /*批量绑定*/
+    async batchBinding(id){
+      this.attachmentids = []
+      this.listFile.forEach((item,index)=>{
+        this.attachmentids[index] = item.attachmentid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        "content": {
+          "ownertable": "sys_task",
+          "ownerid": id,
+          "usetype": "default",
+          "attachmentids": this.attachmentids
+        }
+      })
+    },
+    /*批量删除*/
+    async batchDeletion(){
+      this.linksids = []
+      this.listFile.forEach((item,index)=>{
+        this.linksids[index] = item.linksid
+      })
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "deleteFileLink",
+        "content": {
+          "linksids": this.linksids
+        }
+      })
+    },
 		/*onCancel (done) {
       console.log("关闭")
       this.assistShow = false

+ 2 - 2
src/components/upload/hw_obs_upload_new.vue

@@ -17,7 +17,7 @@
       <el-button icon="el-icon-paperclip" type="text" size="mini" @click="dialogUploadVisible = true" :disabled="status === '已结案' || status === '已失败' || disabled">{{$t('附件上传')}}</el-button>
     </div>
     <!-- 按钮类型 -->
-    <el-button v-else :type="status === '已结案' || status === '已失败' || disabled?'':'primary'" size="small" @click="dialogUploadVisible = true" icon="el-icon-upload" :disabled="status === '已结案' || status === '已失败' || disabled">{{$t(`上 传`)}}</el-button>
+    <el-button v-else :type="status === '已结案' || status === '已失败' || disabled?'':'primary'" size="small" @click="dialogUploadVisible = true" icon="el-icon-upload" :disabled="status === '已结案' || status === '已失败' || disabled">{{$t(title?title:`上 传`)}}</el-button>
     <el-dialog :title="$t(`文件上传`)" :visible.sync="dialogUploadVisible" width="500px" append-to-body :close-on-click-modal="false" :before-close="clearFiles">
       <selectMedia v-if = "!hidemediastock" @onShow="onShow" :accept="accept" :bindData="bindData" @onBindSuccess="onBindSuccess"></selectMedia>
       <el-upload
@@ -67,7 +67,7 @@ export default {
     bindData:附件上传成功后对应需要绑定的数据信息,
     hidemediastock:是否隐藏媒体库选择
   */
-  props:['folderid','btntype','accept','bindData','hidemediastock','status','disabled'],
+  props:['folderid','btntype','accept','bindData','hidemediastock','status','disabled','title'],
   components:{
     selectMedia
   },