educationList.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div id="EducationList" class="app-container">
  3. <el-row :gutter="10" class="mb8">
  4. <el-col :span="1.5">
  5. <el-button
  6. type="primary"
  7. plain
  8. icon="el-icon-plus"
  9. size="mini"
  10. @click="handleAdd"
  11. >新增</el-button>
  12. </el-col>
  13. <el-col :span="1.5">
  14. <el-button
  15. type="success"
  16. plain
  17. icon="el-icon-edit"
  18. size="mini"
  19. :disabled="single"
  20. @click="handleUpdate"
  21. >修改</el-button>
  22. </el-col>
  23. <el-col :span="1.5">
  24. <el-button
  25. type="danger"
  26. plain
  27. icon="el-icon-delete"
  28. size="mini"
  29. :disabled="multiple"
  30. @click="handleDelete"
  31. >删除</el-button>
  32. </el-col>
  33. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  34. </el-row>
  35. <el-table v-loading="loading" :data="educationList" @selection-change="handleSelectionChange">
  36. <el-table-column type="selection" width="55" align="center" />
  37. <el-table-column label="入学日期" align="center" prop="enrollDate" width="180">
  38. <template slot-scope="scope">
  39. <span>{{ parseTime(scope.row.enrollDate, '{y}-{m}-{d}') }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="毕业日期" align="center" prop="graduationDate" width="180">
  43. <template slot-scope="scope">
  44. <span>{{ parseTime(scope.row.graduationDate, '{y}-{m}-{d}') }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="学校名称" align="center" prop="school" />
  48. <el-table-column label="专业名称" align="center" prop="majorName" />
  49. <el-table-column label="学历" align="center" prop="education" >
  50. <template slot-scope="scope">
  51. <dict-tag :options="dict.type.mk_bo_education" :value="scope.row.education"/>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  55. <template slot-scope="scope">
  56. <el-button
  57. size="mini"
  58. type="text"
  59. icon="el-icon-edit"
  60. @click="handleUpdate(scope.row)"
  61. >修改</el-button>
  62. <el-button
  63. size="mini"
  64. type="text"
  65. icon="el-icon-delete"
  66. @click="handleDelete(scope.row)"
  67. >删除</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <pagination
  72. v-show="total>0"
  73. :total="total"
  74. :page.sync="queryParams.pageNum"
  75. :limit.sync="queryParams.pageSize"
  76. @pagination="getList"
  77. />
  78. <!-- 添加或修改联系人学历信息对话框 -->
  79. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  80. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  81. <!-- <el-form-item label="联系人ID" prop="contactId">
  82. <el-input v-model="form.contactId" placeholder="请输入联系人ID" />
  83. </el-form-item> -->
  84. <el-form-item label="入学日期" prop="enrollDate">
  85. <el-date-picker clearable
  86. v-model="form.enrollDate"
  87. type="date"
  88. value-format="yyyy-MM-dd"
  89. placeholder="请选择入学日期"
  90. :picker-options="editStartOptions"
  91. >
  92. </el-date-picker>
  93. </el-form-item>
  94. <el-form-item label="毕业日期" prop="graduationDate">
  95. <el-date-picker clearable
  96. v-model="form.graduationDate"
  97. type="date"
  98. value-format="yyyy-MM-dd"
  99. placeholder="请选择毕业日期"
  100. :picker-options="editStopOptions"
  101. >
  102. </el-date-picker>
  103. </el-form-item>
  104. <el-form-item label="学校名称" prop="school">
  105. <el-input v-model="form.school" placeholder="请输入学校名称" />
  106. </el-form-item>
  107. <el-form-item label="专业名称" prop="majorName">
  108. <el-input v-model="form.majorName" placeholder="请输入专业名称" />
  109. </el-form-item>
  110. <el-form-item label="学历" prop="education">
  111. <el-select v-model="form.education" placeholder="请输入学历">
  112. <el-option
  113. v-for="dict in dict.type.mk_bo_education"
  114. :key="dict.value"
  115. :label="dict.label"
  116. :value="dict.value"
  117. ></el-option>
  118. </el-select>
  119. </el-form-item>
  120. </el-form>
  121. <div slot="footer">
  122. <el-button type="primary" @click="submitForm" :disabled="submitButtonEditStatus">确 定</el-button>
  123. <el-button @click="cancel">取 消</el-button>
  124. </div>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import { listEducation, getEducation, delEducation, addEducation, updateEducation } from "@/api/business/spd/bo/education";
  130. export default {
  131. name: "EducationList",
  132. props:["supForm"],
  133. dicts: ['mk_bo_education'],
  134. data() {
  135. return {
  136. // 遮罩层
  137. loading: true,
  138. // 选中数组
  139. ids: [],
  140. // 非单个禁用
  141. single: true,
  142. // 非多个禁用
  143. multiple: true,
  144. // 显示搜索条件
  145. showSearch: true,
  146. // 总条数
  147. total: 0,
  148. // 联系人学历信息表格数据
  149. educationList: [],
  150. // 弹出层标题
  151. title: "",
  152. // 是否显示弹出层
  153. open: false,
  154. // 查询参数
  155. queryParams: {
  156. pageNum: 1,
  157. pageSize: 10,
  158. contactId: null,
  159. createDate: null,
  160. graduationDate: null,
  161. enrollDate: null,
  162. majorName: null,
  163. education: null,
  164. school: null,
  165. code: null,
  166. },
  167. // 表单参数
  168. form: {},
  169. // 表单校验
  170. rules: {
  171. enrollDate: [
  172. { required: true, message: "入学日期不能为空", trigger: ["blur", "change"] }
  173. ],
  174. graduationDate: [
  175. { required: true, message: "毕业日期不能为空", trigger: ["blur", "change"] }
  176. ],
  177. school: [
  178. { required: true, message: "学校名称不能为空", trigger: "blur" }
  179. ],
  180. education: [
  181. { required: true, message: "学历不能为空", trigger: "blur" }
  182. ],
  183. },
  184. editStartOptions: {
  185. disabledDate: time => {
  186. if (!this.form.graduationDate) {
  187. return time.getTime() < new Date(1970 - 1 - 1).getTime(); //禁止选择1970年以前的日期
  188. } else {
  189. return time.getTime() > new Date(this.form.graduationDate);
  190. }
  191. }
  192. },
  193. editStopOptions: {
  194. disabledDate: time => {
  195. return (
  196. time.getTime() < new Date(this.form.enrollDate) ||
  197. time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
  198. );
  199. }
  200. },
  201. //确定按钮是否可点
  202. submitButtonEditStatus:false,
  203. };
  204. },
  205. created() {
  206. this.queryParams.contactId = this.supForm.id;
  207. this.getList();
  208. },
  209. methods: {
  210. /** 查询联系人学历信息列表 */
  211. getList() {
  212. this.loading = true;
  213. listEducation(this.queryParams).then(response => {
  214. this.educationList = response.rows;
  215. this.total = response.total;
  216. this.loading = false;
  217. });
  218. },
  219. // 取消按钮
  220. cancel() {
  221. this.open = false;
  222. this.reset();
  223. },
  224. // 表单重置
  225. reset() {
  226. this.form = {
  227. contactId: null,
  228. delFlag: null,
  229. updateTime: null,
  230. updateBy: null,
  231. createDate: null,
  232. createBy: null,
  233. graduationDate: null,
  234. enrollDate: null,
  235. majorName: null,
  236. education: null,
  237. school: null,
  238. code: null,
  239. id: null
  240. };
  241. this.resetForm("form");
  242. },
  243. /** 搜索按钮操作 */
  244. handleQuery() {
  245. this.queryParams.pageNum = 1;
  246. this.getList();
  247. },
  248. /** 重置按钮操作 */
  249. resetQuery() {
  250. this.resetForm("queryForm");
  251. this.handleQuery();
  252. },
  253. // 多选框选中数据
  254. handleSelectionChange(selection) {
  255. this.ids = selection.map(item => item.id)
  256. this.single = selection.length!==1
  257. this.multiple = !selection.length
  258. },
  259. /** 新增按钮操作 */
  260. handleAdd() {
  261. this.operatingState = "Insert";
  262. this.reset();
  263. this.form.contactId = this.supForm.id;
  264. this.open = true;
  265. this.title = "添加联系人学历信息";
  266. },
  267. /** 修改按钮操作 */
  268. handleUpdate(row) {
  269. this.reset();
  270. const id = row.id || this.ids
  271. getEducation(id).then(response => {
  272. this.form = response.data;
  273. this.open = true;
  274. this.title = "修改联系人学历信息";
  275. });
  276. },
  277. /** 提交按钮 */
  278. submitForm() {
  279. this.submitButtonEditStatus = true;
  280. this.$refs["form"].validate(valid => {
  281. if (valid) {
  282. if (this.form.id != null) {
  283. updateEducation(this.form).then(response => {
  284. this.$modal.msgSuccess("修改成功");
  285. this.open = false;
  286. this.getList();
  287. this.submitButtonEditStatus = false;
  288. });
  289. } else {
  290. addEducation(this.form).then(response => {
  291. this.$modal.msgSuccess("新增成功");
  292. this.open = false;
  293. this.getList();
  294. this.submitButtonEditStatus = false;
  295. });
  296. }
  297. }else{
  298. this.submitButtonEditStatus = false;
  299. }
  300. });
  301. },
  302. /** 删除按钮操作 */
  303. handleDelete(row) {
  304. const ids = row.id || this.ids;
  305. this.$modal.confirm('是否确认删除联系人学历信息编号为"' + ids + '"的数据项?').then(function() {
  306. return delEducation(ids);
  307. }).then(() => {
  308. this.getList();
  309. this.$modal.msgSuccess("删除成功");
  310. }).catch(() => {});
  311. },
  312. /** 导出按钮操作 */
  313. handleExport() {
  314. this.download('system/education/export', {
  315. ...this.queryParams
  316. }, `education_${new Date().getTime()}.xlsx`)
  317. }
  318. }
  319. };
  320. </script>