procurementPlanAdd.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. // 创建采购计划
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left title">创建采购计划</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="returnsales()">
  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. />返回
  17. </el-button>
  18. </el-col>
  19. </el-row>
  20. <div class="basicInformation">
  21. <div class="center1">
  22. <div class="small-title">
  23. <h3>基本信息</h3>
  24. </div>
  25. <el-form ref="dataList" :model="dataList" label-width="140px">
  26. <ws-form-item label="标题" span="1" prop="title">
  27. <el-input v-model="dataList.title" maxlength="16" placeholder="请输入标题,不超过16个字" />
  28. </ws-form-item>
  29. <ws-form-item label="货名" span="1" prop="goodsName">
  30. <ws-select
  31. v-model="dataList.goodsName"
  32. placeholder
  33. class="typeselect"
  34. @change="selectgoodsName"
  35. >
  36. <ws-option
  37. v-for="item in goodnameList"
  38. :key="item.constKey"
  39. :label="item.constValue"
  40. :value="item.constValue"
  41. />
  42. </ws-select>
  43. </ws-form-item>
  44. <ws-form-item label="计划采购量(吨)" span="1" prop="plannedPurchaseVolume">
  45. <el-input
  46. v-model="dataList.plannedPurchaseVolume"
  47. class="typeselect"
  48. placeholder="请输入计划采购量"
  49. />
  50. </ws-form-item>
  51. <ws-form-item label="最小成交量(吨)" span="1" prop="minimumVolume">
  52. <el-input v-model="dataList.minimumVolume" placeholder="请输入最小成交量" />
  53. </ws-form-item>
  54. <ws-form-item label="类型" span="1" prop="procurementPlanType">
  55. <ws-select
  56. v-model="dataList.procurementPlanType"
  57. placeholder
  58. class="typeselect"
  59. @change="selectprocurementPlanType"
  60. >
  61. <ws-option
  62. v-for="item in procurementPlanTypeList"
  63. :key="item.constKey"
  64. :label="item.constValue"
  65. :value="item.constValue"
  66. />
  67. </ws-select>
  68. </ws-form-item>
  69. <ws-form-item label="价格类型" span="1" prop="priceType">
  70. <el-input v-model="dataList.priceType" disabled />
  71. </ws-form-item>
  72. <ws-form-item
  73. v-show="dataList.procurementPlanType=='期货'"
  74. label="基差(元/吨)"
  75. span="1"
  76. prop="basisPrice"
  77. >
  78. <el-input v-model="dataList.basisPrice" placeholder="请输入基差" />
  79. </ws-form-item>
  80. <ws-form-item
  81. v-show="dataList.procurementPlanType=='现货'"
  82. label="采购价格(元)"
  83. span="1"
  84. prop="procurementPrice"
  85. >
  86. <el-input
  87. v-model="dataList.procurementPrice"
  88. maxlength="120"
  89. size="small"
  90. placeholder="请输入采购价格"
  91. />
  92. </ws-form-item>
  93. <ws-form-item label="收货库" span="1" prop="receiveWarehouse">
  94. <ws-select
  95. v-model="dataList.receiveWarehouse"
  96. placeholder
  97. class="typeselect"
  98. @change="sendWarehousechange"
  99. >
  100. <ws-option
  101. v-for="item in warehouseList"
  102. :key="item.warehouseName"
  103. :label="item.warehouseName"
  104. :value="item.warehouseName"
  105. />
  106. </ws-select>
  107. </ws-form-item>
  108. <ws-form-item label="收货库所在地区" span="1" prop="receiveArea">
  109. <el-cascader
  110. :options="options_"
  111. v-model="selectedOptions"
  112. clearable
  113. size="large"
  114. placeholder="请选择收货库所在地区"
  115. @change="handleChange"
  116. style="width:200%"
  117. />
  118. </ws-form-item>
  119. <ws-form-item label="运费承担方" span="1" prop="freightPayer">
  120. <ws-select
  121. v-model="dataList.freightPayer"
  122. placeholder
  123. class="typeselect"
  124. @change="selectfreightPayer"
  125. >
  126. <ws-option
  127. v-for="item in freightPayerList"
  128. :key="item.constKey"
  129. :label="item.constValue"
  130. :value="item.constValue"
  131. />
  132. </ws-select>
  133. </ws-form-item>
  134. <ws-form-item label="包装方式" span="1" prop="packingType">
  135. <ws-select
  136. v-model="dataList.packingType"
  137. placeholder
  138. class="typeselect"
  139. @change="selectpackingType"
  140. >
  141. <ws-option
  142. v-for="item in packingTypeList"
  143. :key="item.constKey"
  144. :label="item.constValue"
  145. :value="item.constValue"
  146. />
  147. </ws-select>
  148. </ws-form-item>
  149. <el-form-item v-if="dataList.packingType!='散装'" label="装袋备注" span="1" prop="baggingNotes">
  150. <el-input
  151. maxlength='30'
  152. v-model="dataList.baggingNotes"
  153. size="small"
  154. placeholder="请输入装袋要求如:98斤,王中王彩袋"
  155. />
  156. </el-form-item>
  157. <ws-form-item label="买方" span="1" prop="buyer">
  158. <el-input maxlength='25' v-model="dataList.buyer" size="small" placeholder="请输入买方名称" />
  159. </ws-form-item>
  160. <el-form-item label="买方电话" span="1" prop="buyerPhone">
  161. <el-input
  162. v-model="dataList.buyerPhone"
  163. filterable
  164. type="number"
  165. :filter-method="dataFilter"
  166. placeholder="请输入买方电话"
  167. ></el-input>
  168. </el-form-item>
  169. <div class="small-title"></div>
  170. </el-form>
  171. </div>
  172. <div class="center1">
  173. <div class="small-title">
  174. <h3>货物要求</h3>
  175. </div>
  176. <el-form ref="dataList" :model="dataList" label-width="140px">
  177. <el-form-item label="水分(%)<=" span="1" prop="waterContent">
  178. <el-input v-model="dataList.waterContent" class="typeselect" placeholder="请输入水分占比" />
  179. </el-form-item>
  180. <el-form-item label="容重(g/l)<=" span="1" prop="bulkDensity">
  181. <el-input v-model="dataList.bulkDensity" class="typeselect" placeholder="请输入容重" />
  182. </el-form-item>
  183. <el-form-item label="热损伤(%)<=" span="1" prop="jiaorenli">
  184. <el-input v-model="dataList.jiaorenli" class="typeselect" placeholder="请输入热损伤占比" />
  185. </el-form-item>
  186. <el-form-item label="杂质(%)<=" span="1" prop="impurity">
  187. <el-input v-model="dataList.impurity" class="typeselect" placeholder="请输入杂质占比" />
  188. </el-form-item>
  189. <el-form-item label="霉变粒(%)<=" span="1" prop="mildewGrain">
  190. <el-input v-model="dataList.mildewGrain" placeholder="请输入霉变粒占比" />
  191. </el-form-item>
  192. <el-form-item label="不完善粒(%)<=" span="1" prop="imperfectGrain">
  193. <el-input v-model="dataList.imperfectGrain" maxlength="120" placeholder="请输入不完善粒占比" />
  194. </el-form-item>
  195. <el-form-item label="蛋白(%)<=" span="1" prop="protein">
  196. <el-input v-model="dataList.protein" class="typeselect" placeholder="请输入蛋白占比" />
  197. </el-form-item>
  198. <ws-form-item label="粒型" span="1" prop="grain">
  199. <ws-select
  200. v-model="dataList.grain"
  201. placeholder
  202. class="typeselect"
  203. @change="selectgrain"
  204. >
  205. <ws-option
  206. v-for="item in grainList"
  207. :key="item.constKey"
  208. :label="item.constValue"
  209. :value="item.constValue"
  210. />
  211. </ws-select>
  212. </ws-form-item>
  213. <ws-form-item label="品级" span="1" prop="grade">
  214. <ws-select
  215. v-model="dataList.grade"
  216. placeholder
  217. class="typeselect"
  218. @change="selectgrade"
  219. >
  220. <ws-option
  221. v-for="item in gradeList"
  222. :key="item.constKey"
  223. :label="item.constValue"
  224. :value="item.constValue"
  225. />
  226. </ws-select>
  227. </ws-form-item>
  228. <ws-form-item label="产地" span="1" prop="unitPrice">
  229. <el-cascader
  230. :options="options1_"
  231. v-model="selectedOptions1"
  232. clearable
  233. size="large"
  234. placeholder="请选择产地"
  235. @change="handleChange1"
  236. style="width:200%"
  237. />
  238. </ws-form-item>
  239. <el-form-item label="产出年份" span="1" prop="outputYear">
  240. <el-date-picker
  241. v-model="dataList.outputYear"
  242. type="year"
  243. align="right"
  244. unlink-panels
  245. value-format='yyyy'
  246. range-separator="至"
  247. placeholder="开始日期"
  248. ></el-date-picker>
  249. </el-form-item>
  250. </el-form>
  251. </div>
  252. </div>
  253. <!-- 提交 -->
  254. <div style="text-align: right; padding: 10px" class="center">
  255. <el-button class="bg-bottom" type="primary" size="small" @click="submit()">提交</el-button>
  256. </div>
  257. </div>
  258. </template>
  259. <script>
  260. import { procurementAdd } from '@/model/purchasingManagement/index'
  261. import { regionData,provinceAndCityDataPlus, CodeToText, TextToCode } from 'element-china-area-data'
  262. import { packList } from '@/model/contarct/index'
  263. import { getwarehousename } from '@/model/tasksport/index'
  264. import Pagination from '@/components/Pagination'
  265. import WsUpload from '@/components/WsUpload'
  266. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  267. import { dayjs, EventBus } from 'base-core-lib'
  268. export default {
  269. name: 'viewSpareMoney',
  270. components: {
  271. WsUpload,
  272. Pagination
  273. },
  274. watch: {
  275. // vesselId(val) {
  276. // this.getList()
  277. // },
  278. isShow(val) {
  279. this.showType = val
  280. }
  281. },
  282. computed: {
  283. },
  284. data() {
  285. return {
  286. //弹出框
  287. dialogViewSpareMoney: false,
  288. dialogApproveFormVisible: false,
  289. // 是否显示
  290. showType: true,
  291. // 年
  292. year: '',
  293. options_: regionData,
  294. options1_:provinceAndCityDataPlus,
  295. packingTypeList: '',
  296. procurementPlanTypeList: '',
  297. freightPayerList: '',
  298. searchTypeText: '',
  299. selectedOptions: [],
  300. selectedOptions1: [],
  301. contractNoList: [],
  302. deptBudgetTotal: 0,
  303. readonly: true,
  304. currentPage: 1,
  305. pageSize: 10,
  306. searchType: 1,
  307. searchKeyWord: '',
  308. radio: '1',
  309. contractType: 2,
  310. startDate: null,
  311. endDate: null,
  312. goodnameList: {},
  313. grainList: [],
  314. checked: true,
  315. form: {},
  316. pcFlag: 1,
  317. staffList: [],
  318. options: [],
  319. storageType: [],
  320. storageType1: [],
  321. outContractNo: [],
  322. // 提交类型
  323. submitType: true,
  324. status: [],
  325. unitPricechange: [],
  326. warehouseNameList: [],
  327. warehouseNameList1: [],
  328. waterContentchange: [],
  329. appendixIdsAdd: '',
  330. uploadSuccess: {},
  331. warehouseList: [],
  332. warehouseInOutDetail: {},
  333. onChange: {},
  334. deptBudgetList1: [],
  335. gradeList: [],
  336. rules: {
  337. netWeight: [
  338. {
  339. required: true,
  340. type: 'number',
  341. message: '请输入活动名称',
  342. trigger: 'blur'
  343. }
  344. ]
  345. },
  346. outputYear: [],
  347. size: 10,
  348. compId: sessionStorage.getItem('ws-pf_compId'),
  349. deptCircularPage: {},
  350. packtypeList: {},
  351. date: {
  352. year: dayjs().format('YYYY'),
  353. month: dayjs().format('MM')
  354. },
  355. contractList: [],
  356. inOutTaskNo: '',
  357. dataList: { taskTypeKey: '1',goodsName:'玉米',goodsNameKey:1,procurementPlanType:'现货',procurementPlanTypeKey:2,priceType:'定价采购',priceTypeKey:2,packingType:'散装',
  358. packingTypeKey:1 },
  359. historyList: [],
  360. pickerBeginDateBefore: {
  361. disabledDate: time => {
  362. return time.getTime() > Date.now()
  363. }
  364. },
  365. accessoryTFs: false
  366. }
  367. },
  368. activated() {
  369. this.loaddata()
  370. },
  371. mounted() {},
  372. methods: {
  373. //返回按钮
  374. revert() {
  375. this.$router.go(-1)
  376. },
  377. returnsales() {
  378. this.dataList = {}
  379. // this.selectedOptions = ''
  380. this.$router.push({ path: 'procurementPlanList' })
  381. },
  382. // 获取当前年月日
  383. getdate() {
  384. var date = new Date()
  385. var year = date.getFullYear() //获取完整的年份(4位)
  386. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  387. var datetime = date.getDate() //获取当前日(1-31)
  388. if (mouth < 10) {
  389. mouth = '0' + mouth
  390. }
  391. if (datetime < 10) {
  392. datetime = '0' + datetime
  393. }
  394. return year + mouth + datetime
  395. },
  396. // 随机验证码
  397. verifyinit() {
  398. var arr = []
  399. for (var i = 48; i < 123; i++) {
  400. if (i > 57 && i < 65) continue
  401. if (i > 90 && i < 97) continue
  402. arr.push(String.fromCharCode(i))
  403. }
  404. arr.sort(function() {
  405. return Math.random() - 0.5
  406. })
  407. arr.length = 4
  408. return arr.join('')
  409. },
  410. dataFilter(val) {
  411. // console.log(val,"名")
  412. this.deptBudgetList.staffList = val
  413. if (val) {
  414. //val存在
  415. this.options = this.staffList.filter(item => {
  416. if (
  417. !!~item.staffName.indexOf(val) ||
  418. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  419. ) {
  420. return true
  421. }
  422. })
  423. } else {
  424. //val为空时,还原数组
  425. this.options = this.staffList
  426. }
  427. },
  428. selecttaskType(e) {
  429. for (var i = 0; i < this.taskTypeList.length; i++) {
  430. if (this.taskTypeList[i].value == e) {
  431. this.searchType = this.taskTypeList[i].type
  432. }
  433. }
  434. },
  435. selectstaff(e) {
  436. for (var i = 0; i < this.staffList.length; i++) {
  437. if (this.staffList[i].staffName == e) {
  438. this.dataList.agentKey = this.staffList[i].staffId
  439. }
  440. }
  441. },
  442. selectstaff1(e) {
  443. for (var i = 0; i < this.staffList.length; i++) {
  444. if (this.staffList[i].staffName == e) {
  445. this.dataList1.agentKey = this.staffList[i].staffId
  446. }
  447. }
  448. },
  449. selectgrain(e) {
  450. for (var i = 0; i < this.grainList.length; i++) {
  451. if (this.grainList[i].constValue == e) {
  452. this.dataList.grainKey = this.grainList[i].constKey
  453. }
  454. }
  455. },
  456. selectpackingType(e) {
  457. for (var i = 0; i < this.packingTypeList.length; i++) {
  458. if (this.packingTypeList[i].constValue == e) {
  459. this.dataList.packingTypeKey = this.packingTypeList[i].constKey
  460. }
  461. }
  462. },
  463. selectfreightPayer(e) {
  464. for (var i = 0; i < this.freightPayerList.length; i++) {
  465. if (this.freightPayerList[i].constValue == e) {
  466. this.dataList.freightPayerKey = this.freightPayerList[i].constKey
  467. }
  468. }
  469. },
  470. selectgrade(e) {
  471. for (var i = 0; i < this.gradeList.length; i++) {
  472. if (this.gradeList[i].constValue == e) {
  473. this.dataList.gradeKey = this.gradeList[i].constKey
  474. }
  475. }
  476. },
  477. selectprocurementPlanType(e) {
  478. if(e=='现货'){
  479. this.dataList.priceType='定价采购'
  480. this.dataList.priceTypeKey=2
  481. }else{
  482. this.dataList.priceType='期货盘面价+基差'
  483. this.dataList.priceTypeKey=1
  484. }
  485. for (var i = 0; i < this.procurementPlanTypeList.length; i++) {
  486. if (this.procurementPlanTypeList[i].constValue == e) {
  487. this.dataList.procurementPlanTypekey = this.procurementPlanTypeList[
  488. i
  489. ].constKey
  490. }
  491. }
  492. },
  493. handleChange(value) {
  494. this.selectedOptions = value
  495. this.dataList.receivePrivate = CodeToText[value[0]]
  496. this.dataList.receiveCity = CodeToText[value[1]]
  497. this.dataList.receiveArea = CodeToText[value[2]]
  498. },
  499. handleChange1(value) {
  500. this.selectedOptions1 = value
  501. this.dataList.receivePrivate = CodeToText[value[0]]
  502. this.dataList.receiveCity = CodeToText[value[1]]
  503. this.dataList.receiveArea = CodeToText[value[2]]
  504. },
  505. sendWarehousechange(e) {
  506. for (let i = 0; i < this.warehouseList.length; i++) {
  507. if (this.warehouseList[i].warehouseName == e) {
  508. var tmp = []
  509. tmp[0] = TextToCode[this.warehouseList[i].warehousePrivate].code
  510. tmp[1] =
  511. TextToCode[this.warehouseList[i].warehousePrivate][
  512. this.warehouseList[i].warehouseCity
  513. ].code
  514. tmp[2] =
  515. TextToCode[this.warehouseList[i].warehousePrivate][
  516. this.warehouseList[i].warehouseCity
  517. ][this.warehouseList[i].warehouseArea].code
  518. this.selectedOptions = tmp
  519. }
  520. }
  521. },
  522. //关闭
  523. close() {
  524. this.$router.push({ path: 'procurementPlanList' })
  525. },
  526. loaddata() {
  527. getwarehousename({
  528. compId: this.compId,
  529. warehouseType: 1,
  530. })
  531. .toPromise()
  532. .then(response => {
  533. console.log(response)
  534. this.warehouseList = response
  535. })
  536. // 货名
  537. packList({ constId: 'CON2' })
  538. .toPromise()
  539. .then(response => {
  540. this.goodnameList = response
  541. })
  542. // 品级
  543. packList({ constId: 'CON3' })
  544. .toPromise()
  545. .then(response => {
  546. this.gradeList = response
  547. })
  548. //粒形
  549. packList({ constId: 'PRO4' })
  550. .toPromise()
  551. .then(response => {
  552. this.grainList = response
  553. })
  554. //类型
  555. packList({ constId: 'PRO1' })
  556. .toPromise()
  557. .then(response => {
  558. this.procurementPlanTypeList = response
  559. })
  560. //包装方式
  561. packList({ constId: 'PRO2' })
  562. .toPromise()
  563. .then(response => {
  564. this.packingTypeList = response
  565. })
  566. //运费承担方
  567. packList({ constId: 'PRO3' })
  568. .toPromise()
  569. .then(response => {
  570. this.freightPayerList = response
  571. })
  572. },
  573. getdate() {
  574. var date = new Date()
  575. var year = date.getFullYear() //获取完整的年份(4位)
  576. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  577. var datetime = date.getDate() //获取当前日(1-31)
  578. if (mouth < 10) {
  579. mouth = '0' + mouth
  580. }
  581. if (datetime < 10) {
  582. datetime = '0' + datetime
  583. }
  584. return year + mouth + datetime
  585. },
  586. // 随机验证码
  587. verifyinit() {
  588. var arr = []
  589. for (var i = 48; i < 123; i++) {
  590. if (i > 57 && i < 65) continue
  591. if (i > 90 && i < 97) continue
  592. arr.push(String.fromCharCode(i))
  593. }
  594. arr.sort(function () {
  595. return Math.random() - 0.5
  596. })
  597. arr.length = 4
  598. return arr.join('')
  599. },
  600. submit() {
  601. if (!this.dataList.title) {
  602. this.$message({
  603. message: '标题不能为空!',
  604. type: 'warning'
  605. })
  606. return
  607. }
  608. if (this.dataList.title.length>16) {
  609. this.$message({
  610. message: '标题输入错误!',
  611. type: 'warning'
  612. })
  613. return
  614. }
  615. if (!this.dataList.plannedPurchaseVolume) {
  616. this.$message({
  617. message: '计划采购量不能为空!',
  618. type: 'warning'
  619. })
  620. return
  621. }
  622. if (this.dataList.plannedPurchaseVolume>10000000||this.dataList.plannedPurchaseVolume<1) {
  623. this.$message({
  624. message: '计划采购量输入错误!',
  625. type: 'warning'
  626. })
  627. return
  628. }
  629. if (this.dataList.plannedPurchaseVolume.indexOf('.')!=-1) {
  630. if(this.dataList.plannedPurchaseVolume.split('.')[1].length>2){
  631. this.$message({
  632. message: '计划采购量输入错误!',
  633. type: 'warning'
  634. })
  635. return
  636. }
  637. }
  638. if (!this.dataList.minimumVolume) {
  639. this.$message({
  640. message: '最小交易量不能为空!',
  641. type: 'warning'
  642. })
  643. return
  644. }
  645. if (
  646. this.dataList.minimumVolume>10000000||this.dataList.minimumVolume<1) {
  647. this.$message({
  648. message: '最小交易量输入错误!',
  649. type: 'warning'
  650. })
  651. return
  652. }
  653. if (this.dataList.minimumVolume.indexOf('.') != -1 &&this.dataList.minimumVolume.split('.')[1].length >2) {
  654. this.$message({
  655. message: '最小交易量输入错误!',
  656. type: 'warning'
  657. })
  658. return
  659. }
  660. if (!this.dataList.buyer) {
  661. this.$message({
  662. message: '买方不能为空!',
  663. type: 'warning'
  664. })
  665. return
  666. }
  667. if (this.dataList.buyer.length>25||this.dataList.buyer.length<1) {
  668. this.$message({
  669. message: '买方输入错误!',
  670. type: 'warning'
  671. })
  672. return
  673. }
  674. if (!this.dataList.buyerPhone) {
  675. this.$message({
  676. message: '请输入买方电话!',
  677. type: 'warning'
  678. })
  679. return
  680. }
  681. if (this.dataList.buyerPhone.length!=11) {
  682. this.$message({
  683. message: '买方电话输入错误!',
  684. type: 'warning'
  685. })
  686. return
  687. }
  688. if (!this.dataList.waterContent) {
  689. this.$message({
  690. message: '水分不能为空!',
  691. type: 'warning'
  692. })
  693. return
  694. }
  695. if (this.dataList.waterContent>40||this.dataList.waterContent<1) {
  696. this.$message({
  697. message: '水分输入错误!',
  698. type: 'warning'
  699. })
  700. return
  701. }
  702. if (String(this.dataList.waterContent).indexOf('.') != -1 &&
  703. String(this.dataList.waterContent).length -
  704. (String(this.dataList.waterContent).indexOf('.') + 1) >
  705. 2) {
  706. this.$message({
  707. message: '水分输入错误',
  708. type: 'warning'
  709. })
  710. return
  711. }
  712. if (
  713. this.dataList.bulkDensity&&String(this.dataList.bulkDensity).indexOf('.') != -1 &&
  714. String(this.dataList.bulkDensity).length -
  715. (String(this.dataList.bulkDensity).indexOf('.') + 1) >
  716. 2||this.dataList.bulkDensity>1000||this.dataList.bulkDensity<500){
  717. this.$message({
  718. message: '容重输入错误',
  719. type: 'warning'
  720. })
  721. return
  722. }
  723. if (
  724. this.dataList.protein&&String(this.dataList.protein).indexOf('.') != -1 &&
  725. String(this.dataList.protein).length -
  726. (String(this.dataList.protein).indexOf('.') + 1) >
  727. 2||this.dataList.protein>40||this.dataList.protein<1){
  728. this.$message({
  729. message: '蛋白占比输入错误',
  730. type: 'warning'
  731. })
  732. return
  733. }
  734. if (
  735. this.dataList.impurity&&String(this.dataList.impurity).indexOf('.') != -1 &&
  736. String(this.dataList.impurity).length -
  737. (String(this.dataList.impurity).indexOf('.') + 1) >2) {
  738. this.$message({
  739. message: '杂质输入错误',
  740. type: 'warning'
  741. })
  742. return
  743. }
  744. if (
  745. this.dataList.mildewGrain&&String(this.dataList.mildewGrain).indexOf('.') != -1 &&
  746. String(this.dataList.mildewGrain).length -
  747. (String(this.dataList.mildewGrain).indexOf('.') + 1) >
  748. 2) {
  749. this.$message({
  750. message: '霉变粒输入错误',
  751. type: 'warning'
  752. })
  753. return
  754. }
  755. if (
  756. this.dataList.jiaorenli&&String(this.dataList.jiaorenli).indexOf('.') != -1 &&
  757. String(this.dataList.jiaorenli).length -
  758. (String(this.dataList.jiaorenli).indexOf('.') + 1) >
  759. 2) {
  760. this.$message({
  761. message: '热损伤输入错误',
  762. type: 'warning'
  763. })
  764. return
  765. }
  766. if (
  767. this.dataList.imperfectGrain&&String(this.dataList.imperfectGrain).indexOf('.') != -1 &&
  768. String(this.dataList.imperfectGrain).length -
  769. (String(this.dataList.imperfectGrain).indexOf('.') + 1) >
  770. 2) {
  771. this.$message({
  772. message: '不完整粒输入错误',
  773. type: 'warning'
  774. })
  775. return
  776. }
  777. this.dataList.id = this.$route.query.id
  778. this.$confirm(`提交后该采购信息将发布到交易平台,是否确定提交?`, {
  779. cancelButtonText: '取消',
  780. confirmButtonText: '确定',
  781. type: 'warning'
  782. })
  783. .then(() => {
  784. this.$refs.dataList.validate(valid => {
  785. if (valid) {
  786. this.dataList.procurementPlanNo='CGJH'+this.getdate()+this.verifyinit()
  787. this.dataList.sourceProvince = CodeToText[this.selectedOptions[0]]
  788. this.dataList.sourceCity = CodeToText[this.selectedOptions[1]]
  789. this.dataList.receivePrivate = CodeToText[this.selectedOptions[0]]
  790. this.dataList.receiveCity = CodeToText[this.selectedOptions[1]]
  791. this.dataList.receiveArea = CodeToText[this.selectedOptions[2]]
  792. this.dataList.outputPrivate =
  793. CodeToText[this.selectedOptions1[0]]
  794. this.dataList.outputCity = CodeToText[this.selectedOptions1[1]]
  795. this.dataList.compId = this.compId
  796. // this.dataList.contractType = 1
  797. // this.dataList.goodsType = 1
  798. this.dataList.pcFlag = 1
  799. this.dataList.compId = sessionStorage.getItem('ws-pf_compId')
  800. console.log(this.dataList,"查看添加对象")
  801. procurementAdd(this.dataList)
  802. .toPromise()
  803. .then(response => {
  804. this.$message.success('添加成功')
  805. ;(this.outputYear = ''),
  806. this.$router.push({ path: 'procurementPlanList' })
  807. })
  808. } else {
  809. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  810. return false
  811. }
  812. })
  813. })
  814. .catch(() => {
  815. return false
  816. })
  817. },
  818. selectwarehouseName() {},
  819. tarechange(e) {
  820. if (this.dataList.grossWeight && this.dataList.tare) {
  821. this.dataList.netWeight = Number(
  822. this.dataList.grossWeight - this.dataList.tare
  823. )
  824. }
  825. },
  826. grossWeightchange(e) {
  827. if (this.dataList.grossWeight && this.dataList.tare) {
  828. this.dataList.netWeight = Number(
  829. this.dataList.grossWeight - this.dataList.tare
  830. )
  831. }
  832. },
  833. selectgoodsName(e) {
  834. for (var i = 0; i < this.goodnameList.length; i++) {
  835. if (this.goodnameList[i].constValue == e) {
  836. this.dataList.goodsNameKey = this.goodnameList[i].constKey
  837. }
  838. }
  839. },
  840. selectpackingMethod(e) {
  841. for (var i = 0; i < this.packtypeList.length; i++) {
  842. if (this.packtypeList[i].constValue == e) {
  843. this.dataList.packingMethodKey = this.packtypeList[i].constKey
  844. }
  845. }
  846. },
  847. selectpackingMethod1(e) {
  848. for (var i = 0; i < this.packtypeList.length; i++) {
  849. if (this.packtypeList[i].constValue == e) {
  850. this.dataList1.packingMethodKey = this.packtypeList[i].constKey
  851. }
  852. }
  853. },
  854. selectstorageType(e) {
  855. for (var i = 0; i < this.storageType.length; i++) {
  856. if (this.storageType[i].constValue == e) {
  857. this.dataList.inOutTypeKey = this.storageType[i].constKey
  858. }
  859. }
  860. },
  861. selectstorageType1(e) {
  862. for (var i = 0; i < this.storageType1.length; i++) {
  863. if (this.storageType1[i].constValue == e) {
  864. this.dataList1.inOutTypeKey = this.storageType[i].constKey
  865. }
  866. }
  867. },
  868. handleClose() {
  869. this.accessoryTFs = false
  870. },
  871. tasktypechange() {
  872. this.tasknumber()
  873. },
  874. GetRandomNum(Min, Max) {
  875. var Range = Max - Min
  876. var Rand = Math.random()
  877. return Min + Math.round(Rand * Range)
  878. },
  879. // deletecontract(){},
  880. //删除
  881. approve() {},
  882. listQuery() {},
  883. total() {},
  884. clearfiltQuery() {},
  885. selectCrtDuty() {}
  886. }
  887. }
  888. </script>
  889. <style lang="scss" scoped>
  890. /deep/.basicInformation {
  891. .el-info-table {
  892. border: none;
  893. position: relative;
  894. }
  895. .el-form-item {
  896. width: 33.3333%;
  897. border: none;
  898. margin: 0;
  899. .el-form-item__label {
  900. text-align: left;
  901. font-size: 14px;
  902. font-family: PingFangSC-Regular, PingFang SC;
  903. font-weight: 400;
  904. color: #8890b1;
  905. }
  906. .el-form-item__content {
  907. padding-left: 0px;
  908. padding-right: 10px;
  909. // background: #fff;
  910. white-space: nowrap;
  911. height: 40px;
  912. display: flex;
  913. -webkit-box-align: center;
  914. align-items: center;
  915. text-align: left;
  916. overflow: hidden;
  917. }
  918. }
  919. }
  920. /deep/.el-radio {
  921. color: #606266;
  922. font-weight: 500;
  923. line-height: 1;
  924. cursor: pointer;
  925. white-space: nowrap;
  926. outline: 0;
  927. margin-right: 30px;
  928. margin-top: 15px;
  929. }
  930. /deep/.el-radio__inner {
  931. border: 1px solid #dcdfe6;
  932. border-radius: 100%;
  933. width: 14px;
  934. height: 14px;
  935. background-color: #fff;
  936. cursor: pointer;
  937. -webkit-box-sizing: border-box;
  938. box-sizing: border-box;
  939. margin-left: 100px;
  940. }
  941. /deep/.el-radio__input {
  942. white-space: nowrap;
  943. cursor: pointer;
  944. outline: 0;
  945. line-height: 1;
  946. vertical-align: middle;
  947. margin-top: -1px;
  948. }
  949. .title {
  950. position: relative;
  951. padding-left: 10px;
  952. }
  953. .title::before {
  954. content: '';
  955. display: inline-block;
  956. width: 5px;
  957. height: 30px;
  958. background: #5473e8;
  959. position: absolute;
  960. left: 0;
  961. }
  962. .el-form {
  963. padding: 0 15%;
  964. display: flex;
  965. flex-wrap: wrap;
  966. margin-left: -50px;
  967. margin-top: 15px;
  968. width: 110%;
  969. }
  970. .el-button--primary {
  971. background-color: #5878e8;
  972. border-color: #5878e8;
  973. }
  974. .el-col {
  975. background: #f6f7fc;
  976. }
  977. .bg-right {
  978. text-align: right;
  979. padding: 16px 20px;
  980. }
  981. .center {
  982. position: relative;
  983. top: 50px;
  984. width: 40%;
  985. margin: 0 auto;
  986. margin-right: 180px;
  987. }
  988. /deep/.el-form-item__label {
  989. width: 160px;
  990. }
  991. .inspector {
  992. width: 50%;
  993. }
  994. /deep/.el-form-item--small .el-form-item__label,
  995. .el-form-item--small .el-form-item__content {
  996. text-align: left;
  997. }
  998. /deep/.el-input--small {
  999. font-size: 13px;
  1000. position: relative;
  1001. display: inline-block;
  1002. }
  1003. .center1 .small-title {
  1004. margin-left: 323px;
  1005. }
  1006. .center1 {
  1007. width: 90%;
  1008. margin: 0 auto;
  1009. margin-left: 10px;
  1010. margin-top: 25px;
  1011. }
  1012. /deep/.el-input--small .el-input__inner {
  1013. height: 32px;
  1014. line-height: 32px;
  1015. }
  1016. /deep/.el-select {
  1017. display: inline-block;
  1018. position: relative;
  1019. width: 100%;
  1020. }
  1021. .annu {
  1022. height: 81px;
  1023. background: #ffffff;
  1024. border-radius: 4px;
  1025. }
  1026. .basicInformation .el-form-item {
  1027. width: 50.3333%;
  1028. border: none;
  1029. margin: 0;
  1030. }
  1031. .el-form {
  1032. font-size: 14px;
  1033. font-family: PingFangSC-Regular, PingFang SC;
  1034. font-weight: 400;
  1035. color: #8890b1;
  1036. line-height: 16px;
  1037. margin-left: 130px;
  1038. }
  1039. .a {
  1040. margin-left: -32px;
  1041. }
  1042. .el-radio-group {
  1043. margin-left: 80px;
  1044. }
  1045. .ding {
  1046. height: 23px;
  1047. background: #e8ecf6;
  1048. box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
  1049. }
  1050. .nav2 {
  1051. height: 25px;
  1052. background: #e8ecf6;
  1053. margin-top: 15px;
  1054. }
  1055. .ziti {
  1056. width: 72px;
  1057. height: 20px;
  1058. font-size: 14px;
  1059. font-family: PingFangSC-Regular, PingFang SC;
  1060. font-weight: 400;
  1061. color: #8890b1;
  1062. line-height: 20px;
  1063. margin-left: 314px;
  1064. /* margin-top: 112px; */
  1065. }
  1066. /deep/.ziti1 {
  1067. height: 40px;
  1068. font-size: 16px;
  1069. font-family: PingFangSC-Medium, PingFang SC;
  1070. font-weight: 500;
  1071. color: #262626;
  1072. line-height: 20px;
  1073. margin-left: 381px;
  1074. margin-top: -21px;
  1075. width: 100px;
  1076. }
  1077. .winseaview-view {
  1078. padding: 0 0 20px;
  1079. }
  1080. .container {
  1081. overflow: scroll;
  1082. height: 93vh;
  1083. }
  1084. /deep/.basicInformation .el-form-item .el-form-item__content {
  1085. padding-left: 0px;
  1086. padding-right: 10px;
  1087. white-space: nowrap;
  1088. height: 40px;
  1089. display: -webkit-box;
  1090. display: -ms-flexbox;
  1091. display: flex;
  1092. -webkit-box-align: center;
  1093. -ms-flex-align: center;
  1094. align-items: center;
  1095. text-align: left;
  1096. overflow: hidden;
  1097. font-size: 12px;
  1098. font-family: PingFangSC-Regular, PingFang SC;
  1099. font-weight: 400;
  1100. color: #232323;
  1101. line-height: 14px;
  1102. }
  1103. .nav {
  1104. width: 400px;
  1105. height: 20px;
  1106. }
  1107. .readonly :after {
  1108. content: '*';
  1109. color: #ff2727;
  1110. position: absolute;
  1111. right: 8px;
  1112. z-index: 10;
  1113. top: 21%;
  1114. font-size: 20px;
  1115. }
  1116. /deep/.typeselect .el-input__inner {
  1117. color: #8890b1;
  1118. }
  1119. </style>