幼儿评价对接完成
This commit is contained in:
+2
-1
@@ -54,7 +54,8 @@ export default {
|
||||
setScoreRules:'setScoreRules',
|
||||
facultyInformation:'facultyInformation',
|
||||
attendanceMachineEquipmentManagement:'attendanceMachineEquipmentManagement',
|
||||
recipe: 'recipe'
|
||||
recipe: 'recipe',
|
||||
evaluate: 'evaluate',
|
||||
},
|
||||
staticRoutes: {
|
||||
signIn: 'signIn',
|
||||
|
||||
@@ -54,7 +54,8 @@ export default {
|
||||
schoolAlbumManagement:'学校画册管理',
|
||||
facultyInformation:'教职工信息',
|
||||
attendanceMachineEquipmentManagement:'考勤机设备管理',
|
||||
recipe: '每周食谱'
|
||||
recipe: '每周食谱',
|
||||
evaluate: '幼儿评价表',
|
||||
|
||||
},
|
||||
staticRoutes: {
|
||||
|
||||
@@ -55,6 +55,7 @@ export default {
|
||||
deviceManagement:'人脸设备管理',
|
||||
attendanceMachineEquipmentManagement:'考勤機設備管理',
|
||||
recipe: '每周食谱',
|
||||
evaluate: '幼儿评价表',
|
||||
},
|
||||
staticRoutes: {
|
||||
signIn: '登入',
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 查询评价表列表
|
||||
export function getEvaluation () {
|
||||
return request({
|
||||
url: '/evaluation/form/list',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 添加评价表列表
|
||||
export function postEvaluation (data) {
|
||||
return request({
|
||||
url: '/evaluation/form',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改评价表列表
|
||||
export function putEvaluation (data) {
|
||||
return request({
|
||||
url: '/evaluation/form',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 查看详情问题
|
||||
export function getEvaluationById (data) {
|
||||
return request({
|
||||
url: '/evaluation/form/'+data,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 查看详情问题
|
||||
export function deleteEvaluationById (data) {
|
||||
return request({
|
||||
url: '/evaluation/form/' + data,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
export default [
|
||||
{
|
||||
label: "设备id",
|
||||
prop: "deviceId",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "账号名称",
|
||||
prop: "username",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
{
|
||||
label: "设备名称",
|
||||
prop: "deviceName",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "用户名",
|
||||
prop: "username",
|
||||
type: "image",
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
label: "设备标签",
|
||||
prop: "deviceLabel",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "设备地址",
|
||||
prop: "deviceUrl",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
label: "设备状态",
|
||||
prop: "deviceStatus",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
{
|
||||
label: "设备物理地址",
|
||||
prop: "macAddress",
|
||||
type: "text",
|
||||
},
|
||||
|
||||
]
|
||||
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button @click="newlyClick" type="primary" size="mini" icon="el-icon-plus"
|
||||
>新增幼儿评价表</el-button
|
||||
>
|
||||
|
||||
<!-- <el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan"
|
||||
>重置</el-button
|
||||
>
|
||||
<el-button @click="searchClick" type="warning" size="mini" icon="el-icon-search"
|
||||
>搜索</el-button
|
||||
> -->
|
||||
<el-input
|
||||
v-if="false"
|
||||
v-model="searchData"
|
||||
size="mini"
|
||||
style="width: 20%"
|
||||
placeholder="请输入搜索的关键字"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CommonHead",
|
||||
data() {
|
||||
return {
|
||||
searchData: "",
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
newlyClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("newly-data");
|
||||
},
|
||||
updateClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("update-data");
|
||||
},
|
||||
newlyTwoClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("newly-two-data");
|
||||
},
|
||||
updateTwoClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("update-two-data");
|
||||
},
|
||||
newlyClassClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("newly-class-data");
|
||||
},
|
||||
updateClassClick() {
|
||||
// 在此处调用父组件传入的方法叫父组件做事情
|
||||
this.$emit("update-class-data");
|
||||
},
|
||||
resetClick() {
|
||||
this.$emit("reset-data");
|
||||
},
|
||||
searchClick() {
|
||||
this.$emit("search-data", this.searchData);
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<el-table
|
||||
border
|
||||
:header-cell-style="{
|
||||
background: '#f5f7fa',
|
||||
}"
|
||||
:data="tableData"
|
||||
style="width: 100%; margin-top: 20px"
|
||||
height="650"
|
||||
size="mini"
|
||||
>
|
||||
<el-table-column
|
||||
v-if="
|
||||
column.label !== 'id' &&
|
||||
column.label !== '审批人Id' &&
|
||||
column.label !== '抄送人Id'
|
||||
"
|
||||
v-for="(column, index) in tableColumns"
|
||||
:key="index"
|
||||
:prop="column.prop"
|
||||
:label="column.label"
|
||||
width="auto"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="column.type === 'text'"> {{ scope.row[column.prop] }}</span>
|
||||
<div v-else-if="column.type === 'image'">
|
||||
<img style="width: 200px; height: 100px" :src="scope.row[column.prop]" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@click="handleEdit(scope.row)"
|
||||
class="el-icon-edit"
|
||||
type="text"
|
||||
size="small"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-popconfirm @confirm="handleDelete(scope.row)" :title="'确定要删除吗?'">
|
||||
<el-button
|
||||
slot="reference"
|
||||
style="margin-left: 10px; color: red"
|
||||
class="el-icon-delete"
|
||||
type="text"
|
||||
size="small"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "CommonTablesImg",
|
||||
props: {
|
||||
columns: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
deleteFunc: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
editFunc: {
|
||||
type: Function,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
// 删除事件
|
||||
handleDelete(row) {
|
||||
this.deleteFunc(row.id);
|
||||
},
|
||||
// 编辑事件
|
||||
handleEdit(row) {
|
||||
console.log(row);
|
||||
this.editFunc(row);
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
tableColumns() {
|
||||
// 处理传进来的列配置,返回符合 Element UI 表格要求的配置
|
||||
return this.columns.map((column) => {
|
||||
return {
|
||||
label: column.label,
|
||||
prop: column.prop,
|
||||
type: column.type,
|
||||
};
|
||||
});
|
||||
},
|
||||
tableData() {
|
||||
// 处理传进来的数据,返回符合 Element UI 表格要求的数据
|
||||
return this.data.map((rowData) => {
|
||||
let row = {};
|
||||
for (let column of this.columns) {
|
||||
row[column.prop] = rowData[column.prop];
|
||||
}
|
||||
return row;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="form-adapt-container">
|
||||
<el-card shadow="hover">
|
||||
<CommonHead
|
||||
@newly-data="onClickAdd"
|
||||
></CommonHead>
|
||||
<!-- newly-data删除所选事件 -->
|
||||
<!-- reset-data重置表单内容 -->
|
||||
<!-- search-data搜索事件,接收被搜索的内容 -->
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="hover" style=" margin-top: 20px;" >
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:row-style="{ height: '50px' }"
|
||||
border
|
||||
>
|
||||
<el-table-column label="评价表标题">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.evaluateTitle }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="total" label="评价分值" />
|
||||
<!-- <el-table-column label="评价问题">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="(item, index) in scope.row.evaluateContent" :key="index">
|
||||
{{ item.question }}</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@click="onClickLook(scope.row)"
|
||||
type="text"
|
||||
size="small"
|
||||
>查看问题</el-button
|
||||
>
|
||||
<el-button
|
||||
@click="handleEdit(scope.row)"
|
||||
class="el-icon-edit"
|
||||
type="text"
|
||||
size="small"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-popconfirm @confirm="onClickDelete(scope.row)" :title="'确定要删除吗?'">
|
||||
<el-button
|
||||
slot="reference"
|
||||
style="margin-left: 10px; color: red"
|
||||
class="el-icon-delete"
|
||||
type="text"
|
||||
size="small"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
</el-table>
|
||||
|
||||
</el-card>
|
||||
<Pagination
|
||||
:total="total"
|
||||
:pageNum="query.pageNum"
|
||||
:pageSize="query.pageSize"
|
||||
@clickCurrent="onClickCurrent"
|
||||
@clickSize="onClickSize"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog :title="formTitle" :visible.sync="dialogVisible">
|
||||
<el-form ref="form" label-width="100px">
|
||||
<el-form-item label="评价表标题">
|
||||
<el-input v-model="form.evaluateTitle"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="问题分值">
|
||||
<el-input type="number" v-model="form.total"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-for="(item, index) in form.evaluateContent" :label="'问题' + (index + 1)">
|
||||
<div style="display: flex;">
|
||||
<el-input v-model="item.question"></el-input>
|
||||
<el-button @click="onClickAddRemoveQuestion(index)" icon="el-icon-delete" circle style="margin-left: 5px;"></el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div></div>
|
||||
</el-form>
|
||||
<el-button @click="onClickAddQuestion" type="primary" icon="el-icon-plus" >添加问题</el-button>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onClickSubmit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="isLook">
|
||||
<el-form ref="lookform" label-width="100px">
|
||||
<el-form-item label="评价表标题">
|
||||
<p>{{ lookform.evaluateTitle }}</p>
|
||||
</el-form-item>
|
||||
<el-form-item label="问题分值">
|
||||
<p>{{ lookform.total + '分'}}</p>
|
||||
</el-form-item>
|
||||
<el-form-item v-for="(item, index) in lookform.evaluateContent" :label="'问题' + (index + 1)">
|
||||
<p>{{ item.question }}</p>
|
||||
</el-form-item>
|
||||
<div></div>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import columns from "./columns";
|
||||
import { getEvaluation, postEvaluation, getEvaluationById, putEvaluation, deleteEvaluationById } from "./api";
|
||||
import { formatDate } from "@/com/index";
|
||||
import CommonHead from './components/CommonHead.vue'
|
||||
|
||||
export default {
|
||||
name: "deviceManagement",
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
total: 0,
|
||||
query: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
loading: false,
|
||||
dialogVisible: false,
|
||||
isLook: false,
|
||||
lookform: {},
|
||||
form: {
|
||||
evaluateTitle: undefined,
|
||||
evaluateContent: [
|
||||
{
|
||||
question: "",
|
||||
point: 0,
|
||||
}
|
||||
],
|
||||
total: undefined,
|
||||
},
|
||||
tableData: [],
|
||||
formTitle: "新增评价表",
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CommonHead,
|
||||
},
|
||||
async created() {
|
||||
this.evaluationList();
|
||||
},
|
||||
methods: {
|
||||
// 删除
|
||||
onClickDelete(row) {
|
||||
deleteEvaluationById(row.id).then(() => {
|
||||
this.evaluationList();
|
||||
this.$message.success("删除成功");
|
||||
});
|
||||
},
|
||||
// 修改
|
||||
handleEdit(row) {
|
||||
this.formTitle = "修改评价表"
|
||||
this.resetForm()
|
||||
getEvaluationById(row.id).then((res) => {
|
||||
console.log(res)
|
||||
this.form = res.data
|
||||
res.data.evaluateContent ? this.form.evaluateContent = JSON.parse(res.data.evaluateContent) : ''
|
||||
this.dialogVisible = true
|
||||
});
|
||||
},
|
||||
//查看
|
||||
onClickLook (row) {
|
||||
getEvaluationById(row.id).then((res) => {
|
||||
console.log(res)
|
||||
this.lookform = res.data
|
||||
res.data.evaluateContent ? this.lookform.evaluateContent = JSON.parse(res.data.evaluateContent) : ''
|
||||
this.isLook = true
|
||||
});
|
||||
},
|
||||
// 验证表单方法
|
||||
validateForm() {
|
||||
const validations = [
|
||||
{ condition: this.form.evaluateTitle, message: "请输入评价表标题" },
|
||||
{ condition: this.form.total, message: "请输入评价总分" },
|
||||
{ condition: this.form.evaluateContent.length !== 0, message: "请输入问题" },
|
||||
{ condition: !this.form.evaluateContent.some((item) => !item.question), message: "请输入问题" },
|
||||
];
|
||||
|
||||
for (let validation of validations) {
|
||||
if (!validation.condition) {
|
||||
this.$message.error(validation.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 提交表单
|
||||
onClickSubmit() {
|
||||
if (this.validateForm()) {
|
||||
let obj = { ...this.form }
|
||||
obj.evaluateContent = JSON.stringify(obj.evaluateContent);
|
||||
obj.total = Math.abs(obj.total);
|
||||
if( this.formTitle === "修改评价表"){
|
||||
putEvaluation(obj).then(() => {
|
||||
this.evaluationList();
|
||||
this.$message.success("修改成功");
|
||||
this.dialogVisible = false;
|
||||
});
|
||||
}else if( this.formTitle === "新增评价表"){
|
||||
postEvaluation(obj).then(() => {
|
||||
this.evaluationList();
|
||||
this.$message.success("新增成功");
|
||||
this.dialogVisible = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// 添加问题
|
||||
onClickAddQuestion() {
|
||||
this.form.evaluateContent.push({ question: "", point: 0 });
|
||||
},
|
||||
// 删除问题
|
||||
onClickAddRemoveQuestion(index) {
|
||||
this.form.evaluateContent.splice(index, 1);
|
||||
},
|
||||
// 获取评价表
|
||||
evaluationList() {
|
||||
getEvaluation(this.query).then((res) => {
|
||||
this.total = res.total;
|
||||
this.tableData = res.data.map((item) => {
|
||||
item.evaluateContent ? item.evaluateContent = JSON.parse(item.evaluateContent) : ''
|
||||
return item
|
||||
});
|
||||
});
|
||||
},
|
||||
// 点击新增
|
||||
onClickAdd() {
|
||||
this.resetForm()
|
||||
this.dialogVisible = true
|
||||
this.formTitle = "新增评价表"
|
||||
},
|
||||
onClickCurrent(val) {
|
||||
this.query.pageNum = val;
|
||||
this.evaluationList();
|
||||
},
|
||||
// 点击了每页页数
|
||||
onClickSize(val) {
|
||||
this.query.pageSize = val;
|
||||
this.evaluationList();
|
||||
},
|
||||
// 重置
|
||||
resetForm() {
|
||||
this.form = {
|
||||
evaluateTitle: undefined,
|
||||
evaluateContent: [
|
||||
{
|
||||
question: "",
|
||||
point: 0,
|
||||
}
|
||||
],
|
||||
total: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.material-list{
|
||||
width: 100%;
|
||||
.top-box{
|
||||
display: flex;
|
||||
}
|
||||
.label{
|
||||
display: flex; flex: 1; align-items: center;
|
||||
height: 36px;
|
||||
}
|
||||
.delete-box{
|
||||
width: 30px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.content::-webkit-scrollbar {
|
||||
width: 0; /* 设置滚动条的宽度 */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user