dep_ps.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta name="viewport" content="widtd=device-widtd, initial-scale=1.0">
  5. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  6. <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
  7. <link rel="stylesheet" type="text/css" href="/static/css/layer.css">
  8. <link rel="stylesheet" type="text/css" href="/static/css/css.css">
  9. <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-select.min.css">
  10. <link rel="stylesheet" type="text/css" href="/static/css/macf.css">
  11. <script src="/static/js/jquery.min.js"></script>
  12. <script src="/static/js/bootstrap.min.js"></script>
  13. <script src="/static/js/vue-2.4.0.js"></script>
  14. <script src="/static/js/axios.min.js"></script>
  15. <!-- 用户操作cookie -->
  16. <script src="/static/js/vue-Cookies.js"></script>
  17. <!-- 下拉搜索插件 -->
  18. <script type="text/javascript" src="/static/js/jquery.select.js"></script>
  19. <script src="/static/js/bootstrap-select_new.js"></script>
  20. <script src="/static/js/layer.js"></script>
  21. <title>Document</title>
  22. </head>
  23. <body>
  24. <div id="app">
  25. <!-- navbar-default这个类是设置导航栏 -->
  26. <div class="navbar navbar-default">
  27. <div class="container">
  28. <!-- navbar-header用于设置内容横向显示 -->
  29. <div class="navbar-header">
  30. <a href="/index" class="navbar-brand"></a>
  31. </div>
  32. <!-- navbar-nav用来设置横向显示 -->
  33. <!-- navbar-right用来设置右浮动 -->
  34. <!-- hidden-xs用于当屏幕很小的情况下隐藏div里面的内容 -->
  35. <div class="hidden-xs">
  36. <ul class="nav navbar-nav">
  37. <li class="dropdown">
  38. <!--订单一览表-->
  39. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  40. 订单一览表
  41. <b class="caret"></b>
  42. </a>
  43. <ul class="nav dropdown-menu">
  44. <li><a href="/index">订单一览表</a></li>
  45. </ul>
  46. </li>
  47. <li class="dropdown">
  48. <!--月度产能评估表-->
  49. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  50. 月度产能评估表
  51. <b class="caret"></b>
  52. </a>
  53. <ul class="nav dropdown-menu">
  54. <li><a href="/depps">月度产能评估表</a></li>
  55. <li><a href="/dessettingtm">车间标准产能设置</a></li>
  56. </ul>
  57. </li>
  58. <li class="dropdown">
  59. <!--月度主排程计划-->
  60. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  61. 月度主排程计划
  62. <b class="caret"></b>
  63. </a>
  64. <ul class="nav dropdown-menu">
  65. <li><a href="/pcydscjhtm">PC月度生产计划(N+7)</a></li>
  66. <li><a href="/ydzpcjhtm">月度主排程计划</a></li>
  67. <li><a href="/ympxqjhtm">研磨品需求计划</a></li>
  68. <li><a href="/btmbxqtm">表头模板需求</a></li>
  69. </ul>
  70. </li>
  71. <li class="dropdown">
  72. <!--ie文件号管理-->
  73. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  74. IE工艺文件号管理
  75. <b class="caret"></b>
  76. </a>
  77. <ul class="nav dropdown-menu">
  78. <li><a href="/iefiletm">新增IE工艺文件号</a></li>
  79. <li><a href="/iefilemaintaintm">IE工艺文件号维护</a></li>
  80. <li><a href="/iefilemaintaindetailtm">IE效率明细表</a></li>
  81. <li><a href="/iefilemaintaininfotm">IE效率统计表</a></li>
  82. </ul>
  83. </li>
  84. </ul>
  85. <ul class="nav navbar-nav navbar-right">
  86. <li v-if="username !=''">
  87. <a>{% verbatim %}{{ '欢迎'+username+'!!!' }} {% endverbatim %}</a>
  88. </li>
  89. <li v-else><a href="">请登录</a></li>
  90. <li><a href="/login/" @click="logout()">退出登录</a></li>
  91. </ul>
  92. </div>
  93. </div>
  94. </div>
  95. <!--搜索-->
  96. <div class="filter">
  97. <div class="container ">
  98. <label>
  99. <div class="navbar-nav">查询日期起:</div>
  100. <div class="navbar-nav"><input type='date' class="input form-control" v-model="data_timeqi" /></div>
  101. </label>
  102. <label>
  103. <div class="navbar-nav">查询日期止:</div>
  104. <div class="navbar-nav"><input type='date' class="input form-control" v-model="data_timezhi" />
  105. </div>
  106. </label>
  107. <label>
  108. <div class="navbar-nav">部门:</div>
  109. <div class="navbar-nav">
  110. <input class="input form-control" id="testInput" type="text" autocomplete="off" />
  111. </div>
  112. </label>
  113. <label>
  114. <div class="navbar-nav">单号:</div>
  115. <div class="navbar-nav">
  116. <input class="input form-control" id="testInput2" type="text" autocomplete="off" />
  117. </div>
  118. </label>
  119. <label class="save def" id="def">
  120. <div class="btn btn-primary navbar-nav" @click="seek()">确定查询</div>
  121. </label>
  122. </div>
  123. </div>
  124. <!-- 内容 -->
  125. <!-- container这个类是设置居中对齐 -->
  126. <div class="container">
  127. <button class="btn btn-primary" data-toggle="modal" data-target="#myModal" @click="newly()">新增</button>
  128. <div class="modal fade" id="myModal">
  129. <div class="modal-dialog">
  130. <div class="modal-content" style="width: 300px;">
  131. <!-- 这里是标题 -->
  132. <div class="modal-header">
  133. <div class="modal-title">新增月度排产</div>
  134. </div>
  135. <!-- 这里是内容 -->
  136. <div class="modal-body">
  137. <table>
  138. <tr>
  139. <td>灌装生产线:
  140. <input class="input form-control" id="testInput1" type="text"
  141. autocomplete="off" />
  142. </td>
  143. </tr>
  144. <tr>
  145. <td>单据日期:
  146. <input type='date' class="input form-control" v-model="data_time_no" />
  147. </td>
  148. </tr>
  149. </table>
  150. </div>
  151. <!-- 这里是确定否 -->
  152. <div class="modal-footer">
  153. <button class="btn btn-primary" data-dismiss="modal" @click="add_dep_data()">确定</button>
  154. <button class="btn btn-primary" data-dismiss="modal">取消</button>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <button class="btn btn-primary abc" @click="add_no()" disabled="disabled">保存</button>
  160. <button class="btn btn-primary update" @click="update()" disabled="disabled">修改</button>
  161. <button class="btn btn-primary del" @click=del('','','','',data_list) disabled="disabled">删除</button>
  162. <label>
  163. <div class="input">
  164. 单号:<input type="text" v-model="monthly_odd_new" disabled="disabled">
  165. </div>
  166. </label>
  167. <label>
  168. <div class="input">
  169. 做单日期:<input type='date' v-model="data_time_no" disabled="disabled">
  170. </div>
  171. </label>
  172. <table class="table table-bordered table-hover table-striped">
  173. <tbody>
  174. <tr>
  175. <td class="macf_01">序号</td>
  176. <td class="macf_022">单号</td>
  177. <td class="macf_02">产线</td>
  178. <td class="macf_03">产线名称</td>
  179. <td class="macf_04">未完工数量</td>
  180. <td class="macf_05">标准/满线日产能</td>
  181. <td class="macf_07">订单可维持天数</td>
  182. <td class="macf_06">标准直接人员配置</td>
  183. <td class="macf_08">现有产能</td>
  184. <td class="macf_09">现有生产线/人员</td>
  185. <td class="macf_10">现有配置可生产天数</td>
  186. <td class="macf_11">现有辅助工人</td>
  187. <td class="macf_18">现有直接工人</td>
  188. <td class="macf_12">现有出勤人员合计</td>
  189. <td class="macf_13">直接工人274小时/25天</td>
  190. <td class="macf_14">按274小时/25天</td>
  191. <td class="macf_15">计划新增人员配置</td>
  192. <td class="macf_16">需求工时</td>
  193. <td class="macf_17">按25个工作日计算人员需求</td>
  194. <td class="macf_19">人员缺口</td>
  195. <td class="macf_20">编制</td>
  196. <td class="macf_21">备注</td>
  197. <td class="macf_22">操作</td>
  198. </tr>
  199. <tr class="save" v-for="(item,i) in data_list" :key="item.DEP_DEP"
  200. :class="i == activeIndex?'tr_active':''">
  201. <!--这里是序号-->
  202. <td class="macf_01" v-text="i+1"></td>
  203. <!-- 单号 -->
  204. <td class="macf_022" v-text="item.no"></td>
  205. <!--产线-->
  206. <td class="macf_02" v-text="item.dep"></td>
  207. <!--产线名称-->
  208. <td class="macf_03" v-text="item.dep_name"></td>
  209. <!--未完工数量-->
  210. <td class="macf_04"><input class="macf_04 macf_td" type="number" v-model="item.un_qty"
  211. disabled="disabled"></td>
  212. <!--标准/满线日产能-->
  213. <td class="macf_05"><input class="macf_05 macf_td" type="number" min="0"
  214. v-model="item.s_capacity"></td>
  215. <!--订单可维持天数-->
  216. <td class="macf_07"><input class="macf_07 macf_td" type="number" min="0"
  217. v-bind:value="Number(item.un_qty)/Number(item.s_capacity) | rounding"
  218. disabled="disabled"></td>
  219. <!--标准直接人员配置-->
  220. <td class="macf_06"><input class="macf_06 macf_td" type="number" min="0"
  221. v-model="item.s_d_staffing">
  222. </td>
  223. <!--现有产能-->
  224. <td class="macf_08"><input class="macf_08 macf_td" type="number" min="0"
  225. v-model="item.e_capacity"></td>
  226. <!--现有生产线/人员-->
  227. <td class="macf_09"><input class="macf_09 macf_td" type="number" min="0"
  228. v-model="item.epl_personnel">
  229. </td>
  230. <!--现有配置可生产天数-->
  231. <td class="macf_10"><input class="macf_10 macf_td" type="number"
  232. v-bind:value="Number(item.un_qty)/Number(item.e_capacity) | rounding"
  233. disabled="disabled"></td>
  234. <!--现有辅助工人-->
  235. <td class="macf_11"><input class="macf_11 macf_td" type="number" min="0"
  236. v-model="item.e_a_workers">
  237. </td>
  238. <!--现有直接工人-->
  239. <td class="macf_18"><input class="macf_18 macf_td" type="number" min="0"
  240. v-model="item.e_d_workers">
  241. </td>
  242. <!--现有出勤人员合计-->
  243. <td class="macf_12"><input class="macf_12 macf_td" type="number"
  244. v-bind:value="Number(item.e_a_workers)+Number(item.e_d_workers) | rounding"
  245. disabled="disabled"></td>
  246. <!--直接工人274小时/25天-->
  247. <td class="macf_13"><input class="macf_13 macf_td" type="number"
  248. v-bind:value="(Number(item.ok_qty)/(Number(item.s_capacity)+Number(item.s_d_staffing)))/25 | rounding"
  249. disabled="disabled"></td>
  250. <!--按274小时/25天-->
  251. <td class="macf_14"><input class="macf_14 macf_td" type="number"
  252. v-bind:value="(Number(item.ok_qty)/(Number(item.s_capacity)+Number(item.s_d_staffing)))/25+Number(item.e_a_workers) | rounding"
  253. disabled="disabled"></td>
  254. <!--计划新增人员配置-->
  255. <td class="macf_15"><input class="macf_15 macf_td" type="number"
  256. v-bind:value="(Number(item.ok_qty)/(Number(item.s_capacity)+Number(item.s_d_staffing)))/25-Number(item.e_d_workers) | rounding"
  257. disabled="disabled"></td>
  258. <!--需求工时-->
  259. <td class="macf_16"><input class="macf_16 macf_td" type="number"
  260. v-bind:value="Number(item.s_d_staffing)*(Number(item.un_qty)/Number(item.s_capacity))*11 | rounding"
  261. disabled="disabled"></td>
  262. <!--按25个工作日计算人员需求-->
  263. <td class="macf_17"><input class="macf_17 macf_td" type="number"
  264. v-bind:value="Number(item.s_d_staffing)*(Number(item.un_qty)/Number(item.s_capacity))*11/274*1.2 | rounding"
  265. disabled="disabled"></td>
  266. <!--人员缺口-->
  267. <td class="macf_19"><input class="macf_19 macf_td" type="number"
  268. v-bind:value="Number(item.s_d_staffing)*(Number(item.un_qty)/Number(item.s_capacity))*11/274*1.2-item.e_d_workers | rounding"
  269. disabled="disabled"></td>
  270. <!--编制-->
  271. <td class="macf_20"><input class="macf_20 macf_td" type="text" v-model="item.a_strength"></td>
  272. <!--备注-->
  273. <td class="macf_21"><textarea class="macf_21 macf_td" rows="1" cols="10"
  274. v-model="item.rem"></textarea></td>
  275. <!--操作-->
  276. <td class="macf_22"><button class="btn btn-primary row_del"
  277. @click="del(i,item.dep,item.no,item.itm,'')">删除</button></td>
  278. </tr>
  279. </tbody>
  280. </table>
  281. </div>
  282. <div class="footer">
  283. 分页
  284. </div>
  285. </div>
  286. <script>
  287. var vm = new Vue({
  288. el: '#app',
  289. data: {
  290. username: '', //用户名
  291. data_timeqi: '', //用户查询日期起
  292. data_timezhi: '', //用户查询日期止
  293. activeIndex: 0, //用于设置选择表格行变化颜色
  294. DEP_QTY: 0, //sum()函数测试计算用
  295. DEP_CN: 0, //sum()函数测试计算用
  296. qty: 0, //sum()函数测试计算用
  297. add_date: [], //用于监控测试
  298. data_list: [], //用户新增查询部门得到的数据保存
  299. monthly_odd_new: '保存显示', //用于前台单号的显示与否
  300. data_time_no: '', //单据日期
  301. activeIndex: 0, //激活选中tr的颜色变化
  302. mo_no: '', //重构开始
  303. dep: '', //车间部门
  304. dep_name: '', //车间部门名称
  305. no: '', // 单号
  306. dd: '', //单据日期
  307. un_qty: 0, //未完工数量
  308. s_capacity: 0, //标准/满线日产能
  309. s_d_staffing: 0, //标准直接人员配置
  310. tolf_days: 0, //订单可维持天数
  311. e_capacity: 0, //现有产能
  312. epl_personnel: 0, //现有生产线/人员
  313. p_d_f_e_configurations: 1, //现有配置可生产天数
  314. a_strength: '', //编制
  315. e_a_workers: 0, //现在有辅助工人
  316. work_sum: 0, //现有出勤人员合计
  317. zj_274_24: 0, //直接工人按按274小时/25天配置人员
  318. a_274_24: 0, //按274小时/25天配置人员
  319. new_personnel: 0, //计划新增人员配置
  320. rem: '', //备注
  321. need_hours: 0, //需求工时
  322. a_25: 0, //按25个工作日计算人员需求
  323. e_d_workers: 0, //现有直接工人
  324. p_gap: 0, //人员缺口
  325. },
  326. mounted() {
  327. // 获取登录名
  328. // this.username=getCookie('username');
  329. this.username = $cookies.get('username')
  330. // console.log($cookies.get('username'))
  331. },
  332. methods: {
  333. // 根据部门查询后台数据
  334. add_dep_data() {
  335. // 获取搜索框的值
  336. var serch_var = $("#testInput1").val()
  337. // alert('qq')
  338. if (serch_var == '' | typeof serch_var === 'undefined') {
  339. alert("请选择部门")
  340. return
  341. }
  342. if (serch_var == '') {
  343. alert("部门没选择上")
  344. return
  345. }
  346. axios.get('/depmacfdepdata/', {
  347. params: {
  348. dep: serch_var
  349. }
  350. })
  351. .then(res => {
  352. // alert(res.data)
  353. var itm = res.data.data
  354. for (let i in itm) {
  355. this.data_list.push(itm[i])
  356. };
  357. })
  358. .catch(err => {
  359. alert(err.response["data"] + err.response["status"])
  360. })
  361. },
  362. // 保存单据
  363. add_no() {
  364. //获取单号
  365. // 判断有没有数据
  366. if (this.data_list.length == 0) {
  367. alert('表身没有数据可保存');
  368. return
  369. }
  370. if (this.monthly_odd_new !== '') {
  371. {
  372. axios.post('/depmacf/', {
  373. data: {
  374. data_list: this.data_list,
  375. data_time_no: this.data_time_no
  376. }
  377. })
  378. .then(res => {
  379. // alert(res.data)
  380. var data1 = res.data.data
  381. this.monthly_odd_new = data1
  382. $(".abc").attr("disabled", "disabled");
  383. //移除修改按钮禁止效果disabled
  384. $('.update').removeAttr('disabled')
  385. //移除删除按钮禁止效果disabled
  386. $('.del').removeAttr('disabled')
  387. alert("保存成功")
  388. })
  389. .catch(err => {
  390. alert(err.response["data"] + err.response["status"])
  391. })
  392. }
  393. }
  394. console.log(this.add_date)
  395. //设置保存按钮为禁止
  396. this.monthly_odd_new = '保存显示'
  397. //
  398. },
  399. // 获取每一行的计算栏位qty
  400. qty_sum(i) {
  401. this.add_date[i]["qty"] = Number(this.add_date[i]["DEP_QTY"]) + Number(this.add_date[i]["DEP_CN"])
  402. console.log(this.add_date[i]["qty"])
  403. },
  404. // 修改操作
  405. update() {
  406. console.log(this.data_list)
  407. axios.put('/depmacf/', {
  408. data: {
  409. data: this.data_list
  410. }
  411. })
  412. .then(res => {
  413. // alert(res.data)
  414. console.log("修改成功")
  415. // this.data_list='';
  416. })
  417. .catch(err => {
  418. alert(err.response["data"] + err.response["status"])
  419. })
  420. },
  421. // 删除操作
  422. del(i, dep, no, itm, data) {
  423. // this.add_date.$remove(i);
  424. console.log(no)
  425. if (no == undefined) {
  426. this.data_list.splice(i, 1);
  427. return
  428. }
  429. axios.delete('/depmacf/', {
  430. data: {
  431. dep: dep,
  432. no: no,
  433. itm: itm,
  434. data: data
  435. }
  436. })
  437. .then(res => {
  438. // alert(res.data)
  439. console.log("删除成功")
  440. if (data !== '') {
  441. this.data_list = '';
  442. }
  443. else {
  444. this.data_list.splice(i, 1);
  445. }
  446. })
  447. .catch(err => {
  448. alert(err.response["data"] + err.response["status"])
  449. })
  450. },
  451. //新增
  452. newly() {
  453. // 如果是新增另外一张单的话那么清空数据
  454. if ($(".abc").prop("disabled") == true) {
  455. this.data_list = [];
  456. this.monthly_odd_new = '保存显示'
  457. }
  458. // 移除保存按钮禁止disabled效果
  459. $('.abc').removeAttr('disabled');
  460. //设置修改按钮为禁止效果
  461. $(".update").attr("disabled", "disabled");
  462. //设置删除按钮为禁止效果
  463. $(".del").attr("disabled", "disabled");
  464. },
  465. // 查询单据
  466. seek() {
  467. console.log('查询单据')
  468. // 获取搜索框的部门
  469. var serch_dep = $("#testInput").val()
  470. // 获取搜索框的单号
  471. var serch_no = $("#testInput2").val()
  472. console.log(serch_no)
  473. if (this.data_timeqi == '' & this.data_timezhi == '') {
  474. alert('请选择时间')
  475. return
  476. }
  477. axios.get('/depmacf/', {
  478. // params对象里面已键值对的形式放参数
  479. params: {
  480. "data_timeqi": this.data_timeqi,
  481. "data_timezhi": this.data_timezhi,
  482. "serch_dep": serch_dep,
  483. "serch_no": serch_no
  484. }
  485. }).then(res => {
  486. // 请求成功后的操作
  487. //设置保存按钮为禁止效果
  488. $(".abc").attr("disabled", "disabled");
  489. if (serch_no !== '') {
  490. //移除修改按钮禁止效果disabled
  491. $('.update').removeAttr('disabled')
  492. //移除删除按钮禁止效果disabled
  493. $('.del').removeAttr('disabled')
  494. }
  495. //设置删除行按钮为禁止效果
  496. // $(".row_del").attr("disabled", "disabled");
  497. this.data_list = ''
  498. var data = res.data.data
  499. this.data_list = data
  500. // console.log(this.data_list[0]["no"])
  501. // console.log(this.data_list)
  502. // console.log(res.data)
  503. }).catch(err => {
  504. //请求错误的处理
  505. alert(err.response["data"] + err.response["status"])
  506. })
  507. },
  508. //获取当前日期
  509. addDate() {
  510. var date = new Date();
  511. var seperator1 = "-";
  512. var year = date.getFullYear();
  513. var month = date.getMonth() + 1;
  514. var strDate = date.getDate();
  515. if (month >= 1 && month <= 9) {
  516. month = "0" + month;
  517. }
  518. if (strDate >= 0 && strDate <= 9) {
  519. strDate = "0" + strDate;
  520. }
  521. var currentdate = year + seperator1 + month + seperator1 + strDate;
  522. // console.log(currentdate)
  523. this.data_timezhi = this.data_timeqi = this.data_time_no = currentdate
  524. },
  525. //退出登录
  526. logout() {
  527. console.log("qweq")
  528. axios.delete('/login/', {
  529. params: {
  530. user_1: this.user_1,
  531. pswd: this.pswd,
  532. }
  533. })
  534. .then(res => {
  535. })
  536. .catch(err => {
  537. })
  538. },
  539. },
  540. filters: {
  541. rounding(value) {
  542. if (typeof value == "number") {
  543. return value.toFixed(2)
  544. }
  545. else {
  546. return "No Number!!!"
  547. }
  548. }
  549. },
  550. created() {
  551. this.addDate()
  552. },
  553. watch: {
  554. add_date(news, olds) {
  555. // console.log(news)
  556. // console.log(olds)
  557. }
  558. },
  559. });
  560. $(function () {
  561. // 开始写 jQuery 代码...
  562. var timer = null;
  563. // 定义一个公用的搜索接口
  564. function getStr(n, url, field, clickif) {
  565. //n为搜索的参数 url为请求的路由,filed是定位表单的id,
  566. //clickif用于判断是否是第一次加载,如果不是第一次加载则需要模拟点击
  567. var search = n
  568. // 配置路由
  569. if (typeof search === 'undefined') {
  570. search = ''
  571. };
  572. // console.log(search)
  573. axios.get(url, {
  574. params: {
  575. search_no: search
  576. }
  577. })
  578. .then(res => {
  579. // alert(res.data)
  580. var data1 = res.data.data
  581. datas = data1
  582. // console.log(datas)
  583. if (datas.length == 0) {
  584. alert("没有搜索到数据")
  585. return
  586. }
  587. $.selectSuggest(field, datas);
  588. // 是否第一次进入
  589. if (clickif !== 1) {
  590. $("#" + field).trigger("click");
  591. }
  592. })
  593. .catch(err => {
  594. console.log('error:' + err)
  595. })
  596. };
  597. //查询部门资料
  598. $("#testInput").bind("input propertychange", function (event) {
  599. var search = $("#testInput").val()
  600. // console.log($("#testInput1").val())
  601. timer && clearTimeout(timer);
  602. timer = setTimeout(function () {
  603. getStr(search, '/dept/', 'testInput');
  604. }, 1000);
  605. });
  606. getStr('', '/dept/', 'testInput', 1);
  607. // 点击新增时候灌装生产线资料获取
  608. $("#testInput1").bind("input propertychange", function (event) {
  609. var search = $("#testInput1").val()
  610. // console.log($("#testInput1").val())
  611. timer && clearTimeout(timer);
  612. timer = setTimeout(function () {
  613. getStr(search, '/dept/', 'testInput1');
  614. }, 1000);
  615. });
  616. //查询单号
  617. $("#testInput2").bind("input propertychange", function (event) {
  618. var search = $("#testInput2").val()
  619. // console.log($("#testInput1").val())
  620. timer && clearTimeout(timer);
  621. timer = setTimeout(function () {
  622. getStr(search, '/oddno/', 'testInput2');
  623. }, 1000);
  624. });
  625. getStr('', '/oddno/', 'testInput2', 1);
  626. });
  627. </script>
  628. </body>
  629. </html>