pcydscjhtm.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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/iefilemaintaindetail.css"> -->
  9. <link rel="stylesheet" type="text/css" href="/static/css/pcydscjhtm.css">
  10. <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-select.min.css">
  11. <!-- 加载动画 -->
  12. <link rel="stylesheet" type="text/css" href="/static/css/loader.css">
  13. <script src="/static/js/jquery.min.js"></script>
  14. <script src="/static/js/bootstrap.min.js"></script>
  15. <script src="/static/js/vue-2.4.0.js"></script>
  16. <script src="/static/js/axios.min.js"></script>
  17. <script src="/static/js/vue-Cookies.js"></script>
  18. <script type="text/javascript" src="/static/js/jquery.select.js"></script>
  19. <script src="/static/js/bootstrap-select_new.js"></script>
  20. <!-- 图标js -->
  21. <!-- <script src="/static/js/ionicons.js"></script> -->
  22. <title>Document</title>
  23. </head>
  24. <body>
  25. <div id="app">
  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="so_no" 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="cus_no" type="text" autocomplete="off" />
  117. </div>
  118. </label>
  119. <label>
  120. <div class="navbar-nav">成品名称:</div>
  121. <div class="navbar-nav">
  122. <input class="input form-control" id="mrp_no" type="text" autocomplete="off" />
  123. </div>
  124. </label>
  125. <label class="save def" @click="seek('ok')">
  126. <div class="btn btn-primary navbar-nav">查询</div>
  127. </label>
  128. <label class="save def">
  129. <div class="btn btn-primary navbar-nav" @click="exportaa()">导出数据</div>
  130. </label>
  131. </div>
  132. </div>
  133. <div class="container">
  134. <table class="table table-hover">
  135. <tbody>
  136. <tr v-for="(item,i) in seek_data" :key="item.id"
  137. v-bind:class="{ 'tr_red': item.ddjd =='已下达' ? true:false, 'tr_orange': item.ddjd =='已完成' ? true:false, 'tr_green': item.ddjd == '生产中' ? true:false }">
  138. <td v-text="item.cus_snm"></td>
  139. <td v-text="item.need_dd"></td>
  140. <td v-text="item.so_no"></td>
  141. <td v-text="item.mrp_no"></td>
  142. <td v-text="item.mrp_name"></td>
  143. <td v-text="item.mo_no"></td>
  144. <td v-text="item.pmc_dd"></td>
  145. <td v-text="item.mo_dep_name"></td>
  146. <td v-text="item.zx"></td>
  147. <td v-text="item.mo_no_no"></td>
  148. <td v-text="item.mo_no_name"></td>
  149. <td v-if="i>0" v-text="Number(item.qty)"></td>
  150. <td v-else v-text="item.qty"></td>
  151. <td v-if="i>0" v-text="Number(item.qty_fin)"></td>
  152. <td v-else v-text="item.qty_fin"></td>
  153. <td v-if="i>0" v-text="Number(item.w_qty)"></td>
  154. <td v-else v-text="item.w_qty"></td>
  155. <td v-if="i>0" v-text="Number(item.dcl)"></td>
  156. <td v-else v-text="item.dcl"></td>
  157. <td v-text="item.jhwcrq"></td>
  158. <td v-if="i>0" v-text="Number(item.cn)"></td>
  159. <td v-else v-text="item.cn"></td>
  160. <td v-text="item.ddjd"></td>
  161. <td v-text="item.ymp"></td>
  162. <td v-text="item.rq"></td>
  163. <td v-text="item.bq"></td>
  164. <td v-text="item.bc"></td>
  165. </tr>
  166. </tbody>
  167. </table>
  168. </div>
  169. <div class="page footer" style="display: none;">
  170. <ul class="pagination">
  171. <li><button type="button" class="btn btn-default" disabled="disabled">{% verbatim %}
  172. {{ '第'+Number(page)+'页' }} {% endverbatim %}</button></li>
  173. <li><button type="button" class="btn btn-default previouspage" disabled="disabled"
  174. @click="click_page('up')" :disabled="page == 1 ? true : false">上一页</button></li>
  175. <li><button type="button" class="btn btn-default nextpage" @click="click_page('next')" :disabled="page == count_page ? true : false">下一页</button></li>
  176. <li><button type="button" class="btn btn-default" disabled="disabled">{% verbatim %}
  177. {{ '共'+count_page+'页' }} {% endverbatim %}</button></li>
  178. <li><button type="button" class="btn btn-default" disabled="disabled">{% verbatim %}
  179. {{ '共'+total_count+'笔' }} {% endverbatim %}</button></li>
  180. </ul>
  181. </div>
  182. <div class="load" style="display: none;">
  183. <span></span>
  184. <span></span>
  185. <span></span>
  186. <span></span>
  187. <span></span>
  188. <span></span>
  189. <span></span>
  190. <span></span>
  191. </div>
  192. </div>
  193. <!-- 这里是导出数据 -->
  194. <script type="text/javascript" src="/static/js/export/exports.js"></script>
  195. <script>
  196. var vm = new Vue({
  197. el: '#app',
  198. data: {
  199. data_timeqi: '', //查询时间起
  200. data_timezhi: '', //查询时间止
  201. username: '', //登录用户名
  202. seek_data: [], //查询到的数据
  203. cls_id:'1' , //结案否
  204. count_page:0, //总页数
  205. page:1,//第几页
  206. total_count:0,//总记录数
  207. },
  208. mounted() {
  209. // 获取登录名
  210. // this.username=getCookie('username');
  211. this.username = $cookies.get('username')
  212. console.log($cookies.get('username'))
  213. },
  214. methods: {
  215. // 查询
  216. seek(n) {
  217. $(".footer").hide();
  218. $(".load").show();
  219. // 如果是点击查询清空分页数据
  220. if(n=='ok'){
  221. this.count_page = this.total_count = 0
  222. this.page = 1
  223. }
  224. // 初始化数据
  225. this.seek_data = []
  226. var titled = {
  227. "id": "id",
  228. "cus_snm": "客户名称",
  229. "need_dd": "订单交货期",
  230. "so_no": "计划受订",
  231. "mrp_no": "成品代号",
  232. "mrp_name": "成品名称",
  233. "mo_no": "制令单号",
  234. "pmc_dd": "计划排产日期",
  235. "mo_dep_name": "工作中心",
  236. "zx": "线组",
  237. "mo_no_no": "制令单代号",
  238. "mo_no_name": "制令单名称",
  239. "qty": "订单数量",
  240. "qty_fin": "已缴库量",
  241. "w_qty": "未完工量",
  242. "dcl": "达成率",
  243. "jhwcrq": "计划完成日期",
  244. "cn": "产能",
  245. "ddjd": "订单完成进度",
  246. "ymp": "研磨品",
  247. "rq": "容器",
  248. "bq": "标签",
  249. "bc": "包材"
  250. }
  251. url = '/pcydscjh/?'+'min_pmc_dd='+this.data_timeqi+'&'+'max_pmc_dd='+this.data_timezhi+'&'+'page='+this.page
  252. var cus_no = $("#cus_no").val().split('->')[0]
  253. if (cus_no){
  254. url = url + '&' + 'cus_no='+cus_no
  255. }
  256. var mrp_no = $("#mrp_no").val().split('->')[0]
  257. if (mrp_no){
  258. url = url + '&' + 'mrp_no='+ mrp_no
  259. }
  260. var so_no =$("#so_no").val().split('->')[0]
  261. if (so_no){
  262. url = url + '&' + 'so_no='+ so_no
  263. }
  264. console.log(url)
  265. axios.get(url, {
  266. // params: {
  267. // data_timeqi: this.data_timeqi,
  268. // data_timezhi: this.data_timezhi,
  269. // cls_id:this.cls_id
  270. // }
  271. }).then(res => {
  272. var data = res.data
  273. this.seek_data = data.results
  274. if (this.seek_data.length==0){
  275. alert("没有查询到数据")
  276. return
  277. }
  278. this.count_page = data.count_page
  279. this.total_count = data.count
  280. this.seek_data.splice(0,0,titled)
  281. // console.log(this.seek_data)
  282. $(".load").hide();
  283. $(".footer").show();
  284. }).catch(err => {
  285. alert(err.response["data"] + err.response["status"])
  286. })
  287. },
  288. // 点击分页
  289. click_page(n){
  290. if(n == 'up'){
  291. this.page = this.page -1
  292. }
  293. if(n == 'next'){
  294. this.page = this.page +1
  295. }
  296. this.seek('no')
  297. // if(this.page==1){
  298. // $(".previouspage").attr("disabled", "disabled");
  299. // }
  300. // else{
  301. // $('.previouspage').removeAttr('disabled')
  302. // }
  303. // if(this.page==this.count_page){
  304. // $(".nextpage").attr("disabled", "disabled");
  305. // }
  306. // else{
  307. // $('.nextpage').removeAttr('disabled')
  308. // }
  309. console.log(this.page)
  310. console.log(this.count_page)
  311. },
  312. // 导出数据
  313. exportaa() {
  314. // console.log(this.list)
  315. var filter = [];
  316. var title = [];
  317. exportExcel(this.seek_data, 'PC月度生产计划', title, filter);
  318. },
  319. //获取当前日期
  320. addDate() {
  321. var date = new Date();
  322. var seperator1 = "-";
  323. var year = date.getFullYear();
  324. var month = date.getMonth() + 1;
  325. var strDate = date.getDate();
  326. if (month >= 1 && month <= 9) {
  327. month = "0" + month;
  328. }
  329. if (strDate >= 0 && strDate <= 9) {
  330. strDate = "0" + strDate;
  331. }
  332. var currentdate = year + seperator1 + month + seperator1 + strDate;
  333. // console.log(currentdate)
  334. this.data_timeqi = this.data_timezhi = currentdate
  335. },
  336. //退出登录
  337. logout() {
  338. console.log("qweq")
  339. axios.delete('/login/', {
  340. params: {
  341. user_1: this.user_1,
  342. pswd: this.pswd,
  343. }
  344. })
  345. .then(res => {
  346. })
  347. .catch(err => {
  348. })
  349. },
  350. },
  351. created() {
  352. this.addDate()
  353. }
  354. });
  355. $(function () {
  356. // 开始写 jQuery 代码...
  357. var timer = null;
  358. // 定义一个公用的搜索接口
  359. // console.log(vm.$data.list)
  360. function getStr(n, url, field, clickif) {
  361. //n为搜索的参数 url为请求的路由,filed是定位表单的id,
  362. //clickif用于判断是否是第一次加载,如果不是第一次加载则需要模拟点击
  363. var search = n
  364. // 配置路由
  365. if (typeof search === 'undefined') {
  366. search = ''
  367. };
  368. // console.log(search)
  369. axios.get(url, {
  370. params: {
  371. search_no: search
  372. }
  373. })
  374. .then(res => {
  375. // alert(res.data)
  376. var data1 = res.data.data
  377. datas = data1
  378. // console.log(datas)
  379. if (datas.length == 0) {
  380. alert("没有搜索到数据")
  381. return
  382. }
  383. $.selectSuggest(field, datas);
  384. // 是否第一次进入
  385. if (clickif !== 1) {
  386. $("#" + field).trigger("click");
  387. }
  388. })
  389. .catch(err => {
  390. Console.log(err.response)
  391. alert(err.response["data"] + err.response["status"])
  392. })
  393. };
  394. //查询客户资料调用
  395. $("#cus_no").bind("input propertychange", function (event) {
  396. var search = $("#cus_no").val()
  397. // console.log($("#testInput").val())
  398. timer && clearTimeout(timer);
  399. timer = setTimeout(function () {
  400. getStr(search, '/cust/', 'cus_no');
  401. }, 1000);
  402. });
  403. getStr('', '/cust/', 'cus_no', 1);
  404. // 查询成品编码
  405. $("#mrp_no").bind("input propertychange", function (event) {
  406. var search = $("#mrp_no").val()
  407. // console.log($("#testInput").val())
  408. timer && clearTimeout(timer);
  409. timer = setTimeout(function () {
  410. getStr(search, '/prdt/', 'mrp_no');
  411. }, 1000);
  412. });
  413. getStr('', '/prdt/', 'mrp_no', 1);
  414. // 查询成品编码
  415. $("#so_no").bind("input propertychange", function (event) {
  416. var search = $("#so_no").val()
  417. // console.log($("#testInput").val())
  418. timer && clearTimeout(timer);
  419. timer = setTimeout(function () {
  420. getStr(search, '/jhsd/', 'so_no');
  421. }, 1000);
  422. });
  423. getStr('', '/jhsd/', 'so_no', 1);
  424. });
  425. </script>
  426. <!-- <script type="text/javascript" src="/static/js/export/jquery-1.8.2.js"></script> -->
  427. </body>
  428. </html>