Jelajahi Sumber

修改产品技术资料

qymljy 2 tahun lalu
induk
melakukan
d6833d60e8

+ 131 - 9
src/HDrpManagement/prodectFileData/modules/add.vue

@@ -6,13 +6,15 @@
       :visible.sync="drawer"
       size="800px"
       direction="rtl"
-      append-to-body>
+      append-to-body
+      @close="onClose"
+      >
       <div class="drawer__panel">
         <el-row :gutter="20">
           <el-form :model="form" :rules="rules"  ref="form"  size="mini" label-position="right" label-width="90px">
-            <el-col :span="20">
+            <el-col :span="24">
               <el-form-item prop="type"  label="资料类别:">
-                <el-select v-model="form.type" placeholder="请选择">
+                <el-select v-model="form.type" placeholder="请选择资料类别" style="width: 100%">
                   <el-option
                       v-for="item in options"
                       :key="item.value"
@@ -22,13 +24,25 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="20">
+            <el-col :span="24">
               <el-form-item  label="资料说明:">
-                <el-input type="textarea" autosize v-model="form.remarks" placeholder="输入资料说明"></el-input>
+                <el-input type="textarea" rows="5" v-model="form.remarks" placeholder="输入资料说明"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item  label="上传附件">
+                <uploadFile ref="upload" style="margin-top:0px" :folderid="folderid" accept=".text,.doc,.xls" :bindData="{ownertable:'plm_technicalinfo',ownerid:plm_technicalinfoid,usetype:'default'}" @onSuccess="uploadSuccess"></uploadFile>
               </el-form-item>
             </el-col>
           </el-form>
         </el-row>
+        <div>
+          <file_table ref="list" :id="plm_technicalinfoid">
+            <template v-slot:del="scope">
+              <file_delete v-if="tool.checkAuth($route.name,'delete')" :data="scope.data" :type="'text'" @deleteSuccess="onSuccess"></file_delete>
+            </template>
+          </file_table>
+        </div>
       <div class="fixed__btn__panel">
         <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
         <el-button size="small" type="primary" @click="onSubmit"   class="normal-btn-width btn-primary">确 定</el-button>
@@ -39,32 +53,53 @@
 </template>
 
 <script>
+import uploadFile from '../../../components/upload/hw_obs_upload.vue'
+import file_table from "../components/fileTable";
+import file_delete from "../components/fileDel"
 export default {
   name: "add",
   data() {
     return {
       drawer:false,
+      plm_technicalinfoid:'',
       form:{
         type:'',
-        remarks:''
+        remarks:'',
+        attinfos:[]
       },
       options: [],
       rules:{
         type: [
-          { required: true, message: '档案名称不可为空', trigger: 'change' },
+          { required: true, message: '资料类别不可为空', trigger: 'change' },
         ],
       },
+      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+      attachmentids:[],
+      linksids:[]
     }
   },
+  components:{
+    uploadFile,
+    file_table,
+    file_delete
+  },
   methods:{
     onShow() {
       this.drawer = true
       this.typeDetails();
+      this.plm_technicalinfoid = '0'
     },
     onClose() {
-      this.form = {
-        type:''
+      if (this.linksids.length > 0){
+        this.batchDeletion()
       }
+      /*this.$refs.form.resetFields()*/
+      /*this.plm_technicalinfoid = ''
+      this.form = {
+        type:'',
+        remarks:'',
+        attinfos:[]
+      }*/
     },
     onSubmit(){
       this.$refs['form'].validate(async (valid) => {
@@ -79,8 +114,17 @@ export default {
           }
         })
         this.tool.showMessage(res,() => {
+          console.log("输出创建id")
+          console.log(res)
+          this.batchBinding(res.data)
           this.drawer = false
           this.$refs.form.resetFields()
+          this.plm_technicalinfoid = ''
+          this.form = {
+            type:'',
+            remarks:'',
+            attinfos:[]
+          }
           this.$emit('onSuccess')
         })
       })
@@ -101,6 +145,84 @@ export default {
       })
       console.log(res)
       this.options = res.data
+    },
+    uploadSuccess(res){
+      console.log("输出")
+      console.log(res)
+      this.bindEnclosure(res.data.attachmentids)
+      this.form.attinfos = this.form.attinfos.push(res.data.attachmentids)
+      console.log(this.form)
+      this.$refs['upload'].dialogUploadVisible = false
+    },
+    async bindEnclosure(attachmentids){
+      console.log(attachmentids)
+      console.log(this.attachmentids)
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        "content": {
+          "ownertable": "plm_technicalinfo",
+          "ownerid": 0,
+          "usetype": "default",
+          "attachmentids": attachmentids
+        }
+      })
+      this.tool.showMessage(res,() => {
+        console.log("附件绑定")
+        console.log(res)
+        const attachmentid = []
+        const linksid=[]
+        attachmentid[0] = res.data[0].attachmentid
+        linksid[0] = res.data[0].linksid
+        if (this.attachmentids.length === 0){
+          this.attachmentids[0]= res.data[0].attachmentid
+          this.linksids[0] = res.data[0].linksid
+        }else {
+          this.attachmentids.push(...attachmentid)
+          this.linksids.push(...linksid)
+        }
+        console.log(this.attachmentids)
+        console.log(this.linksids)
+        this.$refs.list.listData()
+      })
+    },
+    /*批量绑定*/
+    async batchBinding(id){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "createFileLink",
+        "content": {
+          "ownertable": "plm_technicalinfo",
+          "ownerid": id,
+          "usetype": "default",
+          "attachmentids": this.attachmentids
+        }
+      })
+      this.batchDeletion()
+    },
+    /*批量删除*/
+    async batchDeletion(){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "deleteFileLink",
+        "content": {
+          "linksids": this.linksids
+        }
+      })
+      console.log("删除")
+      console.log(res)
+      this.$refs.form.resetFields()
+      this.plm_technicalinfoid = ''
+      this.form = {
+        type:'',
+        remarks:'',
+        attinfos:[]
+      }
+      this.$refs.list.listData()
+      this.$emit('onSuccess')
+    },
+    onSuccess(){
+      this.$refs.list.listData()
     }
   }
 

