diff --git a/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js b/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js index 5681a3d9..a6e6a017 100644 --- a/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js +++ b/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js @@ -41,14 +41,21 @@ export function getOrgDetail(id) { export function initOrgTypeOption() { return request({ - url: '/basedatamanage/organization/organization', + url: '/basedatamanage/organization/init', method: 'get', }) } export function disableOrg(id) { return request({ - url: '/basedatamanage/organization/organization?orgId=' + id, + url: '/basedatamanage/organization/organization-inactive?orgId=' + id, + method: 'put', + }) +} + +export function enableOrg(id) { + return request({ + url: '/basedatamanage/organization/organization-active?orgId=' + id, method: 'put', }) } diff --git a/openhis-ui-vue3/src/views/basicmanage/organization/index.vue b/openhis-ui-vue3/src/views/basicmanage/organization/index.vue index 1f0487e7..73b45976 100644 --- a/openhis-ui-vue3/src/views/basicmanage/organization/index.vue +++ b/openhis-ui-vue3/src/views/basicmanage/organization/index.vue @@ -44,11 +44,10 @@ row-key="id" @selection-change="handleSelectionChange" > - + - - + @@ -109,18 +108,18 @@ style="width: 100%" > - + { - orgTypeOption.value = res.data.records; + orgTypeOption.value = res.data; }); } } +function reset() { + form.value.busNo = undefined; + form.value.name = undefined; + form.value.typeEnum = undefined; + form.value.busNoParent = undefined; + proxy.resetForm("orgRef"); +} + function getPageList() { loading.value = false; getList(queryParams.value).then((res) => { organization.value = res.data.records; - console.log(res.data.records); - + total.value = res.data.total; loading.value = false; }); } function handleAdd() { + reset(); initOption(); - proxy.resetForm("orgRef"); open.value = true; + console.log(form.value); } -function handelEdit(id) { +function handelEdit(row) { + reset(); initOption(); - getOrgDetail(id).then((res) => { - form.value = res.data.records; - }); + // if (row.busNo.lastIndexOf(".") != -1) { + // row.busNoParent = row.busNo.substring(0, row.busNo.lastIndexOf(".")); + // row.busNo = row.busNo.substring( + // row.busNo.lastIndexOf(".") + 1, + // row.busNo.length + // ); + // } + form.value.busNo = row.busNo; + form.value.name = row.name; + form.value.typeEnum = row.typeEnum; + form.value.busNoParent = undefined; open.value = true; } function cancel() { open.value = false; - proxy.resetForm("orgRef"); + reset(); } -/** - * 新增提交 - */ function submitForm() { proxy.$refs["orgRef"].validate((valid) => { if (valid) { - if (form.value.id != undefined) { + if (form.value.busNoParent) { + form.value.busNo = form.value.busNoParent + "." + form.value.busNo; + } + if (form.value.id == undefined) { addOrganization(form.value).then((res) => { proxy.$modal.msgSuccess(res.msg); open.value = false; @@ -255,11 +273,24 @@ function handleDisabled(id) { }); } -function handleSelectionChange() { - console.log(orgTableRef.value.getSelectionRows()); +function handelEnable(id){ + enableOrg(id).then((res) => { + proxy.$modal.msgSuccess(res.msg); + getList(); + }); +} +function handleSelectionChange() { selectRowIds.value = orgTableRef.value .getSelectionRows() .map((item) => item.id); } + +// function handleAddInferior(row) { +// initOption(); +// proxy.resetForm("orgRef"); +// open.value = true; +// form.value.busNoParent = row.busNo; +// row.busNo = undefined; +// } \ No newline at end of file