index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <view class="content">
  3. <view class="confirm-view">
  4. <text class="text">设备:</text>
  5. <view class="" style="width: 74%">
  6. <uni-data-select
  7. v-model="device"
  8. :localdata="deviceList"
  9. @change="deviceChange"></uni-data-select>
  10. </view>
  11. </view>
  12. <view class="confirm-view">
  13. <text class="text">生产状态:</text>
  14. <view class="" style="width: 74%">
  15. <uni-data-select
  16. v-model="value"
  17. :localdata="tabList"
  18. @change="change"></uni-data-select>
  19. </view>
  20. </view>
  21. <view class="confirm-view" v-if="deviceShow">
  22. <text class="text" style="width: 195px">退货下料设备编号:</text>
  23. <view class="" style="width: 74%">
  24. <uni-data-select
  25. v-model="deviId"
  26. :localdata="devicez1List"
  27. @change="deviChange"></uni-data-select>
  28. </view>
  29. </view>
  30. <view class="confirm-view" v-if="sourceLocationIdshow">
  31. <text class="text">批次号:</text>
  32. <uni-easyinput
  33. errorMessage
  34. type="text"
  35. v-model="sourceLocationId"
  36. focus
  37. :focus="focusState"
  38. @focus="focusFn"
  39. @input="input"
  40. :class="recshow ? 'rec' : ''"
  41. @blur="focusState = false"
  42. placeholder-style="font-size:16px;color: #a7a7a7;"
  43. :placeholder="placeholder"></uni-easyinput>
  44. </view>
  45. <view class="confirm-view" v-if="palletNoshow">
  46. <text class="text">托盘:</text>
  47. <uni-easyinput
  48. type="text"
  49. errorMessage
  50. v-model="palletNo"
  51. focus
  52. :focus="focusStateto"
  53. @focus="focusFnto"
  54. :class="recshowto ? 'recto' : ''"
  55. @blur="focusStateto = false"
  56. placeholder-style="font-size:16px;color: #a7a7a7;"
  57. :placeholder="placeholders"></uni-easyinput>
  58. </view>
  59. <view class="confirm-view">
  60. <text class="text">产线:</text>
  61. <uni-easyinput
  62. errorMessage
  63. type="text"
  64. v-model="productionLine"
  65. focus
  66. :focus="fote"
  67. @focus="focusFnthree"
  68. @input="lisInput"
  69. :class="recshowRamik ? 'recthees' : ''"
  70. @blur="fote = false"
  71. placeholder-style="font-size:16px;color: #a7a7a7;"
  72. :placeholder="placeholderthree"></uni-easyinput>
  73. </view>
  74. <view class="confirm-view" @click="open">
  75. <text class="text">日期:</text>
  76. <view class="">
  77. <uv-datetime-picker
  78. ref="datetimePicker"
  79. v-model="valueTime"
  80. mode="datetime"
  81. @confirm="confirmTime"></uv-datetime-picker>
  82. </view>
  83. <view class="">
  84. <text>{{ dataTime }}</text>
  85. </view>
  86. </view>
  87. <view class="border-buttons">
  88. <view class="buttons2" v-throttle="1000" @click="WeakRefthree">
  89. <text>提交</text>
  90. </view>
  91. </view>
  92. <xw-scan></xw-scan>
  93. <uni-popup ref="inputDialog" type="dialog">
  94. <uni-popup-dialog
  95. ref="inputClose"
  96. title="选择物料"
  97. value="对话框预置提示内容!"
  98. placeholder="请输入内容"
  99. @confirm="dialogInputConfirm">
  100. <u-radio-group
  101. placement="column"
  102. :borderBottom="true"
  103. v-model="value"
  104. iconPlacement="right">
  105. <u-radio
  106. :customStyle="{ marginBottom: '8px' }"
  107. v-for="(item, index) in radiolist1"
  108. :key="index"
  109. :label="item.name"
  110. :name="item.name"
  111. @change="radioChange($event, item)"></u-radio>
  112. </u-radio-group>
  113. </uni-popup-dialog>
  114. </uni-popup>
  115. </view>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. recshow: false,
  122. recshowto: false,
  123. recshowRamik: false,
  124. focusState: false,
  125. fote: false,
  126. deviceShow: false,
  127. palletNo: "",
  128. status: "",
  129. productionLine: "Z1",
  130. materialType: "",
  131. sourceLocationId: "",
  132. deviceId: "",
  133. qty: "1",
  134. device: "",
  135. deviceList: [],
  136. deviId: "",
  137. updateTime: "",
  138. valueTmia: "",
  139. palletNoshow: false,
  140. sourceLocationIdshow: true,
  141. tabList: [],
  142. devicez1List: [],
  143. dataTime: "请选择日期",
  144. valueTime: Number(new Date()),
  145. radiolist1: [
  146. {
  147. name: "丁铵黑药",
  148. disabled: true,
  149. id: 5,
  150. },
  151. ],
  152. focusStateto: false,
  153. value: "",
  154. value2: "",
  155. placeholders: "请输入托盘号",
  156. placeholder: "请输入批次号",
  157. placeholderthree: "请输入产线",
  158. valueTmname: "",
  159. host: "",
  160. };
  161. },
  162. onLoad(option) {},
  163. onUnload() {
  164. // 移除监听事件
  165. uni.$off("xwscan");
  166. },
  167. onHide() {},
  168. onShow() {
  169. let that = this;
  170. let pages = getCurrentPages();
  171. let currPage = pages[pages.length - 1]; //当前页面
  172. if (currPage.testdata != undefined) {
  173. console.log("$attrs", currPage.testdata);
  174. this.sourceLocationId = currPage.testdata.name;
  175. }
  176. },
  177. created() {},
  178. watch: {
  179. scanCodeValue(value) {
  180. if (!!value) {
  181. document.onkeydown = null;
  182. } else {
  183. this.placeholder = "扫码失败,请重新扫码...";
  184. }
  185. },
  186. },
  187. mounted() {
  188. let _this = this;
  189. uni.getStorage({
  190. key: "hostappst",
  191. success(res) {
  192. console.log("获取成功", res.data);
  193. _this.host = res.data;
  194. },
  195. });
  196. this.getData();
  197. this.getList();
  198. },
  199. onHide() {
  200. this.recshow = false;
  201. },
  202. methods: {
  203. confirmTime(e) {
  204. console.log("e", e);
  205. let date = new Date(e.value);
  206. let time = this.formatDate(date, "yyyy-MM-dd hh:mm");
  207. this.updateTime = time + ":00";
  208. this.dataTime = time + ":00";
  209. console.log("confirm", this.updateTime);
  210. },
  211. open() {
  212. this.$refs.datetimePicker.open();
  213. },
  214. otherFun(obj) {
  215. console.log(obj);
  216. if (obj.show == 3) {
  217. this.valueTmname = obj.id;
  218. this.sourceLocationId = obj.locationNo;
  219. }
  220. },
  221. radioChange(val, row) {
  222. console.log(val, row);
  223. this.valueTmianame = val;
  224. this.materialType = row.id;
  225. },
  226. dialogInputConfirm(val) {
  227. this.valueTmia = this.valueTmianame;
  228. },
  229. Material() {
  230. uni.navigateTo({
  231. url: "/pages/Warehousing/selectMaterial/index",
  232. });
  233. },
  234. change(e) {
  235. console.log("e", e);
  236. this.status = e;
  237. if (e < 5) {
  238. this.deviceShow = false;
  239. this.palletNoshow = false;
  240. this.sourceLocationIdshow = true;
  241. } else if (e == 5) {
  242. this.deviceShow = true;
  243. this.palletNoshow = true;
  244. this.sourceLocationIdshow = false;
  245. } else if (e >= 5) {
  246. this.deviceShow = false;
  247. this.palletNoshow = true;
  248. this.sourceLocationIdshow = false;
  249. }
  250. },
  251. deviChange(e) {
  252. console.log("e", e);
  253. this.deviId = e;
  254. },
  255. deviceChange(e) {
  256. console.log("e", e);
  257. this.deviceld = e;
  258. },
  259. inputDialogToggle() {
  260. this.$refs.inputDialog.open();
  261. },
  262. WeakRefthree() {
  263. let text = "";
  264. if (this.device == "") {
  265. text = "请选择设备";
  266. } else if (this.value == "") {
  267. text = "请选择生产状态";
  268. } else if (this.valueTmname == "" && this.status < 5) {
  269. if (this.valueTmname == "") {
  270. text = "请输入批次号";
  271. }
  272. } else if (this.palletNo == "" && this.status >= 5) {
  273. text = "请输入托盘号";
  274. } else if (this.productionLine == "") {
  275. text = "请输入产线";
  276. } else if (this.updateTime == "") {
  277. text = "请选择日期";
  278. }
  279. if (text != "") {
  280. return uni.showToast({
  281. title: text,
  282. icon: "none",
  283. });
  284. }
  285. this.GetBanner();
  286. },
  287. focusFn(e) {
  288. this.recshow = true;
  289. this.recshowto = false;
  290. this.recshowRamik = false;
  291. uni.$off("xwscan");
  292. uni.$on("xwscan", (res) => {
  293. console.log("扫码结果:", res.code);
  294. this.sourceLocationId = res.code;
  295. this.valueTmname = res.code;
  296. });
  297. console.log("focus事件");
  298. },
  299. focusFnto(e) {
  300. this.recshowto = true;
  301. this.recshow = false;
  302. this.recshowRamik = false;
  303. uni.$off("xwscan");
  304. uni.$on("xwscan", (res) => {
  305. console.log("扫码结果:", res.code);
  306. this.palletNo = res.code;
  307. });
  308. console.log("focus事件");
  309. },
  310. focusFnthree(e) {
  311. this.recshowto = false;
  312. this.recshow = false;
  313. this.recshowRamik = true;
  314. uni.$off("xwscan");
  315. uni.$on("xwscan", (res) => {
  316. console.log("扫码结果:", res.code);
  317. this.productionLine = res.code;
  318. });
  319. console.log("focus事件");
  320. },
  321. goto(data) {
  322. uni.navigateTo({
  323. url: data,
  324. });
  325. },
  326. input(e) {
  327. console.log(e);
  328. this.valueTmname = e;
  329. },
  330. lisInput(e) {
  331. console.log(e);
  332. this.productionLine = e;
  333. },
  334. GetBanner() {
  335. let params = {
  336. lotNo: this.palletNo,
  337. deviceId: this.deviceld,
  338. batchNo: this.valueTmname,
  339. productionLine: this.productionLine,
  340. status: this.status,
  341. updateTime: this.updateTime,
  342. sanPanDevice: this.deviId,
  343. };
  344. let that = this;
  345. uni.getStorage({
  346. key: "GetPhone_Token",
  347. success: function (res) {
  348. // 恢复请求
  349. uni.request({
  350. url: `http://${that.host}` + "/retroactive/now/pda/complement",
  351. header: {
  352. Authorization: res.data,
  353. "Content-Type": "application/json",
  354. },
  355. data: params,
  356. method: "POST",
  357. success(respenon) {
  358. console.log("chaoShiPanDuan", respenon);
  359. if (respenon.data.code == 200) {
  360. uni.showToast({
  361. title: respenon.data.msg,
  362. icon: "none",
  363. });
  364. uni.navigateTo({
  365. url: "/pages/index/tabbar/tabbar",
  366. });
  367. } else {
  368. uni.showToast({
  369. title: respenon.data.msg,
  370. icon: "none",
  371. });
  372. }
  373. console.log("res", res);
  374. },
  375. });
  376. },
  377. });
  378. },
  379. getData(type) {
  380. let that = this;
  381. uni.getStorage({
  382. key: "GetPhone_Token",
  383. success: function (res) {
  384. uni.request({
  385. url: `http://${that.host}` + "/system/dict/data/type/process",
  386. header: {
  387. Authorization: res.data,
  388. "content-type": "application/x-www-form-urlencoded",
  389. },
  390. method: "GET",
  391. success(respenon) {
  392. console.log("chaoShiPanDuan", respenon);
  393. if (respenon.data.code == 200) {
  394. // { value: 0, text: "篮球" },
  395. respenon.data.data.forEach((item, index) => {
  396. Object.assign(item, {
  397. value: item.dictValue,
  398. text: item.dictLabel,
  399. });
  400. });
  401. that.tabList = respenon.data.data;
  402. } else if (respenon.data.code == 401) {
  403. uni.reLaunch({
  404. url: "/pages/index/login",
  405. });
  406. } else {
  407. uni.showToast({
  408. title: respenon.data.msg,
  409. icon: "none",
  410. });
  411. }
  412. },
  413. });
  414. uni.request({
  415. url:
  416. `http://${that.host}` +
  417. "/system/dict/data/type/z1_san_pan_device",
  418. header: {
  419. Authorization: res.data,
  420. "content-type": "application/x-www-form-urlencoded",
  421. },
  422. method: "GET",
  423. success(respenon) {
  424. console.log("chaoShiPanDuan", respenon);
  425. if (respenon.data.code == 200) {
  426. // { value: 0, text: "篮球" },
  427. respenon.data.data.forEach((item, index) => {
  428. Object.assign(item, {
  429. value: item.dictValue,
  430. text: item.dictLabel,
  431. });
  432. });
  433. that.devicez1List = respenon.data.data;
  434. } else if (respenon.data.code == 401) {
  435. uni.reLaunch({
  436. url: "/pages/index/login",
  437. });
  438. } else {
  439. uni.showToast({
  440. title: respenon.data.msg,
  441. icon: "none",
  442. });
  443. }
  444. },
  445. });
  446. },
  447. });
  448. },
  449. getList(type) {
  450. let that = this;
  451. let data = {
  452. pageNum: this.page,
  453. pageSize: 10,
  454. };
  455. uni.getStorage({
  456. key: "GetPhone_Token",
  457. success: function (res) {
  458. uni.request({
  459. url: `http://${that.host}` + "/device/list",
  460. header: {
  461. Authorization: res.data,
  462. "content-type": "application/x-www-form-urlencoded",
  463. },
  464. data: data,
  465. method: "GET",
  466. success(respenon) {
  467. console.log("chaoShiPanDuan", respenon);
  468. if (respenon.data.code == 200) {
  469. respenon.data.data.forEach((item, index) => {
  470. Object.assign(item, {
  471. value: item.deviceId,
  472. text: item.abbreviation,
  473. });
  474. });
  475. that.deviceList = respenon.data.data;
  476. } else {
  477. uni.showToast({
  478. title: respenon.data.msg,
  479. icon: "none",
  480. });
  481. }
  482. },
  483. });
  484. },
  485. });
  486. },
  487. formatDate(date, fmt) {
  488. console.log("date", date);
  489. if (/(y+)/.test(fmt)) {
  490. fmt = fmt.replace(
  491. RegExp.$1,
  492. (date.getFullYear() + "").substr(4 - RegExp.$1.length)
  493. );
  494. }
  495. let o = {
  496. "M+": date.getMonth() + 1,
  497. "d+": date.getDate(),
  498. "h+": date.getHours(),
  499. "m+": date.getMinutes(),
  500. "s+": date.getSeconds(),
  501. };
  502. for (let k in o) {
  503. if (new RegExp(`(${k})`).test(fmt)) {
  504. let str = o[k] + "";
  505. fmt = fmt.replace(
  506. RegExp.$1,
  507. RegExp.$1.length === 1 ? str : this.padLeftZero(str)
  508. );
  509. }
  510. }
  511. return fmt;
  512. },
  513. padLeftZero(str) {
  514. return ("00" + str).substr(str.length);
  515. },
  516. },
  517. };
  518. </script>
  519. <style scoped>
  520. /deep/.is-input-border {
  521. display: flex;
  522. box-sizing: border-box;
  523. flex-direction: row;
  524. align-items: center;
  525. border-radius: 4px;
  526. background-color: rgb(245 245 245) !important;
  527. /* background: #24bdbd; */
  528. }
  529. /deep/uni-button {
  530. color: #000;
  531. border: 1px solid #ff0000;
  532. border-radius: 31px;
  533. width: 21%;
  534. background-color: #f5f5f5;
  535. height: 42px;
  536. font-size: 16px;
  537. color: #ff0000;
  538. }
  539. /deep/.uni-easyinput__content-input[data-v-abe12412] {
  540. width: auto;
  541. position: relative;
  542. overflow: hidden;
  543. flex: 1;
  544. line-height: 1;
  545. font-size: 14px;
  546. height: 35px;
  547. /* border-bottom: 1px solid #ff0000 !important; */
  548. }
  549. /deep/.is-input-border {
  550. display: flex;
  551. box-sizing: border-box;
  552. flex-direction: row;
  553. align-items: center;
  554. border: none !important;
  555. border-radius: 4px;
  556. }
  557. .recto {
  558. box-sizing: border-box;
  559. position: relative;
  560. overflow: hidden;
  561. /* margin: 300px auto; */
  562. /* width: 300px; */
  563. /* height: 4px; */
  564. /* border: 0.1px solid #ccc; */
  565. }
  566. .recto::before {
  567. position: absolute;
  568. bottom: 0;
  569. content: "";
  570. height: 2px;
  571. width: 258px;
  572. background-color: red;
  573. /* 依次对应:动画名、时长、匀速、无限循环 */
  574. animation: move 3s;
  575. }
  576. .recthees {
  577. box-sizing: border-box;
  578. position: relative;
  579. overflow: hidden;
  580. /* margin: 300px auto; */
  581. /* width: 300px; */
  582. /* height: 4px; */
  583. /* border: 0.1px solid #ccc; */
  584. }
  585. .recthees::before {
  586. position: absolute;
  587. bottom: 0;
  588. content: "";
  589. height: 2px;
  590. width: 258px;
  591. background-color: red;
  592. /* 依次对应:动画名、时长、匀速、无限循环 */
  593. animation: move 3s;
  594. }
  595. @keyframes move {
  596. from {
  597. left: -100%;
  598. }
  599. to {
  600. left: 100%;
  601. }
  602. }
  603. </style>
  604. <style lang="scss" scoped>
  605. .content {
  606. padding: 15px;
  607. .confirm-view {
  608. display: flex;
  609. margin-bottom: 15px;
  610. align-items: center;
  611. height: 55px;
  612. /* border-top: 1px solid #dbdbdb; */
  613. /* border-bottom: 1px solid; */
  614. border-bottom: 1px solid #dbdbdb;
  615. .text {
  616. font-size: 16px;
  617. color: #6e6860;
  618. font-weight: 500;
  619. width: 80px;
  620. text-align-last: justify;
  621. }
  622. }
  623. .vontent_boby {
  624. margin: 15px 0;
  625. border-top: 1px solid #dbdbdb;
  626. display: flex;
  627. justify-content: space-between;
  628. font-size: 15px;
  629. color: #838383;
  630. border-bottom: 1px solid #dbdbdb;
  631. height: 55px;
  632. align-items: center;
  633. }
  634. .border-buttons {
  635. display: flex;
  636. position: absolute;
  637. button: 0;
  638. bottom: 32px;
  639. justify-content: space-between;
  640. width: 91%;
  641. text-align: center;
  642. .buttons {
  643. width: 46%;
  644. border: 1px solid #f00;
  645. border-radius: 34px;
  646. height: 42px;
  647. display: flex;
  648. justify-content: center;
  649. align-items: center;
  650. font-size: 18px;
  651. color: red;
  652. font-weight: 500;
  653. }
  654. .buttons2 {
  655. width: 100%;
  656. border: 1px solid #ff0505;
  657. border-radius: 34px;
  658. height: 42px;
  659. background: red;
  660. display: flex;
  661. justify-content: center;
  662. align-items: center;
  663. font-size: 18px;
  664. color: white;
  665. font-weight: 500;
  666. }
  667. }
  668. }
  669. </style>