+ 38 - 10
src/HDrpManagement/prodectFileData/modules/edit.vue

@@ -10,19 +10,26 @@
       <div class="drawer__panel">
         <el-row :gutter="20">
           <el-form :model="form" :rules="rules"  ref="form"  size="mini" label-position="left" label-width="90px">
-            <el-col :span="20">
-              <el-form-item prop="type"  label="档案名称:">
-                <el-input v-model="form.type" placeholder="输入档案名称"></el-input>
+            <el-col :span="24">
+              <el-form-item prop="type"  label="资料类别:">
+                <el-select v-model="form.type" placeholder="请选择资料类别" style="width: 100%">
+                  <el-option
+                      v-for="item in options"
+                      :key="item.value"
+                      :label="item.value"
+                      :value="item.value">
+                  </el-option>
+                </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="20">
-              <el-form-item  label="档案备注:">
-                <el-input type="textarea" autosize v-model="form.remarks" placeholder="输入档案备注"></el-input>
+            <el-col :span="24">
+              <el-form-item  label="资料说明:">
+                <el-input type="textarea" rows="5" v-model="form.remarks" placeholder="输入资料说明"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="20">
+            <el-col :span="24">
               <el-form-item  label="上传附件">
-                <uploadFile ref="upload" style="margin-top:10px" :folderid="folderid" accept=".text,.doc,.xls" :bindData="{ownertable:'plm_technicalinfo',ownerid:form.plm_technicalinfoid,usetype:'default'}" @onSuccess="uploadSuccess"></uploadFile>
+                <uploadFile ref="upload" style="margin-top:0px" :folderid="folderid" accept=".text,.doc,.xls" :bindData="{ownertable:'plm_technicalinfo',ownerid:form.plm_technicalinfoid,usetype:'default'}" @onSuccess="uploadSuccess"></uploadFile>
               </el-form-item>
             </el-col>
           </el-form>
@@ -55,9 +62,10 @@ export default {
     return {
       drawer:false,
       form:[],
+      options: [],
       rules:{
         type: [
-          { required: true, message: '档案名称不可为空', trigger: 'blur' },
+          { required: true, message: '资料类别不可为空', trigger: 'blur' },
         ],
       },
       folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
@@ -77,11 +85,12 @@ export default {
       this.drawer = true
       this.form = this.data
       console.log(this.form)
+      this.typeDetails()
     },
     onClose(){
       this.drawer = false
     },
-    async onSubmit(){
+    onSubmit(){
       this.$refs['form'].validate(async (valid) => {
         if (!valid) return false
         const res = await this.$api.requested({
@@ -100,7 +109,26 @@ export default {
         })
       })
     },
+    /*资料类别明细*/
+    async typeDetails(){
+      const res = await this.$api.requested({
+        "classname": "sysmanage.develop.optiontype.optiontype",
+        "method": "optiontypeselect",
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 20,
+          "typename": "technicalinfotype",
+          "parameter": {
+            "siteid": "YOSTEST2"
+          }
+        }
+      })
+      console.log(res)
+      this.options = res.data
+    },
     uploadSuccess(res){
+      console.log("输出")
+      console.log(res)
       this.bindEnclosure(res.data.attachmentids)
       this.form.attinfos = JSON.parse(res.attinfos).data
       this.$refs['upload'].dialogUploadVisible = false

+ 1 - 1
src/HManagement/submit/index.vue

@@ -21,7 +21,7 @@
       </template>
       <template v-slot:tbOpreation="scope">
         <edit :id="scope.data.data.sat_submiteditmodelid" @updateSuccess="onSuccess"></edit>
-        <el-button class="inline-16" v-if="tool.checkAuth($route.name,'data_analysis')" type="text" size="small" @click="$router.push({path:'/submit_statistics',query:{id:scope.data.data.sat_submiteditmodelid}})">数据分析</el-button>
+        <el-button class="inline-16"  type="text" size="small" @click="$router.push({path:'/submit_statistics',query:{id:scope.data.data.sat_submiteditmodelid}})">数据分析</el-button>
 
         <!--        <el-button v-if="tool.checkAuth($route.name,'data_analysis')" type="text" size="small" @click="$router.push({path:'/notice_edit',query:{id:scope.data.data.sat_noticeid}})">详情</el-button>-->
       </template>

+ 1 - 1
src/router/HDrpManagement.js

@@ -62,7 +62,7 @@ const HDrpManagement = [
     path: '/prodectFileData',
     name: 'prodectFileData',
     meta: {
-      title: '产品技术资料管理',
+      title: '产品技术资料',
       ast_nav: true,
       keeproute: true,
     },