| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <el-dialog title="添加资料" :visible.sync="dialogFormVisible" @close="closeDialog" :close-on-click-modal="false" width="40%">
- <el-form :model="form" label-width="110px">
- <el-form-item label="资料名称:">
- <el-input v-model="form.catalogName" autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="编制单位:">
- <el-input v-model="form.estUnit" autocomplete="off"></el-input>
- </el-form-item>
- <el-form-item label="编制时间:">
- <el-date-picker
- v-model="form.estTm"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="资料上传:">
- <upload
- ref="uploadFile"
- :url="`/pdcApi/file/insert?bizId=`"
- @uploadOver="removeNewSupervision"
- ></upload>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button style="font-size:large;" @click="closeDialog">取 消</el-button>
- <el-button style="font-size:large;" type="primary" @click="addFile">保 存</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import {addFileApi} from '@api/InspectionReport.js'
- export default {
- props: ['listId'], //底稿id
- data() {
- //这里存放数据
- return {
- dialogFormVisible: true,
- form:{
- catalogName: '',
- estUnit: '', //编制单位
- estTm: '', //编制时间
- listId: '', //底稿id
- persId: '',
- gwComFileList: []
- },
- gwComFileList: []
- };
- },
- components:{
- upload: resolve => {
- require(["../../../widgets/uploadFile.vue"], resolve);
- }
- },
- computed: {
- persId() {
- return localStorage.getItem("userid") ? localStorage.getItem("userid") : "1098101939614724096";
- },
- },
- //监控data中的数据变化
- watch: {},
- //方法集合
- methods: {
- //添加资料
- addFile(){
- this.form.listId = this.listId
- this.form.persId = this.persId
- addFileApi(this.form).then(res=>{
- if(res.success){
- this.gwComFileList = [];
- if (this.$refs.uploadFile.submitUpload(res.data.id)) {
- this.removeNewSupervision();
- }
- this.$message.success('添加成功')
- }
- }).catch(err=>{
- this.$message.error(err)
- })
- },
- closeDialog(){
- this.$emit('dialogClose')
- },
- removeNewSupervision(arg) {
- if (arg) {
- var args = this.gwComFileList.concat(arg);
- }
- this.gwComFileList = [];
- this.$emit('dialogClose')
- },
- // 文件上传
- submitUpload() {
- this.$refs.upload.submit();
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- }
- }
- </script>
- <style scoped>
- </style>
|