提交排班3
This commit is contained in:
commit
df1d132246
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,10 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询回答问卷列表
|
||||
export function listElderProfile(query) {
|
||||
return request({
|
||||
url: '/elder/fwzypgmb/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询回答问卷列表
|
||||
export function listFwzypgmb(query) {
|
||||
return request({
|
||||
url: '/elder/fwzypgmb/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 老人档案信息
|
||||
export function listElderProfile(query) {
|
||||
return request({
|
||||
url: '/elder/profile/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 获取问卷列表
|
||||
export function listQuestionnaireTemplate(query) {
|
||||
return request({
|
||||
url: '/elder/questionnaire/question/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 新增老人能力评估
|
||||
export function addLrnlpg(data) {
|
||||
return request({
|
||||
url: '/elder/lrnlpg',
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -54,7 +54,8 @@
|
|||
"navigationBarTitleText": "浏览文本"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages_mine/pages",
|
||||
|
@ -374,6 +375,28 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages_evaQuestion/pages",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "评估问卷"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages_radioQustion/pages",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "老人能力评估调查问卷"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages_WenJuanDiaoCha/pages",
|
||||
"pages": [
|
||||
|
|
|
@ -111,6 +111,12 @@
|
|||
<text class="text">巡更管理</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
<uni-grid-item>
|
||||
<view class="grid-item-box" @click="toPath('/pages_evaQuestion/pages/index')">
|
||||
<uni-icons type="wallet-filled" size="30"></uni-icons>
|
||||
<text class="text">评估问卷</text>
|
||||
</view>
|
||||
</uni-grid-item>
|
||||
</uni-grid>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
<template>
|
||||
<view style="width: 100%">
|
||||
<view class="u-page">
|
||||
<u-loading-page :loading="loading" bg-color="#e8e8e8"></u-loading-page>
|
||||
|
||||
<u-row customStyle="margin: 5px">
|
||||
<u-col span="9">
|
||||
<u-search style="z-index: 999" :disabled="true" bgColor="rgb(255 255 255)" placeholder="搜索"
|
||||
shape="round" @click="handle_SearchBox_click" :showAction="false" :animation="true"></u-search>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<u-button type="primary" @click="handel_plus_click" size="small" shape="circle" class="custom-style"
|
||||
plain text="创建">
|
||||
</u-button>
|
||||
</u-col>
|
||||
|
||||
</u-row>
|
||||
|
||||
<u-row customStyle="margin-bottom: 10px ">
|
||||
<u-col span="12">
|
||||
<u-empty v-if="DataList.length == 0" mode="list"></u-empty>
|
||||
<u-cell-group customStyle="background-color: white;" v-else>
|
||||
<u-cell v-for="item in DataList" :key="item.id" size="large" isLink clickable
|
||||
:title="item.templateName" :name="item.elderQuestionnairePaperId"
|
||||
@click="handel_cell_click(item)">
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
<uni-load-more :status="status" :contentText="loadText" @clickLoadMore="MyonLoad" />
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
listFwzypgmb,
|
||||
} from '@/api/elder/pensionAssessment/fwzypgmb/index';
|
||||
|
||||
import {
|
||||
listAssign,
|
||||
getAssign,
|
||||
delAssign,
|
||||
addAssign,
|
||||
updateAssign,
|
||||
} from "@/api/elder/questionnaire/assign";
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
} from 'vue';
|
||||
|
||||
|
||||
|
||||
const show = ref(false);
|
||||
const columns = reactive([
|
||||
|
||||
]);
|
||||
// 老人性名
|
||||
let elderName = ref('')
|
||||
const form1 = ref(null)
|
||||
// import myLoadMore from "@/pages/mixins/myLoadMore";
|
||||
// mixins: [myLoadMore],
|
||||
// 遮罩层
|
||||
let loading = ref(true)
|
||||
// 选中数组
|
||||
let ids = ref([])
|
||||
// 子表选中数据
|
||||
let checkedElderQuestionnaireAssignDetail = ref([])
|
||||
// 非单个禁用
|
||||
let single = ref(true)
|
||||
// 非多个禁用
|
||||
let multiple = ref(true)
|
||||
// 显示搜索条件
|
||||
let showSearch = ref(true)
|
||||
// 总条数
|
||||
let total = ref(0)
|
||||
// 发起问卷表格数据
|
||||
let DataList = ref([])
|
||||
// 发起问卷明细表格数据
|
||||
let elderQuestionnaireAssignDetailList = ref([])
|
||||
// 弹出层标题
|
||||
let title = ref('')
|
||||
// 是否显示弹出层
|
||||
let open = ref(false)
|
||||
// 查询参数
|
||||
|
||||
let queryParams = reactive({
|
||||
pageNum: null,
|
||||
pageSize: null,
|
||||
assignName: null,
|
||||
assignType: null,
|
||||
answererId: null,
|
||||
answererName: null,
|
||||
assignStatus: null,
|
||||
autoRating: null,
|
||||
ruleId: null,
|
||||
value: null,
|
||||
level: null,
|
||||
status: 1,
|
||||
})
|
||||
|
||||
// 表单参数
|
||||
let form = reactive({})
|
||||
// 表单校验
|
||||
let rules = reactive({})
|
||||
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
/** 查询发起问卷列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
|
||||
|
||||
listFwzypgmb(queryParams).then((response) => {
|
||||
|
||||
DataList.value = response.rows || [];
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//跳转问卷考卷页面
|
||||
function handel_cell_click(item) {
|
||||
const filteredDataList = DataList.value.filter(data => data.elderQuestionnairePaperId === item.name);
|
||||
const dataListString = JSON.stringify(filteredDataList);
|
||||
console.log(dataListString, 789);
|
||||
console.log('11111',item)
|
||||
// 转义字符串以适应 URL
|
||||
uni.navigateTo({
|
||||
// url: `/pages_radioQustion/pages/index?name=${encodeURIComponent(item.name)}`
|
||||
url: `/pages_radioQustion/pages/index?item=${JSON.stringify(item)}`
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.demo-uni-row {
|
||||
margin-bottom: 10px;
|
||||
/* QQ、字节小程序文档写有 :host,但实测不生效 */
|
||||
/* 百度小程序没有 :host,需要设置block */
|
||||
/* #ifdef MP-TOUTIAO || MP-QQ || MP-BAIDU */
|
||||
display: block;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/* 支付宝小程序没有 demo-uni-row 层级 */
|
||||
/* 微信小程序使用了虚拟化节点,没有 demo-uni-row 层级 */
|
||||
/* #ifdef MP-ALIPAY || MP-WEIXIN */
|
||||
/deep/ .uni-row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.demo-uni-col {
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.mypage-title {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.demo-layout {
|
||||
height: 25px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.list-cell {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 10px 24rpx;
|
||||
overflow: hidden;
|
||||
color: #323233;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.custom-style {
|
||||
width: 90%;
|
||||
font-weight: bolder;
|
||||
font-size: 15px;
|
||||
height: 75rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,166 @@
|
|||
<template>
|
||||
<view class="form-container">
|
||||
<u-form :model="form" label-width="250px" label-position="top">
|
||||
<u-divider></u-divider>
|
||||
<view v-for="(parent, index) in firstArray" :key="parent.questionId">
|
||||
<text>{{ parent.questionName }}</text>
|
||||
|
||||
<template v-if="secondArray[index] === '是否'">
|
||||
<u-radio-group v-model="selectedValues[index]">
|
||||
<u-radio :value="parent.value" size="large">是</u-radio>
|
||||
<u-radio :value="0" size="large">否</u-radio>
|
||||
</u-radio-group>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<u-radio-group v-model="selectedValues[index]">
|
||||
<u-radio v-for="child in secondArray[index]" :key="child.questionId" :value="child.value"
|
||||
size="large">
|
||||
{{ child.questionName }}
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<u-form-item class="submit-btn-container">
|
||||
<u-button type="primary" @click="submitForm">提交</u-button>
|
||||
<u-button @click="goBack">取消</u-button>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
useRoute
|
||||
} from 'vue-router'; // 如果使用 vue-router
|
||||
import {
|
||||
listQuestionnaireTemplate,
|
||||
listElderProfile,
|
||||
addLrnlpg
|
||||
} from '@/api/elder/pensionAssessment/fwzypgmb/index';
|
||||
|
||||
|
||||
const name = ref('');
|
||||
const loading = ref(false); // 定义 loading 变量
|
||||
const DataList = ref([]); // 定义 DataList 变量
|
||||
const total = ref(0); // 定义 total 变量
|
||||
const elderList = ref([])
|
||||
const firstArray = ref([]);
|
||||
const secondArray = ref([]);
|
||||
const selectedValues = ref([]);
|
||||
const questionTitles = ref([])
|
||||
const dataList = ref([])
|
||||
let moban=ref({})
|
||||
const questionnaireTemplateList = ref([])
|
||||
const isSubmitting = ref(false);
|
||||
const route = useRoute(); // 使用 vue-router 获取当前路由信息
|
||||
onLoad((option) => {
|
||||
console.log('-----option',JSON.parse(option.item))
|
||||
moban.value = JSON.parse(option.item)
|
||||
console.log('-----option',moban.value.elderQuestionnairePaperId)
|
||||
getList();
|
||||
})
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
const receivedName = moban.value.elderQuestionnairePaperId;
|
||||
|
||||
|
||||
// 更新响应式数据
|
||||
name.value = receivedName ? decodeURIComponent(receivedName) : '';
|
||||
|
||||
|
||||
|
||||
console.log("Received name:", name.value);
|
||||
|
||||
listElderProfile().then((res) => {
|
||||
// console.log("老人信息", res.rows[0]);
|
||||
elderList.value = res.rows[0]
|
||||
// 根据需要处理 res 数据
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
listQuestionnaireTemplate({
|
||||
paperId: moban.value.elderQuestionnairePaperId,
|
||||
status: 0
|
||||
}).then((res) => {
|
||||
questionTitles.value = res.rows;
|
||||
questionnaireTemplateList.value = res.rows;
|
||||
firstArray.value = res.rows.filter(item => item.parentQuestionid === null || item.parentQuestionid ===
|
||||
'0');
|
||||
|
||||
secondArray.value = firstArray.value.map(parent => {
|
||||
const children = res.rows.filter(item => item.parentQuestionid === parent.questionId);
|
||||
|
||||
if (parent.questionType === '2') {
|
||||
return '是否';
|
||||
} else {
|
||||
return children;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
selectedValues.value = new Array(firstArray.value.length).fill(null);
|
||||
|
||||
console.log(selectedValues.value, 888)
|
||||
// 更新总数
|
||||
total.value = res.total;
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
if (isSubmitting.value) {
|
||||
console.log('提交已被锁定,防止多次提交');
|
||||
|
||||
return; // 防止多次提交
|
||||
}
|
||||
|
||||
isSubmitting.value = true; // 标记为正在提交
|
||||
// 创建一个空的list
|
||||
const list = [];
|
||||
const params = new URLSearchParams(location.search);
|
||||
|
||||
// 遍历firstArray,生成包含questionId和value的对象
|
||||
firstArray.value.forEach((parent, index) => {
|
||||
list.push({
|
||||
questionId: parent.questionId,
|
||||
value: selectedValues.value[index]
|
||||
});
|
||||
});
|
||||
|
||||
// 打印list以便调试
|
||||
console.log('生成的list:', list);
|
||||
addLrnlpg({
|
||||
list,
|
||||
elderName: elderList.value.name,
|
||||
birthDate: elderList.value.birthday,
|
||||
elderNumber: elderList.value.sn,
|
||||
elderProfileId: elderList.value.id,
|
||||
elderQuestionnairePaperId: route.query.name,
|
||||
gender: elderList.value.gender,
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
console.log('Cancel button clicked');
|
||||
};
|
||||
onMounted(() => {
|
||||
});
|
||||
</script>
|
Reference in New Issue