Commit e4fed9fa authored by renjintao's avatar renjintao

importimport

parent c511ba38
This diff is collapsed.
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="24">
</Col>
<Col :span="24">
<FormItem :label="l('file')" prop="file">
<InputExcel v-model="imgName" :parms="parms" :showButton="false" />
<InputExcel v-model="imgName" :parms="parms" :showButton="false" />
</FormItem>
</Col>
<Col :span="24">
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
<Input v-model="entity.remark" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</Form>
</template>
<script>
<script>
import Api from "./api";
import InputExcel from "@/components/page/inputExcel.vue";
export default {
name: "Add",
components: {
InputExcel
},
data() {
return {
disabled: false,
parms: "app=import&eid="+this.$u.guid()+"&name=excel",
imgName: "",
entity: {
name: "",
file: "",
filePath:"",
remark: "",
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
file:[{ required: true, message: "请上传文件", trigger: "change" }]
},
};
},
props: {
v: Object,
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.entity.id = 0;
});
name: "Add",
components: {
InputExcel
},
getEid() {
this.parms.eid = this.$u.guid()
this.parms.app = 'import'
this.$refs.refFile.intFiles()
data() {
return {
disabled: false,
parms: "app=import&eid=" + this.$u.guid() + "&name=excel",
imgName: "",
entity: {
name: "",
file: "",
path: "",
remark: "",
},
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur"
}],
file: [{
required: true,
message: "请上传文件",
trigger: "change"
}]
},
};
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
props: {
v: Object,
eid: Number,
},
},
watch: {
imgName(newName, oldName) {
const imgPathsArr = JSON.parse(newName);
this.entity.file=imgPathsArr[0].fileName
this.entity.filePath=imgPathsArr[0].filePath
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
v() {
this.entity = this.$u.clone(this.v);
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({
id: v
}).then((r) => {
this.entity = r.result;
this.entity.id = 0;
});
},
getEid() {
this.parms.eid = this.$u.guid()
this.parms.app = 'import'
this.$refs.refFile.intFiles()
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
eid(v) {
if (v > 0) {
this.load(v);
}
watch: {
imgName(newName, oldName) {
const imgPathsArr = JSON.parse(newName);
this.entity.file = imgPathsArr[0].fileName
this.entity.path = imgPathsArr[0].filePath
},
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
},
};
</script>
......@@ -24,5 +24,8 @@ export default {
deletes(params) {
return Api.post(`${systemUrl}/importcenter/batchdelete`, params);
},
openExcel(params) {//处理时打开以前上传的excel返回数据
return Api.post(`${systemUrl}/importcenter/open`, params);
},
}
<template>
<div class="detail">
<div class="detail">
<Row>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('file')"><a @click="downFile(entity.filePath)">{{entity.file}}</a></Filed>
<Filed :span="12" :name="l('status')">{{entity.status}}</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{entity.creatorUserId}}</Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{entity.lastModifierUserId}}</Filed>
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{entity.deleterUserId}}</Filed>
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('lastModifier')">{{entity.lastModifier}}</Filed>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('file')">
<a @click="downFile(entity.path)">{{entity.file}}</a>
</Filed>
<Filed :span="12" :name="l('status')">
<state code="improt.im.status" :value="entity.status" type="text"></state>
</Filed>
<Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">
<User :value="entity.creatorUserId"></User>
</Filed>
<!--
<Filed :span="12" :name="l('lastModificationTime')">{{entity.lastModificationTime}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">
{{entity.lastModifierUserId}}
<User :value="entity.lastModifierUserId"></User>
</Filed>
<Filed :span="12" :name="l('isDeleted')">{{entity.isDeleted}}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{entity.deletionTime}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">
{{entity.deleterUserId}}
<User :value="entity.deleterUserId"></User>
</Filed>
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('lastModifier')">{{entity.lastModifier}}</Filed>
-->
</Row>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
name: "Add",
data() {
return {
entity: {},
downUrl: fileUrlDown,
fileUrlPath: "",
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur",
}, ],
code: [{
required: true,
message: "必填",
trigger: "blur",
}, ],
},
};
},
handleClose() {
this.$emit("on-close");
props: {
eid: Number,
},
downFile(path) {
alert(path)
let truePath = path.trim();
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
}
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
methods: {
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
downFile(path) {
//alert(path)
let truePath = path;
if (truePath.length > 2) {
if (
truePath.substring(0, 7).toLowerCase() == "http://" ||
truePath.substring(0, 8).toLowerCase() == "https://"
) {
window.open(truePath, "_blank");
} else {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
}
}
},
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
},
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
},
};
</script>
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment