刘翔宇-旅管家 2 years ago
parent 938fc5d2f2
commit 9995d26cdd

@ -2,8 +2,8 @@
ENV = 'development' ENV = 'development'
# base api # base api
#VUE_APP_DOMIAN=http://192.168.60.99:9003/ VUE_APP_DOMIAN=http://192.168.60.99:9003/
VUE_APP_DOMIAN=http://hdcontract.ali251.langye.net/ #VUE_APP_DOMIAN=http://hdcontract.ali251.langye.net/
VUE_APP_BASE_API = '' VUE_APP_BASE_API = ''
VUE_APP_UPLOAD=http://hdcontract.ali251.langye.net/api/admin/upload-file VUE_APP_UPLOAD=http://hdcontract.ali251.langye.net/api/admin/upload-file

@ -1,24 +1,23 @@
<template> <template>
<div> <div>
<Modal v-model="isShow" title="附件" footer-hide :width="64"> <Modal v-model="isShow" title="附件" footer-hide :width="64">
<Button v-if="role === 1 || role === 0" type="primary" shape="circle" icon="ios-add" @click="add" <Button v-if="role === 1 || role === 0" type="primary" shape="circle" icon="ios-add" @click="add"></Button>
>新增</Button
>
<Table <Table style="margin-top: 10px" :height="320" :data="detail.attachment" :columns="columns">
style="margin-top: 10px"
:height="320"
:data="detail.attachment"
:columns="columns"
>
</Table> </Table>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import { getToken } from "@/utils/auth"; import {
import { show, save, store } from "@/api/propertyPlan"; getToken
} from "@/utils/auth";
import {
show,
save,
store
} from "@/api/propertyPlan";
export default { export default {
props: { props: {
role: Number role: Number
@ -34,16 +33,19 @@ export default {
type: "", type: "",
detail: {}, detail: {},
columns: [ columns: [{
{
key: "file", key: "file",
title: "文件(点击下载)", title: "文件(点击下载)",
width: 200, width: 200,
render: (h, { row }) => { render: (h, {
row
}) => {
return h( return h(
"a", "a", {
{ attrs: {
attrs: { download: row.file.original_name, href: row.file.url }, download: row.file.original_name,
href: row.file.url
},
}, },
row.file.original_name row.file.original_name
); );
@ -65,7 +67,9 @@ export default {
title: "操作", title: "操作",
width: 100, width: 100,
align: "left", align: "left",
render: (h, { row }) => { render: (h, {
row
}) => {
if (this.role == 0 || this.role == 1) if (this.role == 0 || this.role == 1)
return h("Poptip", { return h("Poptip", {
props: { props: {
@ -76,8 +80,7 @@ export default {
scopedSlots: { scopedSlots: {
default: () => { default: () => {
return h( return h(
"Button", "Button", {
{
props: { props: {
ghost: true, ghost: true,
size: "small", size: "small",
@ -174,7 +177,9 @@ export default {
}, },
async getDetail() { async getDetail() {
const res = await show({ id: this.getId() }); const res = await show({
id: this.getId()
});
this.detail = res; this.detail = res;
console.log(res); console.log(res);
}, },
@ -185,20 +190,29 @@ export default {
file: "", file: "",
content: "", content: "",
}; };
this.fileList = [];
const h = this.$createElement; const h = this.$createElement;
this.$msgbox({ this.$msgbox({
title: "新增附件", title: "新增附件",
message: h( message: h(
"el-form", "el-form", {
{ key: ++this.key, props: { model: form, "label-width": "80px" } }, key: ++this.key,
props: {
model: form,
"label-width": "80px"
}
},
[ [
h("el-form-item", { h("el-form-item", {
props: { label: "文件", required: true }, props: {
label: "文件",
required: true
},
scopedSlots: { scopedSlots: {
default: () => default: () =>
h( h(
"el-upload", "el-upload", {
{
props: { props: {
action: this.action, action: this.action,
"file-list": this.fileList, "file-list": this.fileList,
@ -206,8 +220,7 @@ export default {
headers: { headers: {
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
}, },
accept: accept: ".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.xls,.xlsx",
".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.xls,.xlsx",
"on-success": (response, file, fileList) => { "on-success": (response, file, fileList) => {
this.fileList = fileList; this.fileList = fileList;
form.file = response?.id; form.file = response?.id;
@ -228,8 +241,7 @@ export default {
}, },
[ [
h( h(
"el-button", "el-button", {
{
props: { props: {
type: "primary", type: "primary",
size: "small", size: "small",
@ -239,8 +251,7 @@ export default {
"选取文件" "选取文件"
), ),
h( h(
"div", "div", {
{
class: "el-upload__tip", class: "el-upload__tip",
slot: "tip", slot: "tip",
}, },
@ -251,13 +262,17 @@ export default {
}, },
}), }),
h("el-form-item", { h("el-form-item", {
props: { label: "内容" }, props: {
label: "内容"
},
scopedSlots: { scopedSlots: {
default: () => default: () =>
h("textarea", { h("textarea", {
key: this.key, key: this.key,
class: "el-textarea__inner", class: "el-textarea__inner",
props: { value: form.content }, props: {
value: form.content
},
on: { on: {
["input"]: (e) => { ["input"]: (e) => {
form.content = e.target.value; form.content = e.target.value;
@ -284,7 +299,11 @@ export default {
instance.confirmButtonText = "保存中..."; instance.confirmButtonText = "保存中...";
this.detail.attachment_list = [ this.detail.attachment_list = [
...this.detail.attachment?.map((i) => { ...this.detail.attachment?.map((i) => {
return { file: i.file.id, content: i.content, date: i.date }; return {
file: i.file.id,
content: i.content,
date: i.date
};
}), }),
form, form,
]; ];
@ -315,7 +334,6 @@ export default {
this.getDetail(); this.getDetail();
} else { } else {
this.id = ""; this.id = "";
this.fileList = [];
} }
}, },
}, },

Loading…
Cancel
Save