purchaseContractAdd.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424
  1. <template>
  2. <div class="container">
  3. <el-row>
  4. <el-col :span="12">
  5. <h2 class="bg-left title">创建采购合同</h2>
  6. </el-col>
  7. <el-col :span="12" class="bg-right">
  8. <el-button
  9. class="bg-bottom"
  10. type="primary"
  11. size="small"
  12. @click="returnsales()"
  13. ><img
  14. width="6"
  15. height="10"
  16. style="vertical-align: bottom; margin-right: 3px"
  17. src="../../../public/img/lujing.png"
  18. alt=""
  19. />返回</el-button
  20. >
  21. </el-col>
  22. </el-row>
  23. <ws-form
  24. ref="deptBudgetList"
  25. :rules="mainReportAdd"
  26. :model="deptBudgetList"
  27. >
  28. <div class="remark">
  29. <h3>基本信息</h3>
  30. <p style="color: #8890b1">
  31. 注:基本信息和货物信息均为必填项,“*” 标记的条目提交后不可修改。
  32. </p>
  33. </div>
  34. <ws-info-table>
  35. <!--合同编号-->
  36. <ws-form-item
  37. label="合同编号"
  38. span="1"
  39. prop="contractNo"
  40. class="readonly"
  41. >
  42. <ws-input
  43. v-model="deptBudgetList.contractNo"
  44. placeholder="请输入合同编号"
  45. maxlength="20"
  46. size="small"
  47. :rules="ruleDeptBudget"
  48. />
  49. </ws-form-item>
  50. <!--运输方式-->
  51. <ws-form-item label="运输方式" span="1" prop="shippingType">
  52. <ws-input
  53. v-model="deptBudgetList.shippingType"
  54. placeholder="请输入运输方式"
  55. maxlength="100"
  56. size="small"
  57. />
  58. </ws-form-item>
  59. <!--买方-->
  60. <ws-form-item label="买方" span="1" prop="buyer" class="readonly">
  61. <ws-input
  62. v-model="deptBudgetList.buyer"
  63. placeholder="请输入买方名称"
  64. maxlength="100"
  65. size="small"
  66. />
  67. </ws-form-item>
  68. <!--结算方式-->
  69. <ws-form-item label="结算方式" span="1" prop="settlementMethod">
  70. <ws-input
  71. v-model="deptBudgetList.settlementMethod"
  72. placeholder="请输入结算方式"
  73. maxlength="100"
  74. size="small"
  75. />
  76. </ws-form-item>
  77. <!--卖方-->
  78. <ws-form-item label="卖方" span="1" prop="seller" class="readonly">
  79. <ws-input
  80. v-model="deptBudgetList.seller"
  81. placeholder="请输入卖方名称"
  82. maxlength="100"
  83. size="small"
  84. />
  85. </ws-form-item>
  86. <!--货源地-->
  87. <ws-form-item label="货源地" span="1" prop="sourceGoods">
  88. <ws-input
  89. v-model="deptBudgetList.sourceGoods"
  90. placeholder="请输入货源地"
  91. maxlength="100"
  92. size="small"
  93. />
  94. </ws-form-item>
  95. <!--买方电话-->
  96. <ws-form-item label="买方电话" span="1" prop="contractNo">
  97. <ws-input
  98. v-model.number="deptBudgetList.buyerPhone"
  99. maxlength="100"
  100. size="small"
  101. />
  102. </ws-form-item>
  103. <!--交货地-->
  104. <ws-form-item label="交货地" span="1" prop="placeDelivery">
  105. <ws-input
  106. v-model="deptBudgetList.placeDelivery"
  107. placeholder="请输入交货地"
  108. maxlength="100"
  109. size="small"
  110. />
  111. </ws-form-item>
  112. <!--卖方电话-->
  113. <ws-form-item label="卖方电话" span="1" prop="sellerPhone">
  114. <ws-input
  115. v-model="deptBudgetList.sellerPhone"
  116. placeholder="请输入卖方电话"
  117. maxlength="100"
  118. size="small"
  119. />
  120. </ws-form-item>
  121. <!--包装方式-->
  122. <ws-form-item label="包装方式" span="1" prop="packingMethod">
  123. <ws-select
  124. v-model="deptBudgetList.packingMethod"
  125. placeholder=""
  126. class="typeselect"
  127. :value="value1"
  128. @change="selectpackingMethod"
  129. >
  130. <ws-option
  131. v-for="item in packtypeList"
  132. :key="item.constKey"
  133. :label="item.constValue"
  134. :value="item.constValue"
  135. />
  136. </ws-select>
  137. </ws-form-item>
  138. <!--重量(吨)-->
  139. <ws-form-item label="重量(吨)" span="1" prop="weight">
  140. <ws-input
  141. v-model="deptBudgetList.weight"
  142. placeholder="请输入重量(吨)"
  143. maxlength="100"
  144. size="small"
  145. />
  146. </ws-form-item>
  147. <!--验收方式-->
  148. <ws-form-item label="验收方式" span="1" prop="acceptanceMethod">
  149. <el-select
  150. v-model="deptBudgetList.acceptanceMethod"
  151. placeholder="请选择验收方式"
  152. style="width: 100%"
  153. filterable
  154. @change="selectunitList"
  155. >
  156. <el-option
  157. v-for="(item, index) in unitList"
  158. :key="item.constValue"
  159. :label="item.constValue"
  160. :value="item.constValue"
  161. >
  162. <span class="unit-left" style="float: left">
  163. <span v-if="item.flag == 'delete'"> {{ item.constValue }}</span>
  164. <!-- 新增文本框 -->
  165. <div
  166. style="width: 160px"
  167. v-if="item.flag !== 'delete'"
  168. @click.stop
  169. >
  170. <ws-input
  171. v-model="item.constValue"
  172. clearable
  173. maxlength="10"
  174. style="width: 100%"
  175. ></ws-input>
  176. </div>
  177. </span>
  178. <span style="float: right; color: #8492a6; font-size: 13px">
  179. <!-- 对号 -->
  180. <i
  181. class="el-icon-check"
  182. style="line-height: 29px; margin-left: 10px"
  183. v-if="item.flag !== 'delete'"
  184. @click.stop="saveClick(item, index)"
  185. ></i>
  186. <!-- 编辑 -->
  187. <i
  188. class="el-icon-edit"
  189. style="line-height: 29px; margin-left: 10px"
  190. v-if="item.flag == 'delete'"
  191. @click.stop="editClick(item, index)"
  192. ></i>
  193. <!-- 删除 -->
  194. <i
  195. class="el-icon-delete"
  196. style="line-height: 29px"
  197. @click.stop="deleteClick(item, index)"
  198. ></i>
  199. </span>
  200. </el-option>
  201. <!-- 新增按钮 -->
  202. <el-option value="" label="">
  203. <div
  204. style="
  205. text-align: right;
  206. border-top: 1px solid #dcdfe6;
  207. padding: 5px;
  208. "
  209. >
  210. <ws-button type="primary" @click.stop="addClick">{{
  211. $t('button.add')
  212. }}</ws-button>
  213. </div>
  214. </el-option>
  215. </el-select>
  216. </ws-form-item>
  217. <!--溢短装(%)-->
  218. <ws-form-item label="溢短装(%)" span="1" prop="overShort">
  219. <ws-input
  220. v-model="deptBudgetList.overShort"
  221. placeholder="请输入溢短装比例(%)"
  222. maxlength="100"
  223. size="small"
  224. />
  225. </ws-form-item>
  226. <!--交货日期(起)-->
  227. <ws-form-item label="交货日期(起)" span="1" prop="deliveryDateStart">
  228. <ws-date-picker
  229. :picker-options="pickerBeginDateBefore"
  230. v-model="deptBudgetList.deliveryDateStart"
  231. type="date"
  232. default-value="1980-01-01"
  233. placeholder="请选择交货日期(起)"
  234. format="yyyy-MM-dd"
  235. value-format="yyyy-MM-dd"
  236. />
  237. </ws-form-item>
  238. <!--合同单价(元/吨)-->
  239. <ws-form-item
  240. class="readonly"
  241. label="合同单价(元/吨)"
  242. span="1"
  243. prop="unitContractPrice"
  244. >
  245. <ws-input
  246. v-model="deptBudgetList.unitContractPrice"
  247. placeholder="请输入合同单价"
  248. maxlength="100"
  249. size="small"
  250. />
  251. </ws-form-item>
  252. <!--交货日期(止)-->
  253. <ws-form-item label="交货日期(止)" span="1" prop="deliveryDateEnd">
  254. <ws-date-picker
  255. :picker-options="pickerBeginDateBefore"
  256. v-model="deptBudgetList.deliveryDateEnd"
  257. type="date"
  258. default-value="1980-01-01"
  259. placeholder="请选择交货日期(起)"
  260. format="yyyy-MM-dd"
  261. value-format="yyyy-MM-dd"
  262. />
  263. </ws-form-item>
  264. <!--合同总价-->
  265. <ws-form-item label="合同总价" span="1" prop="totalContractPrice">
  266. <ws-input
  267. v-model="deptBudgetList.totalContractPrice"
  268. placeholder="请输入合同总价"
  269. maxlength="100"
  270. size="small"
  271. />
  272. </ws-form-item>
  273. <!--签订日期-->
  274. <ws-form-item label="签订日期" span="1" prop="signingDate">
  275. <ws-date-picker
  276. :picker-options="pickerBeginDateBefore"
  277. v-model="deptBudgetList.signingDate"
  278. type="date"
  279. default-value="1980-01-01"
  280. placeholder="请选择合同签订日期"
  281. format="yyyy-MM-dd"
  282. value-format="yyyy-MM-dd"
  283. />
  284. </ws-form-item>
  285. </ws-info-table>
  286. </ws-form>
  287. <div class="wenzi">
  288. <h3>货物信息</h3>
  289. </div>
  290. <ws-form
  291. ref="deptBudgetList"
  292. :rules="ruleDeptBudget"
  293. :model="deptBudgetList"
  294. >
  295. <!--货物信息-->
  296. <ws-info-table>
  297. <!--货名-->
  298. <ws-form-item label="货名" span="1" prop="goodsName" class="readonly">
  299. <ws-select
  300. v-model="deptBudgetList.contractGoodsInfo.goodsName"
  301. placeholder=""
  302. class="typeselect"
  303. @change="selectgoodsName"
  304. >
  305. <ws-option
  306. v-for="item in goodnameList"
  307. :key="item.constKey"
  308. :label="item.constValue"
  309. :value="item.constValue"
  310. />
  311. </ws-select>
  312. </ws-form-item>
  313. <!--水分(%)<=-->
  314. <ws-form-item label="水分(%)" span="1" prop="waterContent">
  315. <ws-input
  316. v-model="deptBudgetList.contractGoodsInfo.waterContent"
  317. placeholder="请输入水分占比"
  318. maxlength="100"
  319. size="small"
  320. />
  321. </ws-form-item>
  322. <!--品级-->
  323. <ws-form-item label="品级" span="1" prop="grade">
  324. <ws-select
  325. v-model="deptBudgetList.contractGoodsInfo.grade"
  326. placeholder=""
  327. class="typeselect"
  328. @change="selectgrade"
  329. >
  330. <ws-option
  331. v-for="item in gradeList"
  332. :key="item.constKey"
  333. :label="item.constValue"
  334. :value="item.constValue"
  335. />
  336. </ws-select>
  337. </ws-form-item>
  338. <!--杂质(%)<=-->
  339. <ws-form-item label="杂质(%)" span="1" prop="impurity">
  340. <ws-input
  341. v-model="deptBudgetList.contractGoodsInfo.impurity"
  342. placeholder="请输入杂质占比(%)"
  343. maxlength="100"
  344. size="small"
  345. />
  346. </ws-form-item>
  347. <!--容量(克/升)>=-->
  348. <ws-form-item label="容量(克/升)" span="1" prop="bulkDensity">
  349. <ws-input
  350. v-model="deptBudgetList.contractGoodsInfo.bulkDensity"
  351. placeholder="请输入容重"
  352. maxlength="100"
  353. size="small"
  354. />
  355. </ws-form-item>
  356. <!--霉变粒(%)<=-->
  357. <ws-form-item label="霉变粒(%)" span="1" prop="mildewGrain">
  358. <ws-input
  359. v-model="deptBudgetList.contractGoodsInfo.mildewGrain"
  360. placeholder="请输入霉变粒占比(%)"
  361. maxlength="100"
  362. size="small"
  363. />
  364. </ws-form-item>
  365. <!--热损伤(%)<=-->
  366. <ws-form-item label="热损伤(%)" span="1" prop="jiaorenli">
  367. <ws-input
  368. v-model="deptBudgetList.contractGoodsInfo.jiaorenli"
  369. placeholder="请输入输入热损伤占比(%)"
  370. maxlength="100"
  371. size="small"
  372. />
  373. </ws-form-item>
  374. <!--不完整粒(%)<=-->
  375. <ws-form-item label="不完整粒(%)" span="1" prop="imperfectGrain">
  376. <ws-input
  377. v-model="deptBudgetList.contractGoodsInfo.imperfectGrain"
  378. placeholder="请输入不完整粒占比(%)"
  379. maxlength="100"
  380. size="small"
  381. />
  382. </ws-form-item>
  383. </ws-info-table>
  384. </ws-form>
  385. <div class="wenzi">
  386. <h3>流程信息</h3>
  387. </div>
  388. <ws-form
  389. ref="deptBudgetList"
  390. :rules="ruleDeptBudget"
  391. :model="deptBudgetList"
  392. >
  393. <!--流程信息-->
  394. <ws-info-table>
  395. <!--合同收入(元)-->
  396. <ws-form-item label="合同收入(元)" span="1" prop="goodsNameKey">
  397. <ws-input
  398. v-model="deptBudgetList.contractProcessInfo.goodsNameKey"
  399. placeholder="请输入合同收入(元)"
  400. maxlength="100"
  401. size="small"
  402. />
  403. </ws-form-item>
  404. <!--已开发票(元)-->
  405. <ws-form-item label="已开发票(元)" span="1" prop="goodsName">
  406. <ws-input
  407. v-model="deptBudgetList.contractProcessInfo.goodsName"
  408. placeholder="请输入已开发票(元)"
  409. maxlength="100"
  410. size="small"
  411. />
  412. </ws-form-item>
  413. <!--费用支出(元)-->
  414. <ws-form-item label="费用支出(元)" span="1" prop="waterContent">
  415. <ws-input
  416. v-model="deptBudgetList.contractProcessInfo.waterContent"
  417. placeholder="请输入费用支出(元)"
  418. maxlength="100"
  419. size="small"
  420. />
  421. </ws-form-item>
  422. <!--未开发票(元)-->
  423. <ws-form-item label="未开发票(元)" span="1" prop="impurity">
  424. <ws-input
  425. v-model="deptBudgetList.contractProcessInfo.impurity"
  426. placeholder="请输入未开发票(元)"
  427. maxlength="100"
  428. size="small"
  429. />
  430. </ws-form-item>
  431. <!--已完成发货量(吨)-->
  432. <ws-form-item label="已完成发货量(吨)" span="1" prop="imperfectGrain">
  433. <ws-input
  434. v-model="deptBudgetList.contractProcessInfo.imperfectGrain"
  435. placeholder="请输入已完成发货量(吨)"
  436. maxlength="100"
  437. size="small"
  438. />
  439. </ws-form-item>
  440. <!--双章原件回收情况-->
  441. <ws-form-item label="双章原件回收情况" span="1" prop="grade">
  442. <ws-select
  443. v-model="deptBudgetList.contractProcessInfo.grade"
  444. placeholder=""
  445. class="typeselect"
  446. @change="selectChapterTwo"
  447. >
  448. <ws-option
  449. v-for="item in ChapterTwoList"
  450. :key="item.constKey"
  451. :label="item.constValue"
  452. :value="item.constValue"
  453. />
  454. </ws-select>
  455. </ws-form-item>
  456. </ws-info-table>
  457. </ws-form>
  458. <div class="wenzi">
  459. <h3>备注信息</h3>
  460. </div>
  461. <ws-form
  462. ref="deptBudgetList"
  463. :rules="ruleDeptBudget"
  464. :model="deptBudgetList"
  465. >
  466. <!--备注信息-->
  467. <ws-input
  468. v-model="deptBudgetList.remarks"
  469. type="textarea"
  470. row="3"
  471. placeholder="请输入备注信息,不超过200字"
  472. maxlength="200"
  473. />
  474. <ws-upload
  475. ref="upload"
  476. table-name="maintain_work_order"
  477. oss-key="mainPlan"
  478. :comp-id="compId"
  479. :appendix-ids="appendixIdsAdd"
  480. :vesselId="deptBudgetList.addressUrl"
  481. :size-limit="size"
  482. @uploadSuccess="uploadSuccess"
  483. @onChange="onChange"
  484. accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  485. />
  486. </ws-form>
  487. <div style="text-align: right; padding: 10px" class="center">
  488. <el-button
  489. class="bg-bottom"
  490. type="primary"
  491. size="small"
  492. @click="submit(deptBudgetList)"
  493. >提交</el-button
  494. >
  495. </div>
  496. </div>
  497. </template>
  498. <script>
  499. // import { getVesselOne } from '@/model/procurement/basic'
  500. // import { dayjs } from 'base-core-lib'
  501. import {
  502. packList,
  503. addList,
  504. xiala,
  505. addxiala,
  506. editxiala,
  507. delxiala,
  508. } from '@/model/contarct/index'
  509. import WsUpload from '@/components/WsUpload'
  510. export default {
  511. name: 'viewSpareMoney',
  512. components: {
  513. WsUpload,
  514. },
  515. watch: {
  516. vesselId(val) {
  517. this.getVesselData()
  518. },
  519. isShow(val) {
  520. this.showType = val
  521. },
  522. },
  523. data() {
  524. return {
  525. //弹出框
  526. dialogViewSpareMoney: false,
  527. dialogApproveFormVisible: false,
  528. // 船舶类型
  529. monetaryKey: null,
  530. // 表格显示数据
  531. tableDate: [],
  532. // 是否显示
  533. showType: true,
  534. // 年
  535. year: '',
  536. // 提交类型
  537. submitType: true,
  538. tableData: [{ date: 1111, name: 'qqqq', address: 'errrtt' }],
  539. packtypeList: [],
  540. compId: sessionStorage.getItem('ws-pf_compId'),
  541. mainReportAdd: {},
  542. appendixIdsAdd: '',
  543. size: 10,
  544. // uploadSuccess: {},
  545. // onChange:{},
  546. unitList: [],
  547. goodnameList: [],
  548. value1: '袋装',
  549. value2: '未回收',
  550. gradeList: [],
  551. ChapterTwoList: [],
  552. deptBudgetList: {
  553. contractGoodsInfo: {
  554. goodsName: '',
  555. },
  556. contractProcessInfo: {},
  557. },
  558. pickerBeginDateBefore: {
  559. disabledDate: (time) => {
  560. return time.getTime() > Date.now()
  561. },
  562. },
  563. // selectpackingMethod: {},
  564. // selectgrade: {},
  565. // selectunitList: {},
  566. // selectDuty: {},
  567. // isEdited: false,
  568. // registered: {},
  569. // selectCrtDuty: {},
  570. // dutyList: {},
  571. // sexList: {},
  572. ruleDeptBudget: {
  573. contractNo: [
  574. { required: true, message: '请输入活动名称', trigger: 'blur' },
  575. {
  576. min: 6,
  577. max: 20,
  578. message: '长度在 6 到 20 个字符',
  579. trigger: 'blur',
  580. },
  581. ],
  582. },
  583. selectIntendedShip: {},
  584. interviewTypeList: {},
  585. }
  586. },
  587. activated() {
  588. //cg.viewBudget
  589. //cg.viewSpareMoney
  590. // this.getVesselData();
  591. this.deptBudgetList.packingMethod = '袋装'
  592. this.deptBudgetList.packingMethodKey = 2
  593. this.deptBudgetList.contractGoodsInfo.goodsName = '玉米'
  594. this.deptBudgetList.contractGoodsInfo.goodsNameKey = 1
  595. this.deptBudgetList.contractProcessInfo.grade = '未回收'
  596. this.deptBudgetList.contractProcessInfo.gradeKey = 1
  597. this.loaddata()
  598. this.showType = this.isShow
  599. },
  600. methods: {
  601. // 关闭 dialog时 处理文件url 初始化upload组件
  602. handleClose() {
  603. this.dialogViewSpareMoney = false
  604. },
  605. returnsales() {
  606. this.$router.push({ path: 'purchaseContract' })
  607. },
  608. loaddata() {
  609. // 包装方式
  610. packList({ constId: 'CON1' })
  611. .toPromise()
  612. .then((response) => {
  613. this.packtypeList = response
  614. })
  615. // 验收方式
  616. this.getUnitList()
  617. // 货名
  618. packList({ constId: 'CON2' })
  619. .toPromise()
  620. .then((response) => {
  621. this.goodnameList = response
  622. })
  623. // 品级
  624. packList({ constId: 'CON3' })
  625. .toPromise()
  626. .then((response) => {
  627. this.gradeList = response
  628. })
  629. // 双章
  630. packList({ constId: 'CON4' })
  631. .toPromise()
  632. .then((response) => {
  633. this.ChapterTwoList = response
  634. })
  635. },
  636. // 上传附件
  637. uploadSuccess(data, files, url) {
  638. console.log(data, files, url)
  639. // this.deptBudgetList.
  640. // this.formData.append('files', files)
  641. // this.feedbackObj.uploadNameAttachment = data.appendixName
  642. // this.feedbackObj.pathUploadAttachment = data.appendixPath
  643. // // this.newAppendixs = files
  644. // this.onChangeFlag = true
  645. },
  646. onChange(files) {
  647. this.fileNum = files
  648. this.$refs.upload.handleSaveBill().then((res) => {
  649. console.log(files)
  650. })
  651. },
  652. getUnitList() {
  653. xiala({
  654. compId: sessionStorage.getItem('ws-pf_compId'),
  655. constCode: 'TYPEYAN',
  656. })
  657. .toPromise()
  658. .then((response) => {
  659. this.unitList = response
  660. let currItem
  661. this.unitList.forEach((item, index, arr) => {
  662. item.flag = 'delete'
  663. if (this.vModel == item.constKey) {
  664. currItem = item
  665. }
  666. })
  667. //
  668. if (currItem) {
  669. this.selectContract(currItem.constValue)
  670. }
  671. })
  672. },
  673. submit() {
  674. if (!this.deptBudgetList.contractNo) {
  675. this.$message({
  676. message: '请输入合同编号',
  677. type: 'warning',
  678. })
  679. return
  680. }
  681. console.log(this.deptBudgetList.contractNo.length)
  682. if (
  683. this.deptBudgetList.contractNo.length < 6 ||
  684. this.deptBudgetList.contractNo.length > 20
  685. ) {
  686. this.$message({
  687. message: '合同编号长度不符合要求,请输入6到20个字符之内!',
  688. type: 'warning',
  689. })
  690. return
  691. }
  692. if (!this.deptBudgetList.shippingType) {
  693. this.$message({
  694. message: '请输入运输方式!',
  695. type: 'warning',
  696. })
  697. return
  698. }
  699. if (
  700. this.deptBudgetList.shippingType.length < 1 ||
  701. this.deptBudgetList.shippingType.length > 20
  702. ) {
  703. this.$message({
  704. message: '运输方式长度不符合要求,请输入1到20个字符之内!',
  705. type: 'warning',
  706. })
  707. return
  708. }
  709. if (!this.deptBudgetList.buyer) {
  710. this.$message({
  711. message: '请输入买方名称!',
  712. type: 'warning',
  713. })
  714. return
  715. }
  716. if (
  717. this.deptBudgetList.buyer.length < 4 ||
  718. this.deptBudgetList.buyer.length > 30
  719. ) {
  720. this.$message({
  721. message: '买方名称长度不符合要求,请输入4到30个字符之内!',
  722. type: 'warning',
  723. })
  724. return
  725. }
  726. if (!this.deptBudgetList.seller) {
  727. this.$message({
  728. message: '请输入卖方名称!',
  729. type: 'warning',
  730. })
  731. return
  732. }
  733. if (
  734. this.deptBudgetList.seller.length < 4 ||
  735. this.deptBudgetList.seller.length > 30
  736. ) {
  737. this.$message({
  738. message: '卖方名称长度不符合要求,请输入4到30个字符之内!',
  739. type: 'warning',
  740. })
  741. return
  742. }
  743. if (!this.deptBudgetList.buyerPhone) {
  744. this.$message({
  745. message: '请输入买方电话!',
  746. type: 'warning',
  747. })
  748. return
  749. }
  750. if (isNaN(this.deptBudgetList.buyerPhone)) {
  751. this.$message({
  752. message: '输入买方电话有误!',
  753. type: 'warning',
  754. })
  755. return
  756. }
  757. if (
  758. this.deptBudgetList.buyerPhone.length < 7 ||
  759. this.deptBudgetList.buyerPhone.length > 20
  760. ) {
  761. this.$message({
  762. message: '买方电话长度不符合要求,请输入7到20个字符之内!',
  763. type: 'warning',
  764. })
  765. return
  766. }
  767. if (!this.deptBudgetList.sellerPhone) {
  768. this.$message({
  769. message: '请输入卖方电话!',
  770. type: 'warning',
  771. })
  772. return
  773. }
  774. if (isNaN(this.deptBudgetList.sellerPhone)) {
  775. this.$message({
  776. message: '输入卖方电话有误!',
  777. type: 'warning',
  778. })
  779. return
  780. }
  781. if (
  782. this.deptBudgetList.buyerPhone.length < 7 ||
  783. this.deptBudgetList.buyerPhone.length > 20
  784. ) {
  785. this.$message({
  786. message: '卖方电话长度不符合要求,请输入7到20个字符之内!',
  787. type: 'warning',
  788. })
  789. return
  790. }
  791. if (!this.deptBudgetList.settlementMethod) {
  792. this.$message({
  793. message: '请输入结算方式!',
  794. type: 'warning',
  795. })
  796. return
  797. }
  798. if (!this.deptBudgetList.sourceGoods) {
  799. this.$message({
  800. message: '请输入货源地!',
  801. type: 'warning',
  802. })
  803. return
  804. }
  805. if (!this.deptBudgetList.placeDelivery) {
  806. this.$message({
  807. message: '请输入交货地!',
  808. type: 'warning',
  809. })
  810. return
  811. }
  812. if (!this.deptBudgetList.weight) {
  813. this.$message({
  814. message: '请输入重量!',
  815. type: 'warning',
  816. })
  817. return
  818. }
  819. if (
  820. isNaN(this.deptBudgetList.weight) ||
  821. /\.\d{3}$/.test(this.deptBudgetList.weight) == false ||
  822. this.deptBudgetList.weight < 0 ||
  823. this.deptBudgetList.weight > 200000
  824. ) {
  825. this.$message({
  826. message: '输入重量有误!',
  827. type: 'warning',
  828. })
  829. return
  830. }
  831. if (
  832. !this.deptBudgetList.overShort &&
  833. isNaN(this.deptBudgetList.overShort)
  834. ) {
  835. this.$message({
  836. message: '溢短装输入有误!',
  837. type: 'warning',
  838. })
  839. return
  840. }
  841. if (
  842. !this.deptBudgetList.unitContractPrice &&
  843. isNaN(this.deptBudgetList.unitContractPrice)
  844. ) {
  845. this.$message({
  846. message: '合同单价输入有误!',
  847. type: 'warning',
  848. })
  849. return
  850. }
  851. if (
  852. !this.deptBudgetList.totalContractPrice &&
  853. isNaN(this.deptBudgetList.totalContractPrice)
  854. ) {
  855. this.$message({
  856. message: '合同总价输入有误!',
  857. type: 'warning',
  858. })
  859. return
  860. }
  861. if (!this.deptBudgetList.deliveryDateStart) {
  862. this.$message({
  863. message: '请选择交货日期(起)',
  864. type: 'warning',
  865. })
  866. return
  867. }
  868. if (!this.deptBudgetList.deliveryDateEnd) {
  869. this.$message({
  870. message: '请选择交货日期(止)',
  871. type: 'warning',
  872. })
  873. return
  874. }
  875. //时间
  876. if (
  877. new Date(this.deptBudgetList.deliveryDateStart).getTime() >
  878. new Date(this.deptBudgetList.deliveryDateEnd).getTime()
  879. ) {
  880. this.$message({
  881. message: '交货日期(止)选择错误',
  882. type: 'warning',
  883. })
  884. return
  885. }
  886. if (!this.deptBudgetList.signingDate) {
  887. this.$message({
  888. message: '请选择签订日期',
  889. type: 'warning',
  890. })
  891. return
  892. }
  893. if (!this.deptBudgetList.contractGoodsInfo.goodsName) {
  894. this.$message({
  895. message: '请选择货名',
  896. type: 'warning',
  897. })
  898. return
  899. }
  900. if (!this.deptBudgetList.contractGoodsInfo.waterContent) {
  901. this.$message({
  902. message: '请选择水分',
  903. type: 'warning',
  904. })
  905. return
  906. }
  907. if (!this.deptBudgetList.contractGoodsInfo.grade) {
  908. this.$message({
  909. message: '请选择品级',
  910. type: 'warning',
  911. })
  912. return
  913. }
  914. if (
  915. !this.deptBudgetList.contractGoodsInfo.impurity ||
  916. /\.\d{2}$/.test(this.deptBudgetList.contractGoodsInfo.impurity)
  917. ) {
  918. this.$message({
  919. message: '杂质输入错误',
  920. type: 'warning',
  921. })
  922. return
  923. }
  924. if (
  925. !this.deptBudgetList.contractGoodsInfo.bulkDensity ||
  926. /\.\d{2}$/.test(this.deptBudgetList.contractGoodsInfo.bulkDensity)
  927. ) {
  928. this.$message({
  929. message: '容重输入错误',
  930. type: 'warning',
  931. })
  932. return
  933. }
  934. if (
  935. !this.deptBudgetList.contractGoodsInfo.mildewGrain ||
  936. /\.\d{2}$/.test(this.deptBudgetList.contractGoodsInfo.mildewGrain)
  937. ) {
  938. this.$message({
  939. message: '霉变粒输入错误',
  940. type: 'warning',
  941. })
  942. return
  943. }
  944. if (
  945. !this.deptBudgetList.contractGoodsInfo.jiaorenli ||
  946. /\.\d{2}$/.test(this.deptBudgetList.contractGoodsInfo.jiaorenli)
  947. ) {
  948. this.$message({
  949. message: '热损伤输入错误',
  950. type: 'warning',
  951. })
  952. return
  953. }
  954. if (
  955. !this.deptBudgetList.contractGoodsInfo.imperfectGrain ||
  956. /\.\d{2}$/.test(this.deptBudgetList.contractGoodsInfo.imperfectGrain)
  957. ) {
  958. this.$message({
  959. message: '不完整粒输入错误',
  960. type: 'warning',
  961. })
  962. return
  963. }
  964. if (
  965. (!this.deptBudgetList.contractProcessInfo.goodsNameKey > 1000000000) |
  966. (this.deptBudgetList.contractProcessInfo.goodsNameKey < 0) ||
  967. /\.\d{2}$/.test(this.deptBudgetList.contractProcessInfo.goodsNameKey) ==
  968. false
  969. ) {
  970. this.$message({
  971. message: '合同收入金额输入错误',
  972. type: 'warning',
  973. })
  974. return
  975. }
  976. if (
  977. (!this.deptBudgetList.contractProcessInfo.waterContent > 10000000) |
  978. (this.deptBudgetList.contractProcessInfo.waterContent < 0) ||
  979. /\.\d{2}$/.test(this.deptBudgetList.contractProcessInfo.waterContent) ==
  980. false
  981. ) {
  982. this.$message({
  983. message: '费用金额输入错误',
  984. type: 'warning',
  985. })
  986. return
  987. }
  988. if (
  989. (!this.deptBudgetList.contractProcessInfo.mildewGrain > 1000000000) |
  990. (this.deptBudgetList.contractProcessInfo.mildewGrain < 0) ||
  991. /\.\d{2}$/.test(this.deptBudgetList.contractProcessInfo.mildewGrain) ==
  992. false
  993. ) {
  994. this.$message({
  995. message: '未回款金额输入错误',
  996. type: 'warning',
  997. })
  998. return
  999. }
  1000. if (
  1001. (!this.deptBudgetList.contractProcessInfo.goodsName > 1000000000) |
  1002. (this.deptBudgetList.contractProcessInfo.goodsName < 0) ||
  1003. /\.\d{2}$/.test(this.deptBudgetList.contractProcessInfo.goodsName) ==
  1004. false
  1005. ) {
  1006. this.$message({
  1007. message: '已开发票金额输入错误',
  1008. type: 'warning',
  1009. })
  1010. return
  1011. }
  1012. if (
  1013. (!this.deptBudgetList.contractProcessInfo.impurity > 1000000000) |
  1014. (this.deptBudgetList.contractProcessInfo.impurity < 0) ||
  1015. /\.\d{2}$/.test(this.deptBudgetList.contractProcessInfo.impurity) ==
  1016. false
  1017. ) {
  1018. this.$message({
  1019. message: '未开发票金额输入错误',
  1020. type: 'warning',
  1021. })
  1022. return
  1023. }
  1024. if (
  1025. (!this.deptBudgetList.contractProcessInfo.imperfectGrain > 200000) |
  1026. (this.deptBudgetList.contractProcessInfo.imperfectGrain < 0) ||
  1027. /\.\d{3}$/.test(
  1028. this.deptBudgetList.contractProcessInfo.imperfectGrain
  1029. ) == false
  1030. ) {
  1031. this.$message({
  1032. message: '已完成发运量输入错误',
  1033. type: 'warning',
  1034. })
  1035. return
  1036. }
  1037. this.$refs.deptBudgetList.validate((valid) => {
  1038. if (valid) {
  1039. this.deptBudgetList.compId = this.compId
  1040. this.deptBudgetList.contractType = 2
  1041. addList(this.deptBudgetList)
  1042. .toPromise()
  1043. .then((response) => {
  1044. this.$message.success('添加成功')
  1045. this.$router.push({ path: 'salesContract' })
  1046. })
  1047. } else {
  1048. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1049. return false
  1050. }
  1051. })
  1052. },
  1053. resetForm(deptBudgetList) {
  1054. this.$refs[deptBudgetList].resetFields()
  1055. },
  1056. saveClick(item, index) {
  1057. console.log(item)
  1058. if (Object.is(item.id, 1)) {
  1059. return
  1060. }
  1061. if (Object.is(this.unitList[index].flag, 'delete')) {
  1062. this.$set(this.unitList, index, { flag: 'check' })
  1063. } else {
  1064. this.$set(this.unitList, index, { flag: 'delete' })
  1065. }
  1066. if (!item.constValue) {
  1067. this.unitList.splice(index, 1)
  1068. return
  1069. }
  1070. if (item.flag == 'add') {
  1071. item.constKey = Math.random() * 20
  1072. this.trainingMethods.compId = sessionStorage.getItem('ws-pf_compId')
  1073. this.trainingMethods.constKey = item.constKey
  1074. this.trainingMethods.constCode = 'TYPEYAN'
  1075. this.trainingMethods.constValue = item.constValue
  1076. this.trainingMethods.id = item.id
  1077. addxiala(this.trainingMethods)
  1078. .toPromise()
  1079. .then((response) => {
  1080. this.getUnitList()
  1081. })
  1082. } else if (item.flag == 'check') {
  1083. this.trainingMethods.compId = sessionStorage.getItem('ws-pf_compId')
  1084. this.trainingMethods.constKey = item.constKey
  1085. this.trainingMethods.constCode = 'TYPEYAN'
  1086. this.trainingMethods.constValue = item.constValue
  1087. this.trainingMethods.id = item.id
  1088. editxiala(this.trainingMethods)
  1089. .toPromise()
  1090. .then((response) => {
  1091. this.getUnitList()
  1092. })
  1093. }
  1094. },
  1095. // selectContract(val) {
  1096. // let key = this.unitList.find((item) => item.constValue === val).constKey
  1097. // this.pleaseChoose = val
  1098. // },
  1099. handleExamine() {},
  1100. approve() {},
  1101. // returnsales() {
  1102. // this.$router.push({ path: 'purchaseContract' })
  1103. // },
  1104. selectChapterTwo(e) {
  1105. for (var i = 0; i < this.ChapterTwoList.length; i++) {
  1106. if (this.ChapterTwoList[i].constValue == e) {
  1107. this.deptBudgetList.gradeKey = this.ChapterTwoList[i].constKey
  1108. }
  1109. }
  1110. },
  1111. selectunitList(e) {
  1112. for (var i = 0; i < this.unitList.length; i++) {
  1113. if (this.unitList[i].constValue == e) {
  1114. this.deptBudgetList.acceptanceMethodKey = this.unitList[i].constKey
  1115. }
  1116. }
  1117. },
  1118. selectgrade(e) {
  1119. for (var i = 0; i < this.gradeList.length; i++) {
  1120. if (this.gradeList[i].constValue == e) {
  1121. this.deptBudgetList.gradeKey = this.gradeList[i].constKey
  1122. }
  1123. }
  1124. },
  1125. selectgoodsName(e) {
  1126. for (var i = 0; i < this.goodnameList.length; i++) {
  1127. if (this.goodnameList[i].constValue == e) {
  1128. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  1129. }
  1130. }
  1131. },
  1132. selectpackingMethod(e) {
  1133. for (var i = 0; i < this.packtypeList.length; i++) {
  1134. if (this.packtypeList[i].constValue == e) {
  1135. this.deptBudgetList.packingMethodKey = this.packtypeList[i].constKey
  1136. }
  1137. }
  1138. },
  1139. // 编辑
  1140. editClick(item, index) {
  1141. const map = JSON.parse(JSON.stringify(item))
  1142. if (Object.is(item.id, 1)) {
  1143. return
  1144. }
  1145. if (Object.is(this.unitList[index].flag, 'delete')) {
  1146. map.flag = 'check'
  1147. this.$set(this.unitList, index, map)
  1148. } else {
  1149. map.flag = 'delete'
  1150. this.$set(this.unitList, index, map)
  1151. }
  1152. },
  1153. // 删除
  1154. deleteClick(item, index) {
  1155. if (Object.is(item.constKey, 1)) {
  1156. return
  1157. }
  1158. if (!item.constValue) {
  1159. this.unitList.splice(index, 1)
  1160. return
  1161. }
  1162. delxiala({ id: this.unitList[index].id })
  1163. .toPromise()
  1164. .then((response) => {
  1165. this.getUnitList()
  1166. this.pleaseChoose = ''
  1167. })
  1168. },
  1169. },
  1170. }
  1171. </script>
  1172. <style lang="scss" scoped>
  1173. .el-form {
  1174. padding: 0 15%;
  1175. }
  1176. /deep/.ws-info-table .el-form-item {
  1177. border-right: 1px solid #cdd2dc;
  1178. border-bottom: 1px solid #cdd2dc;
  1179. }
  1180. .readonly {
  1181. position: relative;
  1182. }
  1183. .readonly:after {
  1184. content: '*';
  1185. color: #ff2727;
  1186. position: absolute;
  1187. right: 8px;
  1188. z-index: 10;
  1189. top: 21%;
  1190. font-size: 20px;
  1191. }
  1192. .title {
  1193. position: relative;
  1194. }
  1195. .title::before {
  1196. content: '';
  1197. display: inline-block;
  1198. width: 5px;
  1199. height: 30px;
  1200. background: #5473e8;
  1201. position: absolute;
  1202. left: 0;
  1203. }
  1204. .el-button--primary {
  1205. background-color: #5878e8;
  1206. border-color: #5878e8;
  1207. }
  1208. .el-col {
  1209. background: #f6f7fc;
  1210. }
  1211. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1212. padding: 0 25px;
  1213. border-left: 1px solid #cdd2dc;
  1214. background: #fafbfc;
  1215. }
  1216. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1217. width: 140px;
  1218. text-align: center;
  1219. background: #f0f2f6;
  1220. // border: 1px solid #cdd2dc;
  1221. }
  1222. .button-container {
  1223. display: flex;
  1224. flex-wrap: nowrap;
  1225. justify-content: space-between;
  1226. align-items: center;
  1227. background-color: #fff;
  1228. width: 100%;
  1229. height: 50px;
  1230. padding: 0 10px;
  1231. & > div {
  1232. margin-left: 10px;
  1233. display: flex;
  1234. flex-wrap: nowrap;
  1235. flex-direction: row;
  1236. & > span {
  1237. line-height: 50px;
  1238. }
  1239. }
  1240. /deep/.auditFlow-box {
  1241. position: unset;
  1242. margin-left: 10px;
  1243. &/deep/.auditFlow-icon {
  1244. width: auto;
  1245. padding-right: 30px;
  1246. }
  1247. &/deep/.auditFlow-main {
  1248. position: absolute;
  1249. }
  1250. }
  1251. }
  1252. .box-app {
  1253. display: inline-block;
  1254. float: left;
  1255. margin-left: 30px;
  1256. line-height: 50px;
  1257. }
  1258. /deep/.el-dialog {
  1259. .el-form-item {
  1260. margin-bottom: 0 !important;
  1261. .el-input--medium {
  1262. textarea {
  1263. min-height: 100px !important;
  1264. }
  1265. }
  1266. }
  1267. }
  1268. .collapse-bottom {
  1269. margin-bottom: 20px;
  1270. }
  1271. .input-main .textarea .el-textarea__inner {
  1272. width: 100%;
  1273. z-index: 1;
  1274. }
  1275. .bg-left {
  1276. padding-left: 30px;
  1277. }
  1278. .bg-right {
  1279. padding-right: 10px;
  1280. text-align: right;
  1281. }
  1282. .bg-bottom {
  1283. margin: 15px 0px;
  1284. }
  1285. .wenzi {
  1286. width: 900px;
  1287. margin: 0 auto;
  1288. }
  1289. .wenzi h3 {
  1290. display: inline-block;
  1291. left: 10px;
  1292. }
  1293. .wenzi p {
  1294. display: inline-block;
  1295. }
  1296. .center {
  1297. width: 900px;
  1298. margin: 0 auto;
  1299. }
  1300. .el-form-item {
  1301. width: 50%;
  1302. }
  1303. .el-form-item__label {
  1304. text-align: center;
  1305. }
  1306. .ce {
  1307. width: 900px;
  1308. margin: 0 auto;
  1309. }
  1310. /*.crt-main .textarea /deep/ .el-form-item__label {*/
  1311. /* height: 82px;*/
  1312. /*}*/
  1313. // 控制select为只读的时候显示样式
  1314. .hide-sel {
  1315. .el-input__inner {
  1316. border: 0px;
  1317. }
  1318. .el-icon-arrow-up {
  1319. display: none;
  1320. }
  1321. .el-textarea__inner {
  1322. background-color: #fff !important;
  1323. border: 0;
  1324. }
  1325. .el-date-editor {
  1326. i {
  1327. display: none;
  1328. }
  1329. }
  1330. .is-disabled {
  1331. .el-input__inner:hover {
  1332. background-color: #fff !important;
  1333. border: 0;
  1334. }
  1335. color: #606266;
  1336. .el-input__inner {
  1337. background-color: #fff !important;
  1338. border: 0;
  1339. color: #606266;
  1340. }
  1341. .el-textarea__inner {
  1342. background-color: #fff !important;
  1343. border: 0;
  1344. color: #606266;
  1345. }
  1346. }
  1347. }
  1348. // 控制select为只读的时候显示样式
  1349. /deep/.ws-class-table-col {
  1350. height: auto;
  1351. padding: 0px 2px;
  1352. /deep/.el-input__inner {
  1353. padding: 0px 2px;
  1354. }
  1355. }
  1356. /deep/.is-disabled {
  1357. .el-input__prefix,
  1358. .el-input__suffix {
  1359. display: none;
  1360. }
  1361. .el-input__inner {
  1362. background-color: #fff;
  1363. border-color: #fff !important;
  1364. color: #000 !important;
  1365. font-size: 14px;
  1366. cursor: text;
  1367. padding: 0 !important;
  1368. }
  1369. }
  1370. .winseaview-view {
  1371. padding: 0 0 20px;
  1372. }
  1373. .container {
  1374. overflow: scroll;
  1375. height: 93vh;
  1376. }
  1377. /deep/.ws-info-table[data-v-850a44a6] .el-form-item .el-form-item__label {
  1378. width: 130px;
  1379. }
  1380. </style>