already.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <template>
  2. <el-card>
  3. <el-form :model="queryParams" ref="queryForm" :inline="true">
  4. <el-form-item label="订单号" prop="contractCode">
  5. <el-input placeholder="请输入" v-model="queryParams.contractCode" clearable size="small" @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="万里牛单号" prop="tradeNo">
  8. <el-input placeholder="请输入" v-model="queryParams.tradeNo" clearable size="small" @keyup.enter.native="handleQuery" />
  9. </el-form-item>
  10. <el-form-item label="BOM品号" prop="specCode">
  11. <el-input placeholder="请输入" v-model="queryParams.specCode" clearable size="small" @keyup.enter.native="handleQuery" />
  12. </el-form-item>
  13. <el-form-item label="BOM品名" prop="nameChinese">
  14. <el-input placeholder="请输入" v-model="queryParams.nameChinese" clearable size="small" @keyup.enter.native="handleQuery" />
  15. </el-form-item>
  16. <el-form-item label="事业部" prop="subsidiaryId">
  17. <el-select v-model="queryParams.subsidiaryId" placeholder="请选择事业部" size="small" style="width: 100%" @change="handleQuery">
  18. <el-option v-for="item in companyList" :key="item.id" :label="item.name" :value="item.id" />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button size="small" @click="handleQuery" class="searchBtn">搜索</el-button>
  23. <el-button size="small" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. <el-table
  27. :data="tableList"
  28. size="small"
  29. :row-style="{ height: '35px' }"
  30. :cell-style="{ padding: '0' }"
  31. v-loading="loading"
  32. header-row-class-name="tableHeader"
  33. :cell-class-name="cellClassName"
  34. >
  35. <el-table-column label="设计图" prop="workCode" align="left" width="60">
  36. <template slot-scope="scope">
  37. <div v-if="scope.row.imgPath && scope.row.dataResource === 1">
  38. <img
  39. v-if="!scope.row.imgPath.includes('https')"
  40. class="img"
  41. v-lazy="pathPrefix + scope.row.imgPath"
  42. @click="openFile(pathPrefix + scope.row.imgPath)"
  43. />
  44. <img v-else class="img" v-lazy="scope.row.imgPath" @click="openFile(scope.row.imgPath)" />
  45. </div>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="事业部" prop="subsidiaryName" align="left" width="120" />
  49. <el-table-column label="BOM品号" prop="specCode" align="left" width="140">
  50. <template slot-scope="scope">
  51. <div>
  52. <span
  53. style="border-radius: 50%; height: 20px; width: 20px; display: inline-block; background: #f30303; vertical-align: top"
  54. v-if="scope.row.type === 1"
  55. >
  56. <span style="display: block; color: #ffffff; height: 20px; line-height: 20px; text-align: center">补</span>
  57. </span>
  58. <span style="cursor: pointer; padding-left: 8px" :style="{ color: scope.row.type === 1 ? 'red' : '#409eff' }">{{ scope.row.specCode }}</span>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="BOM品名" prop="nameChinese" align="left" min-width="300" />
  63. <el-table-column label="订单号" prop="contractCode" align="left" width="150" />
  64. <el-table-column label="万里牛单号" prop="tradeNo" width="140" />
  65. <el-table-column label="件数" width="80">
  66. <template slot-scope="scope">
  67. <span>{{ Number(scope.row.quantity) }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="投产时间" prop="putTime" align="center" width="140" />
  71. <el-table-column label="SKU品名" prop="productColorName" width="280" />
  72. <el-table-column label="操作" align="center" fixed="right" width="100">
  73. <template slot-scope="scope">
  74. <div class="miniBtn">
  75. <el-button type="text" @click="printCode(scope.row)" v-if="scope.row.dataResource === 1" v-db-click>打印生产面单</el-button>
  76. </div>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  81. <el-dialog :visible.sync="dialogVisible" title="打印生产面单" width="40%" append-to-body>
  82. <el-form label-width="100px" :model="form" ref="form" :rules="rules">
  83. <el-form-item label="打印张数:" prop="num">
  84. <el-input v-model="form.num" placeholder="请输入"> </el-input>
  85. </el-form-item>
  86. </el-form>
  87. <el-row style="text-align: center; margin-top: 30px">
  88. <el-button size="small" type="primary" @click="handleSubmit">打 印</el-button>
  89. <el-button size="small" @click="handleCancel">取 消</el-button>
  90. </el-row>
  91. </el-dialog>
  92. <div style="display: none">
  93. <div style="width: 250px" id="printMiniTwo">
  94. <div v-for="(item, index) in QRcodeList" :key="index">
  95. <div style="height: 442px; padding-top: 2px; overflow: hidden; position: relative">
  96. <div style="border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center" v-if="item.tradeNo">
  97. <barcode :value="item.tradeNo" :height="50" :width="1.6" />
  98. </div>
  99. <div style="border-bottom: 1px solid #000; display: flex; align-items: center; justify-content: center" v-else>
  100. <barcode :value="item.contractCode" :height="50" :width="1.6" />
  101. </div>
  102. <div style="display: flex; align-items: center; justify-content: center">
  103. <div style="width: 150px; height: 150px; margin-top: 8px" :id="'print' + index" :ref="'print' + index">
  104. <img src="" alt="" style="vertical-align: middle; height: 100%; width: 100%" />
  105. </div>
  106. </div>
  107. <div style="text-align: center; font-size: 18px; font-weight: 700; padding: 4px 0; border-bottom: 1px solid #000">{{ item.dataForTime }}</div>
  108. <div style="word-break: break-all; padding: 2px">SKU品号:{{ item.productColorCode }}</div>
  109. <div style="word-break: break-all; padding: 2px">SKU品名:{{ item.productColorName }}</div>
  110. <div style="word-break: break-all; padding: 2px">BOM品号:{{ item.specCode }}</div>
  111. <div style="word-break: break-all; padding: 2px">BOM品名:{{ item.nameChinese }}</div>
  112. <div v-if="item.contractDataResource === 1" class="one">
  113. <div class="two">
  114. <div class="three">万里牛</div>
  115. </div>
  116. </div>
  117. </div>
  118. <div style="page-break-after: always"></div>
  119. </div>
  120. </div>
  121. <el-button type="primary" size="mini" v-print="'#printMiniTwo'" id="printBtnMiniTwo"></el-button>
  122. </div>
  123. </el-card>
  124. </template>
  125. <script>
  126. import QRCode from 'qrcodejs2'
  127. import Print from 'vue-print-nb'
  128. import Vue from 'vue'
  129. Vue.use(Print)
  130. import { mapGetters } from 'vuex'
  131. import * as API from '@/api/shengde/productionSystem/productionOperation/batching/index'
  132. import { getUid } from '@/util/saas.js'
  133. import { getSubsidiaryList } from '@/api/shengde/subsidiary/bill/bill'
  134. export default {
  135. name: 'already',
  136. components: {},
  137. data() {
  138. return {
  139. pathPrefix: process.env.VUE_APP_IMG_URL,
  140. queryParams: {
  141. pageNum: 1,
  142. pageSize: 10,
  143. contractCode: '',
  144. tradeNo: '',
  145. specCode: '',
  146. nameChinese: '',
  147. // beginTime: '',
  148. // endTime: '',
  149. status: '1',
  150. subsidiaryId: '',
  151. },
  152. tableList: [],
  153. total: null,
  154. dialogVisible: false,
  155. form: {
  156. num: '',
  157. },
  158. rules: {
  159. num: [{ required: true, message: '请输入打印张数', trigger: 'blur' }],
  160. },
  161. QRcodeList: [],
  162. qrList: [],
  163. companyList: [],
  164. }
  165. },
  166. computed: mapGetters(['dictData']),
  167. created() {},
  168. mounted() {
  169. getSubsidiaryList({ pageNum: 1, pageSize: 9999 }).then((res) => {
  170. this.companyList = res.data.data.records
  171. })
  172. },
  173. methods: {
  174. pageInit() {
  175. this.getList()
  176. },
  177. getList() {
  178. this.loading = true
  179. API.list(this.queryParams).then(
  180. (res) => {
  181. this.tableList = res.data.data.records
  182. this.total = res.data.data.total
  183. this.loading = false
  184. },
  185. (err) => {
  186. console.log('list:' + err)
  187. this.loading = false
  188. }
  189. )
  190. },
  191. handleQuery() {
  192. this.queryParams.pageNum = 1
  193. this.getList()
  194. },
  195. resetQuery() {
  196. this.resetForm('queryForm')
  197. this.handleQuery()
  198. },
  199. openFile(path) {
  200. window.open(path)
  201. },
  202. printCode(row) {
  203. this.rowData = row
  204. this.dialogVisible = true
  205. },
  206. handleCancel() {
  207. this.dialogVisible = false
  208. this.form = {
  209. num: '',
  210. }
  211. },
  212. handleSubmit() {
  213. this.$refs['form'].validate((valid) => {
  214. if (valid) {
  215. let arr = []
  216. for (let i = 0; i < this.form.num; i++) {
  217. let obj = { ...this.rowData, sort: i, uid: getUid() }
  218. arr.push(obj)
  219. }
  220. console.log(arr)
  221. this.QRcodeList = arr
  222. this.$nextTick(() => {
  223. for (let i = 0; i < this.QRcodeList.length; i++) {
  224. let element = this.QRcodeList[i]
  225. this.$refs['print' + i][0].innerHTML = '' //清除二维码方法一
  226. let text = element.contractProductId + '-' + element.uid
  227. new QRCode(this.$refs['print' + i][0], {
  228. text: text, //页面地址 ,如果页面需要参数传递请注意哈希模式#
  229. width: 150,
  230. height: 150,
  231. colorDark: '#000000',
  232. colorLight: '#ffffff',
  233. correctLevel: QRCode.CorrectLevel.H,
  234. })
  235. }
  236. })
  237. const btn = document.getElementById('printBtnMiniTwo')
  238. btn.click()
  239. this.handleCancel()
  240. } else {
  241. return false
  242. }
  243. })
  244. },
  245. cellClassName(val) {
  246. if (val && val.row && val.row.dataResource === 0) {
  247. return 'colorDim'
  248. }
  249. },
  250. },
  251. }
  252. </script>
  253. <style>
  254. @media print {
  255. @page {
  256. size: auto;
  257. margin: 5mm;
  258. }
  259. body,
  260. html {
  261. height: auto !important;
  262. }
  263. }
  264. </style>
  265. <style lang="scss" scoped>
  266. ::v-deep {
  267. .vue-barcode-element {
  268. text {
  269. font-size: 20px !important;
  270. font-weight: 700;
  271. }
  272. }
  273. .el-input__inner {
  274. height: 28px;
  275. line-height: 28px;
  276. }
  277. .el-button {
  278. border-radius: 0;
  279. }
  280. .miniBtn .el-button {
  281. padding: 0px !important;
  282. }
  283. .tableHeader th {
  284. background-color: #edf0f5;
  285. height: 35px;
  286. padding: 0;
  287. }
  288. .colorDim {
  289. color: #909399;
  290. }
  291. }
  292. .searchBtn {
  293. background: #20b2aa;
  294. color: #fff;
  295. border: 1px solid #20b2aa;
  296. }
  297. .img {
  298. margin-top: 3px;
  299. width: 40px;
  300. height: 40px;
  301. cursor: pointer;
  302. object-fit: contain;
  303. vertical-align: middle;
  304. }
  305. .one {
  306. position: absolute;
  307. right: 10px;
  308. top: 320px;
  309. width: 70px;
  310. height: 70px;
  311. z-index: 99;
  312. line-height: 80px;
  313. text-align: center;
  314. border-radius: 50%;
  315. border: 1px solid #000;
  316. .two {
  317. position: absolute;
  318. top: 50%;
  319. left: 50%;
  320. transform: translate(-50%, -50%);
  321. width: 60px;
  322. height: 60px;
  323. line-height: 60px;
  324. text-align: center;
  325. border-radius: 50%;
  326. border: 1px dashed #000;
  327. .three {
  328. rotate: -45deg;
  329. font-size: 14px;
  330. }
  331. }
  332. }
  333. .codeList {
  334. width: 340px;
  335. .item {
  336. margin-top: 15px;
  337. border: 1px solid #000;
  338. height: 510px;
  339. overflow: hidden;
  340. position: relative;
  341. .top {
  342. .QRbox {
  343. border-bottom: 1px solid #000;
  344. padding: 4px 8px;
  345. display: flex;
  346. height: 270px;
  347. .img {
  348. width: 200px;
  349. height: 200px;
  350. img {
  351. vertical-align: middle;
  352. width: 100%;
  353. height: 100%;
  354. }
  355. }
  356. }
  357. .productInfo {
  358. display: flex;
  359. flex-direction: column;
  360. padding: 5px 10px;
  361. .title1 {
  362. margin-bottom: 5px;
  363. font-size: 12px;
  364. .val {
  365. font-size: 12px;
  366. font-weight: 700;
  367. }
  368. }
  369. }
  370. .address {
  371. padding: 5px 10px;
  372. display: flex;
  373. align-items: center;
  374. border-top: 1px dashed #000;
  375. }
  376. }
  377. .seal {
  378. position: absolute;
  379. right: 10px;
  380. top: 320px;
  381. width: 70px;
  382. height: 70px;
  383. z-index: 99;
  384. line-height: 80px;
  385. text-align: center;
  386. border-radius: 50%;
  387. border: 1px solid #000;
  388. .wln {
  389. position: absolute;
  390. top: 50%;
  391. left: 50%;
  392. transform: translate(-50%, -50%);
  393. width: 60px;
  394. height: 60px;
  395. line-height: 60px;
  396. text-align: center;
  397. border-radius: 50%;
  398. border: 1px dashed #000;
  399. .aa {
  400. rotate: -45deg;
  401. font-size: 14px;
  402. }
  403. }
  404. }
  405. .two-sided {
  406. width: 40px;
  407. height: 40px;
  408. line-height: 40px;
  409. text-align: center;
  410. border: 1px solid #000;
  411. position: absolute;
  412. right: 20px;
  413. top: 400px;
  414. .wln {
  415. width: 30px;
  416. height: 30px;
  417. position: absolute;
  418. top: 50%;
  419. left: 50%;
  420. transform: translate(-50%, -50%);
  421. line-height: 30px;
  422. text-align: center;
  423. border: 1px dashed #000;
  424. }
  425. }
  426. }
  427. }
  428. </style>