表单内容:
1 <div id="complex" class="mini-complex" style="background: rgb(255, 255, 255); padding: 2px 20px 10px; box-shadow: rgb(144, 144, 144) 0px 0px 5px; margin: 10px auto 12px; font-size: 14px; font-family: Microsoft YaHei; text-align: center; position: relative;" type="1"> 2 <p> 3 <br/> 4 </p> 5 <p style="margin-bottom: 25px;"> 6 <strong><span style="font-size: 24px;">学生实习报备流程</span></strong> 7 </p> 8 <p style="margin-bottom: 25px;"> 9 <strong><span style="font-size: 24px;"></span></strong> 10 </p> 11 <table style="table-layout: fixed;border-collapse:collapse;border:2px solid black;" data-sort="sortDisabled" align="center"> 12 <tbody> 13 <tr class="firstRow"> 14 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="129.33333333333334" valign="middle" align="center"> 15 指导教师姓名 16 </td> 17 <td style="border-color: rgb(38, 38, 38);" width="145.33333333333334" valign="middle" align="center"> 18 <input class="mini-textbox" choosevalue="CURRENTUSER" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="0" enfield="ZDJSXM" cnfield="指导教师姓名" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"ZDJSXM","type":"COUNTDAY","emptytext":""}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen" emptytext=""/><br/> 19 </td> 20 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="109.33333333333333" valign="middle" align="center"> 21 指导教师工号 22 </td> 23 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="186.33333333333334" valign="middle" align="center"> 24 <input class="mini-textbox" choosevalue="CURRENTUSERID" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="1" enfield="ZDJSGH" cnfield="指导教师工号" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"ZDJSGH","type":"COUNTDAY","emptytext":""}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen" emptytext="" linkageurl="/queryservice/query.htm?snumber=CXZDJSXX&ZDJSGH=INPUTVALUE" datasourceurl="" relatefield_1="cnfield=指导教师姓名;enfield=ZDJSXM;datatype=value;icon=;key=ZDJSXM;" relatefield_2="cnfield=联系电话;enfield=LXDH;datatype=value;icon=;key=LXDH;" relatefield_3="cnfield=专业负责人;enfield=ZYFZR;datatype=data;icon=;key=;"/><br/> 25 </td> 26 </tr> 27 <tr> 28 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="129.33333333333334" valign="middle" align="center"> 29 所在单位 30 </td> 31 <td style="border-color: rgb(38, 38, 38);" width="145.33333333333334" valign="middle" align="center"> 32 <input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="2" enfield="SZDW" cnfield="所在单位" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"SZDW","type":"COUNTDAY","emptytext":""}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen" emptytext="" datasourceurl="/queryservice/query.htm?snumber=CXBMMC&HUMANCODE=STARTID" urlkey="DWMC"/><br/> 33 </td> 34 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="101.33333333333333" valign="middle" align="center"> 35 备案日期 36 </td> 37 <td style="border-color: rgb(38, 38, 38);" width="187.33333333333334" valign="middle" align="center"> 38 <input class="mini-datepicker" choosevalue="OPTIONDATE" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="3" enfield="BARQ" cnfield="备案日期" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" showtime="false" tagtype="mini-datepicker" datetimetype="mini-datepicker" mindate="" maxdate="" data-options="{"minDate":"","maxDate":"","showStyle":"rung","dateScope":"false","manyDateScope":"false","nowDateAfter":"false","dateFixedScope":"false","workDate":"false","emptytext":""}" showsignaturedateformat="rung" type="mini-datepicker" ziti="MicrosoftYaHei" zihao="fourteen" emptytext=""/><br/> 39 </td> 40 </tr> 41 <tr> 42 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="129.33333333333334" valign="middle" align="center"> 43 联系电话 44 </td> 45 <td style="border-color: rgb(38, 38, 38);" width="145.33333333333334" valign="middle" align="center"> 46 <input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="4" enfield="LXDH" cnfield="联系电话" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"LXDH","type":"COUNTDAY"}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen"/><br/> 47 </td> 48 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="109.33333333333333" valign="middle" align="center"> 49 专业负责人 50 </td> 51 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="188.33333333333334" valign="middle" align="center"> 52 <input class="mini-combobox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="5" enfield="ZYFZR" cnfield="专业负责人" adaptive="true" multiselect="false" style="width: 100%; height: 100% !important ;" showclearbutton="false" allowlimitvalue="false" textfield="ZYFZR" valuefield="ZYFZRGH" valuefromselect="true" data-options="{"id":"ZYFZR","type":"COUNTDAY"}"/><br/> 53 </td> 54 </tr> 55 <tr> 56 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="129.33333333333334" valign="middle" align="center"> 57 实习课程号 58 </td> 59 <td style="border-color: rgb(38, 38, 38);" width="140.33333333333334" valign="middle" align="center"> 60 <input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="6" enfield="SXKCH" cnfield="实习课程号" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"SXKCH","type":"COUNTDAY"}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen" datasourceurl="" linkageurl="/queryservice/query.htm?snumber=CXSXKCXX&SXKCH=INPUTVALUE" value="" relatefield_1="cnfield=实习课程名;enfield=SXKCM;datatype=value;icon=;key=SXKCM;"/><br/> 61 </td> 62 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="109.33333333333333" valign="middle" align="center"> 63 实习课程名 64 </td> 65 <td style="border-color: rgb(38, 38, 38);" width="188.33333333333334" valign="middle" align="center"> 66 <input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="7" enfield="SXKCM" cnfield="实习课程名" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"SXKCM","type":"COUNTDAY"}" type="mini-textbox" ziti="MicrosoftYaHei" zihao="fourteen"/><br/> 67 </td> 68 </tr> 69 <tr> 70 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="269" valign="middle" height="27" align="center"> 71 学生所在二级学院 72 </td> 73 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" rowspan="1" colspan="3" valign="middle" height="27" align="center"> 74 <input class="mini-combobox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="8" enfield="SZXY" cnfield="学生所在二级学院" adaptive="true" multiselect="false" style="width: 100%; height: 100% !important ;" showclearbutton="false" allowlimitvalue="false" textfield="ORGNAME" valuefield="ORGNAME" valuefromselect="true" data-options="{"id":"SZXY","type":"COUNTDAY"}" datasourceurl="/queryservice/query.htm?snumber=CXXSXY"/><br/> 75 </td> 76 </tr> 77 <tr> 78 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" rowspan="1" colspan="4" valign="middle" height="27" align="center"> 79 <strong>实习学生名单</strong><br/> 80 </td> 81 </tr> 82 <tr> 83 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" rowspan="1" colspan="4" valign="middle" height="27" align="center"> 84 <img src="../../resources/images/flow/datagrid.png" datagrid_style="width: 100%; height: 200px;" datagrid_class="mini-datagrid" datagrid_idfield="id" datagrid_showpager="false" datagrid_fldorder="9" datagrid_cnfield="实习学生名单" datagrid_enfield="SXXSMD" showaddbtn="true" showdelbtn="true" showinbtn="false" showupbtn="true" showdownbtn="true" maxgridrows="500" loadcontext="true" shownumber="false" adaptive="true" datagridfield_1="class=mini-textbox;field=XH;name=学号;required=true;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" stylewidth="80" stylewidthtype="%" fieldname_1="学号" datagridfield_2="class=mini-textbox;field=XM;name=姓名;required=false;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" fieldname_2="姓名" required="true" datagridfield_3="class=mini-textbox;field=ZY;name=专业;required=false;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" fieldname_3="专业" datagridfield_4="class=mini-textbox;field=BJ;name=班级;required=false;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" fieldname_4="班级" datagridfield_5="class=mini-combobox;field=SXXZ;name=实习性质;align=left;required=true;multiselect=false;allowinput=true;allowsort=true;datasourcetype=data;data=[{"id":"分散","text":"分散","_id":1,"_uid":1,"_state":"modified"},{"id":"集中","text":"集中","_id":2,"_uid":2,"_state":"modified"}];valuefield=id;textfield=text;fromEnfield=;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;choosevalue=other;" name="未定义列" field="HT44EB6B" data="[{"id":"是","text":"是","_id":1,"_uid":1,"_state":"modified"},{"id":"否","text":"否","_id":2,"_uid":2,"_state":"modified"}]" fieldname_5="实习性质" datagridfield_6="class=mini-combobox;field=SFLX;name=是否离校;align=left;required=false;multiselect=false;allowinput=true;allowsort=true;datasourcetype=data;data=[{"id":"是","text":"是","_id":1,"_uid":1,"_state":"modified"},{"id":"否","text":"否","_id":2,"_uid":2,"_state":"modified"}];valuefield=id;textfield=text;fromEnfield=;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;choosevalue=other;" fieldname_6="是否离校" datagridfield_7="class=mini-textbox;field=SXDWMC;name=实习单位名称;required=false;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" fieldname_7="实习单位名称" datagridfield_8="class=mini-textbox;field=SXDWDZ;name=实习单位地址(省市县区);required=false;align=left;allowinput=true;allowsort=true;maxLength=200;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;vtype=undefined;choosevalue=other;" fieldname_8="实习单位地址(省市县区)" datagridfield_9="class=mini-datepicker;field=SXKSSJ;name=实习开始时间;align=left;required=false;allowinput=true;allowsort=true;showdatetime=1;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;choosevalue=OPTIONDATE;" fieldname_9="实习开始时间" datagridfield_10="class=mini-datepicker;field=SXJSSJ;name=实习结束时间;align=left;required=false;allowinput=true;allowsort=true;showdatetime=1;emptytext=;stylewidth=80;stylewidthtype=%;linkageurl=;reactionData=%5B%5D;choosevalue=other;" fieldname_10="实习结束时间" fieldname_11="备注" data-options="{"shownumber":"false","mingridrows":1,"showinbtn":"false","showupbtn":"true"}" mingridrows="1"/><br/> 85 </td> 86 </tr> 87 <tr> 88 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="269" valign="middle" height="27" align="center"> 89 辅导员 90 </td> 91 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="269" valign="middle" height="27" align="center"> 92 <input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="1" datasourcetype="url" fldorder="10" enfield="FDYXM" cnfield="辅导员" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"FDYXM","type":"COUNTDAY"}"/><br/> 93 </td> 94 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="269" valign="middle" height="27" align="center"> 95 发起时间<br/> 96 </td> 97 <td style="border-color: rgb(38, 38, 38); word-break: break-all;" width="269" valign="middle" height="27" align="center"> 98 <input class="mini-datepicker" choosevalue="OPRTIONTIME" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="0" datasourcetype="url" fldorder="11" enfield="FQSJ" cnfield="发起时间" adaptive="true" multiselect="false" style="width: 100%;" showclearbutton="false" allowlimitvalue="false" showtime="true" tagtype="mini-datepicker" datetimetype="mini-datetimepicker" mindate="" maxdate="" data-options="{"minDate":"","maxDate":"","showStyle":"chineseDateTime","dateScope":"false","manyDateScope":"false","nowDateAfter":"false","dateFixedScope":"false","workDate":"false","emptytext":""}" showsignaturedateformat="chineseDateTime" emptytext=""/><br/> 99 </td> 100 </tr> 101 </tbody> 102 </table><input class="mini-textbox" choosevalue="other" required="true" fieldtype="ordinary" allowinput="true" isshowonlist="0" datasourcetype="url" fldorder="100" enfield="FDYGH" cnfield="辅导员审批" adaptive="true" multiselect="false" showclearbutton="false" allowlimitvalue="false" maxlength="200" data-options="{"id":"FDYGH","type":"COUNTDAY"}" style="width: 100%;"/> 103 <p style="margin-bottom: 25px; text-align: left;"> 104 <img class="flow-javascript" src="../../style/flow/img/javascript.png" choosevalue="other" enfield="HTA261E6" cnfield="脚本控件" style="width: 18px; height: 18px; display: block;" method="$(function () { 105 mini.get('ZDJSGH').on('valuechanged', valueChanged); 106 mini.get('ZYFZR').on('valuechanged', valueChanged); 107 mini.get('SXKCH').on('valuechanged', valueChanged); 108 mini.get('SZXY').on('valuechanged', valueChanged); 109 var arr = [], arrOfDel = [] , indexArr = 0 110 async function getInputValue(data) { 111 if(data.length == 0){ 112 mini.get('FDYXM').setValue('') 113 mini.get('FDYGH').setValue('') 114 return 115 } 116 data = data.map(item => item.BJ) 117 data.forEach(async (item, index) => { 118 await getData(data, item, index) 119 console.log(indexArr , [...new Set(data)].length) 120 if(indexArr == [...new Set(data)].length){ 121 mini.get('FDYXM').setValue([...new Set(arr.map(item => item['HUMANNAME']))].join(',')) 122 mini.get('FDYGH').setValue([...new Set(arr.map(item => item['HUMANCODE']))].join(',')) 123 arr = [] 124 indexArr = 0 125 } 126 }) 127 } 128 function getData(array, data, index) { 129 return new Promise(function (resolve, reject) { 130 if ((index > 0 && array.filter((item, i) => i < index).some(item => item == data))) { 131 return reject() 132 } 133 $.ajax({ 134 methods: 'GET', 135 url: "${basePath}queryservice/query.htm?snumber=CXFDY&orgname=" + data, 136 success: function (res) { 137 indexArr++ 138 arr = arr.concat(JSON.parse(res)) 139 resolve() 140 }, 141 error: function (err) { 142 reject(err) 143 } 144 }) 145 }) 146 } 147 function valueChanged() { 148 var ZDJSGH = mini.get('ZDJSGH').getValue(); 149 var ZYFZR = mini.get('ZYFZR').getValue(); 150 var SXKCH = mini.get('SXKCH').getValue(); 151 var SZXY = mini.get('SZXY').getValue(); 152 $.ajax({ 153 url: "${basePath}queryservice/query.htm?snumber=CXSXXSXX&ZDJSGH=" + ZDJSGH + "&ZYFZRGH=" + ZYFZR + "&SXKCH=" + SXKCH + "&SZXY=" + SZXY, 154 dataType: "json", 155 success: function (data) { 156 if (Array.isArray(data)) { 157 arrOfDel = JSON.parse(JSON.stringify(data)) 158 mini.get('SXXSMD').setData(data); 159 getInputValue(data) 160 } else { 161 arrOfDel = [] 162 arr = [] 163 indexArr = 0 164 mini.get('FDYXM').setValue('') 165 mini.get('FDYGH').setValue('') 166 mini.get('SXXSMD').setData([]); 167 } 168 }, 169 }); 170 } 171 $('#delbar_SXXSMD').click(function () { 172 if (mini.get('SXXSMD').getData().length == arrOfDel.length) return 173 else indexArr = 0; arr = []; getInputValue(mini.get('SXXSMD').getData()) 174 }) 175 })"/><br/> 176 </p> 177 </div>
表单JS-MINIUI:
$(function () { mini.get('ZDJSGH').on('valuechanged', valueChanged); mini.get('ZYFZR').on('valuechanged', valueChanged); mini.get('SXKCH').on('valuechanged', valueChanged); mini.get('SZXY').on('valuechanged', valueChanged); var arr = [], arrOfDel = [] , indexArr = 0 async function getInputValue(data) { if(data.length == 0){ mini.get('FDYXM').setValue('') mini.get('FDYGH').setValue('') return } data = data.map(item => item.BJ) data.forEach(async (item, index) => { await getData(data, item, index) console.log(indexArr , [...new Set(data)].length) if(indexArr == [...new Set(data)].length){ mini.get('FDYXM').setValue([...new Set(arr.map(item => item['HUMANNAME']))].join(',')) mini.get('FDYGH').setValue([...new Set(arr.map(item => item['HUMANCODE']))].join(',')) arr = [] indexArr = 0 } }) } function getData(array, data, index) { return new Promise(function (resolve, reject) { if ((index > 0 && array.filter((item, i) => i < index).some(item => item == data))) { return reject() } $.ajax({ methods: 'GET', url: "${basePath}queryservice/query.htm?snumber=CXFDY&orgname=" + data, success: function (res) { indexArr++ arr = arr.concat(JSON.parse(res)) resolve() }, error: function (err) { reject(err) } }) }) } function valueChanged() { var ZDJSGH = mini.get('ZDJSGH').getValue(); var ZYFZR = mini.get('ZYFZR').getValue(); var SXKCH = mini.get('SXKCH').getValue(); var SZXY = mini.get('SZXY').getValue(); $.ajax({ url: "${basePath}queryservice/query.htm?snumber=CXSXXSXX&ZDJSGH=" + ZDJSGH + "&ZYFZRGH=" + ZYFZR + "&SXKCH=" + SXKCH + "&SZXY=" + SZXY, dataType: "json", success: function (data) { if (Array.isArray(data)) { arrOfDel = JSON.parse(JSON.stringify(data)) mini.get('SXXSMD').setData(data); getInputValue(data) } else { arrOfDel = [] arr = [] indexArr = 0 mini.get('FDYXM').setValue('') mini.get('FDYGH').setValue('') mini.get('SXXSMD').setData([]); } }, }); } $('#delbar_SXXSMD').click(function () { if (mini.get('SXXSMD').getData().length == arrOfDel.length) return else indexArr = 0; arr = []; getInputValue(mini.get('SXXSMD').getData()) }) })
截图:
标签:function,mini,辅导员,miniui,get,arr,JS,item,data From: https://www.cnblogs.com/xiaoweihongyan/p/17532595.html