update:人员临时库放到单页应用中
This commit is contained in:
3
src/views/ProjectExtraUser.vue
Normal file
3
src/views/ProjectExtraUser.vue
Normal file
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
93
src/views/ProjectExtraUser/Index.vue
Normal file
93
src/views/ProjectExtraUser/Index.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<a-button class="editable-add-btn" style="margin-bottom: 8px" @click="add"
|
||||
>Add</a-button
|
||||
>
|
||||
<a-table bordered :data-source="users" :columns="columns">
|
||||
<template
|
||||
v-for="col in columns.filter(c => c.editable !== false)"
|
||||
#[col.dataIndex]="{text,record}"
|
||||
:key="col"
|
||||
>
|
||||
<div v-if="editableData[record.id]">
|
||||
<a-input
|
||||
v-model:value="editableData[record.id][col.dataIndex]"
|
||||
style="margin: -5px 0"
|
||||
/>
|
||||
</div>
|
||||
<template v-else>
|
||||
{{ text }}
|
||||
</template>
|
||||
</template>
|
||||
<template #opt="{record}">
|
||||
{{ record.name }}
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
<style></style>
|
||||
<script>
|
||||
import { ref } from "@vue/reactivity";
|
||||
import { onMounted } from "@vue/runtime-core";
|
||||
export default {
|
||||
setup() {
|
||||
var idx = 0;
|
||||
var users = ref([]);
|
||||
var editableData = ref({});
|
||||
var columns = [
|
||||
{
|
||||
title: "姓名",
|
||||
dataIndex: "name"
|
||||
},
|
||||
{
|
||||
title: "证件号码",
|
||||
dataIndex: "idCard"
|
||||
},
|
||||
{
|
||||
title: "联系电话",
|
||||
dataIndex: "phone"
|
||||
},
|
||||
{
|
||||
title: "承担工作",
|
||||
dataIndex: "duty"
|
||||
},
|
||||
{
|
||||
title: "从事专业",
|
||||
dataIndex: "specialty"
|
||||
},
|
||||
{
|
||||
title: "备注说明",
|
||||
dataIndex: "remarks"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "opt",
|
||||
editable: false
|
||||
}
|
||||
].map(p => ({ ...p, slot: { customRender: p.dataIndex } }));
|
||||
var getUsers = async acceptId => {
|
||||
var response = await fetch(
|
||||
"/api2/ProjectExtraUser/GetUsers?acceptId=" + acceptId
|
||||
);
|
||||
var body = await response.json();
|
||||
if (body.errorCode == 0) {
|
||||
users.value = body.data;
|
||||
}
|
||||
};
|
||||
onMounted(() => {
|
||||
var acceptId = new URL(location.href).searchParams.get("acceptId");
|
||||
getUsers(acceptId);
|
||||
});
|
||||
var edit = id => {
|
||||
editableData.value[id] = { ...users.value.find(p => p.id) };
|
||||
};
|
||||
var add = () => {
|
||||
var user = {
|
||||
id: idx--
|
||||
};
|
||||
users.value.push(user);
|
||||
};
|
||||
var save = () => {};
|
||||
var cancel = () => {};
|
||||
return { users, columns, editableData, edit, add, save, cancel };
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user