Commit 03245e5d authored by 仇晓婷's avatar 仇晓婷

文档分类选择模板,分类前加图标

parent 590fddf4
...@@ -1733,8 +1733,9 @@ export default { ...@@ -1733,8 +1733,9 @@ export default {
englishName:'英文简称', englishName:'英文简称',
status:'', status:'',
inheritCategoryId:'继承', //继承分类id inheritCategoryId:'继承', //继承分类id
template:'上传模板', //模板路径 url:'上传模板', //模板路径
templateId:'', template:'', //模板路径
templateId:'选择模板',
status:'状态', status:'状态',
description:'备注' description:'备注'
}, },
......
...@@ -57,23 +57,14 @@ ...@@ -57,23 +57,14 @@
<Input v-model="entity.description" type="textarea" :rows="5"></Input> <Input v-model="entity.description" type="textarea" :rows="5"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('template')" prop="template"> <FormItem :label="l('templateId')" prop="templateId">
<!-- <Input v-model="entity.template" type="textarea" :rows="5"></Input> --> <Select
<inputFile v-model="entity.templateId"
class="tphoto" @on-change="setTemplate"
ref="refmovieFile1" clearable
v-model="imgName" filterable
:parms="parmsName" >
files
/>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('template')" prop="template">
<!-- <Input v-model="entity.template" type="textarea" :rows="5"></Input> -->
<Select v-model="template" @on-select-change="setTemplate">
<Option v-for="(t, i) in templates" :key="i" :value="t.id">{{ <Option v-for="(t, i) in templates" :key="i" :value="t.id">{{
t.name t.name
}}</Option> }}</Option>
...@@ -180,11 +171,8 @@ export default { ...@@ -180,11 +171,8 @@ export default {
name: "Add", name: "Add",
data() { data() {
return { return {
imgName: "",
parmsName: "app=material&eid=1&name=documentTemplate",
codeList: [], codeList: [],
temlplates: [], templates: [],
template: null,
entity: { entity: {
creatorUserId: this.$store.state.userInfo.userId, creatorUserId: this.$store.state.userInfo.userId,
name: "", name: "",
...@@ -324,12 +312,12 @@ export default { ...@@ -324,12 +312,12 @@ export default {
align: "center", align: "center",
}, },
], ],
parms: { // parms: {
app: "material", // app: "material",
eid: null, // eid: null,
name: "", // name: "",
field: "", // field: "",
}, // },
}; };
}, },
props: { props: {
...@@ -339,8 +327,7 @@ export default { ...@@ -339,8 +327,7 @@ export default {
mounted() { mounted() {
this.tebleSet(); this.tebleSet();
this.loadTemplate(); this.loadTemplate();
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
}, },
methods: { methods: {
tebleSet() { tebleSet() {
...@@ -358,11 +345,17 @@ export default { ...@@ -358,11 +345,17 @@ export default {
}; };
Api.filesList(data).then((r) => { Api.filesList(data).then((r) => {
if (r.result) { if (r.result) {
// this.templates = r.result; this.templates = r.result.items;
}
});
},
setTemplate(a) {
this.templates.forEach((r) => {
if (a == r.id) {
this.entity.template = r.name;
} }
}); });
}, },
setTemplate() {},
addNew() { addNew() {
let maxId = 0; let maxId = 0;
this.checkList.map((u) => { this.checkList.map((u) => {
...@@ -403,18 +396,18 @@ export default { ...@@ -403,18 +396,18 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
if (this.$refs.refFile.nameList.length > 0) { // if (this.$refs.refFile.nameList.length > 0) {
let nameList = this.$refs.refFile.nameList; // let nameList = this.$refs.refFile.nameList;
let names = []; // let names = [];
nameList.forEach((e) => { // nameList.forEach((e) => {
names.push(e.fileName); // names.push(e.fileName);
}); // });
this.entity.templateId = this.parms.eid; // this.entity.templateId = this.parms.eid;
this.entity.template = names.join(","); // this.entity.template = names.join(",");
} else { // } else {
// this.entity.filePath = ""; // // this.entity.filePath = "";
this.entity.templateId = ""; // this.entity.templateId = "";
} // }
if (this.row.id) { if (this.row.id) {
this.entity.upId = this.row.id; this.entity.upId = this.row.id;
this.entity.level = this.row.level; this.entity.level = this.row.level;
...@@ -460,14 +453,7 @@ export default { ...@@ -460,14 +453,7 @@ export default {
}, },
}, },
watch: { watch: {
// v() {
// this.entity = this.$u.clone(this.v);
// },
// eid(v) {
// if (v > 0) {
// this.load(v);
// }
// },
}, },
}; };
</script> </script>
\ No newline at end of file
...@@ -59,23 +59,20 @@ ...@@ -59,23 +59,20 @@
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('template')" prop="template"> <FormItem :label="l('templateId')" prop="templateId">
<!-- <Input v-model="entity.template" type="textarea" :rows="5"></Input> --> <Select
<inputFile v-model="entity.templateId"
class="tphoto" @on-change="setTemplate"
ref="refmovieFile1" clearable
v-model="imgName" filterable
:parms="parmsName" >
files <Option v-for="(t, i) in templates" :key="i" :value="t.id">{{
/> t.name
</FormItem> }}</Option>
</Col> </Select>
<Col :span="24">
<FormItem :label="l('template')" prop="templateId">
<!-- <Input v-model="entity.template" type="textarea" :rows="5"></Input> -->
<files ref="refFile" :parms="parms" files />
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="24"> <!-- <Col :span="24">
<FormItem :label="l('templateId')" prop="templateId"> <FormItem :label="l('templateId')" prop="templateId">
<Input v-model="entity.templateId"></Input> <Input v-model="entity.templateId"></Input>
...@@ -176,13 +173,13 @@ export default { ...@@ -176,13 +173,13 @@ export default {
name: "Edit", name: "Edit",
data() { data() {
return { return {
imgName: "",
parmsName: "app=material&eid=1&name=documentTemplate", parmsName: "app=material&eid=1&name=documentTemplate",
codeList: [], codeList: [],
entity: {}, entity: {},
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
}, },
templates: [],
inherit: null, inherit: null,
checkList: [ checkList: [
{ {
...@@ -304,12 +301,6 @@ export default { ...@@ -304,12 +301,6 @@ export default {
align: "center", align: "center",
}, },
], ],
parms: {
app: "material",
eid: null,
name: "",
field: "",
},
}; };
}, },
props: { props: {
...@@ -317,11 +308,31 @@ export default { ...@@ -317,11 +308,31 @@ export default {
}, },
mounted() { mounted() {
this.tebleSet(); this.tebleSet();
this.loadTemplate();
if (this.eid > 0) { if (this.eid > 0) {
this.load(this.eid); this.load(this.eid);
} }
}, },
methods: { methods: {
loadTemplate() {
let data = {
pageIndex: 1,
pageSize: 100,
conditions: [],
};
Api.filesList(data).then((r) => {
if (r.result) {
this.templates = r.result.items;
}
});
},
setTemplate(a) {
this.templates.forEach((r) => {
if (a == r.id) {
this.entity.template = r.name;
}
});
},
tebleSet() { tebleSet() {
Api.getChildren({ id: 582 }).then((r) => { Api.getChildren({ id: 582 }).then((r) => {
if (r.result) { if (r.result) {
...@@ -332,7 +343,7 @@ export default { ...@@ -332,7 +343,7 @@ export default {
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.parms.eid = r.result.templateId; // this.entity.templateId = r.result.template;
if (r.result.inheritCategoryId == 0) { if (r.result.inheritCategoryId == 0) {
this.inherit = "0"; this.inherit = "0";
} else { } else {
...@@ -398,11 +409,6 @@ export default { ...@@ -398,11 +409,6 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
if (this.$refs.refFile.nameList.length > 0) {
this.entity.templateId = this.parms.eid;
} else {
this.entity.templateId = "";
}
if (this.inherit == 0) { if (this.inherit == 0) {
this.entity.inheritCategoryId = 0; this.entity.inheritCategoryId = 0;
} else { } else {
......
...@@ -127,6 +127,7 @@ export default { ...@@ -127,6 +127,7 @@ export default {
"upId" "upId"
); );
this.list = this.$u.clone(data); this.list = this.$u.clone(data);
// console.log(this.list);
}); });
}, },
toggle() { toggle() {
...@@ -141,7 +142,7 @@ export default { ...@@ -141,7 +142,7 @@ export default {
}, },
change(a, b) { change(a, b) {
// console.log(a) // console.log(a)
console.log(b); // console.log(b);
this.treeId = b.id; this.treeId = b.id;
// if (b.children.length == 0) { //判断最底层才能添加文档 // if (b.children.length == 0) { //判断最底层才能添加文档
// this.addShow = true; // this.addShow = true;
...@@ -166,47 +167,31 @@ export default { ...@@ -166,47 +167,31 @@ export default {
this.ids = ids; this.ids = ids;
}, },
renderContent(h, { root, node, data }) { renderContent(h, { root, node, data }) {
return h( let type = "";
"span", if (data.type == 0) {
{ type = "md-folder";
on: { } else if (data.type == 1) {
click: () => { type = "ios-copy";
this.handleSelect(root, data); //手动选择树节点 } else {
}, type = "ios-book";
}
return h("span", [
h("Icon", {
props: {
type: type,
}, },
style: {
marginRight: "8px",
}, },
}),
h(
"span",
data.title data.title
); ),
}, ]);
handleSelect(root, data) {
// let pid = -1; //定义最顶级id
// var pname = "";
// var upId = data.upId;
// let roots = root;
// function addId(roots, upId) {
// roots.map((u) => {
// if (u.node.id == upId) {
// if (u.node.upId == 0) {
// pid = u.node.id;
// pname = u.node.name;
// } else {
// upId = u.node.upId;
// addId(roots, upId);
// }
// }
// });
// }
// addId(roots, upId);
// this.nodeInfo.categoryId = data.id;
// this.nodeInfo.rootCategoryName = data.name;
// if (pid == -1) {
// this.nodeInfo.rootCategoryId = data.id;
// this.nodeInfo.rootCategoryName = data.name;
// } else {
// this.nodeInfo.rootCategoryId = pid;
// this.nodeInfo.rootCategoryName = pname;
// }
}, },
showMenuFn() { showMenuFn() {
//this.$Message.info("展开左侧树") //this.$Message.info("展开左侧树")
this.showMenu = true; this.showMenu = true;
......
...@@ -92,8 +92,7 @@ export default { ...@@ -92,8 +92,7 @@ export default {
status: 1, status: 1,
creator: "", creator: "",
remark: "", remark: "",
template: "", //上传名称 url: "",
templateId: "", //上传id
}, },
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
...@@ -105,19 +104,11 @@ export default { ...@@ -105,19 +104,11 @@ export default {
v: Object, v: Object,
eid: Number, eid: Number,
}, },
mounted() { mounted() {},
// this.parms.eid = this.$u.guid();
// this.$refs.refFile.intFiles();
},
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
// if (this.$refs.refFile.nameList.length > 0) {
// this.entity.url = this.parms.eid;
// } else {
// this.entity.url = "";
// }
Api.create(this.entity) Api.create(this.entity)
.then((r) => { .then((r) => {
if (r.success) { if (r.success) {
...@@ -147,8 +138,7 @@ export default { ...@@ -147,8 +138,7 @@ export default {
imgName(newName, oldName) { imgName(newName, oldName) {
if (newName != "") { if (newName != "") {
const imgPathsArr = JSON.parse(newName); const imgPathsArr = JSON.parse(newName);
this.entity.templateId = imgPathsArr[0].filePath; this.entity.url = imgPathsArr[0].filePath;
this.entity.template = imgPathsArr[0].fileName;
} }
}, },
}, },
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
</FormItem> </FormItem>
</Col>--> </Col>-->
<Col :span="12"> <Col :span="12">
{{imgName}}
<FormItem :label="l('url')" prop="url"> <FormItem :label="l('url')" prop="url">
<inputFile <inputFile
class="tphoto" class="tphoto"
...@@ -104,7 +105,8 @@ export default { ...@@ -104,7 +105,8 @@ export default {
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.entity.imgName = r.result.templateId; this.entity.url = r.result.url;
this.imgName = r.result.url;
}); });
}, },
handleSubmit() { handleSubmit() {
...@@ -138,8 +140,7 @@ export default { ...@@ -138,8 +140,7 @@ export default {
imgName(newName, oldName) { imgName(newName, oldName) {
if (newName != "") { if (newName != "") {
const imgPathsArr = JSON.parse(newName); const imgPathsArr = JSON.parse(newName);
this.entity.templateId = imgPathsArr[0].filePath; this.entity.url = imgPathsArr[0].filePath;
this.entity.template = imgPathsArr[0].fileName;
} }
}, },
eid(v) { eid(v) {
......
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