newQualityInspectionManagement.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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="容重(克/升)" prop="bulkDensity">
  157. <el-input v-model="inspect.bulkDensity" placeholder="请输入容重" 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: 'https://www.zthymaoyi.com/upload/admin',
  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: 'https://www.zthymaoyi.com/upload/admin',
  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. this.$message({
  658. message: '容重输入错误',
  659. type: 'warning',
  660. })
  661. return
  662. }
  663. if (this.inspect.bulkDensity && String(this.inspect.bulkDensity).indexOf('.') != -1 && String(this.inspect
  664. .bulkDensity).length - (String(
  665. this.inspect.bulkDensity).indexOf('.') + 1) > 0) {
  666. this.$message({
  667. message: '容重需输入整数',
  668. type: 'warning',
  669. })
  670. return
  671. }
  672. // if (!this.inspect.jiaorenli) {
  673. // this.$message({
  674. // message: '热损伤不能为空',
  675. // type: 'warning',
  676. // })
  677. // return
  678. // }
  679. if (this.inspect.jiaorenli && this.inspect.jiaorenli < 0 || this.inspect.jiaorenli > 40) {
  680. this.$message({
  681. message: '热损伤输入错误',
  682. type: 'warning',
  683. })
  684. return
  685. }
  686. if (String(this.inspect.jiaorenli).indexOf('.') != -1 && String(this.inspect.jiaorenli).length - (String(
  687. this
  688. .inspect.jiaorenli).indexOf('.') + 1) > 1) {
  689. this.$message({
  690. message: '热损伤应保留一位小数',
  691. type: 'warning',
  692. })
  693. return
  694. }
  695. // if (!this.inspect.imperfectGrain) {
  696. // this.$message({
  697. // message: '不完善粒不能为空',
  698. // type: 'warning',
  699. // })
  700. // return
  701. // }
  702. if (this.inspect.imperfectGrain && this.inspect.imperfectGrain < 0 || this.inspect.imperfectGrain > 40) {
  703. this.$message({
  704. message: '不完善粒输入错误',
  705. type: 'warning',
  706. })
  707. return
  708. }
  709. if (this.inspect.imperfectGrain && String(this.inspect.imperfectGrain).indexOf('.') != -1 && String(this
  710. .inspect.imperfectGrain).length - (
  711. String(this.inspect.imperfectGrain).indexOf('.') + 1) > 1) {
  712. this.$message({
  713. message: '不完善粒应保留一位小数',
  714. type: 'warning',
  715. })
  716. return
  717. }
  718. this.$confirm('确定保存质检信息?', '提示', {
  719. confirmButtonText: '确定',
  720. cancelButtonText: '取消',
  721. type: 'warning',
  722. })
  723. .then(() => {
  724. addOut(this.inspect)
  725. .toPromise()
  726. .then((response) => {
  727. this.$message.success('保存成功')
  728. // this.printData = this.inspect
  729. // conole.log(this.printData)
  730. // this.isShowPrint = true
  731. // this.getList()
  732. getinspectLook({
  733. id: response
  734. })
  735. .toPromise()
  736. .then((response2) => {
  737. this.printData = response2
  738. this.printData.contractManagement = this.inspect.contractManagement
  739. console.log(this.printData)
  740. this.isShowPrint = true
  741. this.getList()
  742. })
  743. })
  744. })
  745. .catch(() => {
  746. return false
  747. })
  748. },
  749. cancel() {
  750. this.$router.push({
  751. path: 'qualityInspectionManagement'
  752. })
  753. },
  754. getList() {
  755. this.timestamp = new Date().valueOf()
  756. // this.refreshClick(1)
  757. getinspectList({
  758. compId: localStorage.getItem('ws-pf_compId'),
  759. currentPage: this.currentPage,
  760. pageSize: this.pageSize,
  761. warehouseName: this.warehouseName,
  762. managementType: this.managementType,
  763. qualityType:1
  764. })
  765. .toPromise()
  766. .then((response) => {
  767. this.noinspectList = response.records
  768. console.log(this.inspectbtn,this.noinspectList.length )
  769. if(this.inspectbtn == 1 && this.noinspectList.length > 0){
  770. this.switchList = this.noinspectList
  771. this.inspect = this.noinspectList[0]
  772. if(!this.inspect.weighingManagement){
  773. this.inspect.weighingManagement = {}
  774. }
  775. }else if(this.inspectbtn == 1){
  776. this.switchList = []
  777. this.inspect = {}
  778. this.inspect.weighingManagement = {}
  779. }
  780. console.log(this.switchList )
  781. this.deptBudgetTotal1 = response.total
  782. this.nosuccess = response.total
  783. })
  784. getinspectList({
  785. compId: localStorage.getItem('ws-pf_compId'),
  786. currentPage: this.currentPage,
  787. pageSize: this.pageSize,
  788. warehouseName: this.warehouseName,
  789. managementType: this.managementType,
  790. qualityType:2
  791. })
  792. .toPromise()
  793. .then((response) => {
  794. this.inspectList = response.records
  795. console.log(this.inspectbtn,this.inspectList.length )
  796. if(this.inspectbtn == 2 && this.inspectList.length > 0){
  797. this.switchList = this.inspectList
  798. this.inspect = this.inspectList[0]
  799. if(!this.inspect.weighingManagement){
  800. this.inspect.weighingManagement = {}
  801. }
  802. }else if(this.inspectbtn == 2){
  803. this.switchList = []
  804. this.inspect = {}
  805. this.inspect.weighingManagement = {}
  806. }
  807. this.deptBudgetTotal2 = response.total
  808. this.success = response.total
  809. })
  810. },
  811. },
  812. }
  813. </script>
  814. <style lang="scss" scoped>
  815. .center {
  816. background: #E8ECF6;
  817. overflow-y: scroll;
  818. }
  819. .ws-info-table {
  820. border: none;
  821. padding: 0 20px;
  822. }
  823. .ws-info-table .el-form-item {
  824. width: 50%;
  825. border: none;
  826. }
  827. /deep/.ws-info-table .el-form-item .el-form-item__label {
  828. width: 30%;
  829. text-align: center;
  830. background: #ffffff;
  831. font-size: 14px;
  832. color: #8890B1;
  833. min-width: 115px;
  834. }
  835. /deep/.ws-info-table .el-form-item .el-form-item__content {
  836. border: none;
  837. }
  838. .title::before {
  839. content: '';
  840. display: inline-block;
  841. width: 5px;
  842. height: 30px;
  843. background: #5473E8;
  844. margin-right: 10px;
  845. margin-top: 15px;
  846. }
  847. .titleTop {
  848. display: flex;
  849. width: 100%;
  850. height: 60px;
  851. background: #F6F7FC;
  852. line-height: 60px;
  853. margin-bottom: 20px;
  854. border-radius: 4px;
  855. .textword {
  856. font-size: 18px;
  857. font-weight: 600;
  858. }
  859. }
  860. .substance {
  861. display: flex;
  862. width: 100%;
  863. height: 730px;
  864. .substance-left {
  865. width: 59%;
  866. background: #ffffff;
  867. border-radius: 4px;
  868. /deep/.el-input.is-disabled .el-input__inner {
  869. background: #F5F7FA;
  870. border-radius: 4px;
  871. color: #8890B1 !important;
  872. border: none;
  873. }
  874. /deep/.ws-info-table .el-form-item {
  875. margin: 10px 0;
  876. }
  877. }
  878. .substance-right {
  879. width: 40%;
  880. background: #ffffff;
  881. margin-left: 20px;
  882. border-radius: 4px;
  883. padding: 10px 20px 0;
  884. /deep/.el-select {
  885. width: 50%;
  886. }
  887. .screen {
  888. display: flex;
  889. width: 100%;
  890. margin: 15px 10px 0 0;
  891. border-bottom: 1px solid #D8DCE6;
  892. height: 45px;
  893. .screen_left,
  894. .screen_right {
  895. width: 50%;
  896. }
  897. .screen_left {
  898. min-width: 182px;
  899. }
  900. .badge_item {
  901. margin-right: 15px;
  902. }
  903. .inspect_css,
  904. .noinspect_css,
  905. .record {
  906. width: 74px;
  907. height: 32px;
  908. border-radius: 4px;
  909. text-align: center;
  910. line-height: 32px;
  911. }
  912. .record:hover,
  913. .inspect_css:hover,
  914. .noinspect_css:hover {
  915. cursor: pointer;
  916. }
  917. .inspect_css {
  918. background: #F0F6FF;
  919. color: #5878E8;
  920. }
  921. .screen_right {
  922. justify-content: flex-end;
  923. display: flex;
  924. }
  925. .record {
  926. color: #5878E8;
  927. }
  928. }
  929. }
  930. }
  931. .footer {
  932. margin-top: 20px;
  933. background: #FFFFFF;
  934. border-radius: 4px;
  935. height: 300px;
  936. .formList {
  937. width: 90%;
  938. margin: auto;
  939. }
  940. /deep/.el-form-item__content {
  941. width: 50%;
  942. }
  943. }
  944. /deep/.el-table .el-table__header .cell,
  945. .el-table .el-table__body .cell {
  946. text-align: center;
  947. }
  948. /deep/.el-table--enable-row-transition .el-table__body td {
  949. text-align: center;
  950. }
  951. .bg-right {
  952. padding-right: 10px;
  953. text-align: right;
  954. }
  955. .but {
  956. text-align: center;
  957. margin: 20px auto;
  958. }
  959. /deep/.switchpage.el-pagination .el-select .el-input {
  960. margin: 0 30px 0 10px;
  961. }
  962. </style>