Commit c6ac0b41 authored by miaojiale's avatar miaojiale

1. 增加临时保存按钮提交逻辑

2. 草稿箱列表页删除接口
3.增加编辑页
parent 7c67e700
......@@ -43,6 +43,14 @@ export function addPatient(data = {}, type = "") {
})
}
// 删除草稿
export function deletePatient(data) {
return request({
url: `/disease-data/data/patient/${data}`,
method: "delete",
})
}
/* 患者数据详情 */
export function getPatientDetail(params = {}) {
return request({
......@@ -137,10 +145,6 @@ export function getZsyzyPatientInfo(params = {}) {
})
}
// 急性胰腺炎-评分表
// 评分表新增修改
......
......@@ -269,6 +269,47 @@ export default {
this.loading = false
})
},
// 临时保存
temporarySave() {
//? 只传数据
this.$refs.form.validate((valid) => {
if (valid) {
const data = {}
const form = this.deepClone(this.form)
Object.keys(form).forEach((k) => {
if (form[k] === undefined) {
data[k] = ""
return false
}
if (k === "YZZKJC") {
// 牙周表格
data[k] = JSON.stringify(form[k])
} else if (
Array.isArray(form[k]) &&
form[k][0] &&
isObject(form[k][0])
) {
// 子表单 去除前端添加的显隐辅助数据($_)和 删除按钮辅助数据(showDelBtn)
data[k] = form[k].map((item) => {
for (let key in item) {
if (["$_keyField", "$_hidden", "showDelBtn"].includes(key))
delete item[key]
}
return item
})
} else {
data[k] = form[k]
}
})
this.$emit("temporaryConfirm", data, () => {
// 完成之后的回调
this.loading = false
})
} else {
this.loading = false
}
})
},
handleConfirm() {
this.loading = true
this.$refs.form.validate((valid) => {
......
......@@ -213,15 +213,17 @@ html {
text-align: center;
white-space: nowrap;
}
.is-background{
button,.el-pager li{
.is-background {
button,
.el-pager li {
border-radius: 6px !important;
}
button,.el-pager li:not(.active){
border: 1px solid #D9D9D9;
button,
.el-pager li:not(.active) {
border: 1px solid #d9d9d9;
background: transparent !important;
}
.el-input__inner{
.el-input__inner {
border-radius: 6px !important;
}
}
......
......@@ -7,7 +7,7 @@
show-close
@closed="cancelSubmit"
:close-on-click-modal="false"
:show-close="false"
:show-close="showClose"
>
<slot name="content"></slot>
<slot name="footer"></slot>
......@@ -19,6 +19,11 @@ export default {
data() {
return { dialogVisible: false, loading: false }
},
props: {
showClose: {
default: false,
},
},
watch: {},
mounted() {},
methods: {
......
<template>
<div class="dataCenter">
<div class="container" style="max-height: 89vh">
<div v-show="!isDetail">
<div class="header">草稿箱</div>
<div class="content">
<customs-table
......@@ -17,21 +18,39 @@
/>
</div>
</div>
<div v-if="isDetail">
<div>
<el-button icon="el-icon-back" @click="isDetail = false"
>返 回</el-button
>
</div>
<div class="form_content">
<ConfigForms
form-type="1"
:patient-id="patientId"
:disabled="disabled"
></ConfigForms>
</div>
</div>
</div>
</template>
<script>
import CustomsTable from "@/components/CustomsTable"
import paginationMixin from "@/components/TabComponents/mixin"
import ConfigForms from "./components/ConfigForms.vue"
import { mapGetters } from "vuex"
import { getPatientPage } from "@/api/patient.js"
import { getPatientPage, deletePatient } from "@/api/patient.js"
export default {
// 数据概览
name: "",
components: {
CustomsTable,
ConfigForms,
},
mixins: [paginationMixin],
data() {
return {
isDetail: false, //! 控制详情显隐
listLoading: false,
columns: [
{
......@@ -90,7 +109,7 @@ export default {
operType: "button",
operations: [
{
func: this.rowOpration,
func: this.handleAdd,
formatter(row) {
return {
label: "编辑",
......@@ -99,7 +118,7 @@ export default {
},
},
{
func: this.rowOpration,
func: this.deletePatient,
formatter(row) {
return {
label: "删除",
......@@ -124,6 +143,12 @@ export default {
watch: {},
mounted() {},
methods: {
handleAdd({ patientId, name }, index, disabled = false) {
this.disabled = disabled
this.patientId = patientId || null
this.name = name
this.isDetail = true
},
setSelectedIndex(i) {
console.log(this.selectedIndex)
this.selectedIndex = i
......@@ -151,6 +176,25 @@ export default {
}
})
},
deletePatient(row) {
this.$confirm(`是否删除【${row.name}】?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deletePatient(row.patientId).then((res) => {
if (res.code === 1) {
this.$message({
type: "success",
message: "删除成功!",
})
this.handleSearch()
}
})
})
.catch(() => {})
},
},
computed: {
...mapGetters({
......@@ -168,8 +212,8 @@ export default {
}
</script>
<style lang="scss" scoped>
.dataCenter {
padding: 24px 0;
.container {
padding: 24px;
height: 100%;
display: flex;
flex-direction: column;
......@@ -187,5 +231,8 @@ export default {
.content {
padding: 0 24px;
}
.form_content {
height: calc(100% - 50px);
}
}
</style>
<template>
<div
id="publicContent"
:style="{
padding:
$route.path == '/screening/draft'
? ' 10px 24px 60px;'
: ' 32px 24px 60px;',
}"
:class="activeName == 'index0' && formClass ? formClass : ''"
>
<div v-if="formTabs && formTabs.length > 0">
......@@ -8,6 +14,7 @@
v-if="!disabled"
class="draftButton"
:loading="loading"
:disabled="!infoCompelete"
@click="onSubmit(formType)"
>{{ formType == 1 ? "临时保存" : "返回" }}</el-button
>
......@@ -24,8 +31,8 @@
:key="form.id"
:label="form.label"
:name="'index' + index"
disabled
>
<!-- disabled -->
<transition mode="out-in" name="fade-transform">
<div v-show="activeName === 'index' + index">
<template v-if="form.formId">
......@@ -42,6 +49,7 @@
@setFormJson="setFormJson"
@handleConfirm="handleConfirm"
@onPrev="onPrev"
@temporaryConfirm="temporaryConfirm"
></form-tab>
</template>
</div>
......@@ -50,7 +58,10 @@
</el-tabs>
</div>
<el-empty v-else description="暂无数据"></el-empty>
<public-dialog ref="showDialog">
<public-dialog
ref="showDialog"
:showClose="dialogType == 'draft' ? true : false"
>
<!-- 保存草稿 -->
<template v-if="dialogType == 'draft'" slot="content">
<div class="title center">已保存至草稿箱!</div>
......@@ -114,6 +125,7 @@ export default {
// survivalFlag:false
dialogType: "",
loading: false,
infoCompelete: false,
formInitial: {}, // 第四步的数据
}
},
......@@ -135,7 +147,36 @@ export default {
},
watch: {
activeName(val) {
console.log(this.formId)
if (!this.disabled) {
if (!["index0"].includes(val)) {
this.infoCompelete = true
} else {
this.infoCompelete = false
}
}
if (val == "index1") {
// 第二步问卷调查
this.$nextTick(() => {
let { birthday } = JSON.parse(sessionStorage.getItem("index1Data"))
let date = new Date(String(birthday).replace(/-/g, "/"))
let d = new Date()
let age =
d.getFullYear() -
date.getFullYear() -
(d.getMonth() < date.getMonth() ||
(d.getMonth() == date.getMonth() && d.getDate() < date.getDate())
? 1
: 0)
//!
this.formInitial = {
birthday,
age,
}
})
} else {
this.formInitial = false
}
if (val == "index3") {
// 第四步风险评估
this.$nextTick(() => {
......@@ -161,27 +202,6 @@ export default {
// }
})
})
} else if (val == "index1") {
// 第二步问卷调查
this.$nextTick(() => {
let { birthday } = JSON.parse(sessionStorage.getItem("index1Data"))
let date = new Date(String(birthday).replace(/-/g, "/"))
let d = new Date()
let age =
d.getFullYear() -
date.getFullYear() -
(d.getMonth() < date.getMonth() ||
(d.getMonth() == date.getMonth() && d.getDate() < date.getDate())
? 1
: 0)
//!
this.formInitial = {
birthday,
age,
}
})
} else {
this.formInitial = false
}
},
},
......@@ -198,16 +218,28 @@ export default {
form: data.data,
})
},
temporaryConfirm(data, done, cb) {
this.addPatient(data, done, cb, () => {
console.log("倒了")
this.$refs.showDialog.dialogVisible = true
this.loading = false
})
},
onPrev(done) {
this.prevTab(done)
},
onSubmit(type) {
this.loading = true
// this.loading = true
if (type == 1) {
// 临时保存草稿
this.dialogType = "draft"
this.$refs.showDialog.dialogVisible = true
this.loading = false
// 保存逻辑处理
// !获取当前tab的formTab
let formTab = this.$refs.formTabs.filter(
(e) => e.form.formId == this.formId
)[0]
formTab.temporarySave()
// console.log(formTab)
} else if (type == 2) {
//提交
this.dialogType = "submit"
......@@ -227,7 +259,6 @@ export default {
this.$refs.formTabs[i].initForm()
}
// 清空红字:不符合筛查条件
this.$refs.showDialog.dialogVisible = false
},
viewJump() {
......@@ -245,7 +276,6 @@ export default {
<style lang="scss" scoped>
#publicContent {
padding: 32px 24px;
position: relative;
.draftButton {
position: absolute;
......@@ -288,6 +318,13 @@ export default {
margin-top: 10px;
}
::v-deep {
.el-button.is-disabled {
color: #c0c4cc !important;
cursor: not-allowed;
background-image: none;
background-color: #fff;
border-color: #ebeef5 !important;
}
.el-tabs__item.is-disabled {
color: #252c49;
}
......
......@@ -42,7 +42,11 @@
</el-switch>-->
</div>
</el-row>
<div ref="my-form" class="my-form" :class="externalScroll ? 'no-scroll' : ''">
<div
ref="my-form"
class="my-form"
:class="externalScroll ? 'no-scroll' : ''"
>
<!-- <read-form
ref="form"
:options="survivalForm"
......@@ -55,6 +59,7 @@
@scrollTop="scrollTop"
@handleConfirm="handleConfirm"
@onPrev="onPrev"
@temporaryConfirm="temporaryConfirm"
></custom-form>
</div>
</template>
......@@ -163,6 +168,62 @@ export default {
this.getRecordList()
}
},
// 临时保存
temporarySave() {
this.$refs.form.temporarySave()
},
// 临时保存确定
temporaryConfirm(data, done) {
this.$emit(
"temporaryConfirm",
{
data,
formId: this.form.formId, // 每个大表单的id
patientId: this.patientId || this.patientStandbyId,
formRecordId: this.formData.formRecordId || this.newformRecordId, // 是否为编辑的表单id
statusMap: {
patient_from: this.$store.getters["table/selectedIndex"],
is_draft: 1, //是否为草稿
check_status: 1, // 审核状态
},
},
done,
(res) => {
// 多次填写的表单新增时,获取最新数据
if (this.form.fillType === 1 && !this.formData.formRecordId) {
this.getRecordList(res.data.formRecordId)
}
this.formatData(res, this.form.fillType !== 1)
}
)
},
handleConfirm(data, done) {
this.$emit(
"handleConfirm",
{
data,
formId: this.form.formId, // 每个大表单的id
patientId: this.patientId || this.patientStandbyId,
formRecordId: this.formData.formRecordId || this.newformRecordId, // 是否为编辑的表单id
statusMap: {
patient_from: this.$store.getters["table/selectedIndex"],
is_draft: 0, //是否为草稿
check_status: 1, // 审核状态
},
},
done,
(res) => {
// 多次填写的表单新增时,获取最新数据
if (this.form.fillType === 1 && !this.formData.formRecordId) {
this.getRecordList(res.data.formRecordId)
}
this.formatData(res, this.form.fillType !== 1)
}
)
},
onPrev(done) {
this.$emit("onPrev", done)
},
scrollTop() {
this.$refs["my-form"].scrollTop = 0
},
......@@ -229,34 +290,6 @@ export default {
})
},
handleConfirm(data, done) {
this.$emit(
"handleConfirm",
{
data,
formId: this.form.formId, // 每个大表单的id
patientId: this.patientId || this.patientStandbyId,
formRecordId: this.formData.formRecordId || this.newformRecordId, // 是否为编辑的表单id
statusMap: {
patient_from: this.$store.getters["table/selectedIndex"],
is_draft: 1, //是否为草稿
check_status: 1, // 审核状态
},
},
done,
(res) => {
// 多次填写的表单新增时,获取最新数据
if (this.form.fillType === 1 && !this.formData.formRecordId) {
this.getRecordList(res.data.formRecordId)
}
this.formatData(res, this.form.fillType !== 1)
}
)
},
onPrev(done) {
this.$emit("onPrev", done)
},
getPatientDetail() {
this.$nextTick(() => {
this.$refs.form && this.$refs.form.resetForm()
......@@ -388,18 +421,19 @@ export default {
z-index: 9;
}
.header {
height: 20px;
// box-shadow: 0 1px 4px rgb(0 21 41 / 8%);
height: 36px;
box-shadow: 0 5px 4px rgb(0 21 41 / 8%);
padding-right: 20px;
position: relative;
font-size: 15px;
z-index: 999;
}
}
.el-aside {
padding-left: 10px;
border-left: 1px solid #ccc;
.side-content {
// height: calc(100vh - #{"272px"});
height: calc(100vh - #{"272px"});
// overflow: auto;
}
}
......
......@@ -56,8 +56,8 @@ export default {
...this.formTabsList.find((_) => _.id === id),
})
},
async addPatient(data, done, cb, type) {
addPatient(data, type)
async addPatient(data, done, cb, ConfigFormsCallback) {
addPatient(data, "")
.then((res) => {
// this.$message.success("操作成功")
if (res.data) {
......@@ -74,7 +74,16 @@ export default {
})
.finally((e) => {
done()
console.log("走了", ConfigFormsCallback)
if (
ConfigFormsCallback &&
Object.prototype.toString.call(ConfigFormsCallback) ===
"[object Function]"
) {
ConfigFormsCallback()
} else {
this.nextTab()
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment