iefilemaintain.html 22 KB

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