1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- * Created by TT on 2017/7/11.
- */
- ;
- spa_define(function () {
- return $.use(["spa", "util", "form"], function (spa, util, fb) {
- return {
- modal: function (data) {
- var root = spa.findInModal(".sys_professornew_job");
- var form = fb.build(root.find(".newForm"));
- var date = new Date(),
- month = date.getMonth() + 1,
- myDate = "" + date.getFullYear() + (month > 9 ? month : ("0" + month));
- var saveBtn = root.find(".opt-save"),
- save = function () {
- if (form.val().company) {
- var company = trim(form.val().company);
- if (company.length > 50) {
- util.alert("机构名称不得超过50个字");
- return;
- }
- } else {
- util.alert("请填写机构名称");
- return;
- }
- if (form.val().title) {
- var title = trim(form.val().title);
- if (title.length > 50) {
- util.alert("职位不得超过50个字");
- return;
- }
- } else {
- util.alert("请填写职位");
- return;
- }
- if (form.val().department) {
- var department = trim(form.val().department);
- if (department.length > 50) {
- util.alert("部门名称不得超过50个字");
- return;
- }
- }
- if (!form.val().startMonth && form.val().stopMonth) {
- util.alert("没有选择开始时间");
- return;
- }
- form.val({professorId:data.data})
- form.doPost("../ajax/job",function () {
- spa.closeModal();
- if (data.hand){
- data.hand();
- }
- })
- };
- root.find(".modal-ctrl .icon-times").on("click", function () {
- spa.closeModal();
- });
- saveBtn.on("click", save);
- function trim(str) {
- return str.replace(/(^\s*)|(\s*$)/g, "");
- }
- }
- }
- });
- });
|