fix: 待办事项
This commit is contained in:
parent
f57e22d74f
commit
e67b03d8a7
@ -2,7 +2,8 @@ ENV = 'development'
|
||||
VITE_CLI_PORT = 8088
|
||||
VITE_SERVER_PORT = 8888
|
||||
VITE_BASE_API = /api
|
||||
VITE_BASE_PATH = https://api.jimingyiliao.com/
|
||||
// VITE_BASE_PATH = https://api.jimingyiliao.com/
|
||||
VITE_BASE_PATH = https://367a21fd.r12.cpolar.top
|
||||
VITE_EDITOR = vscode
|
||||
// VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm
|
||||
// 如果使用docker-compose开发模式,设置为下面的地址或本机主机IP
|
||||
|
@ -4,5 +4,5 @@ VITE_CLI_PORT = 8080
|
||||
VITE_SERVER_PORT = 8888
|
||||
VITE_BASE_API = /api
|
||||
#下方修改为你的线上ip
|
||||
VITE_BASE_PATH = http://36b924d2.r12.cpolar.top
|
||||
VITE_BASE_PATH = https://api.jimingyiliao.com/
|
||||
//VITE_BASE_PATH = http://36b924d2.r12.cpolar.top
|
||||
|
1
package-lock.json
generated
1
package-lock.json
generated
@ -19,6 +19,7 @@
|
||||
"element-plus": "2.2.9",
|
||||
"highlight.js": "^10.6.0",
|
||||
"js-cookie": "^3.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^2.0.0",
|
||||
"mitt": "^3.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"element-plus": "2.2.9",
|
||||
"highlight.js": "^10.6.0",
|
||||
"js-cookie": "^3.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^2.0.0",
|
||||
"mitt": "^3.0.0",
|
||||
"nprogress": "^0.2.0",
|
||||
|
@ -129,8 +129,12 @@ const handleSelectionChange = (val) => {
|
||||
}
|
||||
function editFunc(row) {
|
||||
form.value = _.cloneDeep(row)
|
||||
console.log(form.value)
|
||||
todo_list.value = form.value.todos
|
||||
// console.log(form.value)
|
||||
// 提醒时间用逗号分隔为数组
|
||||
todo_list.value = _.cloneDeep(form.value.todos)
|
||||
for (const item of todo_list.value) {
|
||||
item.remindTime = item.remindTime.split(',')
|
||||
}
|
||||
note_list.value = form.value.notes
|
||||
openDialog('edit')
|
||||
}
|
||||
@ -164,14 +168,10 @@ function handleSizeChange(val) {
|
||||
}
|
||||
function closeDialog() {
|
||||
dialogFormVisible.value = false
|
||||
// question_form.value = {
|
||||
// options: [],
|
||||
// answer: '',
|
||||
// title: ''
|
||||
// }
|
||||
todo_list.value = []
|
||||
note_list.value = []
|
||||
form.value = {}
|
||||
resetForm()
|
||||
}
|
||||
async function enterDialog() { // 提交
|
||||
await apiForm.value.validate(async(valid, fields) => {
|
||||
@ -181,7 +181,13 @@ async function enterDialog() { // 提交
|
||||
if (form.value.ID) { // 编辑
|
||||
func_name = 'editHospital'
|
||||
}
|
||||
form.value.todos = todo_list.value
|
||||
form.value.todos = _.cloneDeep(todo_list.value)
|
||||
// 提醒时间用逗号分隔
|
||||
for (const item of form.value.todos) {
|
||||
if (Array.isArray(item.remindTime)) {
|
||||
item.remindTime = item.remindTime.join(',')
|
||||
}
|
||||
}
|
||||
// 新参数
|
||||
for (const item of note_list.value) {
|
||||
for (let i = 0; i < time_options.value.length; i++) {
|
||||
@ -192,6 +198,7 @@ async function enterDialog() { // 提交
|
||||
}
|
||||
}
|
||||
form.value.notes = note_list.value
|
||||
// console.log(form.value);return
|
||||
const res = await api[func_name](form.value)
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
@ -206,27 +213,41 @@ async function enterDialog() { // 提交
|
||||
}
|
||||
})
|
||||
}
|
||||
function addRowFunc(type) {
|
||||
const resetForm = () => {
|
||||
apiForm.value.resetFields()
|
||||
}
|
||||
function addRowFunc(type, child_index = null) {
|
||||
// {
|
||||
// content: '',
|
||||
// notes_time: ''
|
||||
// }
|
||||
if (type === 1) {
|
||||
if (type === 1) { // 注意事项
|
||||
note_list.value.push({
|
||||
content: '',
|
||||
notes_time: ''
|
||||
})
|
||||
} else {
|
||||
todo_list.value.push({
|
||||
content: ''
|
||||
})
|
||||
} else { // 待办事项
|
||||
if (child_index != null) {
|
||||
todo_list.value[child_index].remindTime.push(0)
|
||||
} else {
|
||||
todo_list.value.push({
|
||||
content: '',
|
||||
remindPeriod: 0,
|
||||
frequency: '', // 用药频率
|
||||
remindTime: []
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
function del_ro_func(i, type) {
|
||||
function del_ro_func(i, type, child_index = null) {
|
||||
if (type === 1) {
|
||||
note_list.value.splice(i, 1)
|
||||
} else {
|
||||
todo_list.value.splice(i, 1)
|
||||
if (child_index != null) {
|
||||
todo_list.value[i].remindTime.splice(child_index, 1)
|
||||
} else {
|
||||
todo_list.value.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 图片上传
|
||||
@ -345,7 +366,7 @@ function beforeUploadImg(i) {
|
||||
<div>{{ scope.row.notes.length }}项</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="须知事项" min-width="150">
|
||||
<el-table-column align="center" label="待办事项" min-width="150">
|
||||
<template #default="scope">
|
||||
<div>{{ scope.row.todos.length }}项</div>
|
||||
</template>
|
||||
@ -359,20 +380,8 @@ function beforeUploadImg(i) {
|
||||
</el-table-column>
|
||||
<el-table-column align="left" fixed="right" label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="edit"
|
||||
size="small"
|
||||
type="primary"
|
||||
link
|
||||
@click="editFunc(scope.row)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
icon="delete"
|
||||
size="small"
|
||||
type="danger"
|
||||
link
|
||||
@click="deleteFunc(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button icon="edit" size="small" type="primary" link @click="editFunc(scope.row)">编辑</el-button>
|
||||
<el-button icon="delete" size="small" type="danger" link @click="deleteFunc(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -384,8 +393,7 @@ function beforeUploadImg(i) {
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -404,7 +412,9 @@ function beforeUploadImg(i) {
|
||||
<div class="item-card-box" style="flex:1">
|
||||
<div v-for="(item, i) in note_list" :key="i" class="item-card">
|
||||
<div class="del-row-btn" @click="del_ro_func(i,1)">
|
||||
<el-icon><Close /></el-icon>
|
||||
<el-icon>
|
||||
<Close />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="ic-left">{{ i + 1 }} . </div>
|
||||
<div class="ic-right">
|
||||
@ -419,10 +429,12 @@ function beforeUploadImg(i) {
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
@click="beforeUploadImg(i)"
|
||||
>
|
||||
@click="beforeUploadImg(i)">
|
||||
<div v-if="uploading_form.uploading" class="progress-box">
|
||||
<el-progress class="progress-item" :percentage="uploading_form.percentage" :status="uploading_form.progressStatus" />
|
||||
<el-progress
|
||||
class="progress-item"
|
||||
:percentage="uploading_form.percentage"
|
||||
:status="uploading_form.progressStatus" />
|
||||
</div>
|
||||
<img v-if="item.content" :src="item.content" class="img-container">
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
@ -435,40 +447,78 @@ function beforeUploadImg(i) {
|
||||
<div class="icr-left">注意时间</div>
|
||||
<div class="icr-right">
|
||||
<el-select v-model="item.notes_time" class="m-2" placeholder="选择注意时间" size="large">
|
||||
<el-option
|
||||
v-for="(item2, i) in time_options"
|
||||
:key="i"
|
||||
:label="item2"
|
||||
:value="item2"
|
||||
/>
|
||||
<el-option v-for="(item2, i) in time_options" :key="i" :label="item2" :value="item2" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-row-btn" style="text-align: center;cursor: pointer;" @click="addRowFunc(1)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="须知事项" prop="notes">
|
||||
<el-form-item label="待办事项" prop="notes">
|
||||
<div class="item-card-box" style="flex:1">
|
||||
<div v-for="(item, i) in todo_list" :key="i" class="item-card">
|
||||
<div class="del-row-btn" @click="del_ro_func(i,2)">
|
||||
<el-icon><Close /></el-icon>
|
||||
<el-icon>
|
||||
<Close />
|
||||
</el-icon>
|
||||
</div>
|
||||
<div class="ic-left">{{ i + 1 }} . </div>
|
||||
<div class="ic-right">
|
||||
<div class="ic-right-row">
|
||||
<div class="icr-left">须知事项</div>
|
||||
<div class="icr-left">待办事项</div>
|
||||
<div class="icr-right">
|
||||
<el-input v-model="item.content" autosize type="textarea" />
|
||||
<el-input v-model="item.content" placeholder="请输入事项内容" autosize type="textarea" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ic-right-row">
|
||||
<div class="icr-left">用药频率</div>
|
||||
<div class="icr-right">
|
||||
<el-input v-model="item.frequency" placeholder="比如一天3次 一天4次" autosize type="textarea" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="ic-right-row">
|
||||
<div class="icr-left">待办状态</div>
|
||||
<div class="icr-right">
|
||||
<el-select v-model="item.remindPeriod" placeholder="请选择待办状态">
|
||||
<el-option label="手术前" :value="0" />
|
||||
<el-option label="手术后" :value="1" />
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ic-right-row ic-right-row2">
|
||||
<div class="icr-left">提醒时间</div>
|
||||
<div class="icr-right">
|
||||
<div v-for="(item_l, il) in item.remindTime" :key="il" class="loop_card">
|
||||
<el-time-picker
|
||||
v-model="item.remindTime[il]"
|
||||
value-format="HH:mm"
|
||||
placeholder="请选择时间"
|
||||
style="width: 100%;position: relative;" />
|
||||
<div class="del-row-btn" @click="del_ro_func(i, 2, il)">
|
||||
<el-icon>
|
||||
<Close />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-row-btn" style="text-align: center;cursor: pointer;" @click="addRowFunc(2,i)">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-row-btn" style="text-align: center;cursor: pointer;" @click="addRowFunc(2)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@ -483,6 +533,16 @@ function beforeUploadImg(i) {
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.loop_card{
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
.del-row-btn{
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
.ic-right-row2{
|
||||
align-items: unset !important;
|
||||
}
|
||||
.progress-box{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
|
Loading…
Reference in New Issue
Block a user