Commit 84392f34 authored by 刘予佳's avatar 刘予佳

Merge remote-tracking branch 'remotes/origin/dev' into dev_lyj

parents 5c0f6e5d b080ebee
......@@ -35,6 +35,9 @@
<el-form-item label="是否只读">
<el-switch v-model="data.readonly"></el-switch>
</el-form-item>
<el-form-item label="是否禁用">
<el-switch v-model="data.disabled"></el-switch>
</el-form-item>
<el-form-item label="是否可见">
<el-switch v-model="data.display"></el-switch>
</el-form-item>
......@@ -50,6 +53,18 @@
</template>
<script>
let checkTel = (rule, value, callback) => {
if (!value) {
return callback(new Error("请输入手机号"))
}
const reg = /^1[3,4,5,6,7,8,9][0-9]{9}$/
reg.test(value)
if (!reg.test(value)) {
callback(new Error("请输入正确的手机号"))
} else {
callback()
}
}
export default {
name: "config-input",
props: ["data"],
......@@ -71,6 +86,9 @@ export default {
})
this.data.rules = rules
},
telRule() {
this.data.rules[1] = { validator: checkTel, trigger: "blur" }
},
},
watch: {
"data.required": function (val) {
......@@ -84,15 +102,21 @@ export default {
this.generateRule()
},
"data.pattern": function (val) {
if (val)
this.validator.pattern = {
pattern: new RegExp(val),
message: `${this.data.label}格式不匹配`,
if (val) {
if (val == "checkTel") {
this.telRule()
} else {
this.validator.pattern = {
pattern: new RegExp(val),
message: `${this.data.label}格式不匹配`,
}
this.generateRule()
}
else this.validator.pattern = null
} else {
this.validator.pattern = null
this.generateRule()
}
// delete this.data.pattern
this.generateRule()
},
},
}
......
......@@ -19,6 +19,7 @@ export default {
#vue-admin-beautiful {
height: 100vh;
min-width: 1400px;
overflow: auto;
margin-right: calc(100% - 100vw);
}
......
let formJson =
{column:[],labelPosition:'left',labelSuffix:'',labelWidth:180,gutter:0,menuBtn:true,submitBtn:true,submitText:'下一步',emptyBtn:false,emptyText:'上一步',nextTabBtn:true,nextTabText:'下一页',menuPosition:'center',prevBtn:true,group:[{label:'个人信息',prop:'1669708504829_2651',arrow:true,collapse:true,display:true,labelWidth:8,column:[{type:'input',display:true,importantField:false,styles:{},prop:'name',label:'姓名',fieldType:'varchar',fieldLength:'15',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,autoRequired:0,personalRequired:0,lg:12,span:12,width:24,xs:12,sm:12,md:12,readonly:false,required:true,rules:[{required:true,message:'姓名必须填写'}]},{type:'date',display:true,importantField:false,styles:{},format:'yyyy-MM-dd',valueFormat:'yyyy-MM-dd',prop:'survey_time',dicType:'',label:'调查时间',fieldType:'datetime',tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,span:12,xs:12,sm:12,md:12,lg:12,required:true,rules:[{required:true,message:'调查时间必须填写'}],personalRequired:0},{type:'input',display:true,importantField:false,styles:{},prop:'phone',label:'手机号',fieldType:'varchar',fieldLength:'15',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,span:12,xs:12,sm:12,md:12,lg:12,required:true,rules:[{required:true,message:'手机号必须填写'},{validator:function checkTel(rule, value, callback) {\n if (!value) {\n return callback(new Error(\"请输入手机号\"));\n }\n\n var reg = /^1[3,4,5,6,7,8,9][0-9]{9}$/;\n reg.test(value);\n\n if (!reg.test(value)) {\n callback(new Error(\"请输入正确的手机号\"));\n } else {\n callback();\n }\n},trigger:'change'}],pattern:'checkTel'},{type:'input',display:true,importantField:false,styles:{},prop:'link_phone',label:'联系号码',fieldType:'varchar',fieldLength:'128',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,span:12,xs:12,sm:12,md:12,lg:12,width:24,rules:[{required:true,message:'联系号码必须填写'}],required:true},{type:'date',display:true,importantField:false,styles:{},prop:'birthday',label:'出生日期',fieldType:'date',fieldLength:'',format:'yyyy-MM-dd',valueFormat:'yyyy-MM-dd',dicType:'',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,span:12,xs:12,sm:12,md:12,lg:12,required:true,rules:[{required:true,message:'出生日期必须填写'}],disabled:true,value:' '},{type:'input',display:true,importantField:false,styles:{},prop:'age',label:'年龄',fieldType:'int',fieldLength:'11',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,span:12,xs:12,sm:12,md:12,lg:12,required:true,rules:[{required:true,message:'年龄必须填写'}],readonly:false,disabled:true},{type:'radio',display:true,importantField:false,styles:{},autoRequired:0,personalRequired:0,prop:'sex',dicData:[{label:'女',value:'2',id:'1595351964546281474',parentId:''},{label:'男',value:'1',id:'1595351940139626497',parentId:''}],dynamicshSet:[],dicType:'d-sex',props:{label:'label',value:'value'},label:'性别',fieldType:'varchar',fieldLength:'20',tableName:'患者信息',tableCode:'gas_patient_info',tableId:'1595347991491833857',notFilter:false,cType:'',subfield:false,span:24,xs:24,sm:24,md:24,lg:24,required:true,rules:[{required:true,message:'请选择性别'}]}]},{label:'家族史',prop:'1669708827460_97007',arrow:true,collapse:true,display:true,labelWidth:8,column:[{type:'radio',display:true,importantField:false,styles:{},prop:'is_first_degree',label:'一级亲属(父母、子女、兄弟姐妹)罹患胃癌情况',dicData:[{label:'是',value:'1',id:'1595347527757000705',parentId:''},{label:'否',value:'0',id:'1595347502595371010',parentId:''}],dynamicshSet:[{value:'1',target:'family_count'},{value:'1',target:'min_age'}],dicType:'d-sf',props:{label:'label',value:'value'},fieldType:'tinyint',fieldLength:'2',tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,autoRequired:0,personalRequired:0,span:24,xs:24,sm:24,md:24,lg:24,required:true,rules:[{required:true,message:'请选择一级亲属(父母、子女、兄弟姐妹)罹患胃癌情况'}]},{type:'input',display:true,importantField:false,styles:{},prop:'family_count',label:'数量',fieldType:'int',fieldLength:'11',tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,span:24,labelSuffix:'(1)',xs:24,sm:24,md:24,lg:24,required:true,rules:[{required:true,message:'数量必须填写'}]},{type:'input',display:true,importantField:false,styles:{},prop:'min_age',label:'诊断时最小年龄',fieldType:'int',fieldLength:'11',tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,autoRequired:0,personalRequired:0,span:24,labelSuffix:'(2)',xs:24,sm:24,md:24,lg:24,width:24,rules:[{required:true,message:'诊断时最小年龄必须填写'}],required:true},{type:'radio',display:true,importantField:false,styles:{},prop:'is_other_sickness',label:'一级亲属罹患其他恶性肿瘤情况',fieldType:'tinyint',fieldLength:'2',dicData:[{label:'是',value:'1',id:'1595347527757000705',parentId:''},{label:'否',value:'0',id:'1595347502595371010',parentId:''}],dynamicshSet:[{value:'1',target:'family_other_count'},{value:'1',target:'other_sickness'}],dicType:'d-sf',props:{label:'label',value:'value'},tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,xs:24,sm:24,md:24,lg:24,span:24,width:24,rules:[{required:true,message:'请选择一级亲属罹患其他恶性肿瘤情况'}],required:true,autoRequired:0,personalRequired:0,labelSuffix:'2'},{type:'input',display:true,importantField:false,styles:{},prop:'family_other_count',label:'一级亲属罹患其他恶性肿瘤数量',fieldType:'int',fieldLength:'11',dicData:[{label:'是',value:'1',id:'1595347527757000705',parentId:''},{label:'否',value:'0',id:'1595347502595371010',parentId:''}],dynamicshSet:[],dicOption:'static',dicType:'',props:{label:'label',value:'value'},tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,lg:24,xs:24,sm:24,md:24,autoRequired:0,personalRequired:0,span:24,width:24,labelSuffix:'(1)',required:true,rules:[{required:true,message:'一级亲属罹患其他恶性肿瘤数量必须填写'}]},{type:'input',display:true,importantField:false,styles:{},prop:'other_sickness',label:'一级亲属罹患其它恶性肿瘤名称',fieldType:'varchar',fieldLength:'255',tableName:'问卷调查',tableCode:'gas_question',tableId:'1597462007689347074',notFilter:false,cType:'',subfield:false,autoRequired:0,personalRequired:0,span:24,labelSuffix:'(2)',xs:24,sm:24,md:24,lg:24,width:24,rules:[{required:true,message:'一级亲属罹患其它恶性肿瘤名称必须填写'}],required:true}]}]}
......@@ -63,9 +63,9 @@
</template>
<script>
import path from "path";
import { isExternal } from "@/utils/validate";
import AppLink from "@/layouts/components/Link";
import path from "path"
import { isExternal } from "@/utils/validate"
import AppLink from "@/layouts/components/Link"
export default {
name: "SideBarItem",
......@@ -85,22 +85,22 @@ export default {
},
},
data() {
this.onlyOneChild = null;
return {};
this.onlyOneChild = null
return {}
},
methods: {
handleChildren(children = [], parent) {
if (children === null) children = [];
if (children === null) children = []
const showChildren = children.filter((item) => {
if (item.hidden) {
return false;
return false
} else {
this.onlyOneChildren = item;
return true;
this.onlyOneChildren = item
return true
}
});
})
if (showChildren.length === 1) {
return true;
return true
}
if (showChildren.length === 0) {
......@@ -108,22 +108,22 @@ export default {
...parent,
path: "",
notShowChildren: true,
};
return true;
}
return true
}
return false;
return false
},
handlePath(routePath) {
if (isExternal(routePath)) {
return routePath;
return routePath
}
if (isExternal(this.basePath)) {
return this.basePath;
return this.basePath
}
return path.resolve(this.basePath, routePath);
return path.resolve(this.basePath, routePath)
},
},
};
}
</script>
<style lang="scss" scoped>
......
......@@ -63,6 +63,9 @@ export default {
return variables
},
},
// mounted() {
// console.log(this.routes)
// },
}
</script>
<style lang="scss" scoped>
......
......@@ -10,6 +10,7 @@ export const constantRoutes = [
path: "/home",
name: "Home",
// redirect: "/home",
hidden: true,
component: layout,
children: [
{
......
<template>
<ConfigForms form-type="1" :prods="'add'"></ConfigForms>
<ConfigForms form-type="1" @addMethods="addMethods"></ConfigForms>
</template>
<script>
......@@ -20,7 +20,18 @@ export default {
return {}
},
created() {},
methods: {},
methods: {
// 处理部分逻辑
addMethods(v) {
console.log(v)
if (v.activeName == "index0") {
let data = {
birthday: v.form.birthday,
}
sessionStorage.setItem("index1Data", JSON.stringify(data))
}
},
},
}
</script>
......
......@@ -7,38 +7,40 @@
<el-button
v-if="!disabled"
class="draftButton"
@click="onSubmit(formType)"
:loading="loading"
@click="onSubmit(formType)"
>{{ formType == 1 ? "临时保存" : "返回" }}</el-button
>
<el-tabs
v-model="activeName"
v-loading="fromLoading"
type="card"
:style="{ width: formType == 1 ? '100%' : 'calc(100% - 200px)' }"
class="publicTab"
v-loading="fromLoading"
@tab-click="handleTabClick"
>
<el-tab-pane
:label="form.label"
:name="'index' + index"
v-for="(form, index) in formTabs"
:key="form.id"
:label="form.label"
:name="'index' + index"
>
<transition mode="out-in" name="fade-transform">
<div v-show="activeName === 'index' + index">
<template v-if="form.formId">
<form-tab
ref="formTabs"
:patient-id="patientId"
:patient-standby-id="patientStandbyId"
:newform-record-id="newformRecordId"
:form="form"
:disabled="disabled"
contrast
:form-initial="formInitial"
:survival-flag="survivalFlag"
@setFormJson="setFormJson"
@handleConfirm="handleConfirm"
@onPrev="onPrev"
:formInitial="formInitial"
:survivalFlag="survivalFlag"
></form-tab>
</template>
</div>
......@@ -80,8 +82,8 @@
<el-button
type="primary"
:loading="loading"
@click="view"
class="textBtn"
@click="view"
>查看</el-button
>
<el-button type="primary" :loading="loading" @click="continueSubmit"
......@@ -97,17 +99,17 @@
import mixin from "./mixin"
import CustomForm from "@/components/FormComponents/CustomForm/index"
import publicDialog from "../../audit-detail/components/publicDialog.vue"
import { getPatientDetail } from "@/api/patient.js"
export default {
components: { publicDialog },
name: "ConfigForms",
components: { publicDialog },
mixins: [mixin],
props: {
disabled: Boolean,
formType: String,
patientId: String,
formClass: String,
prods: String,
},
data() {
return {
......@@ -118,10 +120,85 @@ export default {
formInitial: {}, // 第四步的数据
}
},
computed: {
survivalFlag() {
if (this.activeName == "index0" && this.formClass) {
return true
} else {
return false
}
},
showIndex() {
if (this.activeName == "index0" && this.formClass) {
return false
} else {
return true
}
},
},
watch: {
activeName(val) {
console.log(this.formId)
if (val == "index3") {
// 第四步风险评估
this.$nextTick(() => {
getPatientDetail({
formId: this.formId, // 每个大表单的id
patientId: this.patientId || this.patientStandbyId,
formRecordId: this.newformRecordId,
})
.then((res) => {
console.log(res)
})
.finally(() => {
this.loading = false
})
this.$nextTick(() => {
console.log("走了")
//!
// this.formInitial = {
// risk_rank: "中危",
// risk_score: "5分",
// screening_advise: "立刻住院",
// }
})
})
} 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
}
},
},
created() {
// 字典formType 1 筛查表单
// console.log('回显2',this.formEdit)
this.getCurrentFormByType(this.formType)
},
methods: {
view() {},
handleConfirm(data, done, cb) {
this.addPatient(data, done, cb)
this.$emit("addMethods", {
activeName: this.activeName,
form: data.data,
})
},
onPrev(done) {
this.prevTab(done)
......@@ -143,44 +220,6 @@ export default {
dialogCancel() {},
continueSubmit() {},
},
created() {
// 字典formType 1 筛查表单
// console.log('回显2',this.formEdit)
this.getCurrentFormByType(this.formType)
},
watch: {
activeName(val) {
if (val == "index3") {
// 第四步风险评估
this.$nextTick(() => {
//!
// this.formInitial = {
// risk_rank: "中危",
// risk_score: "5分",
// screening_advise: "立刻住院",
// }
})
} else {
this.formInitial = false
}
},
},
computed: {
survivalFlag() {
if (this.activeName == "index0" && this.formClass) {
return true
} else {
return false
}
},
showIndex() {
if (this.activeName == "index0" && this.formClass) {
return false
} else {
return true
}
},
},
provide() {
return {
configForms: this,
......
......@@ -85,6 +85,7 @@ export default {
form: Object,
patientId: String,
patientStandbyId: String,
newformRecordId: String,
getAll: Boolean, // 获取页面所有数据
survivalFlag: Boolean, //存活的显示
formEdit: {},
......@@ -146,7 +147,6 @@ export default {
},
methods: {
initData() {
console.log("有patientId,获取数据")
this.formData.formRecordId = null
this.formCacheList = []
this.getPatientDetail()
......@@ -162,6 +162,7 @@ export default {
},
handleAdd() {
console.log("触发新增", this.form)
this.$refs.form && this.$refs.form.resetForm()
this.formData = {
formEdit: {},
......@@ -227,16 +228,15 @@ export default {
"handleConfirm",
{
data,
formId: this.form.formId,
formId: this.form.formId, // 每个大表单的id
patientId: this.patientId || this.patientStandbyId,
formRecordId: this.formData.formRecordId,
formRecordId: this.formData.formRecordId || this.newformRecordId, // 是否为编辑的表单id
statusMap: {
patientFrom: this.$store.getters["table/selectedIndex"],
is_draft: 1,
check_status: 1,
is_draft: 1, //是否为草稿
check_status: 1, // 审核状态
},
},
done,
(res) => {
// 多次填写的表单新增时,获取最新数据
......@@ -358,7 +358,13 @@ export default {
}
},
mounted() {
// console.log()
//! 设置新增判断
if (this.$route.path == "/screening/add") {
// this.handleAdd()
if (!this.formData.formRecordId) {
this.handleAdd()
}
}
},
}
</script>
......
......@@ -10,7 +10,9 @@ export default {
activeName: "index0",
fromLoading: false,
patientStandbyId: null, // 备用id
newformRecordId: null, //记录Id
formTabs: [],
formId: "",
formTabsList: [],
isUpdated: false,
}
......@@ -41,6 +43,7 @@ export default {
},
handleTabClick({ index, name }) {
const { formId, id, silent } = this.formTabs[index]
this.formId = this.formTabsList[index].formId
console.log("表单项", this.formTabs[index])
if (formId && silent) {
this.formTabs[index]["silent"] = false //控制是否获取接口数据
......@@ -55,11 +58,15 @@ export default {
async addPatient(data, done, cb, type) {
addPatient(data, type)
.then((res) => {
this.$message.success("操作成功")
// this.$message.success("操作成功")
if (res.data) {
this.isUpdated = true
this.patientStandbyId = res.data.patientId
if (cb && Object.prototype.toString.call(cb) === "[object Function]") {
this.newformRecordId = res.data.formRecordId
if (
cb &&
Object.prototype.toString.call(cb) === "[object Function]"
) {
cb(res)
}
}
......
......@@ -11,9 +11,10 @@
上一步下一步提交按钮触发:CustomForm/index 最终处理实在ConfigForms以及同级中的mixin
formId:表单id
formRecordId:记录数
数据在ConfigForms处理
......
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