config.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入档期名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="档期状态" prop="status">
  14. <el-select v-model="queryParams.status" placeholder="请选择档期状态" clearable size="small">
  15. <el-option
  16. v-for="dict in statusOptions"
  17. :key="dict.dictValue"
  18. :label="dict.dictLabel"
  19. :value="dict.dictValue"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="创建时间" prop="createTime">
  24. <el-date-picker clearable size="small" style="width: 200px"
  25. v-model="queryParams.createTime"
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. placeholder="选择创建时间">
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd"
  43. v-hasPermi="['company:schedule:add']"
  44. >新增</el-button>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-button
  48. type="success"
  49. icon="el-icon-edit"
  50. size="mini"
  51. :disabled="single"
  52. @click="handleUpdate"
  53. v-hasPermi="['company:schedule:edit']"
  54. >修改</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="danger"
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['company:schedule:remove']"
  64. >删除</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. icon="el-icon-download"
  70. size="mini"
  71. @click="handleExport"
  72. v-hasPermi="['company:schedule:export']"
  73. >导出</el-button>
  74. </el-col>
  75. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  76. </el-row>
  77. <el-table v-loading="loading" :data="scheduleList" @selection-change="handleSelectionChange">
  78. <el-table-column type="selection" width="55" align="center" />
  79. <el-table-column label="id" align="center" prop="id" />
  80. <el-table-column label="档期名称" align="center" prop="name" />
  81. <el-table-column label="档期状态" align="center" prop="status" :formatter="statusFormat" />
  82. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  83. <template slot-scope="scope">
  84. <el-button
  85. size="mini"
  86. type="text"
  87. icon="el-icon-edit"
  88. @click="handleUpdate(scope.row)"
  89. v-hasPermi="['company:schedule:edit']"
  90. >修改</el-button>
  91. <el-button
  92. size="mini"
  93. type="text"
  94. icon="el-icon-delete"
  95. @click="handleDelete(scope.row)"
  96. v-hasPermi="['company:schedule:remove']"
  97. >删除</el-button>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. v-show="total>0"
  103. :total="total"
  104. :page.sync="queryParams.pageNum"
  105. :limit.sync="queryParams.pageSize"
  106. @pagination="getList"
  107. />
  108. <!-- 添加或修改中医档期管理对话框 -->
  109. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  110. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  111. <el-form-item label="档期名称" prop="name">
  112. <el-input v-model="form.name" placeholder="请输入档期名称" />
  113. </el-form-item>
  114. <el-form-item label="档期状态">
  115. <el-radio-group v-model="form.status">
  116. <el-radio
  117. v-for="dict in statusOptions"
  118. :key="dict.dictValue"
  119. :label="parseInt(dict.dictValue)"
  120. >{{dict.dictLabel}}</el-radio>
  121. </el-radio-group>
  122. </el-form-item>
  123. </el-form>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button type="primary" @click="submitForm">确 定</el-button>
  126. <el-button @click="cancel">取 消</el-button>
  127. </div>
  128. </el-dialog>
  129. </div>
  130. </template>
  131. <script>
  132. import { listSchedule, getSchedule, delSchedule, addSchedule, updateSchedule, exportSchedule } from "@/api/company/schedule";
  133. export default {
  134. name: "Schedule",
  135. data() {
  136. return {
  137. // 遮罩层
  138. loading: true,
  139. // 选中数组
  140. ids: [],
  141. // 非单个禁用
  142. single: true,
  143. // 非多个禁用
  144. multiple: true,
  145. // 显示搜索条件
  146. showSearch: true,
  147. // 总条数
  148. total: 0,
  149. // 中医档期管理表格数据
  150. scheduleList: [],
  151. // 弹出层标题
  152. title: "",
  153. // 是否显示弹出层
  154. open: false,
  155. // 档期状态字典
  156. statusOptions: [],
  157. // 查询参数
  158. queryParams: {
  159. pageNum: 1,
  160. pageSize: 10,
  161. name: null,
  162. status: null,
  163. createTime: null,
  164. },
  165. // 表单参数
  166. form: {},
  167. // 表单校验
  168. rules: {
  169. name: [
  170. { required: true, message: "档期名称不能为空", trigger: "blur" }
  171. ],
  172. }
  173. };
  174. },
  175. created() {
  176. this.getList();
  177. this.getDicts("company_status").then(response => {
  178. this.statusOptions = response.data;
  179. });
  180. },
  181. methods: {
  182. /** 查询中医档期管理列表 */
  183. getList() {
  184. this.loading = true;
  185. listSchedule(this.queryParams).then(response => {
  186. this.scheduleList = response.rows;
  187. this.total = response.total;
  188. this.loading = false;
  189. });
  190. },
  191. // 档期状态字典翻译
  192. statusFormat(row, column) {
  193. return this.selectDictLabel(this.statusOptions, row.status);
  194. },
  195. // 取消按钮
  196. cancel() {
  197. this.open = false;
  198. this.reset();
  199. },
  200. // 表单重置
  201. reset() {
  202. this.form = {
  203. id: null,
  204. name: null,
  205. createUserId: null,
  206. updateUserId: null,
  207. status: 0,
  208. createTime: null,
  209. updateTime: null
  210. };
  211. this.resetForm("form");
  212. },
  213. /** 搜索按钮操作 */
  214. handleQuery() {
  215. this.queryParams.pageNum = 1;
  216. this.getList();
  217. },
  218. /** 重置按钮操作 */
  219. resetQuery() {
  220. this.resetForm("queryForm");
  221. this.handleQuery();
  222. },
  223. // 多选框选中数据
  224. handleSelectionChange(selection) {
  225. this.ids = selection.map(item => item.id)
  226. this.single = selection.length!==1
  227. this.multiple = !selection.length
  228. },
  229. /** 新增按钮操作 */
  230. handleAdd() {
  231. this.reset();
  232. this.open = true;
  233. this.title = "添加中医档期";
  234. },
  235. /** 修改按钮操作 */
  236. handleUpdate(row) {
  237. this.reset();
  238. const id = row.id || this.ids
  239. getSchedule(id).then(response => {
  240. this.form = response.data;
  241. this.open = true;
  242. this.title = "修改中医档期";
  243. });
  244. },
  245. /** 提交按钮 */
  246. submitForm() {
  247. this.$refs["form"].validate(valid => {
  248. if (valid) {
  249. if (this.form.id != null) {
  250. updateSchedule(this.form).then(response => {
  251. if (response.code === 200) {
  252. this.msgSuccess("修改成功");
  253. this.open = false;
  254. this.getList();
  255. }
  256. });
  257. } else {
  258. addSchedule(this.form).then(response => {
  259. if (response.code === 200) {
  260. this.msgSuccess("新增成功");
  261. this.open = false;
  262. this.getList();
  263. }
  264. });
  265. }
  266. }
  267. });
  268. },
  269. /** 删除按钮操作 */
  270. handleDelete(row) {
  271. const ids = row.id || this.ids;
  272. this.$confirm('是否确认删除中医档期管理编号为"' + ids + '"的数据项?', "警告", {
  273. confirmButtonText: "确定",
  274. cancelButtonText: "取消",
  275. type: "warning"
  276. }).then(function() {
  277. return delSchedule(ids);
  278. }).then(() => {
  279. this.getList();
  280. this.msgSuccess("删除成功");
  281. }).catch(function() {});
  282. },
  283. /** 导出按钮操作 */
  284. handleExport() {
  285. const queryParams = this.queryParams;
  286. this.$confirm('是否确认导出所有中医档期管理数据项?', "警告", {
  287. confirmButtonText: "确定",
  288. cancelButtonText: "取消",
  289. type: "warning"
  290. }).then(function() {
  291. return exportSchedule(queryParams);
  292. }).then(response => {
  293. this.download(response.msg);
  294. }).catch(function() {});
  295. }
  296. }
  297. };
  298. </script>