From 687a6539ee819360370426c2c0013eb143228582 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期三, 16 七月 2025 16:35:09 +0800 Subject: [PATCH] 1 --- src/views/hosp/commonAdvice/index.vue | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 234 insertions(+), 0 deletions(-) diff --git a/src/views/hosp/commonAdvice/index.vue b/src/views/hosp/commonAdvice/index.vue new file mode 100644 index 0000000..e5769c8 --- /dev/null +++ b/src/views/hosp/commonAdvice/index.vue @@ -0,0 +1,234 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鏍囬" prop="bt"> + <el-input v-model="queryParams.bt" placeholder="璇疯緭鍏ユ爣棰�" clearable @keyup.enter.native="handleQuery" /> + </el-form-item> + <el-form-item label="寤鸿" prop="nr"> + <el-input v-model="queryParams.nr" placeholder="璇疯緭鍏ユ鏌ラ」鐩�" clearable @keyup.enter.native="handleQuery" /> + </el-form-item> + + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button type="primary" size="mini" @click="proposalChange">鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button type="primary" size="mini" @click="handleDelete">鎵归噺鍒犻櫎</el-button> + </el-col> + + </el-row> + + <el-table :data="dataList" ref="elTable" v-loading="loading" @selection-change="handleSelectionChange" border + height="580px"> + <el-table-column type="selection" width="40" align="center" /> + <el-table-column label="搴忓彿" width="70" align="center" prop="newID" /> + <el-table-column label="鏍囬" width="120" align="center" prop="title" /> + <el-table-column label="寤鸿鍐呭" align="left" prop="advice" /> + <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width" width="100px"> + <template slot-scope="scope"> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)" title="淇敼"></el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" + title="鍒犻櫎"></el-button> + </template> + </el-table-column> + </el-table> + + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.pageSize" + @pagination="getList" /> + + <!-- 淇敼蹇�熷缓璁爣棰樺拰鍐呭 --> + <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false"> + <el-form ref="form" :model="form" label-width="80px" :inline="true"> + <el-form-item label="鏍囬" prop="title"> + <el-input v-model="form.title" placeholder="璇疯緭鍏ユ爣棰�" style="width: 200px" /> + </el-form-item> + <el-form-item label="鍐呭" prop="advice"> + <el-input v-model="form.advice" type="textarea" placeholder="璇疯緭鍏ヤ富瑕佸唴瀹�" style="width: 780px" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { + updateAdvice, + addAdvice, + getAdvice, + delAdvice, + delCyremove +} from "@/api/advice/advice"; +import { + addCyTjAdvice, +} from "@/api/system/biaoqianzidian"; +import { + getKjTjAdviceKjbqBySex, + getCyTjAdviceKjbqBySex, +} from "@/api/hosp/project"; +import { getInfo } from "@/api/login"; + +export default { + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + // 鎬绘潯鏁� + total: 0, + // 浣撴椤圭洰寤鸿瑙勫垯鏂拌〃琛ㄦ牸鏁版嵁 + dataList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + showSearch: true, + // 鏌ヨ鍙傛暟 + queryParams: { + page: 1, + pageSize: 10, + bt: "", + nr: "", + isZj: "", + userId: "", + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ浣撴椤圭洰寤鸿瑙勫垯鏂拌〃鍒楄〃 */ + getList() { + this.loading = true; + getInfo().then((res) => { + this.queryParams.userId = res.user.userId; + this.queryParams.isZj = null; + getCyTjAdviceKjbqBySex(this.queryParams).then((res) => { + if (res.data) { + this.dataList = res.data.records.map((item, index) => ({ + ...item, + newID: + (this.queryParams.page - 1) * this.queryParams.pageSize + + index + + 1, + })); + this.total = res.data.total; + } else { + this.dataList = []; + this.total = 0; + this.$modal.msgError(res.msg); + } + this.loading = false; + }); + }); + }, + + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + proposalChange() { + this.reset(); + this.open = true; + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + title: null, + advice: null, + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.page = 1; + this.$forceUpdate(); + this.getList(); + }, + + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map((item) => item.id); + this.single = selection.length !== 1; + this.multiple = !selection.length; + }, + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + if (this.form.id != null) { + updateAdvice(this.form).then((response) => { + console.log(response, 1111333); + + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + // addAdvice(this.form).then((response) => { + // this.$modal.msgSuccess("鏂板鎴愬姛"); + // this.open = false; + // this.getList(); + // }); + addCyTjAdvice(this.form).then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + handleEdit(row) { + this.reset(); + const id = row.id || this.ids; + this.kjbq = []; + getAdvice(id).then((response) => { + this.form = response.data; + this.open = true; + // this.form.deptId = this.queryParams.deptId; + this.title = "浣撴寤鸿淇℃伅缁存姢"; + }); + }, + handleDelete(row) { + let idss = this.ids + '' + const ids = row.id || idss; // 鑾峰彇涓婚敭鍊硷紝濡傛灉row涓病鏈変富閿�硷紝鍒欎娇鐢╰his.ids + this.$modal + .confirm(`鏄惁纭鍒犻櫎"${ids}"鐨勬暟鎹」锛焋) + .then(() => { + return delCyremove(ids); // 璋冪敤鍒犻櫎鎺ュ彛锛屼紶鍏ヤ富閿�� + }) + .then(() => { + this.getList(); // 鍒犻櫎鎴愬姛鍚庡埛鏂板垪琛� + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); // 鏄剧ず鍒犻櫎鎴愬姛鐨勬彁绀� + }) + .catch(() => { + // 寮傚父澶勭悊 + }); + }, + }, +}; +</script> \ No newline at end of file -- Gitblit v1.8.0