|
|
@@ -4,7 +4,7 @@
|
|
|
<!--机构数据-->
|
|
|
<el-col :span="4" :xs="24">
|
|
|
<k-org-tree v-model="queryParams.orgId" @defaultKey="getDefaultKey" @checkChange="checkChange"
|
|
|
- @click="clickTreeNode"></k-org-tree>
|
|
|
+ @click="clickTreeNode"></k-org-tree>
|
|
|
</el-col>
|
|
|
<!--用户数据-->
|
|
|
<el-col :span="20" :xs="24">
|
|
|
@@ -100,14 +100,14 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="上传人" align="center" prop="createBy"/>
|
|
|
<el-table-column label="上传时间" align="center" prop="createTime"/>
|
|
|
- <el-table-column label="附件" align="center" prop="file"/>
|
|
|
+ <el-table-column label="附件" align="center" prop="fileList"/>
|
|
|
<el-table-column label="备注" align="center" prop="remark"/>
|
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- 公开 按钮显示逻辑: 仅当前用户上传的学习资料且处于未公开状态-->
|
|
|
<el-button
|
|
|
- v-if="checkCanEditOpen(scope.row)&&scope.row.isOpen===0"
|
|
|
+ v-if="checkCanEditOpen(scope.row)&&scope.row.isOpen==0"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@@ -176,8 +176,8 @@
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="附件" prop="file">
|
|
|
- <file-upload v-model="form.file"/>
|
|
|
+ <el-form-item label="附件" prop="fileList">
|
|
|
+ <file-upload ref="upload" @input="getFileList" v-model="form.fileList"/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -185,6 +185,7 @@
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ c
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -205,7 +206,7 @@ import kOrgTree from "@/components/k-orgTree/index.vue";
|
|
|
|
|
|
export default {
|
|
|
name: "Materials",
|
|
|
- components: {OrgTree,kOrgTree},
|
|
|
+ components: {OrgTree, kOrgTree},
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
|
@@ -245,10 +246,10 @@ export default {
|
|
|
content: null,
|
|
|
orgId: null,
|
|
|
isOpen: null,
|
|
|
- file: null
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
+
|
|
|
// 表单校验
|
|
|
rules: {},
|
|
|
//默认选中节点
|
|
|
@@ -260,7 +261,8 @@ export default {
|
|
|
}, {
|
|
|
label: "未公开",
|
|
|
value: 0
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ fileList: []
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -291,12 +293,19 @@ export default {
|
|
|
this.deptOptions = response.data;
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ getFileList() {
|
|
|
+ //循环获取this.$refs.upload.fileList中的name和url,放到 this.form.fileList中去
|
|
|
+ let fileList = [];
|
|
|
+ for (let i = 0; i < this.$refs.upload.fileList.length; i++) {
|
|
|
+ fileList.push({name: this.$refs.upload.fileList[i].name, url: this.$refs.upload.fileList[i].url})
|
|
|
+ }
|
|
|
+ this.fileList = JSON.stringify(fileList);
|
|
|
+ },
|
|
|
checkCanEditOrDel(row) {
|
|
|
- return row.createBy === this.$store.getters.userId && row.isOpen === 0;
|
|
|
+ return row.createId == this.$store.getters.userId && row.isOpen == 0;
|
|
|
},
|
|
|
checkCanEditOpen(row) {
|
|
|
- return row.createBy === this.$store.getters.userId;
|
|
|
+ return row.createId == this.$store.getters.userId;
|
|
|
},
|
|
|
|
|
|
// 节点单击事件
|
|
|
@@ -321,11 +330,9 @@ export default {
|
|
|
knowledgeId: null,
|
|
|
content: null,
|
|
|
orgId: this.queryParams.orgId,
|
|
|
- orgName: this.queryParams.orgName,
|
|
|
- orgPath: this.queryParams.orgPath,
|
|
|
isOpen: null,
|
|
|
- file: null,
|
|
|
remark: null,
|
|
|
+ fileList: null,
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
this.initKnowledgeList();
|
|
|
@@ -417,6 +424,9 @@ export default {
|
|
|
this.reset();
|
|
|
const id = row.id || this.ids
|
|
|
getMaterials(id).then(response => {
|
|
|
+ let fileList = response.data.fileList;
|
|
|
+ this.form.fileList = JSON.parse(fileList);
|
|
|
+ this.$emit("input", this.listToString(this.form.fileList));
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
this.title = "修改学习资料";
|
|
|
@@ -424,9 +434,11 @@ export default {
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
+
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
- console.log("this.form",this.form)
|
|
|
if (valid) {
|
|
|
+ this.form.fileList = this.fileList;
|
|
|
+ console.log('55555', this.form.fileList)
|
|
|
if (this.form.id != null) {
|
|
|
updateMaterials(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
@@ -443,6 +455,14 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ listToString(list, separator) {
|
|
|
+ let strs = "";
|
|
|
+ separator = separator || ",";
|
|
|
+ for (let i in list) {
|
|
|
+ strs += list[i].url + separator;
|
|
|
+ }
|
|
|
+ return strs != '' ? strs.substring(0, strs.length - 1) : '';
|
|
|
+ },
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
this.download('core/materials/export', {
|