newQualityInspectionManagement.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <!--质检信息-->
  2. <template>
  3. <div class="center">
  4. <div class="substance">
  5. <div class="substance-left">
  6. <div class="titleTop">
  7. <div class="title"></div>
  8. <div class="textword">基本信息</div>
  9. </div>
  10. <ws-form>
  11. <ws-info-table>
  12. <ws-form-item label="任务编号" span="1" prop="contractNo">
  13. <ws-input v-model="inspect.contractNo" placeholder="自动获取,不可编辑" disabled size="small" />
  14. </ws-form-item>
  15. <ws-form-item label="仓位号" span="1" prop="binNumber">
  16. <ws-input v-model="inspect.binNumber" placeholder="自动获取,不可编辑" disabled size="small" />
  17. </ws-form-item>
  18. <ws-form-item label="业务编号" span="1" prop="number">
  19. <ws-input v-model="inspect.weighingManagement.number" placeholder="自动获取,不可编辑" disabled size="small" />
  20. </ws-form-item>
  21. <ws-form-item label="囤位号" span="1" prop="storageTagNo">
  22. <ws-input v-model="inspect.storageTagNo" placeholder="暂无" disabled size="small" />
  23. </ws-form-item>
  24. <ws-form-item label="合同/移库编号" span="1" prop="contractNo">
  25. <!--moveTaskNo-->
  26. <ws-input v-model="inspect.contractNo" placeholder="自动获取,不可编辑" disabled size="small"
  27. v-if="inspect.contractNo" />
  28. <ws-input v-model="inspect.moveTaskNo" placeholder="自动获取,不可编辑" disabled size="small" v-else />
  29. </ws-form-item>
  30. <ws-form-item label="提示" span="1" prop="tips">
  31. <ws-input v-model="inspect.weighingManagement.tips" placeholder="暂无" disabled size="small" />
  32. </ws-form-item>
  33. <ws-form-item label="货名" span="1" prop="goodsName">
  34. <ws-input v-model="inspect.goodsName" placeholder="自动获取,不可编辑" disabled size="small" />
  35. </ws-form-item>
  36. <ws-form-item label="经办人" span="1" prop="secretaryWeigher">
  37. <ws-input v-model="inspect.weighingManagement.secretaryWeigher" placeholder="自动获取,不可编辑" disabled
  38. size="small" />
  39. </ws-form-item>
  40. <ws-form-item label="出库类型" span="1" prop="inOutType">
  41. <ws-input v-model="inspect.weighingManagement.inOutType" placeholder="自动获取,不可编辑" disabled size="small" />
  42. </ws-form-item>
  43. <ws-form-item label="出库日期" span="1" prop="updateDate">
  44. <ws-input v-model="inspect.updateDate" placeholder="自动获取,不可编辑" disabled size="small" />
  45. </ws-form-item>
  46. <ws-form-item label="运输方式" span="1" prop="outType">
  47. <ws-input v-model="inspect.weighingManagement.outType" placeholder="自动获取,不可编辑" disabled size="small" />
  48. </ws-form-item>
  49. <ws-form-item label="车队" span="1" prop="fleet">
  50. <ws-input v-model="inspect.fleet" placeholder="非车队车辆" disabled size="small" />
  51. </ws-form-item>
  52. <ws-form-item label="车牌号" span="1" prop="carNumber">
  53. <ws-input v-model="inspect.carNumber" placeholder="自动获取,不可编辑" disabled size="small" />
  54. </ws-form-item>
  55. <ws-form-item label="箱号-1" span="1" prop="boxNo">
  56. <ws-input v-model="inspect.weighingManagement.boxNo" placeholder="暂无" disabled size="small" />
  57. </ws-form-item>
  58. <ws-form-item label="箱号-2" span="1" prop="boxNoOther">
  59. <ws-input v-model="inspect.weighingManagement.boxNoOther" placeholder="暂无" disabled size="small" />
  60. </ws-form-item>
  61. <ws-form-item label="封号-1" span="1" prop="titleNo">
  62. <ws-input v-model="inspect.weighingManagement.titleNo" placeholder="暂无" disabled size="small" />
  63. </ws-form-item>
  64. <ws-form-item label="封号-2" span="1" prop="titleNoOther">
  65. <ws-input v-model="inspect.weighingManagement.titleNoOther" placeholder="暂无" disabled size="small" />
  66. </ws-form-item>
  67. </ws-info-table>
  68. </ws-form>
  69. </div>
  70. <div class="substance-right">
  71. <el-select v-model="warehouseName" placeholder="请选择仓库名" @change="warehouseNameChange">
  72. <el-option v-for="item in warehouseList" :key="item.id" :label="item.warehouseName"
  73. :value="item.warehouseName">
  74. </el-option>
  75. </el-select>
  76. <el-button @click='refreshClick(1)' type="primary">刷新</el-button>
  77. <el-button @click='refreshClick' type="primary">{{timer?refresh:'自动刷新'}}</el-button>
  78. <div class="screen">
  79. <div class="screen_left">
  80. <el-badge :value="nosuccess" class="badge_item">
  81. <div :class="inspectbtn == 1 ? 'inspect_css':'noinspect_css'" @click="inspectChange(1)">未质检</div>
  82. </el-badge>
  83. <el-badge :value="success" class="badge_item">
  84. <div :class="inspectbtn == 2 ? 'inspect_css':'noinspect_css'" @click="inspectChange(2)">已质检</div>
  85. </el-badge>
  86. </div>
  87. <div class="screen_right">
  88. <div class="record" @click="record">记录</div>
  89. </div>
  90. </div>
  91. <!-- <el-table @cell-click='listclick' :data="inspectList" style="width: 100%; margin-top: 20px" ref="inspect" border>
  92. <el-table-column prop="qualityNo" label="业务编号"></el-table-column>
  93. <el-table-column prop="carNumber" label="车牌号"></el-table-column>
  94. <el-table-column prop="status" label="状态">
  95. <template slot-scope="scope">
  96. <span v-if='scope.row.confirm=="1"'>
  97. 已确认
  98. </span>
  99. <span v-else>
  100. {{scope.row.status}}
  101. </span>
  102. </template>
  103. </el-table-column>
  104. </el-table> -->
  105. <el-table ref="singleTable" :key='timestamp' :data="switchList" highlight-current-row
  106. @current-change="rowChange"
  107. style="width: 100%; overflow-y: scroll !important; height: calc(100vh - 54vh);margin-top:14px">
  108. <el-table-column property="number" label="业务编号">
  109. <span slot-scope="scope">{{scope.row.weighingManagement?scope.row.weighingManagement.number:""}}</span>
  110. </el-table-column>
  111. <el-table-column property="carNumber" label="车牌号">
  112. </el-table-column>
  113. <el-table-column property="status" label="状态">
  114. </el-table-column>
  115. </el-table>
  116. <div style="text-align: center" v-if="inspectbtn == 1">
  117. <el-pagination class='switchpage' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  118. :current-page="currentPage" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
  119. :total="deptBudgetTotal1">
  120. </el-pagination>
  121. </div>
  122. <div style="text-align: center" v-if="inspectbtn == 2">
  123. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  124. :current-page="currentPage" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
  125. :total="deptBudgetTotal2">
  126. </el-pagination>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="footer">
  131. <div class="titleTop">
  132. <div class="title"></div>
  133. <div class="textword">质检数据</div>
  134. </div>
  135. <div class="formList">
  136. <ws-form>
  137. <ws-info-table>
  138. <ws-form-item label="等级" prop="grade">
  139. <ws-select v-model="inspect.grade" placeholder="请输入等级" class="typeselect" :disabled="disabled">
  140. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  141. :value="item.constValue" />
  142. </ws-select>
  143. </ws-form-item>
  144. <ws-form-item label="杂质(%)" prop="impurity">
  145. <el-input v-model="inspect.impurity" placeholder="请输入杂质占比" maxlength="10" size="small" type="number"
  146. :disabled="disabled" />
  147. </ws-form-item>
  148. <ws-form-item label="水分(%)" prop="waterContent">
  149. <el-input v-model="inspect.waterContent" placeholder="请输入水分占比" maxlength="10" size="small" type="number"
  150. :disabled="disabled" />
  151. </ws-form-item>
  152. <ws-form-item label="霉变粒(%)" prop="mildewGrain">
  153. <el-input v-model="inspect.mildewGrain" placeholder="请输入霉变粒占比" maxlength="10" size="small" type="number"
  154. :disabled="disabled" />
  155. </ws-form-item>
  156. <ws-form-item :label="inspect.goodsName!='大豆'?'容重(克/升)':'蛋白'" prop="bulkDensity">
  157. <el-input v-model="inspect.bulkDensity" :placeholder="inspect.goodsName!='大豆'?'请输入容重':'请输入蛋白'" maxlength="10" size="small" type="number"
  158. :disabled="disabled" />
  159. </ws-form-item>
  160. <ws-form-item label="热损伤(%)" prop="jiaorenli">
  161. <el-input v-model="inspect.jiaorenli" placeholder="请输入热损伤占比" maxlength="10" size="small" type="number"
  162. :disabled="disabled" />
  163. </ws-form-item>
  164. <ws-form-item label="不完善粒(%)" prop="imperfectGrain">
  165. <el-input v-model="inspect.imperfectGrain" placeholder="请输入不完善粒占比" maxlength="10" size="small"
  166. type="number" :disabled="disabled" />
  167. </ws-form-item>
  168. </ws-info-table>
  169. </ws-form>
  170. <div class="but">
  171. <!-- <el-button @click="print" type="primary">提交</el-button> -->
  172. <el-button @click="print" type="primary">提交并打印</el-button>
  173. </div>
  174. </div>
  175. </div>
  176.  <el-dialog width="70%" class="table-content" center :visible.sync="isShowPrint" title="粮食质检单" @opened="opendBtn"
  177. @close="closeDialog">
  178. <!-- <inspectInfoPrint :printData="printData"></inspectInfoPrint> -->
  179. <outInspectPrint :printData="printData" ref="saveImg"></outInspectPrint>
  180. <div style="text-align:center">
  181. <el-button type="primary" @click="printclose">关闭</el-button>
  182. <el-button type="primary" @click="printSmall">打印小票</el-button>
  183. <el-button type="primary" @click="printBig">打印单据</el-button>
  184. </div>
  185. </el-dialog>
  186. </div>
  187. </template>
  188. <script>
  189. import {
  190. addOut,
  191. selectWarehouseSelf,
  192. getinspectList,
  193. getinspectLook
  194. } from '@/model/outboundManagement/index'
  195. import {
  196. packList
  197. } from '@/model/contarct/index'
  198. import html2canvas from 'html2canvas'
  199. import axios from 'axios'
  200. import outInspectPrint from './component/outInspectPrint.vue'
  201. export default {
  202. components: {
  203. outInspectPrint,
  204. },
  205. watch: {},
  206. data() {
  207. return {
  208. timer: '',
  209. refresh: 60,
  210. inspect: {
  211. weighingManagement: {}
  212. },
  213. disabled: false,
  214. gradeList: [],
  215. cangid: '', //仓库id
  216. warehouseName: '',
  217. warehouseList: [],
  218. inspectbtn: 1,
  219. inspectList: [],
  220. noinspectList: [],
  221. switchList: [],
  222. timestamp: '',
  223. //分页
  224. currentPage: 1,
  225. pageSize: 50,
  226. deptCircularPage: {},
  227. deptBudgetTotal: 0,
  228. deptBudgetTotal1: 0,
  229. managementType: 3,
  230. isShowPrint: false,
  231. printData: {},
  232. nosuccess: 0,
  233. success: 0
  234. }
  235. },
  236. beforeDestroy() {
  237. if (this.timer) { //如果定时器还在运行 或者直接关闭,不用判断
  238. clearInterval(this.timer); //关闭
  239. }
  240. },
  241. activated() {
  242. // this.cangid = this.$route.query.cangid
  243. // this.warehouseName = this.$route.query.warehouseName
  244. // this.inspect.contractNo = this.$route.query.contractNo
  245. // this.inspect.binNumber = this.$route.query.binNumber
  246. // this.inspect.carNumber = this.$route.query.carNumber
  247. // this.inspect.goodsName = this.$route.query.goodsName
  248. // this.inspect.storageTagNo = this.$route.query.storageTagNo
  249. // let id = this.$route.query.id
  250. // this.cangNo = this.$route.query.warehouseNo
  251. // this.count = Number(this.$route.query.count) + 1
  252. // 品级
  253. packList({
  254. constId: 'CON3'
  255. })
  256. .toPromise()
  257. .then((response) => {
  258. this.gradeList = response
  259. })
  260. //仓库
  261. selectWarehouseSelf({
  262. compId: localStorage.getItem('ws-pf_compId'),
  263. })
  264. .toPromise()
  265. .then((response) => {
  266. this.warehouseList = response
  267. let _wareHouse = localStorage.getItem('houseSelfCollect_house1')
  268. _wareHouse = JSON.parse(_wareHouse)
  269. for (let i = 0; i < response.length; i++) {
  270. if (_wareHouse && response[i].warehouseName == _wareHouse.value) {
  271. this.warehouseName = response[i].warehouseName
  272. this.warehouseId = response[i].warehouseId
  273. this.positionInfos = response[i].positionInfos
  274. this.warehouseCount = response[i].count
  275. this.warehouseNo = response[i].commonWarehouseNo
  276. this.warehouseType = response[i].warehouseType
  277. }
  278. if (!_wareHouse) {
  279. this.warehouseName = this.warehouseList[0].value
  280. this.warehouseId = this.warehouseList[0].warehouseId
  281. this.positionInfos = response[0].positionInfos
  282. this.warehouseCount = response[0].count
  283. this.warehouseNo = response[0].commonWarehouseNo
  284. this.warehouseType = response[0].warehouseType
  285. }
  286. }
  287. if (_wareHouse) {
  288. this.warehouseName = _wareHouse.value
  289. for (var i = 0; i < response.length; i++) {
  290. if (response[i].warehouseName == _wareHouse.value) {
  291. this.cangid = this.warehouseList[i].id
  292. break
  293. }
  294. }
  295. } else {
  296. this.warehouseName = this.warehouseList[0].warehouseName
  297. localStorage.setItem('ck', this.warehouseName)
  298. this.cangid = this.warehouseList[0].id
  299. }
  300. this.getList()
  301. })
  302. },
  303. methods: {
  304. refreshClick(type) {
  305. let that = this
  306. if (type == 1) {
  307. getinspectList({
  308. compId: localStorage.getItem('ws-pf_compId'),
  309. currentPage: that.currentPage,
  310. pageSize: that.pageSize,
  311. warehouseName: that.warehouseName,
  312. managementType: that.managementType,
  313. qualityType: 1,
  314. // loadingstatus: 1,
  315. })
  316. .toPromise()
  317. .then((response) => {
  318. that.noinspectList = response.records
  319. console.log(that.inspectbtn, that.noinspectList.length)
  320. if (that.inspectbtn == 1 && that.noinspectList.length > 0) {
  321. that.switchList = that.noinspectList
  322. that.inspect = that.noinspectList[0]
  323. if (!that.inspect.weighingManagement) {
  324. that.inspect.weighingManagement = {}
  325. }
  326. } else if (that.inspectbtn == 1) {
  327. that.switchList = []
  328. that.inspect = {}
  329. that.inspect.weighingManagement = {}
  330. }
  331. console.log(that.switchList)
  332. that.deptBudgetTotal1 = response.total
  333. that.nosuccess = response.total
  334. })
  335. getinspectList({
  336. compId: localStorage.getItem('ws-pf_compId'),
  337. currentPage: that.currentPage,
  338. pageSize: that.pageSize,
  339. warehouseName: that.warehouseName,
  340. managementType: that.managementType,
  341. qualityType: 2,
  342. // loadingstatus: 1,
  343. })
  344. .toPromise()
  345. .then((response) => {
  346. that.inspectList = response.records
  347. console.log(that.inspectbtn, that.inspectList.length)
  348. if (that.inspectbtn == 2 && that.inspectList.length > 0) {
  349. that.switchList = that.inspectList
  350. that.inspect = that.inspectList[0]
  351. if (!that.inspect.weighingManagement) {
  352. that.inspect.weighingManagement = {}
  353. }
  354. } else if (that.inspectbtn == 2) {
  355. that.switchList = []
  356. that.inspect = {}
  357. that.inspect.weighingManagement = {}
  358. }
  359. that.deptBudgetTotal2 = response.total
  360. that.success = response.total
  361. })
  362. } else {
  363. clearInterval(that.timer)
  364. that.refresh = 60
  365. that.timer = setInterval(function() {
  366. // console.log(that.refresh)
  367. if (that.refresh == 0) {
  368. that.refresh = 60
  369. getinspectList({
  370. compId: localStorage.getItem('ws-pf_compId'),
  371. currentPage: that.currentPage,
  372. pageSize: that.pageSize,
  373. warehouseName: that.warehouseName,
  374. managementType: that.managementType,
  375. qualityType: 1,
  376. loadingstatus: 1,
  377. })
  378. .toPromise()
  379. .then((response) => {
  380. that.noinspectList = response.records
  381. console.log(that.inspectbtn, that.noinspectList.length)
  382. if (that.inspectbtn == 1 && that.noinspectList.length > 0) {
  383. that.switchList = that.noinspectList
  384. that.inspect = that.noinspectList[0]
  385. if (!that.inspect.weighingManagement) {
  386. that.inspect.weighingManagement = {}
  387. }
  388. } else if (that.inspectbtn == 1) {
  389. that.switchList = []
  390. that.inspect = {}
  391. that.inspect.weighingManagement = {}
  392. }
  393. console.log(that.switchList)
  394. that.deptBudgetTotal1 = response.total
  395. that.nosuccess = response.total
  396. })
  397. getinspectList({
  398. compId: localStorage.getItem('ws-pf_compId'),
  399. currentPage: that.currentPage,
  400. pageSize: that.pageSize,
  401. warehouseName: that.warehouseName,
  402. managementType: that.managementType,
  403. qualityType: 2,
  404. loadingstatus: 1,
  405. })
  406. .toPromise()
  407. .then((response) => {
  408. that.inspectList = response.records
  409. console.log(that.inspectbtn, that.inspectList.length)
  410. if (that.inspectbtn == 2 && that.inspectList.length > 0) {
  411. that.switchList = that.inspectList
  412. that.inspect = that.inspectList[0]
  413. if (!that.inspect.weighingManagement) {
  414. that.inspect.weighingManagement = {}
  415. }
  416. } else if (that.inspectbtn == 2) {
  417. that.switchList = []
  418. that.inspect = {}
  419. that.inspect.weighingManagement = {}
  420. }
  421. that.deptBudgetTotal2 = response.total
  422. that.success = response.total
  423. })
  424. }
  425. that.refresh--
  426. }, 1000);
  427. }
  428. },
  429. printclose() {
  430. this.isShowPrint = false
  431. this.getList()
  432. },
  433. printSmall() {
  434. this.inspect.type = 1
  435. localStorage.setItem('out-Warehouse_print', JSON.stringify(this.inspect))
  436. window.open('../../../static/outInspectionPrint.html')
  437. },
  438. printBig() {
  439. this.inspect.type = 2
  440. localStorage.setItem('out-Warehouse_print', JSON.stringify(this.inspect))
  441. window.open('../../../static/outInspectionPrint.html')
  442. },
  443. warehouseNameChange(e) {
  444. for (let i = 0; i < this.warehouseList.length; i++) {
  445. if (this.warehouseList[i].warehouseName == e) {
  446. localStorage.setItem('houseSelfCollect_house1', JSON.stringify({
  447. No: this.warehouseList[i].commonWarehouseNo,
  448. allowEdit: this.warehouseList[i].allowEdit,
  449. value: this.warehouseList[i].warehouseName,
  450. count: this.warehouseList[i].count,
  451. warehouseId: this.warehouseList[i].id
  452. }))
  453. // this.positionInfos=this.warehouseList1[i].positionInfos
  454. // this.warehouseCount = this.warehouseList1[i].count
  455. // this.warehouseNo = this.warehouseList1[i].commonWarehouseNo
  456. // this.warehouseType=this.warehouseList1[i].warehouseType
  457. }
  458. }
  459. this.getList()
  460. },
  461. record() {
  462. this.$router.push({
  463. path: 'outInspectRecord',
  464. query: {
  465. warehouseName: this.warehouseName
  466. }
  467. })
  468. },
  469. inspectChange(num) {
  470. this.inspectbtn = num
  471. if (num == 1) {
  472. this.switchList = this.noinspectList
  473. } else if (num == 2) {
  474. this.switchList = this.inspectList
  475. }
  476. if (this.switchList.length > 0) {
  477. this.inspect = this.switchList[0]
  478. if (!this.inspect.weighingManagement) {
  479. this.inspect.weighingManagement = {}
  480. }
  481. } else {
  482. this.inspect = {}
  483. this.inspect.weighingManagement = {}
  484. }
  485. },
  486. handleSizeChange(val) {
  487. console.log(`每页 ${val} 条`)
  488. this.pageSize = val
  489. this.getList()
  490. },
  491. handleCurrentChange(val) {
  492. this.currentPage = val
  493. console.log(`当前页: ${val}`)
  494. this.getList()
  495. },
  496. rowChange(val) {
  497. // if(this.tpyeNo == 2 && this.status == 1 && val.qualityInspectionManagement.confirm == 0){
  498. // this.$message({
  499. // message: '该条质检信息未确认',
  500. // type: 'warning'
  501. // });
  502. // }
  503. if (val) {
  504. this.inspect = val
  505. }
  506. },
  507. getdate() {
  508. var date = new Date()
  509. var year = date.getFullYear() //获取完整的年份(4位)
  510. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  511. var datetime = date.getDate() //获取当前日(1-31)
  512. if (mouth < 10) {
  513. mouth = '0' + mouth
  514. }
  515. if (datetime < 10) {
  516. datetime = '0' + datetime
  517. }
  518. return year + '' + mouth + datetime
  519. },
  520. opendBtn() {
  521. html2canvas(this.$refs.saveImg.$el).then((canvas) => {
  522. let dataURL = canvas.toDataURL('image/png')
  523. this.imgUrl = dataURL
  524. if (this.imgUrl !== '') {
  525. let b = this.dataURLtoFile(this.imgUrl, 'printImage')
  526. let formdata = new FormData()
  527. formdata.append('file', b)
  528. axios({
  529. method: 'post',
  530. url:this.global.uploadPath,
  531. data: formdata,
  532. }).then((response) => {
  533. //编辑接口
  534. this.printData.pictureAddress = response.data.url
  535. this.inspect.pictureAddress = response.data.url
  536. addOut(this.inspect)
  537. .toPromise()
  538. .then((response) => {})
  539. })
  540. }
  541. })
  542. },
  543. closeDialog() {
  544. html2canvas(this.$refs.saveImg.$el).then((canvas) => {
  545. let dataURL = canvas.toDataURL('image/png')
  546. this.imgUrl = dataURL
  547. if (this.imgUrl !== '') {
  548. let b = this.dataURLtoFile(this.imgUrl, 'printImage')
  549. let formdata = new FormData()
  550. formdata.append('file', b)
  551. axios({
  552. method: 'post',
  553. url:this.global.uploadPath,
  554. data: formdata,
  555. }).then((response) => {
  556. //编辑接口
  557. this.printData.pictureAddress = response.data.url
  558. this.inspect.pictureAddress = response.data.url
  559. addOut(this.inspect)
  560. .toPromise()
  561. .then((response) => {})
  562. })
  563. }
  564. })
  565. this.isShowPrint = false
  566. },
  567. print() {
  568. this.inspect.warehouseName = this.warehouseName
  569. // this.inspect.id = this.$route.query.id
  570. // 质检员
  571. this.inspect.backOffice = localStorage.getItem('ws-pf_staffName')
  572. this.inspect.compId = localStorage.getItem('ws-pf_compId')
  573. // if (!this.inspect.grade) {
  574. // this.$message({
  575. // message: '等级不能为空',
  576. // type: 'warning',
  577. // })
  578. // return
  579. // }
  580. // if (!this.inspect.impurity) {
  581. // this.$message({
  582. // message: '杂质不能为空',
  583. // type: 'warning',
  584. // })
  585. // return
  586. // }
  587. if (this.inspect.impurity && (this.inspect.impurity < 0 || this.inspect.impurity > 40)) {
  588. this.$message({
  589. message: '杂质输入错误',
  590. type: 'warning',
  591. })
  592. return
  593. }
  594. if (this.inspect.impurity && String(this.inspect.impurity).indexOf('.') != -1 && String(this.inspect
  595. .impurity).length - (String(this
  596. .inspect.impurity).indexOf('.') + 1) > 1) {
  597. this.$message({
  598. message: '杂质应保留一位小数',
  599. type: 'warning',
  600. })
  601. return
  602. }
  603. // if (!this.inspect.waterContent) {
  604. // this.$message({
  605. // message: '水分不能为空',
  606. // type: 'warning',
  607. // })
  608. // return
  609. // }
  610. if (this.inspect.waterContent && (this.inspect.waterContent < 0 || this.inspect.waterContent > 40)) {
  611. this.$message({
  612. message: '水分输入错误',
  613. type: 'warning',
  614. })
  615. return
  616. }
  617. if (this.inspect.waterContent && String(this.inspect.waterContent).indexOf('.') != -1 && String(this.inspect
  618. .waterContent).length - (String(
  619. this.inspect.waterContent).indexOf('.') + 1) > 1) {
  620. this.$message({
  621. message: '水分应保留一位小数',
  622. type: 'warning',
  623. })
  624. return
  625. }
  626. // if (!this.inspect.mildewGrain) {
  627. // this.$message({
  628. // message: '霉变粒不能为空',
  629. // type: 'warning',
  630. // })
  631. // return
  632. // }
  633. if (this.inspect.mildewGrain && this.inspect.mildewGrain < 0 || this.inspect.mildewGrain > 40) {
  634. this.$message({
  635. message: '霉变粒输入错误',
  636. type: 'warning',
  637. })
  638. return
  639. }
  640. if (String(this.inspect.mildewGrain).indexOf('.') != -1 && String(this.inspect.mildewGrain).length - (
  641. String(
  642. this.inspect.mildewGrain).indexOf('.') + 1) > 1) {
  643. this.$message({
  644. message: '霉变粒应保留一位小数',
  645. type: 'warning',
  646. })
  647. return
  648. }
  649. // if (!this.inspect.bulkDensity) {
  650. // this.$message({
  651. // message: '容重不能为空',
  652. // type: 'warning',
  653. // })
  654. // return
  655. // }
  656. if (this.inspect.bulkDensity && this.inspect.bulkDensity < 500 || this.inspect.bulkDensity > 1000) {
  657. if(this.inspect.goodsName!='大豆'){
  658. this.$message({
  659. message: '容重输入错误',
  660. type: 'warning',
  661. })
  662. return
  663. }else{
  664. this.$message({
  665. message: '蛋白输入错误',
  666. type: 'warning',
  667. })
  668. return
  669. }
  670. }
  671. if (this.inspect.bulkDensity && String(this.inspect.bulkDensity).indexOf('.') != -1 && String(this.inspect
  672. .bulkDensity).length - (String(
  673. this.inspect.bulkDensity).indexOf('.') + 1) > 0) {
  674. if(this.inspect.goodsName!='大豆'){
  675. this.$message({
  676. message: '容重需输入整数',
  677. type: 'warning',
  678. })
  679. return
  680. }else{
  681. this.$message({
  682. message: '蛋白需输入整数',
  683. type: 'warning',
  684. })
  685. return
  686. }
  687. }
  688. // if (!this.inspect.jiaorenli) {
  689. // this.$message({
  690. // message: '热损伤不能为空',
  691. // type: 'warning',
  692. // })
  693. // return
  694. // }
  695. if (this.inspect.jiaorenli && this.inspect.jiaorenli < 0 || this.inspect.jiaorenli > 40) {
  696. this.$message({
  697. message: '热损伤输入错误',
  698. type: 'warning',
  699. })
  700. return
  701. }
  702. if (String(this.inspect.jiaorenli).indexOf('.') != -1 && String(this.inspect.jiaorenli).length - (String(
  703. this
  704. .inspect.jiaorenli).indexOf('.') + 1) > 1) {
  705. this.$message({
  706. message: '热损伤应保留一位小数',
  707. type: 'warning',
  708. })
  709. return
  710. }
  711. // if (!this.inspect.imperfectGrain) {
  712. // this.$message({
  713. // message: '不完善粒不能为空',
  714. // type: 'warning',
  715. // })
  716. // return
  717. // }
  718. if (this.inspect.imperfectGrain && this.inspect.imperfectGrain < 0 || this.inspect.imperfectGrain > 40) {
  719. this.$message({
  720. message: '不完善粒输入错误',
  721. type: 'warning',
  722. })
  723. return
  724. }
  725. if (this.inspect.imperfectGrain && String(this.inspect.imperfectGrain).indexOf('.') != -1 && String(this
  726. .inspect.imperfectGrain).length - (
  727. String(this.inspect.imperfectGrain).indexOf('.') + 1) > 1) {
  728. this.$message({
  729. message: '不完善粒应保留一位小数',
  730. type: 'warning',
  731. })
  732. return
  733. }
  734. this.$confirm('确定保存质检信息?', '提示', {
  735. confirmButtonText: '确定',
  736. cancelButtonText: '取消',
  737. type: 'warning',
  738. })
  739. .then(() => {
  740. addOut(this.inspect)
  741. .toPromise()
  742. .then((response) => {
  743. this.$message.success('保存成功')
  744. // this.printData = this.inspect
  745. // conole.log(this.printData)
  746. // this.isShowPrint = true
  747. // this.getList()
  748. getinspectLook({
  749. id: response
  750. })
  751. .toPromise()
  752. .then((response2) => {
  753. this.printData = response2
  754. this.printData.contractManagement = this.inspect.contractManagement
  755. console.log(this.printData)
  756. this.isShowPrint = true
  757. this.getList()
  758. })
  759. })
  760. })
  761. .catch(() => {
  762. return false
  763. })
  764. },
  765. cancel() {
  766. this.$router.push({
  767. path: 'qualityInspectionManagement'
  768. })
  769. },
  770. getList() {
  771. this.timestamp = new Date().valueOf()
  772. // this.refreshClick(1)
  773. getinspectList({
  774. compId: localStorage.getItem('ws-pf_compId'),
  775. currentPage: this.currentPage,
  776. pageSize: this.pageSize,
  777. warehouseName: this.warehouseName,
  778. managementType: this.managementType,
  779. qualityType:1
  780. })
  781. .toPromise()
  782. .then((response) => {
  783. this.noinspectList = response.records
  784. console.log(this.inspectbtn,this.noinspectList.length )
  785. if(this.inspectbtn == 1 && this.noinspectList.length > 0){
  786. this.switchList = this.noinspectList
  787. this.inspect = this.noinspectList[0]
  788. if(!this.inspect.weighingManagement){
  789. this.inspect.weighingManagement = {}
  790. }
  791. }else if(this.inspectbtn == 1){
  792. this.switchList = []
  793. this.inspect = {}
  794. this.inspect.weighingManagement = {}
  795. }
  796. console.log(this.switchList )
  797. this.deptBudgetTotal1 = response.total
  798. this.nosuccess = response.total
  799. })
  800. getinspectList({
  801. compId: localStorage.getItem('ws-pf_compId'),
  802. currentPage: this.currentPage,
  803. pageSize: this.pageSize,
  804. warehouseName: this.warehouseName,
  805. managementType: this.managementType,
  806. qualityType:2
  807. })
  808. .toPromise()
  809. .then((response) => {
  810. this.inspectList = response.records
  811. console.log(this.inspectbtn,this.inspectList.length )
  812. if(this.inspectbtn == 2 && this.inspectList.length > 0){
  813. this.switchList = this.inspectList
  814. this.inspect = this.inspectList[0]
  815. if(!this.inspect.weighingManagement){
  816. this.inspect.weighingManagement = {}
  817. }
  818. }else if(this.inspectbtn == 2){
  819. this.switchList = []
  820. this.inspect = {}
  821. this.inspect.weighingManagement = {}
  822. }
  823. this.deptBudgetTotal2 = response.total
  824. this.success = response.total
  825. })
  826. },
  827. },
  828. }
  829. </script>
  830. <style lang="scss" scoped>
  831. .center {
  832. background: #E8ECF6;
  833. overflow-y: scroll;
  834. }
  835. .ws-info-table {
  836. border: none;
  837. padding: 0 20px;
  838. }
  839. .ws-info-table .el-form-item {
  840. width: 50%;
  841. border: none;
  842. }
  843. /deep/.ws-info-table .el-form-item .el-form-item__label {
  844. width: 30%;
  845. text-align: center;
  846. background: #ffffff;
  847. font-size: 14px;
  848. color: #8890B1;
  849. min-width: 115px;
  850. }
  851. /deep/.ws-info-table .el-form-item .el-form-item__content {
  852. border: none;
  853. }
  854. .title::before {
  855. content: '';
  856. display: inline-block;
  857. width: 5px;
  858. height: 30px;
  859. background: #5473E8;
  860. margin-right: 10px;
  861. margin-top: 15px;
  862. }
  863. .titleTop {
  864. display: flex;
  865. width: 100%;
  866. height: 60px;
  867. background: #F6F7FC;
  868. line-height: 60px;
  869. margin-bottom: 20px;
  870. border-radius: 4px;
  871. .textword {
  872. font-size: 18px;
  873. font-weight: 600;
  874. }
  875. }
  876. .substance {
  877. display: flex;
  878. width: 100%;
  879. height: 730px;
  880. .substance-left {
  881. width: 59%;
  882. background: #ffffff;
  883. border-radius: 4px;
  884. /deep/.el-input.is-disabled .el-input__inner {
  885. background: #F5F7FA;
  886. border-radius: 4px;
  887. color: #8890B1 !important;
  888. border: none;
  889. }
  890. /deep/.ws-info-table .el-form-item {
  891. margin: 10px 0;
  892. }
  893. }
  894. .substance-right {
  895. width: 40%;
  896. background: #ffffff;
  897. margin-left: 20px;
  898. border-radius: 4px;
  899. padding: 10px 20px 0;
  900. /deep/.el-select {
  901. width: 50%;
  902. }
  903. .screen {
  904. display: flex;
  905. width: 100%;
  906. margin: 15px 10px 0 0;
  907. border-bottom: 1px solid #D8DCE6;
  908. height: 45px;
  909. .screen_left,
  910. .screen_right {
  911. width: 50%;
  912. }
  913. .screen_left {
  914. min-width: 182px;
  915. }
  916. .badge_item {
  917. margin-right: 15px;
  918. }
  919. .inspect_css,
  920. .noinspect_css,
  921. .record {
  922. width: 74px;
  923. height: 32px;
  924. border-radius: 4px;
  925. text-align: center;
  926. line-height: 32px;
  927. }
  928. .record:hover,
  929. .inspect_css:hover,
  930. .noinspect_css:hover {
  931. cursor: pointer;
  932. }
  933. .inspect_css {
  934. background: #F0F6FF;
  935. color: #5878E8;
  936. }
  937. .screen_right {
  938. justify-content: flex-end;
  939. display: flex;
  940. }
  941. .record {
  942. color: #5878E8;
  943. }
  944. }
  945. }
  946. }
  947. .footer {
  948. margin-top: 20px;
  949. background: #FFFFFF;
  950. border-radius: 4px;
  951. height: 300px;
  952. .formList {
  953. width: 90%;
  954. margin: auto;
  955. }
  956. /deep/.el-form-item__content {
  957. width: 50%;
  958. }
  959. }
  960. /deep/.el-table .el-table__header .cell,
  961. .el-table .el-table__body .cell {
  962. text-align: center;
  963. }
  964. /deep/.el-table--enable-row-transition .el-table__body td {
  965. text-align: center;
  966. }
  967. .bg-right {
  968. padding-right: 10px;
  969. text-align: right;
  970. }
  971. .but {
  972. text-align: center;
  973. margin: 20px auto;
  974. }
  975. /deep/.switchpage.el-pagination .el-select .el-input {
  976. margin: 0 30px 0 10px;
  977. }
  978. </style>