index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="患者姓名" prop="patientName">
  5. <el-input
  6. v-model="queryParams.patientName"
  7. placeholder="请输入患者姓名"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="所属会员" prop="userId">
  14. <el-input
  15. v-model="queryParams.userId"
  16. placeholder="请输入所属会员"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="身份证号" prop="idCard">
  23. <el-input
  24. v-model="queryParams.idCard"
  25. placeholder="请输入身份证号"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="出生年月" prop="birthday">
  32. <el-date-picker clearable size="small" style="width: 200px"
  33. v-model="queryParams.birthday"
  34. type="date"
  35. value-format="yyyy-MM-dd"
  36. placeholder="选择出生年月">
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item label="性中坚力量" prop="gender">
  40. <el-input
  41. v-model="queryParams.gender"
  42. placeholder="请输入性中坚力量"
  43. clearable
  44. size="small"
  45. @keyup.enter.native="handleQuery"
  46. />
  47. </el-form-item>
  48. <el-form-item label="状态 1正常 2禁用" prop="status">
  49. <el-select v-model="queryParams.status" placeholder="请选择状态 1正常 2禁用" clearable size="small">
  50. <el-option label="请选择字典生成" value="" />
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="是否删除 " prop="isDel">
  54. <el-input
  55. v-model="queryParams.isDel"
  56. placeholder="请输入是否删除 "
  57. clearable
  58. size="small"
  59. @keyup.enter.native="handleQuery"
  60. />
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  64. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  65. </el-form-item>
  66. </el-form>
  67. <el-row :gutter="10" class="mb8">
  68. <el-col :span="1.5">
  69. <el-button
  70. type="primary"
  71. icon="el-icon-plus"
  72. size="mini"
  73. @click="handleAdd"
  74. v-hasPermi="['store:patient:add']"
  75. >新增</el-button>
  76. </el-col>
  77. <el-col :span="1.5">
  78. <el-button
  79. type="success"
  80. icon="el-icon-edit"
  81. size="mini"
  82. :disabled="single"
  83. @click="handleUpdate"
  84. v-hasPermi="['store:patient:edit']"
  85. >修改</el-button>
  86. </el-col>
  87. <el-col :span="1.5">
  88. <el-button
  89. type="danger"
  90. icon="el-icon-delete"
  91. size="mini"
  92. :disabled="multiple"
  93. @click="handleDelete"
  94. v-hasPermi="['store:patient:remove']"
  95. >删除</el-button>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-button
  99. type="warning"
  100. icon="el-icon-download"
  101. size="mini"
  102. @click="handleExport"
  103. v-hasPermi="['store:patient:export']"
  104. >导出</el-button>
  105. </el-col>
  106. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  107. </el-row>
  108. <el-table v-loading="loading" :data="patientList" @selection-change="handleSelectionChange">
  109. <el-table-column type="selection" width="55" align="center" />
  110. <el-table-column label="ID" align="center" prop="patientId" />
  111. <el-table-column label="患者姓名" align="center" prop="patientName" />
  112. <el-table-column label="所属会员" align="center" prop="userId" />
  113. <el-table-column label="身份证号" align="center" prop="idCard" />
  114. <el-table-column label="出生年月" align="center" prop="birthday" width="180">
  115. <template slot-scope="scope">
  116. <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="性中坚力量" align="center" prop="gender" />
  120. <el-table-column label="状态 1正常 2禁用" align="center" prop="status" />
  121. <el-table-column label="是否删除 " align="center" prop="isDel" />
  122. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  123. <template slot-scope="scope">
  124. <el-button
  125. size="mini"
  126. type="text"
  127. icon="el-icon-edit"
  128. @click="handleUpdate(scope.row)"
  129. v-hasPermi="['store:patient:edit']"
  130. >修改</el-button>
  131. <el-button
  132. size="mini"
  133. type="text"
  134. icon="el-icon-delete"
  135. @click="handleDelete(scope.row)"
  136. v-hasPermi="['store:patient:remove']"
  137. >删除</el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <pagination
  142. v-show="total>0"
  143. :total="total"
  144. :page.sync="queryParams.pageNum"
  145. :limit.sync="queryParams.pageSize"
  146. @pagination="getList"
  147. />
  148. <!-- 添加或修改病人对话框 -->
  149. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  150. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  151. <el-form-item label="患者姓名" prop="patientName">
  152. <el-input v-model="form.patientName" placeholder="请输入患者姓名" />
  153. </el-form-item>
  154. <el-form-item label="所属会员" prop="userId">
  155. <el-input v-model="form.userId" placeholder="请输入所属会员" />
  156. </el-form-item>
  157. <el-form-item label="身份证号" prop="idCard">
  158. <el-input v-model="form.idCard" placeholder="请输入身份证号" />
  159. </el-form-item>
  160. <el-form-item label="出生年月" prop="birthday">
  161. <el-date-picker clearable size="small" style="width: 200px"
  162. v-model="form.birthday"
  163. type="date"
  164. value-format="yyyy-MM-dd"
  165. placeholder="选择出生年月">
  166. </el-date-picker>
  167. </el-form-item>
  168. <el-form-item label="性中坚力量" prop="gender">
  169. <el-input v-model="form.gender" placeholder="请输入性中坚力量" />
  170. </el-form-item>
  171. <el-form-item label="状态 1正常 2禁用">
  172. <el-radio-group v-model="form.status">
  173. <el-radio label="1">请选择字典生成</el-radio>
  174. </el-radio-group>
  175. </el-form-item>
  176. <el-form-item label="是否删除 " prop="isDel">
  177. <el-input v-model="form.isDel" placeholder="请输入是否删除 " />
  178. </el-form-item>
  179. </el-form>
  180. <div slot="footer" class="dialog-footer">
  181. <el-button type="primary" @click="submitForm">确 定</el-button>
  182. <el-button @click="cancel">取 消</el-button>
  183. </div>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import { listPatient, getPatient, delPatient, addPatient, updatePatient, exportPatient } from "@/api/store/patient";
  189. export default {
  190. name: "Patient",
  191. data() {
  192. return {
  193. // 遮罩层
  194. loading: true,
  195. // 选中数组
  196. ids: [],
  197. // 非单个禁用
  198. single: true,
  199. // 非多个禁用
  200. multiple: true,
  201. // 显示搜索条件
  202. showSearch: true,
  203. // 总条数
  204. total: 0,
  205. // 病人表格数据
  206. patientList: [],
  207. // 弹出层标题
  208. title: "",
  209. // 是否显示弹出层
  210. open: false,
  211. // 查询参数
  212. queryParams: {
  213. pageNum: 1,
  214. pageSize: 10,
  215. patientName: null,
  216. userId: null,
  217. idCard: null,
  218. birthday: null,
  219. gender: null,
  220. status: null,
  221. isDel: null
  222. },
  223. // 表单参数
  224. form: {},
  225. // 表单校验
  226. rules: {
  227. }
  228. };
  229. },
  230. created() {
  231. this.getList();
  232. },
  233. methods: {
  234. /** 查询病人列表 */
  235. getList() {
  236. this.loading = true;
  237. listPatient(this.queryParams).then(response => {
  238. this.patientList = response.rows;
  239. this.total = response.total;
  240. this.loading = false;
  241. });
  242. },
  243. // 取消按钮
  244. cancel() {
  245. this.open = false;
  246. this.reset();
  247. },
  248. // 表单重置
  249. reset() {
  250. this.form = {
  251. patientId: null,
  252. patientName: null,
  253. userId: null,
  254. idCard: null,
  255. birthday: null,
  256. gender: null,
  257. status: 0,
  258. isDel: null
  259. };
  260. this.resetForm("form");
  261. },
  262. /** 搜索按钮操作 */
  263. handleQuery() {
  264. this.queryParams.pageNum = 1;
  265. this.getList();
  266. },
  267. /** 重置按钮操作 */
  268. resetQuery() {
  269. this.resetForm("queryForm");
  270. this.handleQuery();
  271. },
  272. // 多选框选中数据
  273. handleSelectionChange(selection) {
  274. this.ids = selection.map(item => item.patientId)
  275. this.single = selection.length!==1
  276. this.multiple = !selection.length
  277. },
  278. /** 新增按钮操作 */
  279. handleAdd() {
  280. this.reset();
  281. this.open = true;
  282. this.title = "添加病人";
  283. },
  284. /** 修改按钮操作 */
  285. handleUpdate(row) {
  286. this.reset();
  287. const patientId = row.patientId || this.ids
  288. getPatient(patientId).then(response => {
  289. this.form = response.data;
  290. this.open = true;
  291. this.title = "修改病人";
  292. });
  293. },
  294. /** 提交按钮 */
  295. submitForm() {
  296. this.$refs["form"].validate(valid => {
  297. if (valid) {
  298. if (this.form.patientId != null) {
  299. updatePatient(this.form).then(response => {
  300. if (response.code === 200) {
  301. this.msgSuccess("修改成功");
  302. this.open = false;
  303. this.getList();
  304. }
  305. });
  306. } else {
  307. addPatient(this.form).then(response => {
  308. if (response.code === 200) {
  309. this.msgSuccess("新增成功");
  310. this.open = false;
  311. this.getList();
  312. }
  313. });
  314. }
  315. }
  316. });
  317. },
  318. /** 删除按钮操作 */
  319. handleDelete(row) {
  320. const patientIds = row.patientId || this.ids;
  321. this.$confirm('是否确认删除病人编号为"' + patientIds + '"的数据项?', "警告", {
  322. confirmButtonText: "确定",
  323. cancelButtonText: "取消",
  324. type: "warning"
  325. }).then(function() {
  326. return delPatient(patientIds);
  327. }).then(() => {
  328. this.getList();
  329. this.msgSuccess("删除成功");
  330. }).catch(function() {});
  331. },
  332. /** 导出按钮操作 */
  333. handleExport() {
  334. const queryParams = this.queryParams;
  335. this.$confirm('是否确认导出所有病人数据项?', "警告", {
  336. confirmButtonText: "确定",
  337. cancelButtonText: "取消",
  338. type: "warning"
  339. }).then(function() {
  340. return exportPatient(queryParams);
  341. }).then(response => {
  342. this.download(response.msg);
  343. }).catch(function() {});
  344. }
  345. }
  346. };
  347. </script>