Commit 99bf9250 authored by 姬鋆屾's avatar 姬鋆屾

pref:代码优化对备注2无法显示动态数组得问题做处理

parent 3c2ce6e6
...@@ -22,45 +22,9 @@ export default { ...@@ -22,45 +22,9 @@ export default {
name: "Dept", name: "Dept",
mixins: [table], mixins: [table],
components: { Treeselect, dialogShow }, components: { Treeselect, dialogShow },
created() {},
methods: {
afterRender(data) {
data.data = handleTree(data.data, "id", "parentId");
console.log("tree", data.data);
this.deptOptions = data.data;
this.$refs.layoutTable.showType = "treetable";
},
handleAdd(row) {
this.$refs.dialogform.add(row, this.deptOptions);
},
/** 重写新增方法 */
toAdd(row) {
this.$refs.dialogform.add(row, this.deptOptions);
},
/** 重写编辑方法 */
toEdit(row) {
this.loading = true;
this.$post(this.pageInfo.exclude, { id: row.id })
.then((res) => {
if (res && res.code && res.code == 1) {
this.deptOptions = handleTree(res.data.result);
this.$refs.dialogform.edit(row, this.deptOptions);
this.loading = false;
}
})
.catch((error) => {
this.$message.error(error.message);
});
},
/** 重写查看方法 */
toView(row) {
this.$refs.dialogform.view(row, this.deptOptions);
},
},
data() { data() {
return { return {
// 表格配置项
config: { config: {
/** 树表是否默认展开 */ /** 树表是否默认展开 */
expand: true, expand: true,
...@@ -107,6 +71,44 @@ export default { ...@@ -107,6 +71,44 @@ export default {
}, },
}; };
}, },
created() {},
methods: {
// 获取数据后处理
afterRender(data) {
data.data = handleTree(data.data, "id", "parentId");
console.log("tree", data.data);
this.deptOptions = data.data;
this.$refs.layoutTable.showType = "treetable";
},
// 新增操作
handleAdd(row) {
this.$refs.dialogform.add(row, this.deptOptions);
},
/** 重写新增方法 */
toAdd(row) {
this.$refs.dialogform.add(row, this.deptOptions);
},
/** 重写编辑方法 */
toEdit(row) {
this.loading = true;
this.$post(this.pageInfo.exclude, { id: row.id })
.then((res) => {
if (res && res.code && res.code == 1) {
this.deptOptions = handleTree(res.data.result);
this.$refs.dialogform.edit(row, this.deptOptions);
this.loading = false;
}
})
.catch((error) => {
this.$message.error(error.message);
});
},
/** 重写查看方法 */
toView(row) {
this.$refs.dialogform.view(row, this.deptOptions);
},
},
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
......
This diff is collapsed.
...@@ -79,85 +79,6 @@ export default { ...@@ -79,85 +79,6 @@ export default {
drawerShow, drawerShow,
}, },
mixins: [table], mixins: [table],
created() {},
methods: {
handleCellClick(row, column, event, cell) {
if (column.label == "图片凭证") {
const suffix = `(bmp|jpg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|jpeg)`;
const regular = new RegExp(`.*\.${suffix}`);
regular.test(row.filePaths);
if (!regular.test(row.filePaths)) {
downloadFile(row.filePaths, row.fileName);
}
}
},
/** 导入 */
handleImport() {
this.upload.title = "考勤绩效记录信息导入";
this.upload.open = true;
},
/** 下载模板操作 */
downloadTemplate() {
this.isExport = true;
this.$download(
"/perform/attend/record/downloadTemplate",
{},
{ type: "excel" }
)
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 文件上传中处理 */
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
/** 文件上传成功处理 */
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getData();
},
/** 提交上传文件 */
submitFileForm() {
this.$refs.upload.submit();
},
/** 导出Excel */
doExport() {
this.isExport = true;
this.$download(
"/perform/attend/record/exportExcel",
{
page: 1,
size: -1,
},
{ type: "excel", name: "考勤绩效管理" }
)
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 重写新增方法 */
toAdd(row) {
this.$refs.drawerform.add(row);
},
/** 重写编辑方法 */
toEdit(row) {
row.view = "核查";
this.$refs.drawerform.edit(row);
},
/** 重写查看方法 */
toView(row) {
row.view = "查看";
this.$refs.drawerform.view(row);
},
},
data() { data() {
return { return {
// 用户导入参数 // 用户导入参数
...@@ -173,7 +94,9 @@ export default { ...@@ -173,7 +94,9 @@ export default {
// 上传的地址 // 上传的地址
url: "/attendance/perform/attend/record/importData", url: "/attendance/perform/attend/record/importData",
}, },
// 导出按钮加载状态
isExport: false, isExport: false,
// 表格配置项
config: { config: {
isshowTabPane: true, isshowTabPane: true,
search: [ search: [
...@@ -319,5 +242,85 @@ export default { ...@@ -319,5 +242,85 @@ export default {
}, },
}; };
}, },
created() {},
methods: {
// 图片凭证点击操作
handleCellClick(row, column, event, cell) {
if (column.label == "图片凭证") {
const suffix = `(bmp|jpg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|jpeg)`;
const regular = new RegExp(`.*\.${suffix}`);
regular.test(row.filePaths);
if (!regular.test(row.filePaths)) {
downloadFile(row.filePaths, row.fileName);
}
}
},
/** 导入 */
handleImport() {
this.upload.title = "考勤绩效记录信息导入";
this.upload.open = true;
},
/** 下载模板操作 */
downloadTemplate() {
this.isExport = true;
this.$download(
"/perform/attend/record/downloadTemplate",
{},
{ type: "excel" }
)
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 文件上传中处理 */
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
/** 文件上传成功处理 */
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getData();
},
/** 提交上传文件 */
submitFileForm() {
this.$refs.upload.submit();
},
/** 导出Excel */
doExport() {
this.isExport = true;
this.$download(
"/perform/attend/record/exportExcel",
{
page: 1,
size: -1,
},
{ type: "excel", name: "考勤绩效管理" }
)
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 重写新增方法 */
toAdd(row) {
this.$refs.drawerform.add(row);
},
/** 重写编辑方法 */
toEdit(row) {
row.view = "核查";
this.$refs.drawerform.edit(row);
},
/** 重写查看方法 */
toView(row) {
row.view = "查看";
this.$refs.drawerform.view(row);
},
},
}; };
</script> </script>
...@@ -327,7 +327,11 @@ export default { ...@@ -327,7 +327,11 @@ export default {
v.value = v.name + "--" + v.content; v.value = v.name + "--" + v.content;
}) })
: ""; : "";
if (!this.form.remarkAdd || this.form.remarkAdd.length == 0) { if (
!this.form.remarkAdd ||
this.form.remarkAdd.length == 0 ||
this.form.remarkAdd != ""
) {
this.form.remarkAdd = []; this.form.remarkAdd = [];
this.form.remarkAdd.push({ this.form.remarkAdd.push({
name: "", name: "",
......
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