inspectInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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="selectpackingMethod"
  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-info-table>
  108. <div class="title">质检数据</div>
  109. <ws-info-table>
  110. <ws-form-item label="等级" span="1" prop="grade">
  111. <ws-select
  112. v-model="inspect.grade"
  113. placeholder="请输入等级"
  114. class="typeselect"
  115. @change="waterContentChange"
  116. :disabled="disabled"
  117. >
  118. <ws-option
  119. v-for="item in gradeList"
  120. :key="item.constKey"
  121. :label="item.constValue"
  122. :value="item.constValue"
  123. />
  124. </ws-select>
  125. </ws-form-item>
  126. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  127. <ws-input
  128. v-model="inspect.impurity"
  129. placeholder="请输入杂质占比"
  130. maxlength="100"
  131. size="small"
  132. :disabled="disabled"
  133. />
  134. </ws-form-item>
  135. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  136. <ws-input
  137. v-model="inspect.waterContent"
  138. placeholder="请输入水分占比"
  139. maxlength="100"
  140. size="small"
  141. @change = "waterContentChange"
  142. :disabled="disabled"
  143. />
  144. </ws-form-item>
  145. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  146. <ws-input
  147. v-model="inspect.mildewGrain"
  148. placeholder="请输入霉变粒占比"
  149. maxlength="100"
  150. size="small"
  151. :disabled="disabled"
  152. />
  153. </ws-form-item>
  154. <ws-form-item label="容重(克/升)" span="1" prop="bulkDensity">
  155. <ws-input
  156. v-model="inspect.bulkDensity"
  157. placeholder="请输入容重"
  158. maxlength="100"
  159. size="small"
  160. :disabled="disabled"
  161. />
  162. </ws-form-item>
  163. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  164. <ws-input
  165. v-model="inspect.jiaorenli"
  166. placeholder="请输入热损伤占比"
  167. maxlength="100"
  168. size="small"
  169. :disabled="disabled"
  170. />
  171. </ws-form-item>
  172. <ws-form-item label="不完整粒(%)" span="1" prop="imperfectGrain">
  173. <ws-input
  174. v-model="inspect.imperfectGrain"
  175. placeholder="请输入不完整粒占比"
  176. maxlength="100"
  177. size="small"
  178. :disabled="disabled"
  179. />
  180. </ws-form-item>
  181. </ws-info-table>
  182. <div style="text-align: right; color: #323233">
  183. 潮粮单价(元/公斤):{{ unitPrice}}
  184. <!-- 潮粮单价(元/公斤):{{ inspect.tidalGrainPrice == null?"0": inspect.tidalGrainPrice}} -->
  185. </div>
  186. <div class="but">
  187. <el-button @click="cancel" v-if="this.types != 2" type="primary"
  188. >取消</el-button
  189. >
  190. <el-button @click="print" v-if="this.types != 2" type="primary"
  191. >保存并打印</el-button
  192. >
  193. <el-button @click="cancel" v-if="this.types == 2" type="primary"
  194. >关闭</el-button
  195. >
  196. </div>
  197. </div>
  198. </ws-form>
  199. </div>
  200. <houseSelfCollectPrint v-show="false"></houseSelfCollectPrint>
  201. </div>
  202. </template>
  203. <script>
  204. import {
  205. inspectAdd,
  206. getbinNumber,
  207. getcustomer,
  208. getinspectLook,
  209. getinspectLookUnitPrice,
  210. getinspectLookGoods,
  211. getinspectEdit
  212. } from '@/model/houseSelfCollect/index'
  213. import { packList } from '@/model/contarct/index'
  214. import houseSelfCollectPrint from './houseSelfCollectPrint.vue'
  215. export default {
  216. components: {
  217. houseSelfCollectPrint,
  218. },
  219. watch: {},
  220. data() {
  221. return {
  222. // warehouseList: {},
  223. inspect: {},
  224. disabled: false,
  225. types: '1',
  226. information: '添加',
  227. goodnameList: [],
  228. gradeList: [],
  229. customerList: [],
  230. getbinNumberList: [],
  231. cangid: '', //仓库id
  232. warehouseName:'',
  233. unitPrice:0,
  234. count:0,
  235. cangNo:"",
  236. }
  237. },
  238. activated() {
  239. this.types = this.$route.query.type
  240. this.cangid = this.$route.query.cangid
  241. this.warehouseName = this.$route.query.warehouseName
  242. let id = this.$route.query.id
  243. this.cangNo = this.$route.query.warehouseNo
  244. this.count = Number(this.$route.query.count)+1
  245. if (this.types == 2) {
  246. this.disabled = true
  247. this.information = '查看'
  248. } else if (this.types == 3) {
  249. this.disabled = false
  250. this.information = '编辑'
  251. }
  252. this.calculation()
  253. this.getList(id)
  254. },
  255. methods: {
  256. getdate() {
  257. var date = new Date()
  258. var year = date.getFullYear() //获取完整的年份(4位)
  259. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  260. var datetime = date.getDate() //获取当前日(1-31)
  261. if (mouth < 10) {
  262. mouth = '0' + mouth
  263. }
  264. if (datetime < 10) {
  265. datetime = '0' + datetime
  266. }
  267. return year + mouth + datetime
  268. },
  269. calculation() {
  270. let number ="000"+ this.count
  271. number = number.substring(number.length - 4,number.length)
  272. this.inspect.qualityNo = 'SGRK' + this.getdate()+this.cangNo+number //SGRK+8位时间+3位仓库编号+4位序列号
  273. // + this.verifyinit()
  274. },
  275. print() {
  276. this.inspect.warehouseName = this.warehouseName
  277. this.inspect.compId = sessionStorage.getItem('ws-pf_compId')
  278. if(this.types == null){
  279. this.$confirm('确定保存质检信息?', '提示', {
  280. confirmButtonText: '确定',
  281. cancelButtonText: '取消',
  282. type: 'warning',
  283. })
  284. .then(() => {
  285. inspectAdd(this.inspect)
  286. .toPromise()
  287. .then((response) => {
  288. this.$message.success('保存成功')
  289. // this.xx = true;
  290. // let newstr = document.getElementById('print').innerHTML
  291. // let oldstr = document.body.innerHTML
  292. // document.body.innerHTML = newstr
  293. // window.print()
  294. // document.body.innerHTML = oldstr
  295. // // window.location.reload()
  296. this.$router.push({ path: 'paymentManagement' })
  297. })
  298. })
  299. .catch(() => {
  300. return false
  301. })
  302. }else if(this.types == 3){
  303. this.$confirm('确定保存质检信息?', '提示', {
  304. confirmButtonText: '确定',
  305. cancelButtonText: '取消',
  306. type: 'warning',
  307. })
  308. .then(() => {
  309. // return
  310. getinspectEdit(this.inspect)
  311. .toPromise()
  312. .then((response) => {
  313. this.$message.success('修改成功')
  314. // this.xx = true;
  315. // let newstr = document.getElementById('print').innerHTML
  316. // let oldstr = document.body.innerHTML
  317. // document.body.innerHTML = newstr
  318. // window.print()
  319. // document.body.innerHTML = oldstr
  320. // window.location.reload()
  321. this.$router.push({ path: 'paymentManagement' })
  322. })
  323. })
  324. .catch(() => {
  325. return false
  326. })
  327. }
  328. },
  329. cancel() {
  330. this.$router.push({ path: 'inspectionManagement' })
  331. },
  332. waterContentChange() {
  333. //潮粮单价改变事件
  334. if(this.inspect.goodsName != null && this.inspect.waterContent != null && this.inspect.grade != null){
  335. getinspectLookUnitPrice({
  336. warehouseId: this.cangid,
  337. goodsName: this.inspect.goodsName,
  338. waterContent: this.inspect.waterContent,
  339. grade:this.inspect.grade
  340. })
  341. .toPromise()
  342. .then((response) => {
  343. this.inspect.tidalGrainPrice = response
  344. this.unitPrice = response
  345. })
  346. }
  347. },
  348. //货名改变事件
  349. selectpackingMethod(e) {
  350. let customers = e.split("(")
  351. // customers = customers[1].split(")")
  352. this.inspect.customerName = customers[0]
  353. this.inspect.customerPhone = customers[1].split(")")[0]
  354. },
  355. getList(ids) {
  356. // 货名
  357. getinspectLookGoods({ warehouseId: this.cangid })
  358. .toPromise()
  359. .then((response) => {
  360. this.goodnameList = response
  361. })
  362. // 品级
  363. packList({ constId: 'CON3' })
  364. .toPromise()
  365. .then((response) => {
  366. this.gradeList = response
  367. })
  368. //客户
  369. getcustomer({ compId: sessionStorage.getItem('ws-pf_compId') })
  370. .toPromise()
  371. .then((response) => {
  372. // this.gradeList = response
  373. this.customerList = []
  374. let customer = response
  375. for (let i = 0; i < response.length; i++) {
  376. customer =
  377. response[i].customerName + '(' + response[i].customerPhone + ')'
  378. this.customerList.push({
  379. valueKey: i,
  380. value: customer,
  381. })
  382. }
  383. })
  384. // 仓位
  385. getbinNumber({ id: this.cangid })
  386. .toPromise()
  387. .then((response) => {
  388. this.getbinNumberList=[]
  389. for (let i = 0; i < response.warehousePositionInfoList.length; i++) {
  390. this.getbinNumberList.push({
  391. value: response.warehousePositionInfoList[i].binNumber,
  392. })
  393. }
  394. // this.getbinNumberList = response.warehousePositionInfoList
  395. })
  396. if (this.types == 2 || this.types == 3) {
  397. //查看
  398. getinspectLook({ id: ids })
  399. .toPromise()
  400. .then((response) => {
  401. this.inspect = response
  402. })
  403. }
  404. },
  405. },
  406. }
  407. </script>
  408. <style lang="scss" scoped>
  409. .center {
  410. background: #f6f7fc;
  411. }
  412. .ws-info-table {
  413. border: none;
  414. }
  415. .ws-info-table .el-form-item {
  416. width: 50%;
  417. border: none;
  418. }
  419. /deep/.ws-info-table .el-form-item .el-form-item__label {
  420. width: 30%;
  421. text-align: center;
  422. background: #ffffff;
  423. font-size: 14px;
  424. color: #8890b1;
  425. }
  426. /deep/.ws-info-table .el-form-item .el-form-item__content {
  427. border: none;
  428. }
  429. .title {
  430. font-size: 16px;
  431. font-weight: 600;
  432. margin: 10px;
  433. }
  434. .titleup {
  435. position: relative;
  436. }
  437. .title::before {
  438. content: '';
  439. display: inline-block;
  440. width: 5px;
  441. height: 15px;
  442. background: #8890b1;
  443. margin-right: 5px;
  444. }
  445. .substance {
  446. background: #ffffff;
  447. width: 100%;
  448. border-radius: 4px;
  449. margin: 0 auto;
  450. padding-top: 20px;
  451. }
  452. /deep/.el-table .el-table__header .cell,
  453. .el-table .el-table__body .cell {
  454. text-align: center;
  455. }
  456. /deep/.el-table--enable-row-transition .el-table__body td {
  457. text-align: center;
  458. }
  459. .bg-left {
  460. padding-left: 30px;
  461. }
  462. .bg-right {
  463. padding-right: 10px;
  464. text-align: right;
  465. }
  466. .bg-bottom {
  467. margin: 15px 0px;
  468. }
  469. .titleup {
  470. position: relative;
  471. }
  472. .titleup::before {
  473. content: '';
  474. display: inline-block;
  475. width: 5px;
  476. height: 30px;
  477. background: #5473e8;
  478. position: absolute;
  479. left: 0;
  480. }
  481. .but {
  482. text-align: center;
  483. margin: 20px auto;
  484. }
  485. </style>