|
@@ -301,8 +301,8 @@
|
|
|
<tr>
|
|
|
<th>其他附件</th>
|
|
|
<td colspan="3">
|
|
|
- <el-form-item label="其他附件" prop="attachIds">
|
|
|
- <FileUpload :files="form.fileList" @input="handleSaleSuccess" :multiple="true" :params="params">上传材料</FileUpload>
|
|
|
+ <el-form-item prop="attachIds" label-width="0">
|
|
|
+ <!-- <FileUpload :files="form.fileList" @input="handleSaleSuccess" :multiple="true" :params="params">上传材料</FileUpload>
|
|
|
<el-table v-loading="loading" :data="list" border style="width: 100%;margin-top: 5px;margin-bottom: 5px;" v-if="type == 'update' || type == 'updateEnt'">
|
|
|
<el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
<el-table-column label="文件名称" prop="fileName" align="center"></el-table-column>
|
|
@@ -312,7 +312,19 @@
|
|
|
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- </el-table>
|
|
|
+ </el-table> -->
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ :action="action"
|
|
|
+ :headers="headers"
|
|
|
+ :on-preview="handlePreview"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :before-remove="beforeRemove"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ multiple
|
|
|
+ :file-list="form.fileList">
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
+ </el-upload>
|
|
|
</el-form-item>
|
|
|
</td>
|
|
|
</tr>
|
|
@@ -351,6 +363,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
import { getEntInfoByIdApi,updateEntInfoApi } from "@/api/admin/ent/ent"
|
|
|
import { registerEnterUserApi } from "@/api/admin/ent/ent";
|
|
|
import {getProvinceDataApi,getRegionChildrenApi,validLicenseApi} from "@/api/common/common"
|
|
@@ -383,6 +396,10 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
+ action: process.env.VUE_APP_BASE_API + "/common/attach/upload", // 上传的图片服务器地址
|
|
|
+ headers: {
|
|
|
+ Authorization: "Bearer " + getToken(),
|
|
|
+ },
|
|
|
dialogVisible: false,
|
|
|
dialogImageUrl: '',
|
|
|
height: window.innerHeight + 'px',
|
|
@@ -615,7 +632,10 @@ export default {
|
|
|
getEnclosureData() {
|
|
|
getEnclosureApi(this.attachType, this.dataId).then(res => {
|
|
|
this.list = res.data.records
|
|
|
- // this.list.
|
|
|
+ this.list.map(item => {
|
|
|
+ item.name = item.fileName
|
|
|
+ })
|
|
|
+ this.form.fileList = this.list
|
|
|
})
|
|
|
},
|
|
|
handleUpload() {
|
|
@@ -624,19 +644,7 @@ export default {
|
|
|
this.$refs.uploadEnclosure.init()
|
|
|
})
|
|
|
},
|
|
|
- handleDelete(row) {
|
|
|
- const id = row.id;
|
|
|
- this.$confirm('是否确认删除该数据?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(function() {
|
|
|
- return deleteEnclosureApi(id);
|
|
|
- }).then(() => {
|
|
|
- this.getEnclosureData()
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
getData() {
|
|
|
this.loading = true
|
|
|
getEntInfoByIdApi(this.form.id).then(res => {
|
|
@@ -690,6 +698,89 @@ export default {
|
|
|
this.form.attachIds.push(item.response.data.id)
|
|
|
});
|
|
|
},
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
+ console.log("fileList", fileList)
|
|
|
+ this.form.attachIds = []
|
|
|
+ fileList.forEach(item => {
|
|
|
+ if(item.id) {
|
|
|
+ this.form.attachIds.push(item.id)
|
|
|
+ }else {
|
|
|
+ this.form.attachIds.push(item.response.data.id)
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handlePreview(file) {
|
|
|
+ console.log(file, "file")
|
|
|
+ if (file) {
|
|
|
+ const addTypeArray = file.name.split(".");
|
|
|
+ const addType = addTypeArray[addTypeArray.length - 1];
|
|
|
+ let filePath = ""
|
|
|
+ if(file.id) {
|
|
|
+ filePath = file.url
|
|
|
+ } else {
|
|
|
+ filePath = file.response.data.url
|
|
|
+ }
|
|
|
+ if (addType === "pdf") {
|
|
|
+ let routeData = this.$router.resolve({
|
|
|
+ path: "/pdfPreview",
|
|
|
+ query: { url: filePath },
|
|
|
+ });
|
|
|
+ window.open(routeData.href, "_blank");
|
|
|
+ }
|
|
|
+ //".rar, .zip, .doc, .docx, .xls, .txt, .pdf, .jpg, .png, .jpeg,"
|
|
|
+ else if (addType === "doc" || addType === "docx" || addType === "xls" || addType === "xlsx") {
|
|
|
+ window.open(filePath);
|
|
|
+ } else if (addType === "txt") {
|
|
|
+ window.open(filePath);
|
|
|
+ } else if (["png", "jpg", "jpeg"].includes(addType)) {
|
|
|
+ window.open(filePath);
|
|
|
+ } else if (addType === "rar" || addType === "zip") {
|
|
|
+ this.$message({
|
|
|
+ message: "该文件类型暂不支持预览",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRemove(file, fileList) {
|
|
|
+ if(this.type == 'update' || this.type == 'updateEnt') {
|
|
|
+ if(file.id) {
|
|
|
+ const id = file.id
|
|
|
+ return this.$confirm('是否确认删除该数据?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return deleteEnclosureApi(id);
|
|
|
+ }).then(() => {
|
|
|
+ this.getEnclosureData()
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ const id = row.id;
|
|
|
+ this.$confirm('是否确认删除该数据?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return deleteEnclosureApi(id);
|
|
|
+ }).then(() => {
|
|
|
+ this.getEnclosureData()
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ // v-if="type == 'update' || type == 'updateEnt'"
|
|
|
+ console.log("handleRemove", fileList, file)
|
|
|
+ if(this.type == 'update' || this.type == 'updateEnt') {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
//选择省份
|
|
|
getCityData() {
|
|
|
this.form.cityId = ''
|