Нет описания

addDayShift.html 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <script src="../../Script/Common/huayi.load.js"></script>
  7. <script src="../../Script/Common/huayi.config.js"></script>
  8. <script src="../../js/laydate/laydate.js"></script>
  9. <script src="../../js/bootstrap-select/js/bootstrap-select.js"></script>
  10. <script src="../../js/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
  11. <script src="../../Script/Common/regexs.js"></script>
  12. <script src="../../js/autosize/autosize.min.js"></script>
  13. <link href="../../css/plugins/cropper/cropper.min.css" rel="stylesheet">
  14. <link href="../../js/bootstrap-select/css/bootstrap-select.css" rel="stylesheet" />
  15. <link href="../../css/init.css" rel="stylesheet" />
  16. <link rel="stylesheet" type="text/css" href="../../css/Table/table1.css" />
  17. <link rel="stylesheet" href="../../css/webuploader.css" />
  18. <!-- <link rel="stylesheet" type="text/css" href="../css/call.css"/> -->
  19. <title>新增设备维修</title>
  20. <style>
  21. .btnn {
  22. background: #2f4050;
  23. color: #fff;
  24. padding: 3px 10px;
  25. border: 0;
  26. border-radius: 3px;
  27. cursor: pointer;
  28. }
  29. .crop_left {
  30. width: 40%;
  31. float: left;
  32. }
  33. .crop_right {
  34. width: 30%;
  35. float: right;
  36. margin-right: 25px;
  37. }
  38. .time-box .dates {
  39. width: 100% !important;
  40. }
  41. i.tub {
  42. right: 25px !important;
  43. }
  44. b.text_require {
  45. color: red;
  46. }
  47. .loader_icon {
  48. display: block;
  49. height: 36px;
  50. width: 36px;
  51. background: url(../../img/upLod.png) no-repeat;
  52. }
  53. /*.provCity select#province{
  54. width: 49%!important;
  55. display: inline-block!important;
  56. }*/
  57. .provCity > div > div {
  58. width: 49.5% !important;
  59. display: inline-block ;
  60. vertical-align: middle !important;
  61. }
  62. /*.provCity select#city {
  63. width: 50%!important;
  64. }*/
  65. /*
  66. #things{
  67. display: inline-block;
  68. }
  69. #equipment{
  70. display: none;
  71. } */
  72. #selecteqname{
  73. display: inline-block;
  74. }
  75. #eqname{
  76. display: none;
  77. }
  78. #eqmargin{
  79. margin-left:133px ;
  80. }
  81. .selequipname{
  82. margin-left: 93px;
  83. margin-top: -20px;
  84. }
  85. .selDpart1{
  86. display: none;
  87. position: absolute;
  88. left: 260px;
  89. top: 300px;
  90. z-index: 11111;
  91. width: 280px;
  92. line-height: 30px;
  93. background: #FFFFFF;
  94. }
  95. #sponsor{
  96. width: 280px;
  97. border: 1px solid #00a1cb;
  98. margin: 0;
  99. padding: 0;
  100. list-style: none;
  101. max-height: 212px;
  102. overflow-x: hidden;
  103. overflow-y: scroll;
  104. }
  105. #sponsor li{
  106. margin: 0;
  107. padding-left: 10px;
  108. width: 280px;
  109. height: 30px;
  110. line-height: 30px;
  111. list-style: none;
  112. }
  113. #sponsor li:hover{
  114. background: #00a1cb;
  115. }
  116. .thumbnail {
  117. margin: 0 10px 10px;
  118. padding: 4px;
  119. float: left;
  120. width: 30%;
  121. height: 200px;
  122. background-color: #fff;
  123. border: 1px solid #ddd;
  124. border-radius: 4px;
  125. position: relative;
  126. cursor: pointer;
  127. }
  128. .thumbnail img {
  129. width: 100%;
  130. height: 100%;
  131. }
  132. .thumbnail .info {
  133. position: absolute;
  134. left: 4px;
  135. bottom: 4px;
  136. right: 4px;
  137. height: 35px;
  138. line-height: 35px;
  139. text-indent: 5px;
  140. background: rgba(0, 0, 0, 0.6);
  141. color: white;
  142. overflow: hidden;
  143. white-space: nowrap;
  144. text-overflow: ellipsis;
  145. font-size: 12px;
  146. z-index: 10;
  147. display: none;
  148. }
  149. .thumbnail:hover .info {
  150. display: block;
  151. }
  152. </style>
  153. </head>
  154. <body class="gray-bg">
  155. <div class="container wrapper-content animated fadeInRight">
  156. <div class="form-horizontal">
  157. <div class="form-group">
  158. <label for="channel" class="col-sm-3 control-label text-right"><b class="text_require">*</b>渠道来源</label>
  159. <div class="col-sm-9">
  160. <select class="form-control selectpicker" id="channel" data-live-search="true">
  161. <option value="1">电话</option>
  162. <option value="2">安卓</option>
  163. <option value="3">IOS </option>
  164. <option value="4">PC端</option>
  165. </select>
  166. </div>
  167. </div>
  168. <div class="form-group provCity" hidden="hidden">
  169. <!-- -->
  170. <label for="" class="col-sm-3 control-label text-right"><b class="text_require">*</b>省市</label>
  171. <div class="col-sm-9">
  172. <div>
  173. <select class="form-control selectpicker" id="province" data-live-search="true"></select>
  174. </div>
  175. <div>
  176. <select class="form-control selectpicker" id="city" data-live-search="true">
  177. <option value="">请选择市</option>
  178. </select>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="form-group" hidden="hidden">
  183. <!-- -->
  184. <label for="proname" class="col-sm-3 control-label text-right"><b class="text_require">*</b>项目名称</label>
  185. <div class="col-sm-9">
  186. <select class="form-control selectpicker" id="proname" data-live-search="true"></select>
  187. </div>
  188. </div>
  189. <div class="form-group provCity">
  190. <label for="repairreplace" class="col-sm-3 control-label text-right"><b class="text_require">*</b>楼名称</label>
  191. <div class="col-sm-9">
  192. <!--<select class="form-control selectpicker" id="repairreplace" data-live-search="true">
  193. </select>-->
  194. <div>
  195. <select class="form-control selectpicker" id="build" data-live-search="true">
  196. <option value="">请选择楼</option>
  197. </select>
  198. </div>
  199. </div>
  200. </div>
  201. <div class="form-group">
  202. <label for="floor" class="col-sm-3 control-label text-right"><b class="text_require">*</b>科室名称</label>
  203. <div class="col-sm-9">
  204. <select class="form-control selectpicker" id="floor" data-live-search="true">
  205. <option value="">请选择科室</option>
  206. </select>
  207. </div>
  208. </div>
  209. <div class="form-group" id="eqmargin">
  210. <div class="col-sm-9 " id="selecteqname">
  211. <b class="text_require">*</b>设备名称<input list="equipname" type="text" class="selequipname form-control" />
  212. </div>
  213. <datalist id="equipname">
  214. </datalist>
  215. </div>
  216. <div class="form-group hidden">
  217. <label for="protype_addText" class="col-sm-3 control-label text-right"><b class="text_require">*</b>项目类型</label>
  218. <div class="col-sm-9">
  219. <!--<select class="form-control selectpicker" id="protype" data-live-search="true">
  220. <option value="">请选择项目类型</option>
  221. </select>-->
  222. <input id="protype_addText" class="form-control" type="text" autocomplete="off" placeholder="请输入项目类型" readonly="readonly" />
  223. <input id="protype_addNode" class="form-control" type="hidden" />
  224. </div>
  225. </div>
  226. <div class="form-group">
  227. <label for="repairoom" class="col-sm-3 control-label text-right"><b class="text_require">*</b>报修地点</label>
  228. <div class="col-sm-9">
  229. <input id="repairoom" class="form-control" type="text" placeholder="请输入报修地点" autocomplete="off" />
  230. </div>
  231. </div>
  232. <!--<div class="form-group">
  233. <label for="repairtime" class="col-sm-3 control-label text-right"><b class="text_require">*</b>报修时间</label>
  234. <div class="col-sm-9 time-box">
  235. <i class="tub fa fa-calendar"></i>
  236. <input class="form-control search_time dates" type="text" id="repairtime" placeholder="请选择时间">
  237. </div>
  238. </div>-->
  239. <!-- <div class="form-group">
  240. <label for="repairman" class="col-sm-3 control-label text-right"><b class="text_require">*</b>报修人</label>
  241. <div class="col-sm-9">
  242. <input id="repairman" class="form-control" type="text" placeholder="请输入报修人" autocomplete="off" />
  243. </div>
  244. </div> -->
  245. <div class="form-group">
  246. <label for="repairman" class="col-sm-3 control-label text-right"><b class="text_require">*</b>报修人</label>
  247. <div class="col-sm-9">
  248. <input type="text" class="form-control" id="formComplainedUnit" placeholder="请输入" onkeyup="darptSearch()"
  249. autocomplete="off" />
  250. </div>
  251. </div>
  252. <div class="selDpart1">
  253. <ul id="sponsor">
  254. </ul>
  255. </div>
  256. <div class="form-group">
  257. <label for="contactway" class="col-sm-3 control-label text-right"><b class="text_require">*</b>联系方式</label>
  258. <div class="col-sm-9">
  259. <input id="contactway" class="form-control" type="text" placeholder="请输入联系方式" autocomplete="off" />
  260. </div>
  261. </div>
  262. <!--<div class="form-group">
  263. <label for="sysname" class="col-sm-3 control-label text-right"><b class="text_require">*</b>系统名称</label>
  264. <div class="col-sm-9">
  265. <select class="form-control selectpicker" id="sysname" data-live-search="true">
  266. </select>
  267. </div>
  268. </div>-->
  269. <!--<div class="form-group">
  270. <label for="faulttype" class="col-sm-3 control-label text-right"><b class="text_require">*</b>故障类型</label>
  271. <div class="col-sm-9">
  272. <select class="form-control selectpicker" id="faulttype" data-live-search="true">
  273. </select>
  274. </div>
  275. </div>-->
  276. <div class="form-group" hidden="hidden">
  277. <label for="faultdescripe" class="col-sm-3 control-label text-right"><b class="text_require">*</b>故障物品</label>
  278. <div class="col-sm-9">
  279. <input id="faultdescripe" class="form-control" type="text" autocomplete="off" />
  280. <!--去掉文本框改为下拉框-->
  281. </div>
  282. </div>
  283. <div class="form-group">
  284. <label for="" class="col-sm-3 control-label text-right">故障图片</label>
  285. <div class="col-sm-9 uploadTP">
  286. <div id="filePicker0" class="imgUpload" data-index="0">
  287. <i class="loader_icon"></i>
  288. </div>
  289. <div id='image_list0' class="row image-list "></div>
  290. </div>
  291. </div>
  292. <!--<div class="form-group">
  293. <label for="callid" class="col-sm-3 control-label text-right">通话标志ID</label>
  294. <div class="col-sm-9">
  295. <input id="callid" class="form-control" type="text" autocomplete="off" />
  296. </div>
  297. </div>-->
  298. <div class="form-group">
  299. <div class="col-sm-12" style="text-align: center;">
  300. <input type="button" id="HY_save" class="btn_gray btn" onclick="btn_save()" value="保存" />
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. <script src="../../js/webuploader/webuploader.min.js"></script>
  306. <!--<script src="../js/equipmentCommon.js"></script>-->
  307. <script src="../js/addEquipmentRepair.js"></script>
  308. <script>
  309. var ids = helper.request.queryString("ids");
  310. var ajaxUrl;
  311. //报修时间
  312. function getFormatDate() {
  313. var nowDate = new Date();
  314. var year = nowDate.getFullYear();
  315. var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
  316. var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
  317. var hour = nowDate.getHours() < 10 ? "0" + nowDate.getHours() : nowDate.getHours();
  318. var minute = nowDate.getMinutes() < 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes();
  319. var second = nowDate.getSeconds() < 10 ? "0" + nowDate.getSeconds() : nowDate.getSeconds();
  320. return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
  321. }
  322. $(document).ready(function() {
  323. //日期
  324. // lay('.dates').each(function () {
  325. // laydate.render({
  326. // elem: this,
  327. // trigger: 'click',
  328. // type: 'datetime'
  329. // });
  330. // });
  331. GetEquipName($('#equipname')); //设备名称
  332. //系统名称
  333. // helper.getDropList.getlistDropByDic($('#sysname'), 'XTMC');
  334. //项目类型
  335. // helper.getDropList.getlistDropByDic($('#protype'), 'XMLX');
  336. //报修地点
  337. // helper.getDropList.getlistDropByDic($('#repairreplace'), 'BXDD');
  338. //故障类型
  339. // helper.getDropList.getlistDropByDic($('#faulttype'), 'GZLX');
  340. if (ids) {
  341. $("#filePicker0").hide()
  342. ajaxUrl = "equipmentapi/api/worepairbase/update";
  343. getValue(ids);
  344. } else {
  345. $("#filePicker0").show()
  346. ajaxUrl = "equipmentapi/api/worepairbase/add";
  347. }
  348. //省市
  349. getProvinceCity($('#province'));
  350. getequipment()
  351. })
  352. //获取详情
  353. function getValue(ids) {
  354. $.ajax({
  355. type: "get",
  356. url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/getsingle",
  357. async: true,
  358. dataType: 'json',
  359. data: {
  360. id: ids
  361. },
  362. success: function(data) {
  363. if (data.state.toLowerCase() == 'success') {
  364. var modelList = data.data.model
  365. $('#channel').selectpicker('val', modelList.channel.toString()).trigger('change') //渠道
  366. $("#formComplainedUnit").val(modelList.repairman) // 报修人
  367. $('#contactway').val(modelList.contactway) //联系方式
  368. $('#build').selectpicker('val', modelList.buildid.toString()).trigger('change') //楼
  369. $('#repairoom').val(modelList.repairoom) // 报修地点
  370. $('#floor').selectpicker('val', modelList.floorid.toString()).trigger('change') //科室
  371. $(".selequipname").val(modelList.faultdescripe) //设备名称
  372. if (modelList.faultpic) {
  373. $(modelList.faultpic).each(function(g, h) {
  374. $('<div class="thumbnail" data-fileurl="' + h.fileurl + '">' +
  375. '<img layer-src="' + h.fileurl + '" alt="' + h.filename + '" src="' + h.filesmallurl + '" alt="" />' +
  376. '<div class="info">' + h.filename + '</div>' +
  377. '</div>').appendTo('#image_list0')
  378. });
  379. }
  380. }
  381. }
  382. });
  383. }
  384. uploaderImg(0)
  385. var imageArr0 = '';
  386. //添加图片
  387. function uploaderImg(cindex) {
  388. var imgList = $('#image_list' + cindex),
  389. eleId = $('#filePicker' + cindex),
  390. uploader;
  391. uploader = WebUploader.create({
  392. // 自动上传。
  393. auto: true,
  394. // swf文件路径
  395. swf: '../../js/Uploader.swf',
  396. // 文件接收服务端。
  397. server: huayi.config.callcenter_url + 'fileserverapi/Api/Upload',
  398. // 选择文件的按钮。可选。
  399. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  400. pick: eleId,
  401. // 图片数量限制
  402. fileNumLimit: 6,
  403. //可以重复上传
  404. duplicate: true,
  405. formData: {
  406. uploadtype: 'equipment' //自定义文件夹用于存放图片
  407. },
  408. // 只允许选择文件,可选。
  409. accept: {
  410. title: 'Images',
  411. extensions: 'gif,jpg,jpeg,bmp,png',
  412. mimeTypes: 'image/*'
  413. },
  414. resize: false,
  415. fileSizeLimit: 30 * 1024 * 1024, // 30 M
  416. fileSingleSizeLimit: 5 * 1024 * 1024, // 5 M
  417. });
  418. //上传图片提示
  419. uploader.on('error', function(code) {
  420. switch (code) {
  421. case "Q_EXCEED_NUM_LIMIT":
  422. layer.msg('只能上传六个文件。');
  423. break;
  424. case "Q_TYPE_DENIED":
  425. layer.msg('图片类型不正确。');
  426. break;
  427. case "F_DUPLICATE":
  428. layer.msg('该文件已上传,请选择其它文件。');
  429. break;
  430. case "F_EXCEED_SIZE":
  431. layer.msg('单文件大小不能超过5M。');
  432. break;
  433. case "Q_EXCEED_SIZE_LIMIT":
  434. layer.msg('总文件大小不能超过30M。');
  435. break;
  436. default:
  437. break;
  438. }
  439. });
  440. // 当有文件添加进来的时候
  441. uploader.on('fileQueued', function(file) {
  442. console.log(file);
  443. var $li = $(
  444. '<div id="' + cindex + '' + file.id + '" class="file-item thumbnail">' +
  445. '<div class="image-close">X</div>' +
  446. '<img>' +
  447. '<div class="info">' + file.name + '</div>' +
  448. '</div>'
  449. ),
  450. $img = $li.find('img');
  451. imgList.prepend($li);
  452. $('#' + cindex + file.id).on('click', ".image-close", function() {
  453. event.stopPropagation();
  454. $(this).parent().remove();
  455. uploader.removeFile(file);
  456. helper.methods.delImgs($(this).parent().attr("data-filesmallurl"), $(this).parent().attr("data-fileurl"));
  457. file_num(cindex)
  458. });
  459. });
  460. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  461. uploader.on('uploadSuccess', function(file, response) {
  462. console.log(file)
  463. $.each(response.data, function(i, j) {
  464. // obj=
  465. var $img = $('#' + cindex + file.id).find('img');
  466. $('#' + cindex + file.id).attr({
  467. 'data-filename': j.filename,
  468. 'data-fileext': j.fileext,
  469. 'data-filemd5': j.filemd5,
  470. 'data-filesize': j.filesize,
  471. 'data-fileurl': j.fileurl,
  472. 'data-filesmallurl': j.filesmallurl
  473. });
  474. uploader.makeThumb(file, function(error, src) {
  475. $img.attr('src', j.filesmallurl);
  476. $img.addClass('image-item');
  477. // $img.attr('data-preview-group', "1");
  478. }, 50, 50);
  479. });
  480. $('#' + cindex + file.id).addClass('upload-state-done');
  481. file_num(cindex)
  482. });
  483. // 文件上传失败,现实上传出错。
  484. uploader.on('uploadError', function(file) {
  485. var $li = $('#' + cindex + file.id),
  486. $error = $li.find('div.error');
  487. // 避免重复创建
  488. if (!$error.length) {
  489. $error = $('<div class="error"></div>').appendTo($li);
  490. }
  491. $error.text('上传失败');
  492. });
  493. // 完成上传完了,成功或者失败,先删除进度条。
  494. // uploader.on('uploadComplete', function(file) {
  495. // });
  496. }
  497. //图片隐藏域值
  498. function file_num(num) {
  499. var arr = [];
  500. $('#image_list' + num).find('.thumbnail').each(function(j, m) {
  501. var obj = {
  502. 'filename': $(m).attr("data-filename"),
  503. 'fileext': $(m).attr("data-fileext"),
  504. 'filemd5': $(m).attr("data-filemd5"),
  505. 'filesize': $(m).attr("data-filesize"),
  506. 'fileurl': $(m).attr("data-fileurl"),
  507. 'filesmallurl': $(m).attr("data-filesmallurl")
  508. }
  509. arr.push(obj)
  510. })
  511. window['imageArr' + num] = arr;
  512. }
  513. //保存
  514. function btn_save() {
  515. addValue();
  516. }
  517. // 故障物品change
  518. var repairplaceStr = ''
  519. var descripe = ''
  520. var descripeStr = ''
  521. $("#floor").bind("change", function() {
  522. if ($("#floor option:selected").text() == '器械科') {
  523. $("#selecteqname").css({
  524. "display": "none"
  525. })
  526. $("#eqname").css({
  527. "display": "inline-block"
  528. })
  529. console.log(descripeStr)
  530. } else {
  531. $("#eqname").css({
  532. "display": "none"
  533. })
  534. $("#selecteqname").css({
  535. "display": "inline-block"
  536. })
  537. }
  538. })
  539. //报修人
  540. function darptSearch() {
  541. if ($('#formComplainedUnit').val() == '') {
  542. $(".selDpart1").css('display', 'none');
  543. } else {
  544. $(".selDpart1").css('display', 'block');
  545. getFormComplainedUnit();
  546. }
  547. }
  548. $("#sponsor").on('click', 'li', function() {
  549. $(".selDpart1").css('display', 'none');
  550. $("#formComplainedUnit").val($(this).html());
  551. })
  552. function getFormComplainedUnit() {
  553. $("#sponsor").empty();
  554. $.ajax({
  555. type: "get",
  556. url: huayi.config.callcenter_url + "testusertypeapi/api/TestUserType/getuserinfobycodename",
  557. dataType: 'json',
  558. async: true,
  559. data: {
  560. codename: $("#formComplainedUnit").val(),
  561. },
  562. success: function(data) {
  563. if (data.state.toLowerCase() == "success") {
  564. var content = data.data;
  565. if (content.length === 0) {
  566. $(".selDpart1").css('display', 'none');
  567. } else {
  568. $(content).each(function(i, n) {
  569. $("<li index='" + n.usercode + "' >" + n.usercode + '-' + n.username + "</li>").appendTo("#sponsor");
  570. })
  571. }
  572. }
  573. }
  574. });
  575. }
  576. //添加
  577. function addValue() {
  578. repairplaceStr = $("#build option:selected").text() + " " + $("#floor option:selected").text();
  579. // if($("#floor option:selected").text()=='1层 器械科'){
  580. // descripeStr = $("#eqtext").val()
  581. // // descripe= $(".equipmentval").val()
  582. // }else{
  583. // descripeStr = $("#equipname").val()
  584. // }
  585. // console.log($(".equipmentval").val(),$("#build option:selected").text())
  586. if (!regexs.phone.test($.trim($("#contactway").val())) || $("#contactway").val() == '') {
  587. layer.confirm('请输入有效的联系方式!', {
  588. icon: 2,
  589. btn: ['确定'] //按钮
  590. });
  591. return;
  592. }
  593. if (!$("#province").val() || !$("#city").val()) {
  594. layer.confirm('请选择省市!', {
  595. icon: 2,
  596. btn: ['确定'] //按钮
  597. });
  598. return;
  599. }
  600. if (!$("#formComplainedUnit").val()) {
  601. layer.confirm('请输入报修人!', {
  602. icon: 2,
  603. btn: ['确定'] //按钮
  604. });
  605. return;
  606. }
  607. if (!$("#repairoom").val()) {
  608. layer.confirm('请输入报修地点!', {
  609. icon: 2,
  610. btn: ['确定'] //按钮
  611. });
  612. return;
  613. }
  614. if (!$(".selequipname").val()) {
  615. layer.confirm('请选择或输入设备名称!', {
  616. icon: 2,
  617. btn: ['确定'] //按钮
  618. });
  619. return;
  620. }
  621. // debugger
  622. $.ajax({
  623. type: "post",
  624. url: huayi.config.callcenter_url + ajaxUrl,
  625. async: true,
  626. dataType: 'json',
  627. data: {
  628. id: ids,
  629. channel: $('#channel').val(), // 是 渠道来源 1表示PC 2表示安卓 3表示IOS 4表示微信
  630. province: $('#province').val(), //省
  631. city: $('#city').val(), //市
  632. projectid: $('#proname').val(), // 项目名称
  633. // protypeid: $('#protype_addNode').val(), // 项目类型
  634. buildid: $("#build option:selected").val(), //楼
  635. floorid: $("#floor option:selected").val(), //楼层
  636. repairreplace: repairplaceStr, // 报修地点
  637. repairoom: $('#repairoom').val(), // 房间号
  638. repairtime: getFormatDate(), // 报修时间
  639. repairman: $("#formComplainedUnit").val(), // 是 string 报修人
  640. contactway: $('#contactway').val(), // 是 string 联系方式
  641. faultdescripe: $(".selequipname").val(), // $('#faultdescripe').val(), // 否 string 故障说明
  642. faultpic: imageArr0 // 故障图片,上传的json
  643. //callid: $('#callid').val(), //否 string 通话标志ID
  644. },
  645. success: function(data) {
  646. if (data.state.toLowerCase() == 'success') {
  647. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  648. parent.layer.close(index); //再执行关闭
  649. layer.msg(data.message);
  650. parent.$('#table1').bootstrapTable('refresh');
  651. }
  652. }
  653. });
  654. }
  655. function getequipment() {
  656. // $("#equipname").html('');
  657. equipmentdata = []
  658. // $("#equipname").append('<option selected="selected" value="">请选择设备</option>');
  659. $.ajax({
  660. type: "get",
  661. url: huayi.config.callcenter_url + "equipmentapi/api/Equipment/getlistsbypage", //获取数据的Servlet地址
  662. async: true,
  663. dataType: 'json',
  664. data: {
  665. pageindex: 1,
  666. pagesize: 1000,
  667. },
  668. success: function(data) {
  669. var equipmentdata = []
  670. if (data.state.toLowerCase() == 'success') {
  671. equipmentdata = data.data.rows
  672. // console.log(equipmentdata.length)
  673. if (equipmentdata.length > 0) {
  674. for (var k = 0; k < equipmentdata.length; k++) {
  675. $(equipmentdata[k]).each(function(q, p) {
  676. $('#equipname')
  677. .append('<option label="' + p.equipment_name + '" value="' + p.equipment_name + '"></option>');
  678. // $("<option value='" + p.equipment_name + "'>" + p.equipment_name + "</option>").appendTo("#equipname");
  679. $("#equipname").selectpicker('refresh');
  680. // console.log(p.equipment_name)
  681. });
  682. }
  683. } else {
  684. $("#equipname").empty();
  685. $("#equipname").selectpicker('refresh');
  686. }
  687. }
  688. }
  689. });
  690. }
  691. </script>
  692. </body>
  693. </html>