|
@@ -228,7 +228,7 @@ const getFormRef = async (index) => {
|
|
|
}
|
|
|
|
|
|
const formModel = ref({
|
|
|
- deptList: [{}],
|
|
|
+ deptList: [{isLader: 0}], status: 1
|
|
|
})
|
|
|
const formRules = {
|
|
|
deptId: [{required: true, message: '请选择选择部门', trigger: 'change'}],
|
|
@@ -275,8 +275,9 @@ const formRules = {
|
|
|
//添加用户
|
|
|
const addUserClick = () => {
|
|
|
formModel.value = {
|
|
|
- deptList: [{}],
|
|
|
- tenantId: useAppState.tenantId
|
|
|
+ deptList: [{isLader: 0}],
|
|
|
+ tenantId: useAppState.tenantId,
|
|
|
+ status: 1
|
|
|
}
|
|
|
postData.value = [{}]
|
|
|
formModal.value = true
|
|
@@ -285,19 +286,30 @@ const addUserClick = () => {
|
|
|
|
|
|
//编辑用户信息
|
|
|
const rowEidtClick = (row) => {
|
|
|
- row.password = ''
|
|
|
const deptList = getArrValue(row.deptList)
|
|
|
- row.deptList = deptList
|
|
|
- row.tenantId = useAppState.tenantId
|
|
|
+ //设置表单数据
|
|
|
+ const form = {
|
|
|
+ id: row.id,
|
|
|
+ account: row.account,
|
|
|
+ password: '',
|
|
|
+ deptList: deptList,
|
|
|
+ tenantId: useAppState.tenantId,
|
|
|
+ realName: row.realName,
|
|
|
+ phone: row.phone,
|
|
|
+ idNumber: row.idNumber,
|
|
|
+ status: row.status,
|
|
|
+ }
|
|
|
+ //如果部门列表为空,就添加一个空对象
|
|
|
if (deptList.length > 0){
|
|
|
deptList.forEach(() => {
|
|
|
postData.value.push({})
|
|
|
})
|
|
|
} else {
|
|
|
- row.deptList = [{}]
|
|
|
+ form.deptList = [{isLader: 0}]
|
|
|
postData.value = [{}]
|
|
|
}
|
|
|
- formModel.value = row
|
|
|
+ //设置表单数据
|
|
|
+ formModel.value = form
|
|
|
formModal.value = true
|
|
|
getSectionData()
|
|
|
}
|
|
@@ -329,7 +341,7 @@ const initPostData = async (id, index) => {
|
|
|
|
|
|
//新增组织
|
|
|
const addOrganizationClick = () => {
|
|
|
- formModel.value.deptList.push({})
|
|
|
+ formModel.value.deptList.push({isLader: 0})
|
|
|
postData.value.push({})
|
|
|
}
|
|
|
|
|
@@ -342,7 +354,6 @@ const delOrganizationClick = (index) => {
|
|
|
|
|
|
//保存
|
|
|
const formModalSave = async () => {
|
|
|
- console.log(formModel.value)
|
|
|
const isForm = await formValidate(formRef.value)
|
|
|
const isForm1 = await formValidate(formRef1.value)
|
|
|
if (!isForm || !isForm1) {
|
|
@@ -361,6 +372,8 @@ const formModalSave = async () => {
|
|
|
//判断状态
|
|
|
if (!error && code === 200) {
|
|
|
window.$message?.success('提交成功')
|
|
|
+ getTableData().then()
|
|
|
+ formModalClose()
|
|
|
} else {
|
|
|
window.$message?.error(msg)
|
|
|
}
|