iefile.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  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/css.css">
  8. <link rel="stylesheet" type="text/css" href="/static/css/iefile.css">
  9. <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-select.min.css">
  10. <script src="/static/js/jquery.min.js"></script>
  11. <script src="/static/js/bootstrap.min.js"></script>
  12. <script src="/static/js/vue-2.4.0.js"></script>
  13. <script src="/static/js/axios.min.js"></script>
  14. <script src="/static/js/vue-Cookies.js"></script>
  15. <script type="text/javascript" src="/static/js/jquery.select.js"></script>
  16. <script src="/static/js/bootstrap-select_new.js"></script>
  17. <!-- 图标js -->
  18. <!-- <script src="/static/js/ionicons.js"></script> -->
  19. <title>Document</title>
  20. </head>
  21. <body>
  22. <div id="app">
  23. <div class="navbar navbar-default">
  24. <div class="container">
  25. <!-- navbar-header用于设置内容横向显示 -->
  26. <div class="navbar-header">
  27. <a href="/index" class="navbar-brand"></a>
  28. </div>
  29. <!-- navbar-nav用来设置横向显示 -->
  30. <!-- navbar-right用来设置右浮动 -->
  31. <!-- hidden-xs用于当屏幕很小的情况下隐藏div里面的内容 -->
  32. <div class="hidden-xs">
  33. <ul class="nav navbar-nav">
  34. <li class="dropdown">
  35. <!--订单一览表-->
  36. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  37. 订单一览表
  38. <b class="caret"></b>
  39. </a>
  40. <ul class="nav dropdown-menu">
  41. <li><a href="/index">订单一览表</a></li>
  42. </ul>
  43. </li>
  44. <li class="dropdown">
  45. <!--月度产能评估表-->
  46. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  47. 月度产能评估表
  48. <b class="caret"></b>
  49. </a>
  50. <ul class="nav dropdown-menu">
  51. <li><a href="/depps">月度产能评估表</a></li>
  52. <li><a href="/dessettingtm">车间标准产能设置</a></li>
  53. </ul>
  54. </li>
  55. <li class="dropdown">
  56. <!--月度主排程计划-->
  57. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  58. 月度主排程计划
  59. <b class="caret"></b>
  60. </a>
  61. <ul class="nav dropdown-menu">
  62. <li><a href="/pcydscjhtm">PC月度生产计划(N+7)</a></li>
  63. <li><a href="/ydzpcjhtm">月度主排程计划</a></li>
  64. <li><a href="/ympxqjhtm">研磨品需求计划</a></li>
  65. <li><a href="/btmbxqtm">表头模板需求</a></li>
  66. </ul>
  67. </li>
  68. <li class="dropdown">
  69. <!--ie文件号管理-->
  70. <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  71. IE工艺文件号管理
  72. <b class="caret"></b>
  73. </a>
  74. <ul class="nav dropdown-menu">
  75. <li><a href="/iefiletm">新增IE工艺文件号</a></li>
  76. <li><a href="/iefilemaintaintm">IE工艺文件号维护</a></li>
  77. <li><a href="/iefilemaintaindetailtm">IE效率明细表</a></li>
  78. <li><a href="/iefilemaintaininfotm">IE效率统计表</a></li>
  79. </ul>
  80. </li>
  81. </ul>
  82. <ul class="nav navbar-nav navbar-right">
  83. <li v-if="username !=''">
  84. <a>{% verbatim %}{{ '欢迎'+username+'!!!' }} {% endverbatim %}</a>
  85. </li>
  86. <li v-else><a href="">请登录</a></li>
  87. <li><a href="/login/" @click="logout()">退出登录</a></li>
  88. </ul>
  89. </div>
  90. </div>
  91. </div>
  92. <!--表头-->
  93. <div class="filter">
  94. <div class="container ">
  95. <table class="table">
  96. <tbody>
  97. <tr>
  98. <td class="align_right">收件日期:</td>
  99. <td class="align_left"><input type="date" v-model="da_date"></td>
  100. <td class="align_right">IE工艺文件编号:</td>
  101. <td class="align_left"><input type="text" v-model="file_serial" autocomplete="off"></td>
  102. <td class="align_right">工段名称:</td>
  103. <td class="align_left"><input type="text" v-model="workshop_name" autocomplete="off"></td>
  104. <td class="align_right">系统输单号:</td>
  105. <td class="align_left"><input type="text" v-model="iefile_no" disabled="disabled"></td>
  106. </tr>
  107. <tr>
  108. <td class="align_right">1小时管理费用(元/小时):</td>
  109. <td class="align_left"><input type="number" v-model="hr_up" min="0"></td>
  110. <td class="align_right">标准总人力(人):</td>
  111. <td class="align_left"><input type="number" v-model="total_manpower" min="0"></td>
  112. <td class="align_right">瓶颈时间(秒):</td>
  113. <td class="align_left"><input type="number" v-model="point" min="0"></td>
  114. <td class="align_right">输单电脑:</td>
  115. <td class="align_left"><input type="text" v-model="username" disabled="disabled"></td>
  116. </tr>
  117. <tr>
  118. <td class="align_right">文件标注单价:</td>
  119. <td class="align_left"><input type="number" v-model="postil_up" min="0"></td>
  120. <td class="align_right zyxt">作业线体:</td>
  121. <td class="align_left"><input type="text" id="dept" autocomplete="off"></td>
  122. <td class="align_right">作业时间(秒):</td>
  123. <td class="align_left"><input type="number" v-model="job_time" min="0"></td>
  124. <td class="align_right">输单日期:</td>
  125. <td colspan="3" class="align_left"><input type="data" v-model="sys_date"
  126. disabled="disabled"></td>
  127. </tr>
  128. <tr>
  129. <td class="align_right">文件备注:</td>
  130. <td colspan="5" class="align_left">
  131. <textarea rows="2" cols="150" v-model="rem"></textarea>
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. </div>
  137. </div>
  138. <!-- 内容 -->
  139. <!-- container这个类是设置居中对齐 -->
  140. <div class="container">
  141. <div class="Watch_body">
  142. <div class="navbar-left container_left">
  143. <ul class="list-unstyled">
  144. <li>
  145. <p class="itm_left left_float">BOM配方号</p>
  146. <p class="itm_right left_float">
  147. <button class="btn btn-primary navbar-nav" data-toggle="modal"
  148. data-target="#myModal">新增</button>
  149. </p>
  150. </li>
  151. <li v-for="(item,i) in list_bom" :key="i">
  152. <p class="itm_left left_float"><input type="text" v-model="item.bom_no"></p>
  153. <p class="itm_right left_float"><button class="btn btn-primary navbar-nav"
  154. @click="tf_iefile(i,item.iefile_no,item.bom_no,item.itm)">删除</button></p>
  155. </li>
  156. </ul>
  157. </div>
  158. <div class="navbar-left container_right">
  159. <ul class="list-unstyled">
  160. <li>
  161. <p class="itm_left left_float text-center">文本标注阶梯单价(元)</p>
  162. <p class="itm_right left_float text-center"><button class="btn btn-primary navbar-nav"
  163. @click=confirmqty()>新增</button></p>
  164. </li>
  165. <li>
  166. <p class="itm_left left_float text-center">数量</p>
  167. <p class="itm_right left_float text-center">单价</p>
  168. </li>
  169. <li v-for="(item,i) in list_qty" :key="i">
  170. <p class="itm_left left_float text-center"><input type="number" min="0" v-model="item.qty">
  171. </p>
  172. <p class="itm_right left_float text-center"><input type="number" min="0" v-model="item.up">
  173. </p>
  174. <p class="itm_del left_float text-center"><button class="btn btn-primary navbar-nav"
  175. @click="tf_iefile(i,item.iefile_no,'',item.itm)">删除</button></p>
  176. </li>
  177. </ul>
  178. </div>
  179. </div>
  180. </div>
  181. <div class="footer container footer_base">
  182. <div class="hidden-xs">
  183. <button class="btn btn-primary navbar-nav" @click="newly_empty()">新增</button>
  184. <button class="btn btn-primary navbar-nav save_ok" @click=newly()>保存</button>
  185. <button class="btn btn-primary navbar-nav update" @click="update_data()">修改</button>
  186. <button class="btn btn-primary navbar-nav" data-toggle="modal" data-target="#select">查询</button>
  187. <button class="btn btn-primary navbar-nav delete" @click="delete_odd()">删除</button>
  188. </div>
  189. </div>
  190. <!-- 这里是新增bom -->
  191. <div class="modal fade" id="myModal">
  192. <div class="modal-dialog">
  193. <div class="modal-content" style="width: 50%;">
  194. <div class="modal-header">
  195. <div class="modal-title" id="uppswd">选择BOM配方号</div>
  196. </div>
  197. <div class="modal-body" style="height: 150px;">
  198. <div class="form-group">
  199. <div style="height: 60px;background-color: #dff0d8;">
  200. <div class="alert alert-success sousuo" id="sousuo">成功提交!数据搜索中。</div>
  201. </div>
  202. <label for="bom">BOM配方号</label>
  203. <input type="text" class="form-control" id="bom" autocomplete="off">
  204. </div>
  205. </div>
  206. <div class="modal-footer">
  207. <button class="btn btn-primary" data-dismiss="modal" id="bom_ok"
  208. @click="confirmbom()">确定</button>
  209. <button class="btn btn-primary" data-dismiss="modal">取消</button>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <!-- 这里是查询 -->
  215. <div class="modal fade" id="select">
  216. <div class="modal-dialog">
  217. <div class="modal-content" style="width: 900px;">
  218. <div class="modal-header">
  219. <div class="modal-title">查询IE文件编号</div>
  220. </div>
  221. <div class="modal-body" style="height: 400px;">
  222. <div class="form-group">
  223. <div style="height: 15%;background-color: #dff0d8;">
  224. <div class="alert alert-success sousuo" id="iesousuo">成功提交!数据搜索中。</div>
  225. </div>
  226. <div class="slect_content">
  227. <div class="left_float select_file_right">
  228. <p>
  229. <label for="date_qi" class="text-center">收件日期起</label>
  230. <input type="date" class="form-control" v-model="date_qi" id="date_qi"
  231. autocomplete="off">
  232. </p>
  233. <p>
  234. <label for="date_zhi" class="text-center">收件日期止</label>
  235. <input type="date" class="form-control" v-model="date_zhi" id="date_zhi"
  236. autocomplete="off">
  237. </p>
  238. <p>
  239. <label for="ie_file" class="text-center">IE工艺文件编号</label>
  240. <input type="text" class="form-control" v-model="select_file_serial"
  241. id="ie_file" autocomplete="off">
  242. </p>
  243. <p>
  244. <label for="select_dep" class="text-center">作业线体</label>
  245. <input type="text" class="form-control" v-model="select_dep" id="select_dep"
  246. autocomplete="off">
  247. </p>
  248. <p>
  249. <label for="ie_file_no" class="text-center">ie文件单号</label>
  250. <input type="text" class="form-control" v-model="select_iefile_no"
  251. id="select_dep" autocomplete="off">
  252. </p>
  253. <p><button class="btn btn-primary navbar-nav" @click="select_data()">查找</button></p>
  254. </div>
  255. <div class="right_float select_file_left">
  256. <table class="table table-hover">
  257. <thead>
  258. <tr>
  259. <th class="slet_01">收件日期</th>
  260. <th class="slet_02">IE工艺文件编号</th>
  261. <th class="slet_03">作业线体</th>
  262. <th class="slet_04">输单电脑</th>
  263. <th class="slet_05">工段名称</th>
  264. <th class="slet_06">系统输单号</th>
  265. </tr>
  266. </thead>
  267. <tbody>
  268. <tr v-for="(item,i) in select_data_list" :key="i"
  269. v-bind:class='{active:i==activeIndex}'
  270. @click="pitch_on(i,item.iefile_no)">
  271. <td class="slet_01" v-text="item.ae_date"></td>
  272. <td class="slet_02" v-text="item.file_serial"></td>
  273. <td class="slet_03" v-text="item.dep_name"></td>
  274. <td class="slet_04" v-text="item.user_no"></td>
  275. <td class="slet_05" v-text="item.workshop_name"></td>
  276. <td class="slet_06" v-text="item.iefile_no"></td>
  277. </tr>
  278. </tbody>
  279. </table>
  280. </div>
  281. </div>
  282. </div>
  283. </div>
  284. <div class="modal-footer">
  285. <button class="btn btn-primary" data-dismiss="modal" @click="select_data_ok()">确定</button>
  286. <button class="btn btn-primary" data-dismiss="modal">取消</button>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. <script>
  293. var vm = new Vue({
  294. el: '#app',
  295. data: {
  296. select_data_list: [], //查询得到的数据
  297. date_qi: '', //查询开始日期
  298. date_zhi: '', //查询结束日期
  299. select_file_serial: '', //查询的时候用的ie文件编号
  300. select_dep: '', //查询的时候用作业线体
  301. select_iefile_no: '', //查询的时候用单号
  302. activeIndex: -1, //用于查询选中行改变颜色
  303. list_bom: [], //BOM配方
  304. list_qty: [], //阶梯单价
  305. iefile_no: '', //系统输单号
  306. hr_up: 0, //1小时管理费用(元/小时)
  307. da_date: '', //收件日期
  308. postil_up: 0, //文件批注单价
  309. rem: '', //文件备注
  310. file_serial: '', //IE工艺文件编号
  311. total_manpower: 0, //标准总人力(人)
  312. workshop_name: '', //工段名称
  313. point: 0, //瓶颈时间(秒)
  314. dep: '', //作业线体
  315. dep_name: '', //部门名称
  316. job_time: 0, //作业时间(秒)
  317. username: '', //输单电脑
  318. sys_date: '', //输单日期
  319. },
  320. mounted() {
  321. // 获取登录名
  322. // this.username=getCookie('username');
  323. this.username = $cookies.get('username')
  324. console.log($cookies.get('username'))
  325. },
  326. methods: {
  327. // 新增单据
  328. newly() {
  329. // 获取作业线体
  330. this.dep = $("#dept").val()
  331. if (this.dep == '') {
  332. alert('请选择作业线体')
  333. return
  334. }
  335. axios.post('/iefile/', {
  336. data: {
  337. hr_up: this.hr_up, //1小时管理费用(元/小时)
  338. da_date: this.da_date, //收件日期
  339. postil_up: this.postil_up, //文件批注单价
  340. rem: this.rem, //文件备注
  341. file_serial: this.file_serial, //IE工艺文件编号
  342. total_manpower: this.total_manpower, //标准总人力(人)
  343. workshop_name: this.workshop_name, //工段名称
  344. point: this.point, //瓶颈时间(秒)
  345. dep: this.dep, //作业线体
  346. job_time: this.job_time, //作业时间(秒)
  347. username: this.username, //输单电脑
  348. sys_date: this.sys_date, //输单日期
  349. list_bom: this.list_bom, //bom配方号
  350. list_qty: this.list_qty //阶梯单价
  351. }
  352. })
  353. .then(res => {
  354. // alert(res.data)
  355. var data1 = res.data
  356. this.iefile_no = data1.data
  357. // 设置保存按钮为禁止
  358. $(".save_ok").attr("disabled", "disabled");
  359. })
  360. .catch(err => {
  361. alert(err.response["data"] + err.response["status"])
  362. })
  363. },
  364. // 新增清空数据
  365. newly_empty() {
  366. $("#dept").val('')
  367. this.list_bom = []
  368. this.list_qty = []
  369. this.hr_up = this.postil_up = this.total_manpower = this.point = this.job_time = 0
  370. this.iefile_no = this.da_date = this.rem = this.file_serial = this.workshop_name = this.dep = this.dep_name = ''
  371. this.addDate()
  372. // 移除保存按钮禁止
  373. $('.save_ok').removeAttr('disabled')
  374. },
  375. // 删除表身
  376. tf_iefile(i, iefile_no, bom, itm) {
  377. // console.log(this.iefile_no)
  378. if (this.iefile_no == '') {
  379. if (bom != '' & bom != undefined) {
  380. this.list_bom.splice(i, 1);
  381. }
  382. else {
  383. this.list_qty.splice(i, 1);
  384. }
  385. return
  386. }
  387. if (iefile_no == '' || iefile_no == undefined) {
  388. alert("参数不全")
  389. return
  390. }
  391. if (itm <= 0 || itm == undefined) {
  392. alert("参数不全")
  393. return
  394. }
  395. axios.delete('/mfiefile/', {
  396. data: {
  397. iefile_no: iefile_no,
  398. bom: bom,
  399. itm: itm
  400. }
  401. })
  402. .then(res => {
  403. if (bom != '' & bom != undefined) {
  404. this.list_bom.splice(i, 1);
  405. }
  406. else {
  407. this.list_qty.splice(i, 1);
  408. }
  409. })
  410. .catch(err => {
  411. // console.log(err.response)
  412. alert(err.response["data"] + err.response["status"])
  413. })
  414. },
  415. // 单据查找
  416. select_data() {
  417. $("#iesousuo").show();
  418. axios.get('/mfiefile/', {
  419. params: {
  420. date_qi: this.date_qi,
  421. date_zhi: this.date_zhi,
  422. select_file_serial: this.select_file_serial,
  423. select_dep: this.select_dep,
  424. select_iefile_no: this.select_iefile_no
  425. }
  426. }).then(res => {
  427. var data = res.data.data
  428. this.select_data_list = data
  429. $("#iesousuo").html("数据查询成功请选择!!!")
  430. }).catch(err => {
  431. alert(err.response["data"] + err.response["status"])
  432. })
  433. },
  434. // 查询单据ok
  435. select_data_ok() {
  436. this.activeIndex = -1
  437. // console.log(this.iefile_no)
  438. if (this.iefile_no == '' || this.iefile_no == undefined) {
  439. alert("没有选择单据")
  440. return
  441. }
  442. axios.get('/iefile/', {
  443. params: {
  444. iefile_no: this.iefile_no
  445. }
  446. }).then(res => {
  447. var data = res.data
  448. this.list_bom = []
  449. this.list_qty = []
  450. this.iefile_no = res.data.datamf[0]["iefile_no"]
  451. this.hr_up = res.data.datamf[0]["hr_up"]
  452. this.da_date = res.data.datamf[0]["ae_date"]
  453. this.rem = res.data.datamf[0]["rem"]
  454. this.file_serial = res.data.datamf[0]["file_serial"]
  455. this.total_manpower = res.data.datamf[0]["total_manpower"]
  456. this.workshop_name = res.data.datamf[0]["workshop_name"]
  457. this.point = res.data.datamf[0]["point"]
  458. this.dep = res.data.datamf[0]["dep"]
  459. var dep_name = res.data.datamf[0]["dep_name"]
  460. $("#dept").val(this.dep + '->' + dep_name) //设置部门
  461. this.postil_up = res.data.datamf[0]["postil_up"]
  462. this.job_time = res.data.datamf[0]["job_time"]
  463. this.username = res.data.datamf[0]["user_no"]
  464. this.sys_date = res.data.datamf[0]["sys_date"]
  465. this.list_bom = (res.data.tfiefilebom)
  466. this.list_qty = res.data.tfiefileqty
  467. // 设置保存按钮为禁止
  468. $(".save_ok").attr("disabled", "disabled");
  469. // 移除禁止
  470. $('.delete').removeAttr('disabled')
  471. $('.update').removeAttr('disabled')
  472. }).catch(err => {
  473. alert(err.response["data"] + err.response["status"])
  474. })
  475. },
  476. //点击查询含改变颜色
  477. pitch_on(i, iefile_no) {
  478. this.activeIndex = i
  479. this.iefile_no = ''
  480. this.iefile_no = iefile_no
  481. },
  482. // 新增一行BOM
  483. confirmbom() {
  484. var bom = $("#bom").val().split("->")[0] + '->';
  485. console.log(bom)
  486. var bom_itm = { "bom_no": bom }
  487. this.list_bom.push(bom_itm)
  488. },
  489. // 新增阶梯单价一行
  490. confirmqty() {
  491. this.list_qty.push({ "QTY": 0, "UP": 0 })
  492. },
  493. // 修改单据
  494. update_data() {
  495. // 获取作业线体
  496. this.dep = $("#dept").val()
  497. if (this.dep == '') {
  498. alert('请选择作业线体')
  499. return
  500. }
  501. axios.put('/iefile/', {
  502. data: {
  503. iefile_no: this.iefile_no,
  504. hr_up: this.hr_up, //1小时管理费用(元/小时)
  505. da_date: this.da_date, //收件日期
  506. postil_up: this.postil_up, //文件批注单价
  507. rem: this.rem, //文件备注
  508. file_serial: this.file_serial, //IE工艺文件编号
  509. total_manpower: this.total_manpower, //标准总人力(人)
  510. workshop_name: this.workshop_name, //工段名称
  511. point: this.point, //瓶颈时间(秒)
  512. dep: this.dep, //作业线体
  513. job_time: this.job_time, //作业时间(秒)
  514. username: this.username, //输单电脑
  515. sys_date: this.sys_date, //输单日期
  516. list_bom: this.list_bom, //bom配方号
  517. list_qty: this.list_qty //阶梯单价
  518. }
  519. })
  520. .then(res => {
  521. // alert(res.data)
  522. var data1 = res.data
  523. this.list_qty = data1.list_qty
  524. this.list_bom = data1.list_bom
  525. alert("修改成功")
  526. // 设置保存按钮为禁止
  527. $(".save_ok").attr("disabled", "disabled");
  528. })
  529. .catch(err => {
  530. alert(err.response["data"] + err.response["status"])
  531. })
  532. },
  533. // 删除单据
  534. delete_odd() {
  535. axios.delete('/iefile/', {
  536. data: {
  537. iefile_no: this.iefile_no
  538. }
  539. }).then(res => {
  540. // console.log(this.iefile_no)
  541. alert("删除成功")
  542. $("#dept").val('')
  543. this.list_bom = []
  544. this.list_qty = []
  545. this.hr_up = this.postil_up = this.total_manpower = this.point = this.job_time = 0
  546. this.iefile_no = this.da_date = this.rem = this.file_serial = this.workshop_name = this.dep = this.dep_name = ''
  547. this.addDate()
  548. // 移除保存按钮禁止
  549. // $('.save_ok').removeAttr('disabled')
  550. }).catch(err => {
  551. alert(err.response["data"] + err.response["status"])
  552. })
  553. },
  554. //获取当前日期
  555. addDate() {
  556. var date = new Date();
  557. var seperator1 = "-";
  558. var year = date.getFullYear();
  559. var month = date.getMonth() + 1;
  560. var strDate = date.getDate();
  561. if (month >= 1 && month <= 9) {
  562. month = "0" + month;
  563. }
  564. if (strDate >= 0 && strDate <= 9) {
  565. strDate = "0" + strDate;
  566. }
  567. var currentdate = year + seperator1 + month + seperator1 + strDate;
  568. // console.log(currentdate)
  569. this.date_qi = this.date_zhi = this.da_date = this.sys_date = currentdate
  570. },
  571. //退出登录
  572. logout() {
  573. console.log("qweq")
  574. axios.delete('/login/', {
  575. params: {
  576. user_1: this.user_1,
  577. pswd: this.pswd,
  578. }
  579. })
  580. .then(res => {
  581. })
  582. .catch(err => {
  583. })
  584. },
  585. },
  586. created() {
  587. this.addDate()
  588. }
  589. });
  590. $(function () {
  591. // 开始写 jQuery 代码...
  592. // 设置隐藏
  593. $("#sousuo").hide();
  594. $("#iesousuo").hide();
  595. // 设置禁用
  596. $("#bom_ok").attr("disabled", "disabled");
  597. $(".update").attr("disabled", "disabled");
  598. $(".delete").attr("disabled", "disabled");
  599. var timer = null;
  600. // 定义一个公用的搜索接口
  601. // console.log(vm.$data.list)
  602. function getStr(n, url, field, clickif) {
  603. //n为搜索的参数 url为请求的路由,filed是定位表单的id,
  604. //clickif用于判断是否是第一次加载,如果不是第一次加载则需要模拟点击
  605. var search = n
  606. // 配置路由
  607. if (typeof search === 'undefined') {
  608. search = ''
  609. };
  610. // console.log(search)
  611. axios.get(url, {
  612. params: {
  613. search_no: search
  614. }
  615. })
  616. .then(res => {
  617. // alert(res.data)
  618. var data1 = res.data.data
  619. datas = data1
  620. // console.log(datas)
  621. if (datas.length == 0) {
  622. alert("没有搜索到数据")
  623. return
  624. }
  625. $.selectSuggest(field, datas);
  626. // $("#sousuo").hide();
  627. if (url == '/bom/') {
  628. $("#sousuo").html("数据查询成功请选择!!!");
  629. $('#bom_ok').removeAttr('disabled')
  630. }
  631. // console.log("ok")
  632. // setTimeout(function () {
  633. // $.selectSuggest(field, datas);
  634. // }, 1000);
  635. // 是否第一次进入
  636. if (clickif !== 1) {
  637. $("#" + field).trigger("click");
  638. }
  639. })
  640. .catch(err => {
  641. alert(err.response["data"] + err.response["status"])
  642. })
  643. };
  644. //查询BOM资料调用
  645. $("#bom").bind("input propertychange", function (event) {
  646. var search = $("#bom").val()
  647. // console.log($("#testInput").val())
  648. timer && clearTimeout(timer);
  649. timer = setTimeout(function () {
  650. // $("#sousuo").hide();
  651. $("#sousuo").show();
  652. getStr(search, '/bom/', 'bom');
  653. }, 1000);
  654. });
  655. //查询部门资料调用
  656. $("#dept").bind("input propertychange", function (event) {
  657. var search = $("#dept").val()
  658. // console.log($("#testInput").val())
  659. timer && clearTimeout(timer);
  660. timer = setTimeout(function () {
  661. getStr(search, '/dept/', 'dept');
  662. }, 1000);
  663. });
  664. getStr('', '/dept/', 'dept', 1);
  665. });
  666. </script>
  667. <!-- <script type="text/javascript" src="/static/js/export/jquery-1.8.2.js"></script> -->
  668. </body>
  669. </html>