agreementIndex.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <style lang="scss">
  2. .avatar-uploader .el-upload {
  3. border: 1px dashed #d9d9d9;
  4. border-radius: 6px;
  5. cursor: pointer;
  6. position: relative;
  7. overflow: hidden;
  8. }
  9. .avatar-uploader .el-upload:hover {
  10. border-color: #409eff;
  11. }
  12. .avatar-uploader-icon {
  13. font-size: 28px;
  14. color: #8c939d;
  15. width: 178px;
  16. height: 178px;
  17. line-height: 178px;
  18. text-align: center;
  19. }
  20. .avatar {
  21. width: 178px;
  22. height: 178px;
  23. display: block;
  24. }
  25. </style>
  26. <template>
  27. <section class="content">
  28. <h4>用户协议列表</h4>
  29. <el-divider></el-divider>
  30. <!-- <el-form label-width="80px" class="filter-form">
  31. <el-row>
  32. <el-col :span="4">
  33. <el-form-item label="名称">
  34. <el-input
  35. clearable
  36. @clear="getData()"
  37. v-model="queryParams.name"
  38. placeholder="请输入名称"
  39. size="mini"
  40. ></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="4">
  44. <el-form-item label="手机号">
  45. <el-input
  46. clearable
  47. @clear="getData()"
  48. v-model="queryParams.phone"
  49. placeholder="请输入手机号"
  50. size="mini"
  51. ></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="4">
  55. <el-form-item label-width="10" style="margin-left: 10px">
  56. <el-button type="primary" @click="getData" size="mini"
  57. >筛选</el-button
  58. >
  59. <el-button
  60. type="primary"
  61. plain
  62. icon="el-icon-plus"
  63. size="mini"
  64. @click="handleAdd"
  65. >新增医生</el-button
  66. >
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. </el-form> -->
  71. <el-table
  72. v-loading="loading"
  73. :data="list"
  74. style="width: 100%; margin-top: 10px"
  75. height="50vh"
  76. >
  77. <el-table-column align="center" prop="name" label="名称" />
  78. <el-table-column align="center" prop="ctime" label="创建时间" />
  79. <el-table-column align="center" prop="date" label="操作" width="320">
  80. <template slot-scope="scope">
  81. <el-button @click="edit(scope.row.id)" size="mini" type="warning"
  82. >编辑</el-button
  83. >
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <Page
  88. ref="pageButton"
  89. :current="form.page"
  90. :page_size="form.page_size"
  91. :total="total"
  92. @pageChange="gopage"
  93. />
  94. <!-- 新增医生 -->
  95. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  96. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  97. <el-form-item label="名称" prop="name">
  98. <el-input
  99. clearable
  100. v-model="form.name"
  101. placeholder="请输入名称"
  102. ></el-input>
  103. </el-form-item>
  104. <el-form-item label="协议内容">
  105. <vue-ueditor-wrap ref="editor" v-model="form.content" :config="myConfig"></vue-ueditor-wrap>
  106. </el-form-item>
  107. </el-form>
  108. <div slot="footer" class="dialog-footer">
  109. <el-button type="primary" @click="submitForm">确 定</el-button>
  110. <el-button @click="open = false">取 消</el-button>
  111. </div>
  112. </el-dialog>
  113. </section>
  114. </template>
  115. <script>
  116. import Page from "../../components/Page";
  117. import fuEditor from "@/components/fuEditor/index.vue";
  118. export default {
  119. components: {
  120. Page,
  121. fuEditor
  122. },
  123. data() {
  124. return {
  125. loading: false,
  126. queryParams: {
  127. page: 1,
  128. },
  129. form: {},
  130. form1: {},
  131. form2: {},
  132. list: [{}, {}],
  133. total: 0,
  134. title: "新增用户",
  135. open: false,
  136. doctorList: [],
  137. rules: {},
  138. myConfig: {
  139. // 编辑器自动被内容撑高
  140. autoHeightEnabled: true,
  141. // 初始容器高度
  142. initialFrameHeight: 500,
  143. // 初始容器宽度
  144. initialFrameWidth: '100%',
  145. // 上传文件接口,实现上传图片功能必须的配置,这个地址会在后端配置的时候产生,此处先放上结果
  146. serverUrl: '/api/admin/ueditor/upload',
  147. },
  148. };
  149. },
  150. methods: {
  151. del(id) {
  152. this.$confirm("确认删除?", "提示", {
  153. type: "warning",
  154. }).then(() => {
  155. this.$api
  156. .delDoctorInfo({
  157. id: id,
  158. })
  159. .then((res) => {
  160. if (!res.data.code) {
  161. this.$msgSuccess("删除成功");
  162. this.getData();
  163. } else {
  164. this.$msgError(res.data.message);
  165. }
  166. });
  167. });
  168. },
  169. gopage(size) {
  170. if (size) {
  171. this.queryParams.page_size = size;
  172. }
  173. this.queryParams.page = this.$refs.pageButton.page;
  174. this.getData();
  175. },
  176. getData() {
  177. this.loading = true;
  178. this.$api.getUserAgreementList(this.queryParams).then((res) => {
  179. this.list = res.data.data.list;
  180. this.total = res.data.data.total;
  181. this.loading = false;
  182. });
  183. },
  184. handleAdd() {
  185. this.open = true;
  186. this.title = "新增医生";
  187. this.form = {};
  188. },
  189. edit(id) {
  190. this.title = "编辑用户协议";
  191. this.$api
  192. .getUserAgreementInfo({
  193. id: id,
  194. })
  195. .then((res) => {
  196. this.form = res.data.data;
  197. this.open = true;
  198. });
  199. },
  200. /** 提交按钮 */
  201. submitForm() {
  202. this.$refs["form"].validate((valid) => {
  203. if (valid) {
  204. if (this.form.id != null) {
  205. this.$api.editUserAgreement(this.form).then((res) => {
  206. if (res.data.code == 0) {
  207. this.msgSuccess("成功!");
  208. this.open = false;
  209. this.getData();
  210. } else {
  211. this.msgError(res.data.message);
  212. }
  213. });
  214. } else {
  215. this.$api.addDoctorInfo(this.form).then((res) => {
  216. if (res.data.code == 0) {
  217. this.msgSuccess("成功!");
  218. this.open = false;
  219. this.getData();
  220. } else {
  221. this.msgError(res.data.message);
  222. }
  223. });
  224. }
  225. }
  226. });
  227. },
  228. remoteMethod(query) {
  229. if (query !== "") {
  230. // this.loading = true;
  231. this.$api
  232. .getDoctorsSearchList({
  233. name: query,
  234. })
  235. .then((res) => {
  236. this.doctorList = res.data.data;
  237. this.$set(this.doctorList, res.data.data);
  238. // this.loading = false;
  239. });
  240. } else {
  241. this.doctorList = [];
  242. }
  243. },
  244. },
  245. created() {
  246. this.getData();
  247. },
  248. };
  249. </script>