diff --git a/.env.development b/.env.development index 15aa236..27e6c4b 100644 --- a/.env.development +++ b/.env.development @@ -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 diff --git a/.env.production b/.env.production index c9cd8b7..5b75fba 100644 --- a/.env.production +++ b/.env.production @@ -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 diff --git a/package-lock.json b/package-lock.json index 350af68..4612a5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 0e90494..0c62cb9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/view/hospital/index.vue b/src/view/hospital/index.vue index 104a09c..54c1374 100644 --- a/src/view/hospital/index.vue +++ b/src/view/hospital/index.vue @@ -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) {
{{ scope.row.notes.length }}项
- + @@ -359,20 +380,8 @@ function beforeUploadImg(i) { @@ -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" /> @@ -404,7 +412,9 @@ function beforeUploadImg(i) {
- + + +
{{ i + 1 }} .
@@ -419,10 +429,12 @@ function beforeUploadImg(i) { :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" - @click="beforeUploadImg(i)" - > + @click="beforeUploadImg(i)">
- +
@@ -435,40 +447,78 @@ function beforeUploadImg(i) {
注意时间
- +
- + + +
- +
- + + +
{{ i + 1 }} .
-
须知事项
+
待办事项
- + +
+
+
+
用药频率
+
+ +
+
+
+
待办状态
+
+ + + + +
+
+
+
提醒时间
+
+
+ +
+ + + +
+
+
+ + + +
- + + +
@@ -483,6 +533,16 @@ function beforeUploadImg(i) {