iefilemaintain.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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/iefilemaintain.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. <label>
  96. <div class="navbar-nav">IE录入日期:</div>
  97. <div class="navbar-nav"><input type='date' class="input form-control" v-model='data_timeqi' /></div>
  98. </label>
  99. <label>
  100. <div class="navbar-nav">至:</div>
  101. <div class="navbar-nav"><input type='date' class="input form-control" v-model='data_timezhi' />
  102. </div>
  103. </label>
  104. <label>
  105. <div class="navbar-nav">车间:</div>
  106. <div class="navbar-nav">
  107. <input class="input form-control" id="erp_dep" type="text" autocomplete="off" />
  108. </div>
  109. </label>
  110. <label>
  111. <div class="navbar-nav">缴库单号:</div>
  112. <div class="navbar-nav">
  113. <input class="input form-control" id="mf_mmo" type="text" autocomplete="off" />
  114. </div>
  115. </label>
  116. <label>
  117. <div class="navbar-nav">IE工艺文件号:</div>
  118. <div class="navbar-nav">
  119. <input class="input form-control" id="iefileno" type="text" autocomplete="off" />
  120. </div>
  121. </label>
  122. <label class="save def" @click="seek()">
  123. <div class="btn btn-primary navbar-nav">查询</div>
  124. </label>
  125. <label class="save def" @click="toiefile()">
  126. <div class="btn btn-primary navbar-nav">新增</div>
  127. </label>
  128. <label class="save def" @click="delete_data()">
  129. <div class="btn btn-primary navbar-nav">删除</div>
  130. </label>
  131. <label class="save def">
  132. <div class="btn btn-primary navbar-nav" @click="save()">保存</div>
  133. </label>
  134. <label>
  135. <div class="navbar-nav">更新日期范围:</div>
  136. <div class="navbar-nav"><input type='date' class="input form-control" v-model='data_timeqi_mo' /></div>
  137. </label>
  138. <label>
  139. <div class="navbar-nav">至:</div>
  140. <div class="navbar-nav"><input type='date' class="input form-control" v-model='data_timezhi_mo' />
  141. </div>
  142. </label>
  143. <label>
  144. <div class="navbar-nav">指定缴库单号更新:</div>
  145. <div class="navbar-nav">
  146. <input class="input form-control" id="zdmf_mmo" type="text" autocomplete="off" />
  147. </div>
  148. </label>
  149. <label class="save def">
  150. <div class="btn btn-primary navbar-nav" @click="zdmf_mmoodd()">更新缴库IE工艺文件号</div>
  151. </label>
  152. </div>
  153. </div>
  154. <div class="container">
  155. <div style="background-color:#EFEDED; color: red;">
  156. 注收到IE文件后录入更新文件。平衡率大于100%标注为蓝色;小于等于0%标注为绿色;等于100%标注为红色;大于0%小于90%标注为浅黄色</div>
  157. <table class="table table-hover">
  158. <tbody>
  159. <tr v-for="(item,i) in seek_data" :key="i"
  160. v-bind:class="{ 'tr_blue': item.scxphl > 1 ? true:false, 'tr_green': item.scxphl <=0 ? true:false, 'tr_red': item.scxphl == 1 ? true:false, 'tr_yellow': item.scxphl < 0.9 && item.scxphl >0 ? true:false }">
  161. <td v-if="i>0"><input type="checkbox" v-text="item.choice" @click="selected(i,item)" /></td>
  162. <td v-else><input type="checkbox" @click="selected(i,item,'all')" /><span>全选否</span></td>
  163. <td v-if="i >0" v-text="i"></td>
  164. <td v-else v-text="'行号'"></td>
  165. <td v-text="item.bom_no"></td>
  166. <td v-if="i>0">
  167. <select class="input form-control" v-model="item.qiting">
  168. <option value="T">T</option>
  169. <option value="F">F</option>
  170. </select>
  171. </td>
  172. <td v-else v-text="item.qiting"></td>
  173. <td v-if="i >0 ">
  174. <textarea rows="2" cols="10" v-model="item.qitingexplain"></textarea>
  175. </td>
  176. <td v-else v-text="item.qitingexplain"></td>
  177. <td v-text="item.ae_date"></td>
  178. <td v-text="item.hr_up"></td>
  179. <td v-text="item.file_serial"></td>
  180. <td v-text="item.workshop_name"></td>
  181. <td v-text="item.dep_name"></td>
  182. <td v-text="item.total_manpower"></td>
  183. <td v-text="item.point"></td>
  184. <td v-text="item.job_time"></td>
  185. <td v-text="item.postil_up"></td>
  186. <td v-text="item.rem"></td>
  187. <td v-text="item.iefile_no"></td>
  188. <td v-text="item.sys_date"></td>
  189. <td v-text="item.user_no"></td>
  190. <td v-text="item.bzsj"></td>
  191. <td v-text="item.scxphl"></td>
  192. <td v-text="item.scxbphl"></td>
  193. <td v-text="item.scjp"></td>
  194. <td v-text="item.xscn"></td>
  195. <td v-text="item.rjcn"></td>
  196. <td v-text="item.bxscn"></td>
  197. <td v-text="item.djcb"></td>
  198. <td v-text="item.bzzys"></td>
  199. </tr>
  200. </tbody>
  201. </table>
  202. </div>
  203. </div>
  204. <script>
  205. var vm = new Vue({
  206. el: '#app',
  207. data: {
  208. data_timeqi: '', //查询时间起
  209. data_timezhi: '', //查询时间止
  210. data_timeqi_mo:'', //更新缴库单号开始日期
  211. data_timezhi_mo:'', //更新缴库单号结束日期
  212. username: '', //登录用户名
  213. seek_data: [], //查询到的数据
  214. selected_data: [], //选中的数据
  215. all_data: 0, //用于处理全选
  216. isActiveblue: 0,
  217. isActivegreen: 0,
  218. isActivered: 0,
  219. isActiveyellow: 0
  220. },
  221. mounted() {
  222. // 获取登录名
  223. // this.username=getCookie('username');
  224. this.username = $cookies.get('username')
  225. console.log($cookies.get('username'))
  226. },
  227. methods: {
  228. // 查询
  229. seek() {
  230. var erp_dep = $('#erp_dep').val().split("->")[0];
  231. var mf_mmo = $('#mf_mmo').val().split("->")[0];
  232. var iefileno = $('#iefileno').val().split("->")[0];
  233. axios.get('/iefilemaintain/', {
  234. params: {
  235. erp_dep: erp_dep,
  236. mf_mmo: mf_mmo,
  237. iefileno: iefileno,
  238. data_timeqi: this.data_timeqi,
  239. data_timezhi: this.data_timezhi
  240. }
  241. }).then(res => {
  242. var data = res.data.data
  243. this.seek_data = data
  244. }).catch(err => {
  245. alert(err.response["data"] + err.response["status"])
  246. })
  247. },
  248. // 选择按钮选择数据
  249. selected(i, item, enall) {
  250. // 第一个参数表示项次,第二个参数表示选中的对象,第三个用于判断是否点击全选
  251. // 这里是处理全选数据
  252. if (enall == "all") {
  253. if (this.all_data == 0) {
  254. this.all_data = 1
  255. }
  256. else {
  257. this.all_data = 0
  258. }
  259. //这里是处理了点击全选
  260. if (this.all_data == 1) {
  261. for (i = 0; i < this.seek_data.length; i++) {
  262. this.seek_data[i]["choice"]='T'
  263. }
  264. this.selected_data = []
  265. // this.selected_data = this.seek_data
  266. this.selected_data = this.seek_data.slice(0)
  267. $("input:checkbox").prop("checked", "checked");
  268. }
  269. // 处理点击不全选
  270. else {
  271. this.selected_data = []
  272. for (i = 0; i < this.seek_data.length; i++) {
  273. this.seek_data[i]["choice"]=''
  274. }
  275. $("input:checkbox").removeAttr("checked");
  276. }
  277. console.log(this.selected_data)
  278. console.log(this.all_data)
  279. return
  280. }
  281. // 这里是处理单向选中数据
  282. console.log(this.seek_data)
  283. if (this.seek_data[i]["choice"] =='') {
  284. console.log(this.seek_data[i])
  285. console.log(1111111111111)
  286. console.log(this.seek_data[i]["choice"])
  287. this.selected_data.push(this.seek_data[i])
  288. console.log(33333333333)
  289. this.seek_data[i]["choice"] = 'T'
  290. }
  291. else {
  292. console.log(item)
  293. console.log(i)
  294. console.log(2222222222,this.selected_data)
  295. var index = this.selected_data.findIndex(itemindex => {
  296. if (itemindex == item) {
  297. return true;
  298. }
  299. })
  300. console.log(index)
  301. this.seek_data[i]["index"] = ''
  302. this.selected_data.splice(index, 1)
  303. console.log(5555555555)
  304. }
  305. console.log(this.selected_data)
  306. console.log(this.seek_data)
  307. },
  308. // 跳转到ie工艺文件新增界面
  309. toiefile() {
  310. window.location.href = "/iefiletm";
  311. },
  312. // 设置启用状态
  313. save() {
  314. if (this.selected_data.length <= 0) {
  315. alert("请选择数据")
  316. return
  317. }
  318. console.log("点击了保存")
  319. axios.post('/iefilemaintain/', {
  320. data: {
  321. selected_data: this.selected_data
  322. }
  323. }).then(res => {
  324. console.log("设置状态成功")
  325. }).catch(err => {
  326. alert(err.response["data"] + err.response["status"])
  327. })
  328. },
  329. // 删除选中
  330. delete_data() {
  331. if (this.selected_data.length <= 0) {
  332. alert("请选择数据")
  333. return
  334. }
  335. axios.delete('/iefilemaintain/', {
  336. data: {
  337. selected_data: this.selected_data
  338. }
  339. }).then(res => {
  340. console.log("删除")
  341. }).catch(err => {
  342. alert(err.response["data"] + err.response["status"])
  343. })
  344. },
  345. // 更新指定缴库单单号ie文件
  346. zdmf_mmoodd() {
  347. if (this.selected_data.length <= 0) {
  348. alert("请选择数据")
  349. return
  350. }
  351. var mm_no = $('#zdmf_mmo').val()
  352. if(mm_no.indexOf("->") != -1){
  353. mm_no = mm_no.split("->")[0]
  354. }
  355. axios.put('/iefilemaintain/', {
  356. data: {
  357. mm_no: mm_no,
  358. selected_data: this.selected_data,
  359. data_timeqi_mo:this.data_timeqi_mo,
  360. data_timezhi_mo:this.data_timezhi_mo
  361. }
  362. }).then(res => {
  363. // console.log("更新成功")
  364. alert("更新缴库单号成功")
  365. }).catch(err => {
  366. alert(err.response["data"] + err.response["status"])
  367. })
  368. },
  369. //获取当前日期
  370. addDate() {
  371. var date = new Date();
  372. var seperator1 = "-";
  373. var year = date.getFullYear();
  374. var month = date.getMonth() + 1;
  375. var strDate = date.getDate();
  376. if (month >= 1 && month <= 9) {
  377. month = "0" + month;
  378. }
  379. if (strDate >= 0 && strDate <= 9) {
  380. strDate = "0" + strDate;
  381. }
  382. var currentdate = year + seperator1 + month + seperator1 + strDate;
  383. // console.log(currentdate)
  384. this.data_timeqi = this.data_timezhi = currentdate
  385. },
  386. //退出登录
  387. logout() {
  388. console.log("qweq")
  389. axios.delete('/login/', {
  390. params: {
  391. user_1: this.user_1,
  392. pswd: this.pswd,
  393. }
  394. })
  395. .then(res => {
  396. })
  397. .catch(err => {
  398. })
  399. },
  400. },
  401. created() {
  402. this.addDate()
  403. }
  404. });
  405. $(function () {
  406. // 开始写 jQuery 代码...
  407. var timer = null;
  408. // 定义一个公用的搜索接口
  409. // console.log(vm.$data.list)
  410. function getStr(n, url, field, clickif) {
  411. //n为搜索的参数 url为请求的路由,filed是定位表单的id,
  412. //clickif用于判断是否是第一次加载,如果不是第一次加载则需要模拟点击
  413. var search = n
  414. // 配置路由
  415. if (typeof search === 'undefined') {
  416. search = ''
  417. };
  418. // console.log(search)
  419. axios.get(url, {
  420. params: {
  421. search_no: search
  422. }
  423. })
  424. .then(res => {
  425. // alert(res.data)
  426. var data1 = res.data.data
  427. datas = data1
  428. // console.log(datas)
  429. if (datas.length == 0) {
  430. alert("没有搜索到数据")
  431. return
  432. }
  433. $.selectSuggest(field, datas);
  434. // 是否第一次进入
  435. if (clickif !== 1) {
  436. $("#" + field).trigger("click");
  437. }
  438. })
  439. .catch(err => {
  440. Console.log(err.response)
  441. alert(err.response["data"] + err.response["status"])
  442. })
  443. };
  444. //查询部门资料调用
  445. $("#erp_dep").bind("input propertychange", function (event) {
  446. var search = $("#erp_dep").val()
  447. // console.log($("#testInput").val())
  448. timer && clearTimeout(timer);
  449. timer = setTimeout(function () {
  450. getStr(search, '/dept/', 'erp_dep');
  451. }, 1000);
  452. });
  453. getStr('', '/dept/', 'erp_dep', 1);
  454. // 查询缴库单号
  455. $("#mf_mmo").bind("input propertychange", function (event) {
  456. var search = $("#mf_mmo").val()
  457. // console.log($("#testInput").val())
  458. timer && clearTimeout(timer);
  459. timer = setTimeout(function () {
  460. getStr(search, '/mfmmooddno/', 'mf_mmo');
  461. }, 1000);
  462. });
  463. getStr('', '/mfmmooddno/', 'mf_mmo', 1);
  464. // 查询指定缴库单号
  465. $("#zdmf_mmo").bind("input propertychange", function (event) {
  466. var search = $("#zdmf_mmo").val()
  467. // console.log($("#testInput").val())
  468. timer && clearTimeout(timer);
  469. timer = setTimeout(function () {
  470. getStr(search, '/mfmmooddno/', 'zdmf_mmo');
  471. }, 1000);
  472. });
  473. getStr('', '/mfmmooddno/', 'zdmf_mmo', 1);
  474. // 查询ie文件号
  475. $("#iefileno").bind("input propertychange", function (event) {
  476. var search = $("#iefileno").val()
  477. // console.log($("#testInput").val())
  478. timer && clearTimeout(timer);
  479. timer = setTimeout(function () {
  480. getStr(search, '/iefileno/', 'iefileno');
  481. }, 1000);
  482. });
  483. getStr('', '/iefileno/', 'iefileno', 1);
  484. });
  485. </script>
  486. <!-- <script type="text/javascript" src="/static/js/export/jquery-1.8.2.js"></script> -->
  487. </body>
  488. </html>