修改因子问题

This commit is contained in:
jiangzhe 2024-04-12 10:16:34 +08:00
parent 42174b6b4f
commit e64bd73bba
5 changed files with 69 additions and 46 deletions

View File

@ -20,6 +20,7 @@ export const useUserStore = defineStore('user', () => {
* @returns * @returns
*/ */
const login = async (userInfo: LoginData): Promise<void> => { const login = async (userInfo: LoginData): Promise<void> => {
console.log('login', userInfo);
const [err, res] = await to(loginApi(userInfo)); const [err, res] = await to(loginApi(userInfo));
if (res) { if (res) {
const data = res.data; const data = res.data;

View File

@ -76,8 +76,6 @@ const captchaEnabled = ref(true);
const register = ref(false); const register = ref(false);
const redirect = ref(undefined); const redirect = ref(undefined);
const loginRef = ref<ElFormInstance>(); const loginRef = ref<ElFormInstance>();
//
const tenantList = ref<TenantVO[]>([]);
watch(() => router.currentRoute.value, (newRoute: any) => { watch(() => router.currentRoute.value, (newRoute: any) => {
redirect.value = newRoute.query && newRoute.query.redirect; redirect.value = newRoute.query && newRoute.query.redirect;

View File

@ -69,7 +69,7 @@
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.status === '0' ? 'success' : 'danger'" disable-transitions> <el-tag :type="scope.row.status === '0' ? 'success' : 'danger'" disable-transitions>
{{ scope.row.status === '0' ? '正常' : '停用' }} {{ scope.row.status === '1' ? '正常' : '停用' }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -164,8 +164,8 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio value="0">正常</el-radio> <el-radio value="0">停用</el-radio>
<el-radio value="1">停用</el-radio> <el-radio value="1">正常</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -278,8 +278,8 @@ const queryFormRef = ref<ElFormInstance>();
const SysScaleFormRef = ref<ElFormInstance>(); const SysScaleFormRef = ref<ElFormInstance>();
const statusOptions = [ const statusOptions = [
{ label: '正常', value: 0 }, { label: '停用', value: 0 },
{ label: '停用', value: 1 } { label: '正常', value: 1 }
] ]
const dimensionTypeOptions = [ const dimensionTypeOptions = [

View File

@ -8,13 +8,6 @@
<el-input v-model="queryParams.factorName" placeholder="请输入因子名称" clearable style="width: 240px" <el-input v-model="queryParams.factorName" placeholder="请输入因子名称" clearable style="width: 240px"
@keyup.enter="handleQuery" /> @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="因子分计算公式" prop="formulaId" label-width="110px">
<el-select v-model="queryParams.formulaId" placeholder="请输入因子分计算公式" style="width: 240px"
@keyup.enter="handleQuery">
<el-option v-for="item in scaleFormulaList" :key="item.formulaId" :label="item.formulaName"
:value="item.formulaId" />
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@ -50,8 +43,12 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="因子名称" align="center" prop="factorName" /> <el-table-column label="因子名称" align="center" prop="factorName" />
<el-table-column label="所属量表" align="center" prop="scaleTitle" /> <el-table-column label="所属量表" align="center" prop="scaleTitle" />
<el-table-column label="分数范围及结果提示" align="center" prop="factorResult" /> <el-table-column label="计算规则" align="center" prop="ruleType">
<el-table-column label="因子分计算公式" align="center" prop="formulaName" /> <template #default="scope">
{{ getRuleType(scope.row) }}
</template>
</el-table-column>
<el-table-column label="权重" align="center" prop="weight" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top">
@ -78,26 +75,37 @@
<div class="title">基础信息</div> <div class="title">基础信息</div>
</div> </div>
</template> </template>
<el-row>
<el-col :span="8">
<el-form-item label="因子名称" prop="factorName"> <el-form-item label="因子名称" prop="factorName">
<el-input v-model="form.factorName" placeholder="请输入因子名称" /> <el-input v-model="form.factorName" placeholder="请输入因子名称" />
</el-form-item> </el-form-item>
<el-form-item label="分数范围及结果解释" prop="factorResult"> </el-col>
<el-input v-model="form.factorResult" placeholder="请输入分数范围及结果解释" :autosize="{ minRows: 5, maxRows: 10 }" <el-col :span="8">
type="textarea" /> <el-form-item label="计算规则" prop="ruleType">
</el-form-item> <el-select v-model="form.ruleType" placeholder="请输入计算规则" style="width: 100%">
<el-form-item label="计分公式" prop="formulaId"> <el-option v-for="item in ruleTypeList" :key="item.value" :label="item.label" :value="item.value" />
<el-select v-model="form.formulaId" placeholder="请输入计分公式" style="width: 100%">
<el-option v-for="item in scaleFormulaList" :key="item.formulaId" :label="item.formulaName"
:value="item.formulaId" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="权重" prop="weight">
<el-input-number v-model="form.weight" placeholder="请输入权重" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="选择题目" prop="questionIds"> <el-form-item label="选择题目" prop="questionIds">
<el-checkbox-group v-model="form.questionIds"> <el-checkbox-group v-model="form.questionIds">
<el-checkbox v-for="item in scaleQuestionList" :key="item.questionId" :label="item.questionOrder" <el-checkbox v-for="item in scaleQuestionList" :key="item.questionId" :label="item.questionOrder"
:value="item.questionId" /> :value="item.questionId" />
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-col>
</el-row>
</el-card> </el-card>
<el-card style="margin-top: 20px;"> <el-card style="margin-top: 20px;">
@ -173,14 +181,12 @@
</template> </template>
<script setup name="SysScaleFactor" lang="ts"> <script setup name="SysScaleFactor" lang="ts">
import {computed} from 'vue'
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { nanoid } from 'nanoid' import { nanoid } from 'nanoid'
import { listSysScaleFactor, getSysScaleFactor, delSysScaleFactor, addSysScaleFactor, updateSysScaleFactor } from '@/api/scale/SysScaleFactor'; import { listSysScaleFactor, getSysScaleFactor, delSysScaleFactor, addSysScaleFactor, updateSysScaleFactor } from '@/api/scale/SysScaleFactor';
import { SysScaleFactorVO, SysScaleFactorQuery, SysScaleFactorForm } from '@/api/scale/SysScaleFactor/types'; import { SysScaleFactorVO, SysScaleFactorQuery, SysScaleFactorForm } from '@/api/scale/SysScaleFactor/types';
import { listSysScaleFormula } from '@/api/scale/SysScaleFormula'
import { SysScaleFormulaVO } from '@/api/scale/SysScaleFormula/types';
import { listSysScaleQuestion } from '@/api/scale/SysScaleQuestion' import { listSysScaleQuestion } from '@/api/scale/SysScaleQuestion'
import { SysScaleQuestionVO } from '@/api/scale/SysScaleQuestion/types'; import { SysScaleQuestionVO } from '@/api/scale/SysScaleQuestion/types';
@ -267,6 +273,16 @@ const getList = async () => {
loading.value = false; loading.value = false;
} }
function getRuleType(row:any) {
if (row.ruleType === 0) {
return '求和型';
} else if (row.ruleType === 1) {
return '均值型';
} else {
return '求和取整';
}
}
/** 取消按钮 */ /** 取消按钮 */
const cancel = () => { const cancel = () => {
reset(); reset();
@ -356,11 +372,21 @@ const handleExport = () => {
}, `SysScaleFactor_${new Date().getTime()}.xlsx`) }, `SysScaleFactor_${new Date().getTime()}.xlsx`)
} }
const scaleFormulaList = ref<SysScaleFormulaVO[]>([]); const ruleTypeList = [
async function getScaleFormulaList() { {
const res = await listSysScaleFormula() label: '求和型',
scaleFormulaList.value = res.rows value: 0
},
{
label: '均值型',
value: 1
},
{
label: '求和取整',
value: 2
} }
]
const scaleQuestionList = ref<SysScaleQuestionVO[]>([]); const scaleQuestionList = ref<SysScaleQuestionVO[]>([]);
async function getScaleQuestionList() { async function getScaleQuestionList() {
@ -391,8 +417,6 @@ function handleRangeDelete(row: any) {
onMounted(() => { onMounted(() => {
getList(); getList();
getScaleFormulaList()
}); });
</script> </script>

View File

@ -61,7 +61,7 @@
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.status === 0 ? 'success' : 'danger'" disable-transitions> <el-tag :type="scope.row.status === 0 ? 'success' : 'danger'" disable-transitions>
{{ scope.row.status === 0 ? '正常' : '停用' }} {{ scope.row.status === 1 ? '正常' : '停用' }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>