inspectInfo.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  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"><img width="6" height="10"
  10. style="vertical-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  11. </el-button>
  12. </el-col>
  13. </el-row>
  14. <div class="substance">
  15. <ws-form>
  16. <div style="width: 50%; margin: 0 auto">
  17. <div class="title">基本信息</div>
  18. <ws-info-table>
  19. <ws-form-item label="仓库" span="1" prop="warehouseName">
  20. <ws-input v-model="warehouseName" placeholder="请输入仓库" maxlength="100" disabled size="small" />
  21. </ws-form-item>
  22. <ws-form-item label="编号" span="1" prop="qualityNo">
  23. <ws-input v-model="inspect.qualityNo" placeholder="请输入编号" maxlength="100" disabled size="small" />
  24. </ws-form-item>
  25. <ws-form-item label="仓位号" span="1" prop="binNumber">
  26. <ws-select v-model="inspect.binNumber" placeholder="请输入仓位号" class="typeselect" :disabled="disabled">
  27. <ws-option v-for="item in getbinNumberList" :key="item.value" :label="item.value" :value="item.value" />
  28. </ws-select>
  29. </ws-form-item>
  30. <ws-form-item label="客户" span="1" prop="customerName">
  31. <el-select v-model="inspect.customerName" clearable filterable placeholder="请选择" class="typeselect" @change="customerChange"
  32. :disabled="disabled1">
  33. <el-option v-for="item in customerList" :key="item.valueKey" :label="item.value" :value="item.value" />
  34. </el-select>
  35. </ws-form-item>
  36. <ws-form-item label="囤位号" span="1" prop="storageTagNo">
  37. <ws-input v-model="inspect.storageTagNo" placeholder="请输入囤位号" maxlength="15" size="small"
  38. :disabled="disabled" />
  39. </ws-form-item>
  40. <ws-form-item label="车牌号" span="1" prop="carNumber">
  41. <ws-input v-model="inspect.carNumber" placeholder="请输入车牌号" maxlength="10" size="small"
  42. :disabled="disabled" />
  43. </ws-form-item>
  44. <ws-form-item label="货名" span="1" prop="goodsName">
  45. <ws-select v-model="inspect.goodsName" placeholder="" class="typeselect" :disabled="disabled1"
  46. @change="waterContentChange">
  47. <ws-option v-for="item in goodNameList" :key="item.goodsName" :label="item.goodsName"
  48. :value="item.goodsName" />
  49. </ws-select>
  50. </ws-form-item>
  51. <ws-form-item v-if="inspect.paramType != '1'" label="扣重比" span="1" prop="buckleWeightRatio">
  52. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.buckleWeightRatio" placeholder="请输入扣重比" maxlength="100" size="small"
  53. :disabled="disabled" />
  54. </ws-form-item>
  55. <ws-form-item v-else label="扣杂" span="1" prop="buckleWeightRatio">
  56. <ws-input type="number" style="padding-right:30px" @mousewheel.native.prevent v-model="inspect.buckleMiscellaneous" @input="waterContentChange" placeholder="请输入扣杂" maxlength="100" size="small"
  57. :disabled="disabled" />
  58. <ws-input v-if='types==4' type="number" @mousewheel.native.prevent v-model="inspect.reBuckleMiscellaneous" placeholder="请输入扣杂" maxlength="100" size="small"
  59. />
  60. <ws-input v-else type="number" @mousewheel.native.prevent v-model="inspect.reBuckleMiscellaneous" placeholder="未复检" maxlength="100" size="small"
  61. disabled />
  62. </ws-form-item>
  63. <ws-form-item label="类型" span="1" prop="type">
  64. <ws-select v-model="inspect.type" disabled @change="typeChange">
  65. <ws-option v-for="item in typeList" :key="item" :label="item" :value="item" />
  66. </ws-select>
  67. </ws-form-item>
  68. <ws-form-item label="购粮性质" span="1" prop="natureOfGrainPurchase">
  69. <ws-input v-model="inspect.natureOfGrainPurchase" placeholder="请输入购粮性质" maxlength="10" size="small"
  70. :disabled="disabled" />
  71. </ws-form-item>
  72. <ws-form-item label="净重单价(元/公斤)" span="1" prop="tidalGrainPrice" v-if="inspect.type == '潮粮'">
  73. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.tidalGrainPrice" placeholder="请输入净重单价" maxlength="10" size="small" disabled />
  74. </ws-form-item>
  75. <ws-form-item label="干粮单价(元/公斤)" span="1" prop="dryGrainPrice" v-if="inspect.type == '干粮'">
  76. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.dryGrainPrice" placeholder="请输入干粮单价" maxlength="10" size="small" :disabled="disabled" />
  77. </ws-form-item>
  78. </ws-info-table>
  79. <div class="title">质检数据</div>
  80. <ws-info-table>
  81. <ws-form-item label="等级" span="1" prop="grade">
  82. <ws-select v-model="inspect.grade" placeholder="请输入等级" class="typeselect"
  83. :disabled="disabled" @change="waterContentChange">
  84. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  85. :value="item.constValue" />
  86. </ws-select>
  87. </ws-form-item>
  88. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  89. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.impurity" placeholder="请输入杂质占比" maxlength="100" size="small"
  90. :disabled="disabled" />
  91. </ws-form-item>
  92. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  93. <ws-input type="number" @mousewheel.native.prevent style="padding-right:30px" v-model="inspect.waterContent" placeholder="请输入水分占比" maxlength="100" size="small"
  94. @change="waterContentChange('water')" :disabled="disabled" />
  95. <ws-input v-if='types==4' type="number" @mousewheel.native.prevent v-model="inspect.reWaterContent" placeholder="请输入水分占比" maxlength="100" size="small"
  96. />
  97. <ws-input v-else type="number" @mousewheel.native.prevent v-model="inspect.reWaterContent" placeholder="未复检" maxlength="100" size="small"
  98. disabled />
  99. </ws-form-item>
  100. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  101. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.mildewGrain" placeholder="请输入霉变粒占比" maxlength="100" size="small"
  102. :disabled="disabled" />
  103. </ws-form-item>
  104. <ws-form-item label="容重(克/升)" span="1" prop="bulkDensity">
  105. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.bulkDensity" placeholder="请输入容重" maxlength="100" size="small"
  106. :disabled="disabled" />
  107. </ws-form-item>
  108. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  109. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.jiaorenli" placeholder="请输入热损伤占比" maxlength="100" size="small"
  110. :disabled="disabled" />
  111. </ws-form-item>
  112. <ws-form-item label="不完善粒(%)" span="1" prop="imperfectGrain">
  113. <ws-input type="number" @mousewheel.native.prevent v-model="inspect.imperfectGrain" placeholder="请输入不完善粒占比" maxlength="100" size="small"
  114. :disabled="disabled" />
  115. </ws-form-item>
  116. </ws-info-table>
  117. <div class="but">
  118. <el-button @click="cancel" v-if="this.types != 2" type="primary">取消</el-button>
  119. <el-button @click="print" v-if="this.types ==3 || this.types ==4 ||this.types ==1" type="primary">保存</el-button>
  120. <el-button @click="print" v-if="this.types ==5 " type="primary">确认并打印</el-button>
  121. <el-button @click="cancel" v-if="this.types == 2" type="primary">关闭</el-button>
  122. </div>
  123. </div>
  124. </ws-form>
  125. </div>
  126. <el-dialog width="70%" class="table-content" center :visible.sync="isShowPrint" title="粮食质检单" @close="closeDialog" :close-on-click-modal="false">
  127. <inspectInfoPrint :printData="inspect" ref="saveImg"></inspectInfoPrint>
  128. <div style="text-align:center">
  129. <el-button type="primary" @click="closePrint">关闭</el-button>
  130. <el-button type="primary" @click="printSmall">打印小票</el-button>
  131. <el-button type="primary" @click="printBig">打印单据</el-button>
  132. </div>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import {
  138. inspectAdd,
  139. getbinNumber,
  140. getcustomer,
  141. getinspectLook,
  142. getinspectLookUnitPrice,
  143. getinspectLookGoods,
  144. getinspectEdit,
  145. getamount,
  146. getCount,
  147. getDryGrainPrice
  148. } from '@/model/houseSelfCollect/index'
  149. import {
  150. packList
  151. } from '@/model/contarct/index'
  152. import inspectInfoPrint from './component/inspectInfoPrint.vue'
  153. import html2canvas from 'html2canvas'
  154. import axios from 'axios'
  155. export default {
  156. components: {
  157. inspectInfoPrint,
  158. },
  159. watch: {},
  160. data() {
  161. return {
  162. isShowPrint: false,
  163. // warehouseList: {},
  164. inspect: {
  165. tidalGrainPrice: 0,
  166. buckleWeightRatio: 0,
  167. natureOfGrainPurchase:'贸易粮',
  168. buckleMiscellaneous:0,
  169. paramType:1,
  170. type:'潮粮'
  171. },
  172. disabled: false,
  173. disabled1: false,
  174. types: '1',
  175. information: '添加初检',
  176. goodNameList: [],
  177. gradeList: [],
  178. customerList: [],
  179. getbinNumberList: [],
  180. cangid: '', //仓库id
  181. warehouseName: '',
  182. unitPrice: 0,
  183. count: 0,
  184. cangNo: '',
  185. typeList: ['干粮', '潮粮'],
  186. purchasePriceList: [],
  187. id: '',
  188. imgUrl:'',
  189. printData:{},
  190. num:0,
  191. tipFlag:true
  192. }
  193. },
  194. activated() {
  195. this.types = this.$route.query.type
  196. if(!this.types){
  197. this.types = 1
  198. this.information = '添加初检'
  199. this.disabled = false
  200. this.inspect = {
  201. tidalGrainPrice: 0,
  202. buckleWeightRatio: 0,
  203. natureOfGrainPurchase:'贸易粮',
  204. type:'潮粮'
  205. }
  206. }
  207. this.cangid = this.$route.query.cangid
  208. this.warehouseName = this.$route.query.warehouseName
  209. this.cangNo = this.$route.query.warehouseNo
  210. this.count = Number(this.$route.query.count) + 1
  211. // this.purchasePriceList = this.$route.query.purchasePriceList
  212. this.id = this.$route.query.id
  213. if (this.types == 2) {
  214. this.disabled = true
  215. this.disabled1 = true
  216. this.information = '查看质检'
  217. } else if (this.types == 3) {
  218. this.disabled = false
  219. this.disabled1 = true
  220. this.information = '编辑初检'
  221. }else if (this.types == 4) {
  222. this.disabled = true
  223. this.disabled1 = true
  224. this.information = '编辑复检'
  225. }else if (this.types == 5) {
  226. this.disabled = false
  227. this.disabled1 = true
  228. this.information = '确认质检'
  229. }
  230. else{
  231. this.disabled1 = false
  232. this.disabled = false
  233. }
  234. this.calculation()
  235. this.getList(this.id)
  236. },
  237. methods: {
  238. printSmall() {
  239. window.open('../../../static/inspection.html?type=1&dataList=' +JSON.stringify(this.inspect))
  240. },
  241. printBig() {
  242. window.open('../../../static/inspection.html?type=2&dataList=' +JSON.stringify(this.inspect))
  243. },
  244. getdate() {
  245. var date = new Date()
  246. var year = date.getFullYear() //获取完整的年份(4位)
  247. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  248. var datetime = date.getDate() //获取当前日(1-31)
  249. if (mouth < 10) {
  250. mouth = '0' + mouth
  251. }
  252. if (datetime < 10) {
  253. datetime = '0' + datetime
  254. }
  255. return String(year) + String(mouth) + String(datetime)
  256. },
  257. calculation() {
  258. let number = '000' + this.count
  259. number = number.substring(number.length - 4, number.length)
  260. this.inspect.qualityNo = 'SGRK' + this.getdate() + this.cangNo + number //SGRK+8位时间+3位仓库编号+4位序列号
  261. },
  262. closeDialog() {
  263. html2canvas(this.$refs.saveImg.$el).then(canvas => {
  264. let dataURL = canvas.toDataURL('image/png');
  265. this.imgUrl = dataURL;
  266. if (this.imgUrl !== '') {
  267. let b = this.dataURLtoFile(this.imgUrl, 'printImg')
  268. let formdata = new FormData();
  269. formdata.append('file', b);
  270. axios({
  271. method: 'post',
  272. url: 'https://www.zthymaoyi.com/upload/admin',
  273. data: formdata
  274. }).then((response) => {
  275. //编辑接口
  276. this.inspect.pictureAddress = response.data.url
  277. console.log(this.types)
  278. if(this.types==3){
  279. this.inspect.flag=0
  280. }else if(this.types==4){
  281. this.inspect.flag=1
  282. }
  283. getinspectEdit(this.inspect)
  284. .toPromise()
  285. .then((response) => {
  286. this.types = ''
  287. // this.inspect = []
  288. this.isShowPrint = false
  289. this.$router.push({path:'inspectionManagement'})
  290. })
  291. })
  292. this.dialogTableVisible = true;
  293. }
  294. })
  295. },
  296. typeChange(){
  297. if(this.inspect.type == '干粮' && this.inspect.goodsName){
  298. getDryGrainPrice({warehouseId:this.cangid,goodsName:this.inspect.goodsName})
  299. .toPromise()
  300. .then((response) => {
  301. this.$set(this.inspect,'dryGrainPrice',response)
  302. })
  303. }
  304. },
  305. closePrint(){
  306. // this.inspect = []
  307. this.isShowPrint = false
  308. },
  309. print() {
  310. if (!this.inspect.qualityNo) {
  311. this.$message({
  312. message: '编号不能为空',
  313. type: 'warning',
  314. })
  315. return
  316. }
  317. if (!this.inspect.binNumber) {
  318. this.$message({
  319. message: '仓位不能为空',
  320. type: 'warning',
  321. })
  322. return
  323. }
  324. if (!this.inspect.customerName) {
  325. this.$message({
  326. message: '客户不能为空',
  327. type: 'warning',
  328. })
  329. return
  330. }
  331. if (!this.inspect.storageTagNo) {
  332. this.$message({
  333. message: '囤位号不能为空',
  334. type: 'warning',
  335. })
  336. return
  337. }
  338. if (this.inspect.storageTagNo.length > 10) {
  339. this.$message({
  340. message: '囤位号不超过10个字符',
  341. type: 'warning',
  342. })
  343. return
  344. }
  345. if (!this.inspect.carNumber) {
  346. this.$message({
  347. message: '车牌号不能为空',
  348. type: 'warning',
  349. })
  350. return
  351. }
  352. if (this.inspect.carNumber.length > 7 || this.inspect.carNumber.length != 7) {
  353. this.$message({
  354. message: '车牌号输入错误',
  355. type: 'warning',
  356. })
  357. return
  358. }
  359. if (!this.inspect.goodsName) {
  360. this.$message({
  361. message: '货名不能为空',
  362. type: 'warning',
  363. })
  364. return
  365. }
  366. if(this.inspect.paramType == '2'){
  367. if (
  368. this.inspect.buckleWeightRatio < 0 ||
  369. this.inspect.buckleWeightRatio > 2
  370. ) {
  371. this.$message({
  372. message: '扣重比输入错误',
  373. type: 'warning',
  374. })
  375. return
  376. }
  377. if (
  378. String(this.inspect.buckleWeightRatio).indexOf('.') != -1 &&
  379. String(this.inspect.buckleWeightRatio).length -
  380. (String(this.inspect.buckleWeightRatio).indexOf('.') + 1) >
  381. 2
  382. ) {
  383. this.$message({
  384. message: '扣重比输入错误',
  385. type: 'warning',
  386. })
  387. return
  388. }
  389. }
  390. if (!this.inspect.type) {
  391. this.$message({
  392. message: '类型不能为空',
  393. type: 'warning',
  394. })
  395. return
  396. }
  397. if (!this.inspect.natureOfGrainPurchase) {
  398. this.$message({
  399. message: '购粮性质不能为空',
  400. type: 'warning',
  401. })
  402. return
  403. }
  404. if(this.inspect.type == '干粮'){
  405. if(!this.inspect.dryGrainPrice){
  406. this.$message({
  407. message:'干粮价格不能为空',
  408. type:'warning'
  409. })
  410. return
  411. }
  412. if(this.inspect.dryGrainPrice < 0 || this.inspect.dryGrainPrice > 1000){
  413. this.$message({
  414. message:'干粮价格输入错误',
  415. type:'warning'
  416. })
  417. return
  418. }
  419. if (
  420. String(this.inspect.dryGrainPrice).indexOf('.') != -1 &&
  421. String(this.inspect.dryGrainPrice).length - (String(this.inspect.dryGrainPrice).indexOf('.') + 1) > 4) {
  422. this.$message({
  423. message: '干粮价格输入错误',
  424. type: 'warning',
  425. })
  426. return
  427. }
  428. }
  429. if (!this.inspect.grade) {
  430. this.$message({
  431. message: '等级不能为空',
  432. type: 'warning',
  433. })
  434. return
  435. }
  436. if (!this.inspect.impurity) {
  437. this.$message({
  438. message: '杂质不能为空',
  439. type: 'warning',
  440. })
  441. return
  442. }
  443. if (String(this.inspect.impurity).indexOf('.') != -1 && String(this.inspect.impurity).length - (String(this.inspect.impurity).indexOf('.') + 1) > 1) {
  444. this.$message({
  445. message: '杂质输入错误',
  446. type: 'warning',
  447. })
  448. return
  449. }
  450. if (this.inspect.impurity < 0 || this.inspect.impurity > 40) {
  451. this.$message({
  452. message: '杂质输入错误',
  453. type: 'warning',
  454. })
  455. return
  456. }
  457. if (!this.inspect.waterContent) {
  458. this.$message({
  459. message: '水分不能为空',
  460. type: 'warning',
  461. })
  462. return
  463. }
  464. if (this.inspect.waterContent < 0 || this.inspect.waterContent > 40) {
  465. this.$message({
  466. message: '水分输入错误',
  467. type: 'warning',
  468. })
  469. return
  470. }
  471. if (String(this.inspect.waterContent).indexOf('.') != -1 && String(this.inspect.waterContent).length - (String(this.inspect.waterContent).indexOf('.') + 1) > 1) {
  472. this.$message({
  473. message: '水分输入错误',
  474. type: 'warning',
  475. })
  476. return
  477. }
  478. if (!this.inspect.mildewGrain) {
  479. this.$message({
  480. message: '霉变粒不能为空',
  481. type: 'warning',
  482. })
  483. return
  484. }
  485. if (this.inspect.mildewGrain < 0 || this.inspect.mildewGrain > 40) {
  486. this.$message({
  487. message: '霉变粒输入错误',
  488. type: 'warning',
  489. })
  490. return
  491. }
  492. if (String(this.inspect.mildewGrain).indexOf('.') != -1 && String(this.inspect.mildewGrain).length - (String(this.inspect.mildewGrain).indexOf('.') + 1) > 1) {
  493. this.$message({
  494. message: '霉变粒输入错误',
  495. type: 'warning',
  496. })
  497. return
  498. }
  499. if (!this.inspect.bulkDensity) {
  500. this.$message({
  501. message: '容重不能为空',
  502. type: 'warning',
  503. })
  504. return
  505. }
  506. if (this.inspect.bulkDensity < 500 || this.inspect.bulkDensity > 1000) {
  507. this.$message({
  508. message: '容重输入错误',
  509. type: 'warning',
  510. })
  511. return
  512. }
  513. if (String(this.inspect.bulkDensity).indexOf('.') != -1 && String(this.inspect.bulkDensity).length - (String(this.inspect.bulkDensity).indexOf('.') + 1) > 0) {
  514. this.$message({
  515. message: '容重需输入整数',
  516. type: 'warning',
  517. })
  518. return
  519. }
  520. if (!this.inspect.jiaorenli) {
  521. this.$message({
  522. message: '热损伤不能为空',
  523. type: 'warning',
  524. })
  525. return
  526. }
  527. if (this.inspect.jiaorenli < 0 || this.inspect.jiaorenli > 40) {
  528. this.$message({
  529. message: '热损伤输入错误',
  530. type: 'warning',
  531. })
  532. return
  533. }
  534. if (String(this.inspect.jiaorenli).indexOf('.') != -1 && String(this.inspect.jiaorenli).length - (String(this.inspect.jiaorenli).indexOf('.') + 1) > 1) {
  535. this.$message({
  536. message: '热损伤输入错误',
  537. type: 'warning',
  538. })
  539. return
  540. }
  541. if (!this.inspect.imperfectGrain) {
  542. this.$message({
  543. message: '不完善粒不能为空',
  544. type: 'warning',
  545. })
  546. return
  547. }
  548. if (this.inspect.imperfectGrain < 0 || this.inspect.imperfectGrain > 40) {
  549. this.$message({
  550. message: '不完善粒输入错误',
  551. type: 'warning',
  552. })
  553. return
  554. }
  555. if (String(this.inspect.imperfectGrain).indexOf('.') != -1 && String(this.inspect.imperfectGrain).length - (String(this.inspect.imperfectGrain).indexOf('.') + 1) > 1) {
  556. this.$message({
  557. message: '不完善粒输入错误',
  558. type: 'warning',
  559. })
  560. return
  561. }
  562. this.inspect.warehouseName = this.warehouseName
  563. this.inspect.compId = sessionStorage.getItem('ws-pf_compId')
  564. if (this.types == 1) {
  565. this.inspect.qualityInspector = sessionStorage.getItem('ws-pf_staffName')
  566. this.$confirm('确定保存质检信息?', '提示', {
  567. confirmButtonText: '确定',
  568. cancelButtonText: '取消',
  569. type: 'warning',
  570. })
  571. .then(() => {
  572. if(!this.inspect.tidalGrainPrice||this.inspect.tidalGrainPrice=='NaN'){
  573. this.inspect.tidalGrainPrice = 0
  574. }
  575. inspectAdd(this.inspect)
  576. .toPromise()
  577. .then((response) => {
  578. this.$message.success('保存成功')
  579. getinspectLook({
  580. id: response
  581. })
  582. .toPromise()
  583. .then((response) => {
  584. this.inspect = response
  585. })
  586. this.isShowPrint = true
  587. //打印
  588. // this.$router.go(-1)
  589. })
  590. })
  591. .catch(() => {
  592. return false
  593. })
  594. } else if (this.types == 3) {
  595. this.inspect.qualityInspector = sessionStorage.getItem('ws-pf_staffName')
  596. this.inspect.flag=0
  597. this.$confirm('确定保存初检信息?', '提示', {
  598. confirmButtonText: '确定',
  599. cancelButtonText: '取消',
  600. type: 'warning',
  601. })
  602. .then(() => {
  603. // return
  604. getinspectEdit(this.inspect)
  605. .toPromise()
  606. .then((response) => {
  607. this.$message.success('修改成功')
  608. this.$router.push({path:'inspectionManagement'})
  609. })
  610. })
  611. .catch(() => {
  612. return false
  613. })
  614. }
  615. else if (this.types == 4) {
  616. this.inspect.flag=1
  617. this.inspect.reInspector=sessionStorage.getItem('ws-pf_roleName') + sessionStorage.getItem('ws-pf_staffName')
  618. this.$confirm('确定保存复检信息?', '提示', {
  619. confirmButtonText: '确定',
  620. cancelButtonText: '取消',
  621. type: 'warning',
  622. })
  623. .then(() => {
  624. // return
  625. getinspectEdit(this.inspect)
  626. .toPromise()
  627. .then((response) => {
  628. this.$message.success('修改成功')
  629. this.$router.push({path:'inspectionManagement'})
  630. })
  631. })
  632. .catch(() => {
  633. return false
  634. })
  635. }else if (this.types == 5) {
  636. this.inspect.flag=2
  637. // this.inspect.reInspector=sessionStorage.getItem('ws-pf_roleName') + sessionStorage.getItem('ws-pf_staffName')
  638. this.$confirm('确定保存质检信息?', '提示', {
  639. confirmButtonText: '确定',
  640. cancelButtonText: '取消',
  641. type: 'warning',
  642. })
  643. .then(() => {
  644. // return
  645. getinspectEdit(this.inspect)
  646. .toPromise()
  647. .then((response) => {
  648. this.$message.success('修改成功')
  649. getinspectLook({
  650. id: this.inspect.id
  651. })
  652. .toPromise()
  653. .then((response) => {
  654. this.inspect = response
  655. })
  656. this.isShowPrint = true
  657. })
  658. })
  659. .catch(() => {
  660. return false
  661. })
  662. }
  663. },
  664. cancel() {
  665. this.types = ''
  666. // this.inspect = []
  667. this.$router.push({
  668. path: 'inspectionManagement'
  669. })
  670. },
  671. customerChange(e) {
  672. let customers = e.split('(')
  673. this.inspect.customerName = customers[0]
  674. this.inspect.customerPhone = customers[1].split(')')[0]
  675. if(this.inspect.goodsName && this.inspect.customerName){
  676. // //查看当前用户对应货名有未结算状态的送货
  677. let count = 0
  678. getCount({
  679. compId: sessionStorage.getItem('ws-pf_compId'),
  680. customerName: this.inspect.customerName,
  681. goodsName: this.inspect.goodsName,
  682. }) .toPromise()
  683. .then((response) => {
  684. count = response
  685. })
  686. // 客户下拉校验
  687. getamount({
  688. compId: sessionStorage.getItem('ws-pf_compId'),
  689. customerName: this.inspect.customerName,
  690. goodsName: this.inspect.goodsName,
  691. })
  692. .toPromise()
  693. .then((response) => {
  694. for (let i = 0; i < this.purchasePriceList.length; i++) {
  695. if (this.inspect.goodsName == this.purchasePriceList[i].goodsName) {
  696. if ((this.purchasePriceList[i].saleLimit - response/1000 < 50 || count > 0)&&this.tipFlag) {
  697. this.tipFlag = false
  698. this.$message('当前客户已累计销售我司' +this.inspect.goodsName + (response/1000).toFixed(2) +'吨,最高可售' +this.purchasePriceList[i].saleLimit +'吨。');
  699. }
  700. }
  701. }
  702. })
  703. }
  704. },
  705. waterContentChange(type) {
  706. if (this.inspect.goodsName&&type!='water') {
  707. if(this.inspect.goodsName.indexOf('潮粮') !=-1){
  708. this.inspect.type='潮粮'
  709. }
  710. else{
  711. this.inspect.type='干粮'
  712. }
  713. if(!this.inspect.dryGrainPrice||this.inspect.dryGrainPrice == 0){
  714. getDryGrainPrice({warehouseId:this.cangid,goodsName:this.inspect.goodsName})
  715. .toPromise()
  716. .then((response) => {
  717. this.$set(this.inspect,'dryGrainPrice',response)
  718. })
  719. }
  720. for (var i = 0; i < this.purchasePriceList.length; i++) {
  721. if (this.purchasePriceList[i].goodsName == this.inspect.goodsName) {
  722. this.$set(this.inspect,'buckleWeightRatio',this.purchasePriceList[i].deductWeight)
  723. this.$set(this.inspect,'paramType',this.purchasePriceList[i].paramType)
  724. }
  725. }
  726. }
  727. //潮粮单价改变事件
  728. if (
  729. this.inspect.goodsName &&
  730. this.inspect.waterContent &&
  731. this.inspect.grade
  732. ) {
  733. getinspectLookUnitPrice({
  734. warehouseId: this.cangid,
  735. goodsName: this.inspect.goodsName,
  736. waterContent: this.inspect.waterContent,
  737. grade: this.inspect.grade,
  738. })
  739. .toPromise()
  740. .then((response) => {
  741. if(this.inspect.paramType == '1'){
  742. this.inspect.tidalGrainPrice = parseFloat(parseFloat(response) - parseFloat(this.inspect.buckleMiscellaneous)/100*parseFloat(this.inspect.dryGrainPrice)).toFixed(4)
  743. }else{
  744. this.inspect.tidalGrainPrice = response
  745. }
  746. })
  747. }
  748. if(this.inspect.goodsName && this.inspect.customerName ){
  749. // //查看当前用户对应货名有未结算状态的送货
  750. let count = 0
  751. if (
  752. this.inspect.goodsName &&
  753. this.inspect.customerName
  754. ) {
  755. getCount({
  756. compId: sessionStorage.getItem('ws-pf_compId'),
  757. customerName: this.inspect.customerName,
  758. goodsName: this.inspect.goodsName,
  759. }) .toPromise()
  760. .then((response) => {
  761. count = response
  762. })
  763. // 货名下拉校验
  764. getamount({
  765. compId: sessionStorage.getItem('ws-pf_compId'),
  766. customerName: this.inspect.customerName,
  767. goodsName: this.inspect.goodsName,
  768. })
  769. .toPromise()
  770. .then((response) => {
  771. for (let i = 0; i < this.purchasePriceList.length; i++) {
  772. if (this.inspect.goodsName == this.purchasePriceList[i].goodsName) {
  773. if ((this.purchasePriceList[i].saleLimit - response/1000 < 50 || count > 0 )&&this.tipFlag) {
  774. this.tipFlag = false
  775. this.$message('当前客户已累计销售我司' +this.inspect.goodsName + (response/1000).toFixed(2) +'吨,最高可售' +this.purchasePriceList[i].saleLimit +'吨。');
  776. }
  777. }
  778. }
  779. })
  780. }
  781. }
  782. },
  783. getList(ids) {
  784. // 货名
  785. getinspectLookGoods({
  786. warehouseId: this.cangid
  787. })
  788. .toPromise()
  789. .then((response) => {
  790. this.goodNameList = []
  791. this.goodNameList = response
  792. this.purchasePriceList = response
  793. })
  794. // 品级
  795. packList({
  796. constId: 'CON3'
  797. })
  798. .toPromise()
  799. .then((response) => {
  800. this.gradeList = response
  801. })
  802. //客户
  803. getcustomer({
  804. compId: sessionStorage.getItem('ws-pf_compId'),
  805. authenticationStatusKey:7
  806. })
  807. .toPromise()
  808. .then((response) => {
  809. this.customerList = []
  810. let customer = response
  811. for (let i = 0; i < response.length; i++) {
  812. customer =
  813. response[i].customerName + '(' + response[i].customerPhone + ')'
  814. this.customerList.push({
  815. valueKey: i,
  816. value: customer,
  817. })
  818. }
  819. })
  820. // 仓位
  821. getbinNumber({
  822. id: this.cangid
  823. })
  824. .toPromise()
  825. .then((response) => {
  826. this.getbinNumberList = []
  827. for (let i = 0; i < response.warehousePositionInfoList.length; i++) {
  828. this.getbinNumberList.push({
  829. value: response.warehousePositionInfoList[i].binNumber,
  830. })
  831. }
  832. })
  833. if (this.types !=1) {
  834. //查看
  835. getinspectLook({
  836. id: ids
  837. })
  838. .toPromise()
  839. .then((response) => {
  840. this.inspect = response
  841. })
  842. }
  843. },
  844. },
  845. }
  846. </script>
  847. <style lang="scss" scoped>
  848. /deep/.el-dialog__header {
  849. text-align: center !important;
  850. padding: 10px 0 !important;
  851. height: auto !important;
  852. }
  853. /deep/.el-dialog__title {
  854. font-size: 24px !important;
  855. }
  856. .center {
  857. background: #f6f7fc;
  858. }
  859. .ws-info-table {
  860. border: none;
  861. }
  862. .ws-info-table .el-form-item {
  863. width: 50%;
  864. border: none;
  865. }
  866. /deep/.ws-info-table .el-form-item .el-form-item__label {
  867. width: 30%;
  868. text-align: center;
  869. background: #ffffff;
  870. font-size: 14px;
  871. color: #8890b1;
  872. }
  873. /deep/.ws-info-table .el-form-item .el-form-item__content {
  874. border: none;
  875. }
  876. .title {
  877. font-size: 16px;
  878. font-weight: 600;
  879. margin: 10px;
  880. }
  881. .titleup {
  882. position: relative;
  883. }
  884. .title::before {
  885. content: '';
  886. display: inline-block;
  887. width: 5px;
  888. height: 15px;
  889. background: #8890b1;
  890. margin-right: 5px;
  891. }
  892. .substance {
  893. background: #ffffff;
  894. width: 100%;
  895. border-radius: 4px;
  896. margin: 0 auto;
  897. padding-top: 20px;
  898. }
  899. /deep/.el-table .el-table__header .cell,
  900. .el-table .el-table__body .cell {
  901. text-align: center;
  902. }
  903. /deep/.el-table--enable-row-transition .el-table__body td {
  904. text-align: center;
  905. }
  906. .bg-left {
  907. padding-left: 30px;
  908. }
  909. .bg-right {
  910. padding-right: 10px;
  911. text-align: right;
  912. }
  913. .bg-bottom {
  914. margin: 15px 0px;
  915. }
  916. .titleup {
  917. position: relative;
  918. }
  919. .titleup::before {
  920. content: '';
  921. display: inline-block;
  922. width: 5px;
  923. height: 30px;
  924. background: #5473e8;
  925. position: absolute;
  926. left: 0;
  927. }
  928. .but {
  929. text-align: center;
  930. margin: 20px auto;
  931. }
  932. </style>