inspectInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <!--质检信息-->
  2. <template>
  3. <div class="center">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left titleup">{{ information }}质检信息</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="cancel"
  10. ><img
  11. width="6"
  12. height="10"
  13. style="vertical-align: bottom; margin-right: 3px"
  14. src="../../../public/img/lujing.png"
  15. alt=""
  16. />返回</el-button
  17. >
  18. </el-col>
  19. </el-row>
  20. <div class="substance">
  21. <ws-form>
  22. <div style="width: 50%; margin: 0 auto">
  23. <div class="title">基本信息</div>
  24. <ws-info-table>
  25. <ws-form-item label="编号" span="1" prop="qualityNo">
  26. <ws-input
  27. v-model="inspect.qualityNo"
  28. placeholder="请输入编号"
  29. maxlength="100"
  30. disabled
  31. size="small"
  32. />
  33. </ws-form-item>
  34. <ws-form-item label="仓位号" span="1" prop="binNumber">
  35. <ws-select
  36. v-model="inspect.binNumber"
  37. placeholder="请输入仓位号"
  38. class="typeselect"
  39. :disabled="disabled"
  40. >
  41. <ws-option
  42. v-for="item in getbinNumberList"
  43. :key="item.value"
  44. :label="item.value"
  45. :value="item.value"
  46. />
  47. </ws-select>
  48. </ws-form-item>
  49. <ws-form-item label="客户" span="1" prop="customerName">
  50. <ws-select
  51. placeholder=""
  52. class="typeselect"
  53. @change="customerChange"
  54. :disabled="disabled"
  55. >
  56. <ws-option
  57. v-for="item in customerList"
  58. :key="item.valueKey"
  59. :label="item.value"
  60. :value="item.value"
  61. />
  62. </ws-select>
  63. </ws-form-item>
  64. <ws-form-item label="囤位号" span="1" prop="storageTagNo">
  65. <ws-input
  66. v-model="inspect.storageTagNo"
  67. placeholder="请输入囤位号"
  68. maxlength="100"
  69. size="small"
  70. :disabled="disabled"
  71. />
  72. </ws-form-item>
  73. <ws-form-item label="车牌号" span="1" prop="carNumber">
  74. <ws-input
  75. v-model="inspect.carNumber"
  76. placeholder="请输入车牌号"
  77. maxlength="100"
  78. size="small"
  79. :disabled="disabled"
  80. />
  81. </ws-form-item>
  82. <ws-form-item label="货名" span="1" prop="goodsName">
  83. <ws-select
  84. v-model="inspect.goodsName"
  85. placeholder=""
  86. class="typeselect"
  87. :disabled="disabled"
  88. @change="waterContentChange"
  89. >
  90. <ws-option
  91. v-for="item in goodnameList"
  92. :key="item.goodsNameKey"
  93. :label="item.goodsName"
  94. :value="item.goodsName"
  95. />
  96. </ws-select>
  97. </ws-form-item>
  98. <ws-form-item label="扣重比" span="1" prop="buckleWeightRatio">
  99. <ws-input
  100. v-model="inspect.buckleWeightRatio"
  101. placeholder="请输入扣重比"
  102. maxlength="100"
  103. size="small"
  104. :disabled="disabled"
  105. />
  106. </ws-form-item>
  107. <ws-form-item label="类型" span="1" prop="type">
  108. <ws-select
  109. v-model="inspect.type"
  110. placeholder=""
  111. :disabled="disabled"
  112. >
  113. <ws-option
  114. v-for="item in typeList"
  115. :key="item"
  116. :label="item"
  117. :value="item"
  118. />
  119. </ws-select>
  120. </ws-form-item>
  121. <ws-form-item
  122. label="购粮性质"
  123. span="1"
  124. prop="natureOfGrainPurchase"
  125. >
  126. <ws-input
  127. v-model="inspect.natureOfGrainPurchase"
  128. placeholder="请输入购粮性质"
  129. maxlength="100"
  130. size="small"
  131. :disabled="disabled"
  132. />
  133. </ws-form-item>
  134. <ws-form-item
  135. label="净重单价(元/公斤)"
  136. span="1"
  137. prop="buckleWeightRatio"
  138. >
  139. <ws-input
  140. v-model="inspect.tidalGrainPrice"
  141. placeholder="请输入净重单价"
  142. maxlength="100"
  143. size="small"
  144. disabled
  145. />
  146. </ws-form-item>
  147. </ws-info-table>
  148. <div class="title">质检数据</div>
  149. <ws-info-table>
  150. <ws-form-item label="等级" span="1" prop="grade">
  151. <ws-select
  152. v-model="inspect.grade"
  153. placeholder="请输入等级"
  154. class="typeselect"
  155. @change="waterContentChange"
  156. :disabled="disabled"
  157. >
  158. <ws-option
  159. v-for="item in gradeList"
  160. :key="item.constKey"
  161. :label="item.constValue"
  162. :value="item.constValue"
  163. />
  164. </ws-select>
  165. </ws-form-item>
  166. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  167. <ws-input
  168. v-model="inspect.impurity"
  169. placeholder="请输入杂质占比"
  170. maxlength="100"
  171. size="small"
  172. :disabled="disabled"
  173. />
  174. </ws-form-item>
  175. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  176. <ws-input
  177. v-model="inspect.waterContent"
  178. placeholder="请输入水分占比"
  179. maxlength="100"
  180. size="small"
  181. @change="waterContentChange"
  182. :disabled="disabled"
  183. />
  184. </ws-form-item>
  185. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  186. <ws-input
  187. v-model="inspect.mildewGrain"
  188. placeholder="请输入霉变粒占比"
  189. maxlength="100"
  190. size="small"
  191. :disabled="disabled"
  192. />
  193. </ws-form-item>
  194. <ws-form-item label="容重(克/升)" span="1" prop="bulkDensity">
  195. <ws-input
  196. v-model="inspect.bulkDensity"
  197. placeholder="请输入容重"
  198. maxlength="100"
  199. size="small"
  200. :disabled="disabled"
  201. />
  202. </ws-form-item>
  203. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  204. <ws-input
  205. v-model="inspect.jiaorenli"
  206. placeholder="请输入热损伤占比"
  207. maxlength="100"
  208. size="small"
  209. :disabled="disabled"
  210. />
  211. </ws-form-item>
  212. <ws-form-item label="不完整粒(%)" span="1" prop="imperfectGrain">
  213. <ws-input
  214. v-model="inspect.imperfectGrain"
  215. placeholder="请输入不完整粒占比"
  216. maxlength="100"
  217. size="small"
  218. :disabled="disabled"
  219. />
  220. </ws-form-item>
  221. </ws-info-table>
  222. <!-- <div style="text-align: right; color: #323233">
  223. 潮粮单价(元/公斤):{{ unitPrice}}
  224. </div> -->
  225. <div class="but">
  226. <el-button @click="cancel" v-if="this.types != 2" type="primary"
  227. >取消</el-button
  228. >
  229. <el-button @click="print" v-if="this.types != 2" type="primary"
  230. >保存并打印</el-button
  231. >
  232. <el-button @click="cancel" v-if="this.types == 2" type="primary"
  233. >关闭</el-button
  234. >
  235. </div>
  236. </div>
  237. </ws-form>
  238. </div>
  239. <houseSelfCollectPrint v-show="false"></houseSelfCollectPrint>
  240. </div>
  241. </template>
  242. <script>
  243. import {
  244. inspectAdd,
  245. getbinNumber,
  246. getcustomer,
  247. getinspectLook,
  248. getinspectLookUnitPrice,
  249. getinspectLookGoods,
  250. getinspectEdit,
  251. getamount,
  252. } from '@/model/houseSelfCollect/index'
  253. import { packList } from '@/model/contarct/index'
  254. import houseSelfCollectPrint from './houseSelfCollectPrint.vue'
  255. export default {
  256. components: {
  257. houseSelfCollectPrint,
  258. },
  259. watch: {},
  260. data() {
  261. return {
  262. // warehouseList: {},
  263. inspect: {
  264. tidalGrainPrice: 0,
  265. },
  266. disabled: false,
  267. types: '1',
  268. information: '添加',
  269. goodnameList: [],
  270. gradeList: [],
  271. customerList: [],
  272. getbinNumberList: [],
  273. cangid: '', //仓库id
  274. warehouseName: '',
  275. unitPrice: 0,
  276. count: 0,
  277. cangNo: '',
  278. typeList: ['干粮', '潮粮'],
  279. purchasePriceList:[],
  280. id:"",
  281. }
  282. },
  283. activated() {
  284. this.types = this.$route.query.type
  285. this.cangid = this.$route.query.cangid
  286. this.warehouseName = this.$route.query.warehouseName
  287. this.cangNo = this.$route.query.warehouseNo
  288. this.count = Number(this.$route.query.count) + 1
  289. this.purchasePriceList = this.$route.query.purchasePriceList
  290. this.id = this.$route.query.id
  291. if (this.types == 2) {
  292. this.disabled = true
  293. this.information = '查看'
  294. } else if (this.types == 3) {
  295. this.disabled = false
  296. this.information = '编辑'
  297. }
  298. this.calculation()
  299. this.getList(this.id)
  300. },
  301. methods: {
  302. getdate() {
  303. var date = new Date()
  304. var year = date.getFullYear() //获取完整的年份(4位)
  305. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  306. var datetime = date.getDate() //获取当前日(1-31)
  307. if (mouth < 10) {
  308. mouth = '0' + mouth
  309. }
  310. if (datetime < 10) {
  311. datetime = '0' + datetime
  312. }
  313. return year + mouth + datetime
  314. },
  315. calculation() {
  316. let number = '000' + this.count
  317. number = number.substring(number.length - 4, number.length)
  318. this.inspect.qualityNo = 'SGRK' + this.getdate() + this.cangNo + number //SGRK+8位时间+3位仓库编号+4位序列号
  319. // + this.verifyinit()
  320. },
  321. print() {
  322. this.inspect.warehouseName = this.warehouseName
  323. this.inspect.compId = sessionStorage.getItem('ws-pf_compId')
  324. this.qualityInspector = sessionStorage.getItem('ws-pf_staffName')
  325. if (this.types == null) {
  326. this.$confirm('确定保存质检信息?', '提示', {
  327. confirmButtonText: '确定',
  328. cancelButtonText: '取消',
  329. type: 'warning',
  330. })
  331. .then(() => {
  332. inspectAdd(this.inspect)
  333. .toPromise()
  334. .then((response) => {
  335. this.$message.success('保存成功')
  336. this.$router.push({ path: 'paymentManagement' })
  337. })
  338. })
  339. .catch(() => {
  340. return false
  341. })
  342. } else if (this.types == 3) {
  343. this.$confirm('确定保存质检信息?', '提示', {
  344. confirmButtonText: '确定',
  345. cancelButtonText: '取消',
  346. type: 'warning',
  347. })
  348. .then(() => {
  349. // return
  350. getinspectEdit(this.inspect)
  351. .toPromise()
  352. .then((response) => {
  353. this.$message.success('修改成功')
  354. // this.xx = true;
  355. // let newstr = document.getElementById('print').innerHTML
  356. // let oldstr = document.body.innerHTML
  357. // document.body.innerHTML = newstr
  358. // window.print()
  359. // document.body.innerHTML = oldstr
  360. // window.location.reload()
  361. this.$router.push({ path: 'paymentManagement' })
  362. })
  363. })
  364. .catch(() => {
  365. return false
  366. })
  367. }
  368. },
  369. cancel() {
  370. this.$router.push({ path: 'inspectionManagement' })
  371. },
  372. customerChange(e) {
  373. let customers = e.split('(')
  374. this.inspect.customerName = customers[0]
  375. this.inspect.customerPhone = customers[1].split(')')[0]
  376. //客户下拉校验
  377. // getamount({
  378. // compId: sessionStorage.getItem('ws-pf_compId'),
  379. // customerName: this.inspect.customerPhone,
  380. // goodsName: this.inspect.goodsName,
  381. // })
  382. // .toPromise()
  383. // .then((response) => {
  384. // console.log(response)
  385. // })
  386. },
  387. waterContentChange() {
  388. if(this.inspect.goodsName){
  389. for(var i=0;i<this.purchasePriceList.length;i++){
  390. if(this.purchasePriceList[i].goodsName == this.inspect.goodsName){
  391. this.inspect.buckleWeightRatio = this.purchasePriceList[i].deductWeight
  392. }
  393. }
  394. }
  395. //潮粮单价改变事件
  396. if (
  397. this.inspect.goodsName &&
  398. this.inspect.waterContent &&
  399. this.inspect.grade
  400. ) {
  401. getinspectLookUnitPrice({
  402. warehouseId: this.cangid,
  403. goodsName: this.inspect.goodsName,
  404. waterContent: this.inspect.waterContent,
  405. grade: this.inspect.grade,
  406. })
  407. .toPromise()
  408. .then((response) => {
  409. this.inspect.tidalGrainPrice = response
  410. this.unitPrice = response
  411. })
  412. }
  413. },
  414. getList(ids) {
  415. // 货名
  416. getinspectLookGoods({ warehouseId: this.cangid })
  417. .toPromise()
  418. .then((response) => {
  419. this.goodnameList = []
  420. this.goodnameList = response
  421. })
  422. // 品级
  423. packList({ constId: 'CON3' })
  424. .toPromise()
  425. .then((response) => {
  426. this.gradeList = response
  427. })
  428. //客户
  429. getcustomer({ compId: sessionStorage.getItem('ws-pf_compId') })
  430. .toPromise()
  431. .then((response) => {
  432. // this.gradeList = response
  433. this.customerList = []
  434. let customer = response
  435. for (let i = 0; i < response.length; i++) {
  436. customer =
  437. response[i].customerName + '(' + response[i].customerPhone + ')'
  438. this.customerList.push({
  439. valueKey: i,
  440. value: customer,
  441. })
  442. }
  443. })
  444. // 仓位
  445. getbinNumber({ id: this.cangid })
  446. .toPromise()
  447. .then((response) => {
  448. this.getbinNumberList = []
  449. for (let i = 0; i < response.warehousePositionInfoList.length; i++) {
  450. this.getbinNumberList.push({
  451. value: response.warehousePositionInfoList[i].binNumber,
  452. })
  453. }
  454. })
  455. if (this.types == 2 || this.types == 3) {
  456. //查看
  457. getinspectLook({ id: ids })
  458. .toPromise()
  459. .then((response) => {
  460. this.inspect = response
  461. })
  462. }
  463. },
  464. },
  465. }
  466. </script>
  467. <style lang="scss" scoped>
  468. .center {
  469. background: #f6f7fc;
  470. }
  471. .ws-info-table {
  472. border: none;
  473. }
  474. .ws-info-table .el-form-item {
  475. width: 50%;
  476. border: none;
  477. }
  478. /deep/.ws-info-table .el-form-item .el-form-item__label {
  479. width: 30%;
  480. text-align: center;
  481. background: #ffffff;
  482. font-size: 14px;
  483. color: #8890b1;
  484. }
  485. /deep/.ws-info-table .el-form-item .el-form-item__content {
  486. border: none;
  487. }
  488. .title {
  489. font-size: 16px;
  490. font-weight: 600;
  491. margin: 10px;
  492. }
  493. .titleup {
  494. position: relative;
  495. }
  496. .title::before {
  497. content: '';
  498. display: inline-block;
  499. width: 5px;
  500. height: 15px;
  501. background: #8890b1;
  502. margin-right: 5px;
  503. }
  504. .substance {
  505. background: #ffffff;
  506. width: 100%;
  507. border-radius: 4px;
  508. margin: 0 auto;
  509. padding-top: 20px;
  510. }
  511. /deep/.el-table .el-table__header .cell,
  512. .el-table .el-table__body .cell {
  513. text-align: center;
  514. }
  515. /deep/.el-table--enable-row-transition .el-table__body td {
  516. text-align: center;
  517. }
  518. .bg-left {
  519. padding-left: 30px;
  520. }
  521. .bg-right {
  522. padding-right: 10px;
  523. text-align: right;
  524. }
  525. .bg-bottom {
  526. margin: 15px 0px;
  527. }
  528. .titleup {
  529. position: relative;
  530. }
  531. .titleup::before {
  532. content: '';
  533. display: inline-block;
  534. width: 5px;
  535. height: 30px;
  536. background: #5473e8;
  537. position: absolute;
  538. left: 0;
  539. }
  540. .but {
  541. text-align: center;
  542. margin: 20px auto;
  543. }
  544. </style>