修改system.js

This commit is contained in:
曹前明 2022-06-20 18:21:58 +08:00
parent 2fbba87176
commit df9a1f38f9
4 changed files with 232 additions and 84 deletions

View File

@ -184,4 +184,31 @@ export default {
} }
} }
}, },
post:{
list: {
name: "获取",
req: async function(data){
return await http.get(
`${config.API_URL}/system/post/`,
data
);
}
},
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/system/post/`,
data);
}
},
delete: {
name: "删除",
req: async function(id, data){
return await http.delete(
`${config.API_URL}/system/post/${id}/`,
data);
}
},
},
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<el-container> <el-container>
<!-- <el-header> <!-- <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button> <el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
<el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button> <el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
@ -13,90 +13,109 @@
</div> </div>
</div> </div>
</el-header> --> </el-header> -->
<el-main class="nopadding"> <el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" fit stripe @resetQuery="resetQuery"> <scTable
<el-table-column label="#" type="index" width="50"></el-table-column> ref="table"
<el-table-column label="事件种类" prop="cate_name"></el-table-column> :apiObj="apiObj"
<el-table-column label="发生区域" prop="area_name"> row-key="id"
</el-table-column> fit
<el-table-column label="人员类型" prop="peope_type"> stripe
<template #default="scope"> @resetQuery="resetQuery"
<span v-if="scope.row.peope_type=='employee'">企业员工</span> >
<span v-if="scope.row.peope_type=='remployee'">相关方</span> <el-table-column label="#" type="index" width="50"></el-table-column>
<span v-if="scope.row.peope_type=='visitor'">访客</span> <el-table-column label="事件种类" prop="cate_name"></el-table-column>
</template> <el-table-column label="发生区域" prop="area_name"> </el-table-column>
</el-table-column> <el-table-column label="人员类型" prop="peope_type">
<el-table-column label="当事人" prop="people_name"></el-table-column> <template #default="scope">
<el-table-column label="发生时间" prop="create_time"></el-table-column> <span v-if="scope.row.peope_type == 'employee'">企业员工</span>
<el-table-column label="是否已处理"> <span v-if="scope.row.peope_type == 'remployee'">相关方</span>
<template #default="scope"> <span v-if="scope.row.peope_type == 'visitor'">访客</span>
<el-icon v-if="scope.row.handle_user" color="green"><CircleCheckFilled /></el-icon> </template>
<el-icon v-else color="red"><CircleCloseFilled /></el-icon> </el-table-column>
</template> <el-table-column label="当事人" prop="people_name"></el-table-column>
</el-table-column> <el-table-column label="发生时间" prop="create_time"></el-table-column>
<el-table-column label="操作" fixed="right" align="right"> <el-table-column label="是否已处理">
<template #default="scope"> <template #default="scope">
<el-button-group> <el-icon v-if="scope.row.handle_user" color="green"
<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button> ><CircleCheckFilled
<!-- <el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button> --> /></el-icon>
<!-- <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)"> <el-icon v-else color="red"><CircleCloseFilled /></el-icon>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="right">
<template #default="scope">
<el-button-group>
<el-button
text
type="primary"
size="small"
@click="table_show(scope.row, scope.$index)"
>查看/处理</el-button
>
<!-- <el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button> -->
<!-- <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference> <template #reference>
<el-button text type="danger" size="small">删除</el-button> <el-button text type="danger" size="small">删除</el-button>
</template> </template>
</el-popconfirm> --> </el-popconfirm> -->
</el-button-group> </el-button-group>
</template> </template>
</el-table-column> </el-table-column>
</scTable>
</scTable> </el-main>
</el-main> </el-container>
</el-container> <save-dialog
</template> v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<script> <script>
import { CircleCheckFilled, CircleCloseFilled } from '@element-plus/icons-vue' import saveDialog from "./event_form.vue";
export default { import { CircleCheckFilled, CircleCloseFilled } from "@element-plus/icons-vue";
name: 'event', export default {
components: { name: "event",
CircleCheckFilled, components: {
CircleCloseFilled CircleCheckFilled,
}, CircleCloseFilled,
data() { saveDialog,
return { },
dialog: { data() {
save: false, return {
permission: false dialog: {
}, save: false,
apiObj: this.$API.ecm.event.list, permission: false,
query: {}, },
selection: [], apiObj: this.$API.ecm.event.list,
search: { query: {},
keyword: null selection: [],
} search: {
} keyword: null,
}, },
methods: { };
// },
table_show(row){ methods: {
this.dialog.save = true //
this.$nextTick(() => { table_show(row) {
this.$refs.saveDialog.open('show').setData(row) this.dialog.save = true;
}) this.$nextTick(() => {
}, this.$refs.saveDialog.open("show").setData(row);
// });
upsearch(){ },
//
}, upsearch() {},
// //
handleSaveSuccess(data, mode){ handleSaveSuccess(data, mode) {
if(mode=='add'){ if (mode == "add") {
this.$refs.table.refresh() this.$refs.table.refresh();
}else if(mode=='edit'){ } else if (mode == "edit") {
this.$refs.table.refresh() this.$refs.table.refresh();
} }
}, },
resetQuery(){ resetQuery() {
this.query = {} this.query = {};
} },
} },
} };
</script> </script>

View File

@ -0,0 +1,102 @@
<template>
<el-drawer
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>提交</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-drawer>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增",
edit: "编辑",
show: "查看/处理",
},
form: {},
rules: {},
visible: false,
isSaveing: false,
selectionFilters: [],
setFiltersVisible: false,
};
},
mounted() {
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
try {
var res;
if (this.mode == "add") {
res = await this.$API.rpm.rparty.create.req(this.form);
} else if (this.mode == "edit") {
res = await this.$API.rpm.rparty.update.req(
this.form.id,
this.form
);
}
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
return res;
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
// this.loading = true
// const params = {
// id: data.id
// }
// setTimeout(async ()=>{
// var res = await this.$API.system.table.info.get(params)
// this.loading = false
// this.form = res.data
// },400)
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
</style>