|
@@ -3,7 +3,10 @@
|
|
|
<template #toolbar>
|
|
|
<div class="w-2/5 flex justify-end">
|
|
|
<!-- <Search @search="value => handleSearch('search', value)" placeholder="项目名称/项目编号" /> -->
|
|
|
- <a-button v-if="hasPermission" @click="showModalFn" class="ml-3"><PlusOutlined />新增账号</a-button>
|
|
|
+ <a-button @click="syncAccount" class="ml-3">同步计量账号</a-button>
|
|
|
+ <a-button type="primary" v-if="hasPermission" @click="showModalFn" class="ml-3"
|
|
|
+ ><PlusOutlined />新增账号</a-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
@@ -29,7 +32,12 @@
|
|
|
import { PlusOutlined } from '@ant-design/icons-vue'
|
|
|
import { BasicForm, FormActionType, FormSchema, useForm } from '/@/components/Form/index'
|
|
|
import { getTableColumns } from './tableData'
|
|
|
- import { getProjectAccount, addProjectAccount, saveProjectAccount } from '/@/api/sys/project'
|
|
|
+ import {
|
|
|
+ getProjectAccount,
|
|
|
+ addProjectAccount,
|
|
|
+ saveProjectAccount,
|
|
|
+ syncProjectAccountFromJL
|
|
|
+ } from '/@/api/sys/project'
|
|
|
import { propTypes } from '/@/utils/propTypes'
|
|
|
import { Switch } from 'ant-design-vue'
|
|
|
import { Icon } from '/@/components/Icon/index'
|
|
@@ -69,7 +77,7 @@
|
|
|
const formElRef = ref<Nullable<FormActionType>>(null)
|
|
|
const formType = ref(0) // 0 - 创建账号 1 - 更新账号
|
|
|
const { createMessage } = useMessage()
|
|
|
- const [registerTable, { setTableData }] = useTable({
|
|
|
+ const [registerTable, { setTableData, reload }] = useTable({
|
|
|
columns: getTableColumns((item: ProjectAccountItem) => showUpdateModalFn(item), props.hasPermission),
|
|
|
showTableSetting: true,
|
|
|
canResize: true
|
|
@@ -151,7 +159,7 @@
|
|
|
slot: 'role'
|
|
|
}
|
|
|
])
|
|
|
- const [registerForm, { removeSchemaByFiled, appendSchemaByField }] = useForm({
|
|
|
+ const [registerForm, { removeSchemaByFiled, appendSchemaByField, updateSchema }] = useForm({
|
|
|
labelWidth: 120,
|
|
|
schemas,
|
|
|
showActionButtonGroup: false
|
|
@@ -165,14 +173,14 @@
|
|
|
okText: '确认添加'
|
|
|
})
|
|
|
await nextTick()
|
|
|
- updateSchema({
|
|
|
+ await updateSchema({
|
|
|
field: 'account',
|
|
|
componentProps: {
|
|
|
disabled: false
|
|
|
}
|
|
|
})
|
|
|
- removeSchemaByFiled('password')
|
|
|
- appendSchemaByField(
|
|
|
+ await removeSchemaByFiled('password')
|
|
|
+ await appendSchemaByField(
|
|
|
{
|
|
|
field: 'password',
|
|
|
component: 'InputPassword',
|
|
@@ -181,7 +189,13 @@
|
|
|
},
|
|
|
'account'
|
|
|
)
|
|
|
- formElRef.value?.resetFields()
|
|
|
+ await formElRef.value?.resetFields()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**同步计量账号 */
|
|
|
+ async function syncAccount() {
|
|
|
+ await syncProjectAccountFromJL({ id: props.id })
|
|
|
+ reload()
|
|
|
}
|
|
|
|
|
|
async function showUpdateModalFn(item: ProjectAccountItem) {
|
|
@@ -231,7 +245,7 @@
|
|
|
await saveProjectAccount(values)
|
|
|
}
|
|
|
|
|
|
- return { formElRef, registerTable, registerModal, registerForm, showModalFn, submitModal }
|
|
|
+ return { formElRef, registerTable, registerModal, registerForm, showModalFn, submitModal, syncAccount }
|
|
|
}
|
|
|
})
|
|
|
</script>
|