|
@@ -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()
|
|
|
}
|
|
|
}
|
|
|
|