procurementPlanAdd.vue 35 KB

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