|
@@ -27,17 +27,19 @@
|
|
|
<div class="relics-content">
|
|
|
<el-table :data="relicsArray" border>
|
|
|
<el-table-column label="单位名称" prop="orgName"></el-table-column>
|
|
|
- <el-table-column label="类型" prop="type"></el-table-column>
|
|
|
+ <el-table-column label="类型" prop="type" v-slot:default="{ row }: { row: OrganizationType }">
|
|
|
+ {{ OrganizationTypeDesc[row.type] }}
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="单位账号" prop="userName"></el-table-column>
|
|
|
<el-table-column label="单位联系人" prop="contact"></el-table-column>
|
|
|
<el-table-column label="创建时间" prop="updateTime"></el-table-column>
|
|
|
- <el-table-column label="创建人" prop="userId"></el-table-column>
|
|
|
+ <el-table-column label="创建人" prop="createByName"></el-table-column>
|
|
|
<el-table-column label="操作" width="100px" fixed="right">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-button link type="danger" @click="() => { }" size="small">
|
|
|
+ <template #default="{ row }: { row: OrganizationType }">
|
|
|
+ <el-button link type="primary" @click="editHandler(row)" size="small">
|
|
|
编辑
|
|
|
</el-button>
|
|
|
- <el-button link type="danger" @click="() => { }" size="small">
|
|
|
+ <el-button link type="danger" @click="delOrganization(row)" size="small">
|
|
|
删除
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -57,14 +59,15 @@ import { onActivated, ref, watch } from "vue";
|
|
|
import {
|
|
|
getOrgListFetch,
|
|
|
addOrgFetch,
|
|
|
+ delOrgFetch,
|
|
|
+ alterOrgFetch,
|
|
|
PageProps
|
|
|
} from "@/request";
|
|
|
-// import { Device } from "@/request/type";
|
|
|
-// import { DeviceTypeDesc } from "@/store/device";
|
|
|
-// import { ElMessageBox } from "element-plus";
|
|
|
+import type { OrganizationType } from "@/request/organization";
|
|
|
import { OrganizationTypeDesc } from '@/store/organization'
|
|
|
-import { organizationAdd } from "./quisk";
|
|
|
+import { organizationAdd, organizationEdit } from "./quisk";
|
|
|
import { debounce } from "@/util";
|
|
|
+import { ElMessageBox } from "element-plus";
|
|
|
|
|
|
const initProps: PageProps<{
|
|
|
orgName: string
|
|
@@ -85,7 +88,6 @@ const relicsArray = ref<any[]>([]);
|
|
|
|
|
|
const refresh = debounce(async () => {
|
|
|
const data = await getOrgListFetch(pageProps.value);
|
|
|
- console.log('data', data)
|
|
|
total.value = data.total;
|
|
|
relicsArray.value = data.records;
|
|
|
});
|
|
@@ -98,6 +100,25 @@ const addHandler = async () => {
|
|
|
await organizationAdd({ submit: addOrgFetch });
|
|
|
await refresh();
|
|
|
};
|
|
|
+
|
|
|
+const editHandler = async (org: OrganizationType) => {
|
|
|
+ await organizationEdit({ org: org, submit: alterOrgFetch });
|
|
|
+ await refresh();
|
|
|
+};
|
|
|
+const delOrganization = async (org: OrganizationType) => {
|
|
|
+ console.log('org', org)
|
|
|
+ const ok = await ElMessageBox.confirm("确定要删除吗", {
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ if (ok) {
|
|
|
+ await delOrgFetch({
|
|
|
+ orgId: org.orgId,
|
|
|
+ orgName: org.orgName,
|
|
|
+ type: org.type
|
|
|
+ });
|
|
|
+ await refresh();
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|