purchaseContractAdd.vue 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817
  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 class="bg-bottom" type="primary" size="small" @click="returnsales()"><img width="6" height="10"
  9. style="vertical-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  10. </el-button>
  11. </el-col>
  12. </el-row>
  13. <ws-form ref="deptBudgetList" :rules="rules" :model="deptBudgetList">
  14. <div class="remark">
  15. <h3>基本信息</h3>
  16. <p style="color: #8890b1">
  17. 注:基本信息和货物信息均为必填项,“*” 标记的条目提交后不可修改。
  18. </p>
  19. </div>
  20. <ws-info-table>
  21. <!--合同类型-->
  22. <!-- <ws-form-item
  23. label="合同类型"
  24. span="1"
  25. prop="agreementType"
  26. >
  27. <ws-select
  28. v-model="deptBudgetList.agreementType"
  29. placeholder
  30. class="deal"
  31. @change="selectType"
  32. >
  33. <ws-option
  34. v-for="item in agreementList"
  35. :key="item.constKey"
  36. :label="item.constValue"
  37. :value="item.constValue"
  38. />
  39. </ws-select>
  40. </ws-form-item> -->
  41. <ws-form-item label="合同类型" span="1" prop="agreementType" class="readonly">
  42. <el-radio v-model="deptBudgetList.agreementType" label="采购合同">采购合同</el-radio>
  43. <el-radio v-model="deptBudgetList.agreementType" label="补充协议">补充协议</el-radio>
  44. </ws-form-item>
  45. <!--合同编号-->
  46. <ws-form-item label="合同编号" span="1" v-show="deptBudgetList.agreementType == '采购合同'" prop="contractNo"
  47. class="readonly" required>
  48. <ws-input v-model="deptBudgetList.contractNo" placeholder="请输入合同编号" maxlength="50" size="small" />
  49. </ws-form-item>
  50. <!--关联合同-->
  51. <ws-form-item prop="contractNo" label="关联合同" span="1" v-show="deptBudgetList.agreementType =='补充协议'">
  52. <ws-select v-model="deptBudgetList.contractNo" placeholder="请选择编号" @change="selectRelation">
  53. <ws-option v-for="item in contractNoList" :key="item.constKey" :label="item.contractNo"
  54. :value="item.contractNo"></ws-option>
  55. </ws-select>
  56. </ws-form-item>
  57. <!--补充协议编号-->
  58. <ws-form-item v-show="deptBudgetList.agreementType == '补充协议'" label="补充协议编号" span="1" prop="agreementNo">
  59. <ws-input v-model="deptBudgetList.agreementNo" placeholder="请输入补充协议编号" maxlength="100" size="small" />
  60. </ws-form-item>
  61. <!--运输方式-->
  62. <ws-form-item label="运输方式" span="1" prop="shippingType">
  63. <ws-input v-model="deptBudgetList.shippingType" placeholder="请输入运输方式" maxlength="100" size="small" />
  64. </ws-form-item>
  65. <!--买方-->
  66. <ws-form-item label="买方" span="1" prop="buyer" class="readonly">
  67. <!-- <ws-input v-model="deptBudgetList.buyer" placeholder="请输入买方名称" maxlength="100" size="small" /> -->
  68. <el-autocomplete class="inline-input" v-model="deptBudgetList.buyer" :fetch-suggestions="querySearch1"
  69. placeholder="请输入买方名称" @select="handleSelect"></el-autocomplete>
  70. </ws-form-item>
  71. <!--结算方式-->
  72. <ws-form-item label="结算方式" span="1" prop="settlementMethod">
  73. <ws-input v-model="deptBudgetList.settlementMethod" placeholder="请输入结算方式" maxlength="100" size="small" />
  74. </ws-form-item>
  75. <!--卖方-->
  76. <ws-form-item label="卖方" span="1" prop="seller" class="readonly">
  77. <!-- <ws-input v-model="deptBudgetList.seller" placeholder="请输入卖方名称" maxlength="100" size="small" /> -->
  78. <el-autocomplete class="inline-input" v-model="deptBudgetList.seller" :fetch-suggestions="querySearch2"
  79. placeholder="请输入卖方名称" @select="handleSelect"></el-autocomplete>
  80. </ws-form-item>
  81. <ws-form-item label="交货方式" span="1" prop="seller" class="readonly">
  82. <el-radio v-model="deptBudgetList.deliverType" label="1">我方自提</el-radio>
  83. <el-radio v-model="deptBudgetList.deliverType" label="2">对方送货</el-radio>
  84. </ws-form-item>
  85. <!--买方电话-->
  86. <ws-form-item label="买方电话" span="1" prop="contractNo">
  87. <!-- <ws-input v-model.number="deptBudgetList.buyerPhone" placeholder="请输入买方电话" maxlength="100" size="small" /> -->
  88. <el-autocomplete class="inline-input" v-model="deptBudgetList.buyerPhone" :fetch-suggestions="querySearch3"
  89. placeholder="请输入买方电话" @select="handleSelect"></el-autocomplete>
  90. </ws-form-item>
  91. <!--包装方式-->
  92. <ws-form-item label="包装方式" span="1" prop="packingMethod">
  93. <ws-select v-model="deptBudgetList.packingMethod" placeholder="" class="typeselect" :value="value1"
  94. @change="selectpackingMethod">
  95. <ws-option v-for="item in packtypeList" :key="item.constKey" :label="item.constValue"
  96. :value="item.constValue" />
  97. </ws-select>
  98. </ws-form-item>
  99. <!--卖方电话-->
  100. <ws-form-item label="卖方电话" span="1" prop="sellerPhone">
  101. <!-- <ws-input v-model="deptBudgetList.sellerPhone" placeholder="请输入卖方电话" maxlength="100" size="small" /> -->
  102. <el-autocomplete class="inline-input" v-model="deptBudgetList.sellerPhone" :fetch-suggestions="querySearch4"
  103. placeholder="请输入卖方电话" @select="handleSelect"></el-autocomplete>
  104. </ws-form-item>
  105. <!--验收方式-->
  106. <ws-form-item label="验收方式" span="1" prop="acceptanceMethod">
  107. <el-select v-model="deptBudgetList.acceptanceMethod" placeholder="请选择验收方式" style="width: 100%" filterable
  108. @change="selectunitList">
  109. <el-option v-for="(item, index) in unitList" :key="item.constValue" :label="item.constValue"
  110. :value="item.constValue">
  111. <span class="unit-left" style="float: left">
  112. <span v-if="item.flag == 'delete'"> {{ item.constValue }}</span>
  113. <!-- 新增文本框 -->
  114. <div style="width: 160px" v-if="item.flag !== 'delete'" @click.stop>
  115. <ws-input v-model="item.constValue" clearable maxlength="10" style="width: 100%"></ws-input>
  116. </div>
  117. </span>
  118. <span style="float: right; color: #8492a6; font-size: 13px">
  119. <!-- 对号 -->
  120. <i class="el-icon-check" style="line-height: 29px; margin-left: 10px" v-if="item.flag !== 'delete'"
  121. @click.stop="saveClick(item, index)"></i>
  122. <!-- 编辑 -->
  123. <i class="el-icon-edit" style="line-height: 29px; margin-left: 10px" v-if="item.flag == 'delete'"
  124. @click.stop="editClick(item, index)"></i>
  125. <!-- 删除 -->
  126. <i class="el-icon-delete" style="line-height: 29px" @click.stop="deleteClick(item, index)"></i>
  127. </span>
  128. </el-option>
  129. <!-- 新增按钮 -->
  130. <el-option value="" label="">
  131. <div style="
  132. text-align: right;
  133. border-top: 1px solid #dcdfe6;
  134. padding: 5px;
  135. ">
  136. <ws-button type="primary" @click.stop="addClick">{{
  137. $t('button.add')
  138. }}</ws-button>
  139. </div>
  140. </el-option>
  141. </el-select>
  142. </ws-form-item>
  143. <!--重量(吨)-->
  144. <ws-form-item label="重量(吨)" span="1" prop="weight">
  145. <ws-input @input="weightchange" v-model="deptBudgetList.weight" placeholder="请输入重量(吨)" maxlength="100"
  146. size="small" />
  147. </ws-form-item>
  148. <!--交货日期(起)-->
  149. <ws-form-item label="交货日期(起)" span="1" prop="deliveryDateStart">
  150. <ws-date-picker v-model="deptBudgetList.deliveryDateStart" type="date" placeholder="请选择交货日期(起)"
  151. value-format="yyyy-MM-dd" />
  152. </ws-form-item>
  153. <!--溢短装(%)-->
  154. <ws-form-item label="溢短装(%)" span="1" prop="overShort">
  155. <ws-input v-model="deptBudgetList.overShort" placeholder="请输入溢短装比例(%)" maxlength="100" size="small" />
  156. </ws-form-item>
  157. <!--交货日期(止)-->
  158. <ws-form-item label="交货日期(止)" span="1" prop="deliveryDateEnd">
  159. <ws-date-picker v-model="deptBudgetList.deliveryDateEnd" type="date" placeholder="请选择交货日期(止)"
  160. value-format="yyyy-MM-dd" />
  161. </ws-form-item>
  162. <!--合同单价(元/吨)-->
  163. <ws-form-item class="readonly" label="合同单价(元/吨)" span="1" prop="unitContractPrice">
  164. <ws-input @input="pricechange" v-model="deptBudgetList.unitContractPrice" placeholder="请输入合同单价"
  165. maxlength="100" size="small" />
  166. </ws-form-item>
  167. <!--合同总价-->
  168. <ws-form-item label="合同总价" span="1" prop="totalContractPrice">
  169. <ws-input v-model="deptBudgetList.totalContractPrice" placeholder="请输入合同总价" maxlength="100" size="small" />
  170. </ws-form-item>
  171. <ws-form-item label="货源所在地区" span="1" prop="sourceGoods">
  172. <!-- <el-cascader
  173. :options="options_"
  174. v-model="selectedOptions"
  175. clearable
  176. size="large"
  177. placeholder="请选择货源所在地区"
  178. style="width: 200%"
  179. @change="handleChange"
  180. /> -->
  181. <el-button @click="mapInputClick('source')" class='address-btn'>
  182. {{newSelectedOptions}}
  183. </el-button>
  184. </ws-form-item>
  185. <ws-form-item label="货源详细地址" span="1" prop="sourceGoods">
  186. <ws-input v-model="deptBudgetList.sourceGoods" placeholder="请输入货源详细地址" maxlength="20" size="small" />
  187. </ws-form-item>
  188. <ws-form-item label="交货所在地区" span="1" prop="sourceGoods">
  189. <!-- <el-cascader
  190. :options="options_"
  191. v-model="selectedOptions1"
  192. clearable
  193. size="large"
  194. placeholder="请选择交货所在地区"
  195. style="width: 200%"
  196. @change="handleChange1"
  197. /> -->
  198. <el-button @click="mapInputClick('deliveryProv')" class='address-btn'>
  199. {{newSelectedOptions1}}
  200. </el-button>
  201. </ws-form-item>
  202. <ws-form-item label="交货详细地址" span="1" prop="placeDelivery">
  203. <ws-input v-model="deptBudgetList.placeDelivery" placeholder="请输入交货详细地址" maxlength="20" size="small" />
  204. </ws-form-item>
  205. <!--签订日期-->
  206. <ws-form-item label="签订日期" span="1" prop="signingDate">
  207. <ws-date-picker v-model="deptBudgetList.signingDate" type="date" placeholder="请选择合同签订日期"
  208. value-format="yyyy-MM-dd" />
  209. </ws-form-item>
  210. <ws-form-item label="最终实际成交量(吨)" span="1" prop="finalTradingVolume">
  211. <ws-input v-model="deptBudgetList.finalTradingVolume" placeholder="请输入最终实际成交量" maxlength="100" size="small" />
  212. </ws-form-item>
  213. <ws-form-item v-show="deptBudgetList.deliverType == 1" label="临时仓库负责人" span="1" prop="packingMethod">
  214. <el-select v-model="deptBudgetList.personCharge" placeholder="请选择临时仓库负责人" filterable
  215. :filter-method="dataFilter" @change="selectstaff">
  216. <el-option v-for="item in options" :key="item.value" :label="item.staffName" :value="item.staffName" />
  217. </el-select>
  218. </ws-form-item>
  219. </ws-info-table>
  220. <div class="wenzi">
  221. <h3>货物信息</h3>
  222. </div>
  223. <!--货物信息-->
  224. <ws-info-table>
  225. <!--货名-->
  226. <ws-form-item label="货名" span="1" prop="goodsName" class="readonly">
  227. <ws-select v-model="deptBudgetList.contractGoodsInfo.goodsName" placeholder="" class="typeselect"
  228. @change="selectgoodsName">
  229. <ws-option v-for="item in goodnameList" :key="item.constKey" :label="item.constValue"
  230. :value="item.constValue" />
  231. </ws-select>
  232. </ws-form-item>
  233. <!--水分(%)<=-->
  234. <ws-form-item label="水分(%)<=" span="1" prop="waterContent">
  235. <ws-input v-model="deptBudgetList.contractGoodsInfo.waterContent" placeholder="请输入水分占比" maxlength="100"
  236. size="small" />
  237. </ws-form-item>
  238. <!--品级-->
  239. <ws-form-item label="品级" span="1" prop="grade">
  240. <ws-select v-model="deptBudgetList.contractGoodsInfo.grade" placeholder="" class="typeselect"
  241. @change="selectgrade">
  242. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  243. :value="item.constValue" />
  244. </ws-select>
  245. </ws-form-item>
  246. <!--杂质(%)<=-->
  247. <ws-form-item label="杂质(%)<=" span="1" prop="impurity">
  248. <ws-input v-model="deptBudgetList.contractGoodsInfo.impurity" placeholder="请输入杂质占比(%)" maxlength="100"
  249. size="small" />
  250. </ws-form-item>
  251. <!--容重(克/升)>=-->
  252. <ws-form-item label="容重(克/升)>=" span="1" prop="bulkDensity">
  253. <ws-input v-model="deptBudgetList.contractGoodsInfo.bulkDensity" placeholder="请输入容重" maxlength="100"
  254. size="small" />
  255. </ws-form-item>
  256. <!--霉变粒(%)<=-->
  257. <ws-form-item label="霉变粒(%)<=" span="1" prop="mildewGrain">
  258. <ws-input v-model="deptBudgetList.contractGoodsInfo.mildewGrain" placeholder="请输入霉变粒占比(%)" maxlength="100"
  259. size="small" />
  260. </ws-form-item>
  261. <!--热损伤(%)<=-->
  262. <ws-form-item label="热损伤(%)<=" span="1" prop="jiaorenli">
  263. <ws-input v-model="deptBudgetList.contractGoodsInfo.jiaorenli" placeholder="请输入输入热损伤占比(%)" maxlength="100"
  264. size="small" />
  265. </ws-form-item>
  266. <!--不完善粒(%)<=-->
  267. <ws-form-item label="不完善粒(%)<=" span="1" prop="imperfectGrain">
  268. <ws-input v-model="deptBudgetList.contractGoodsInfo.imperfectGrain" placeholder="请输入不完善粒占比(%)" maxlength="100"
  269. size="small" />
  270. </ws-form-item>
  271. </ws-info-table>
  272. <div class="wenzi">
  273. <h3>流程信息</h3>
  274. </div>
  275. <!--流程信息-->
  276. <ws-info-table>
  277. <!--已付款(元)-->
  278. <ws-form-item label="已付款(元)" span="1" prop="mildewGrain">
  279. <ws-input v-model="deptBudgetList.contractProcessInfo.mildewGrain" placeholder="请输入已付款(元)" maxlength="100"
  280. size="small" />
  281. </ws-form-item>
  282. <!--已开发票(元)-->
  283. <ws-form-item label="已开发票(元)" span="1" prop="goodsName">
  284. <ws-input v-model="deptBudgetList.contractProcessInfo.goodsName" placeholder="请输入已开发票(元)" maxlength="100"
  285. size="small" />
  286. </ws-form-item>
  287. <!--费用支出(元)-->
  288. <ws-form-item label="费用支出(元)" span="1" prop="waterContent">
  289. <ws-input v-model="deptBudgetList.contractProcessInfo.waterContent" placeholder="请输入费用支出(元)" maxlength="100"
  290. size="small" />
  291. </ws-form-item>
  292. <!--未开发票(元)-->
  293. <ws-form-item label="未开发票(元)" span="1" prop="impurity">
  294. <ws-input v-model="deptBudgetList.contractProcessInfo.impurity" placeholder="请输入未开发票(元)" maxlength="100"
  295. size="small" />
  296. </ws-form-item>
  297. <!--双章原件回收情况-->
  298. <ws-form-item label="双章原件回收情况" span="1" prop="grade">
  299. <ws-select v-model="deptBudgetList.contractProcessInfo.grade" placeholder="" class="typeselect"
  300. @change="selectChapterTwo">
  301. <ws-option v-for="item in ChapterTwoList" :key="item.constKey" :label="item.constValue"
  302. :value="item.constValue" />
  303. </ws-select>
  304. </ws-form-item>
  305. <!--已完成发货量(吨)-->
  306. <ws-form-item label="已完成发货量(吨)" span="1" prop="imperfectGrain">
  307. <ws-input v-model="deptBudgetList.contractProcessInfo.imperfectGrain" placeholder="请输入已完成发货量(吨)"
  308. maxlength="100" size="small" />
  309. </ws-form-item>
  310. </ws-info-table>
  311. <div class="wenzi">
  312. <h3>备注信息</h3>
  313. </div>
  314. <!--备注信息-->
  315. <ws-input v-model="deptBudgetList.remarks" type="textarea" row="3" placeholder="请输入备注信息,不超过3000字"
  316. maxlength="3000" />
  317. <ws-upload ref="upload" :comp-id="compId" :appendix-ids="deptBudgetList.addressUrl" :size-limit="size"
  318. @onChange="onChange" accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar" />
  319. </ws-form>
  320. <div v-if="dialogVisible" class="map">
  321. <map-drag @marker="marker" :isShowaddress='true' v-on:addressListen='getAddress' :type="type"></map-drag>
  322. </div>
  323. <div style="text-align: right; padding: 10px" class="center">
  324. <el-button class="bg-bottom" type="primary" size="small" @click="submit(deptBudgetList)">提交</el-button>
  325. </div>
  326. </div>
  327. </template>
  328. <script>
  329. import {
  330. packList,
  331. addList,
  332. xiala,
  333. addxiala,
  334. editxiala,
  335. delxiala,
  336. getstafffind,
  337. getRelationContractNo
  338. } from '@/model/contarct/index'
  339. import {
  340. regionData,
  341. CodeToText,
  342. TextToCode
  343. } from 'element-china-area-data'
  344. import {
  345. dayjs,
  346. fmoney,
  347. EventBus
  348. } from 'base-core-lib'
  349. import WsUpload from '@/components/WsUpload'
  350. import mapDrag from '@/components/mapdrag/mapdrag'
  351. export default {
  352. name: 'viewSpareMoney',
  353. components: {
  354. WsUpload,
  355. mapDrag,
  356. },
  357. watch: {
  358. vesselId(val) {
  359. this.getVesselData()
  360. },
  361. isShow(val) {
  362. this.showType = val
  363. },
  364. },
  365. data() {
  366. return {
  367. restaurants1: [],
  368. restaurants2: [],
  369. restaurants3: [],
  370. restaurants4: [],
  371. type: "",
  372. dialogVisible: false,
  373. //弹出框
  374. dialogViewSpareMoney: false,
  375. dialogApproveFormVisible: false,
  376. // 船舶类型
  377. monetaryKey: null,
  378. // 表格显示数据
  379. tableDate: [],
  380. // 是否显示
  381. showType: true,
  382. // 年
  383. year: '',
  384. options_: regionData,
  385. selectedOptions: [],
  386. newSelectedOptions: '请选择货源所在地',
  387. selectedOptions1: [],
  388. newSelectedOptions1: '请选择交货所在地区',
  389. // 提交类型
  390. submitType: true,
  391. tableData: [{
  392. date: ,
  393. name: '',
  394. address: ''
  395. }],
  396. packtypeList: [],
  397. compId: sessionStorage.getItem('ws-pf_compId'),
  398. rules: {
  399. // contractNo: [
  400. // { required: true, message: '请输入合同编号', trigger: 'blur' },
  401. // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' },
  402. // ],
  403. },
  404. options: [],
  405. staffList: [],
  406. appendixIdsAdd: '',
  407. size: 10,
  408. unitList: [],
  409. agreementList: [{
  410. constValue: '采购合同',
  411. constKey: '1'
  412. },
  413. {
  414. constValue: '补充协议',
  415. constKey: '2'
  416. },
  417. ],
  418. contractNoList: [],
  419. goodnameList: [],
  420. value1: '袋装',
  421. value2: '未回收',
  422. gradeList: [],
  423. ChapterTwoList: [],
  424. agreementType: '',
  425. deptBudgetList: {
  426. deliverType: '1',
  427. agreementType: '采购合同',
  428. addressUrl: '',
  429. finalTradingVolume: 0,
  430. totalContractPrice: 0,
  431. contractGoodsInfo: {
  432. goodsName: '',
  433. },
  434. contractProcessInfo: {},
  435. sourceGoods: '',
  436. placeDelivery: '',
  437. },
  438. acceptanceCheck: {},
  439. pickerBeginDateBefore: {
  440. disabledDate: (time) => {
  441. return time.getTime() > Date.now()
  442. },
  443. },
  444. ruleDeptBudget: {
  445. contractNo: [{
  446. required: true,
  447. message: '请输入活动名称',
  448. trigger: 'blur'
  449. },
  450. {
  451. min: 6,
  452. max: 50,
  453. message: '长度在 6 到 50 个字符',
  454. trigger: 'blur',
  455. },
  456. ],
  457. },
  458. selectIntendedShip: {},
  459. interviewTypeList: {},
  460. }
  461. },
  462. activated() {
  463. this.selectedOptions = []
  464. this.selectedOptions1 = []
  465. this.newSelectedOptions = '请选择货源所在地'
  466. this.newSelectedOptions1 = '请选择交货所在地'
  467. this.deptBudgetList.packingMethod = '散装'
  468. this.deptBudgetList.packingMethodKey = 1
  469. this.deptBudgetList.contractGoodsInfo.goodsName = '玉米'
  470. this.deptBudgetList.contractGoodsInfo.goodsNameKey = 1
  471. this.deptBudgetList.contractProcessInfo.grade = '未回收'
  472. this.deptBudgetList.contractProcessInfo.gradeKey = 1
  473. this.deptBudgetList.contractGoodsInfo.grade = '一等品'
  474. this.deptBudgetList.contractGoodsInfo.gradeKey = 1
  475. getstafffind({
  476. roles: 'd6a5c8a52da544309259f91f75de1ec6'
  477. })
  478. .toPromise()
  479. .then((response) => {
  480. this.options = response
  481. this.staffList = response
  482. })
  483. this.loaddata()
  484. this.showType = this.isShow
  485. },
  486. mounted() {
  487. this.restaurants1 = JSON.parse(localStorage.getItem('deptBudgetList_data1'));
  488. this.restaurants2 = JSON.parse(localStorage.getItem('deptBudgetList_data2'));
  489. this.restaurants3 = JSON.parse(localStorage.getItem('deptBudgetList_data3'));
  490. this.restaurants4 = JSON.parse(localStorage.getItem('deptBudgetList_data4'));
  491. if (!this.restaurants1) this.restaurants1 = [];
  492. if (!this.restaurants2) this.restaurants2 = [];
  493. if (!this.restaurants3) this.restaurants3 = [];
  494. if (!this.restaurants4) this.restaurants4 = [];
  495. },
  496. methods: {
  497. querySearch1(queryString, cb) {
  498. var restaurants1 = this.restaurants1;
  499. var results = queryString ? restaurants1.filter(this.createFilter(queryString)) : restaurants1;
  500. // 调用 callback 返回建议列表的数据
  501. cb(results);
  502. },
  503. querySearch2(queryString, cb) {
  504. var restaurants2 = this.restaurants2;
  505. var results = queryString ? restaurants2.filter(this.createFilter(queryString)) : restaurants2;
  506. // 调用 callback 返回建议列表的数据
  507. cb(results);
  508. },
  509. querySearch3(queryString, cb) {
  510. var restaurants3 = this.restaurants3;
  511. var results = queryString ? restaurants3.filter(this.createFilter(queryString)) : restaurants3;
  512. // 调用 callback 返回建议列表的数据
  513. cb(results);
  514. },
  515. querySearch4(queryString, cb) {
  516. var restaurants4 = this.restaurants4;
  517. var results = queryString ? restaurants4.filter(this.createFilter(queryString)) : restaurants4;
  518. // 调用 callback 返回建议列表的数据
  519. cb(results);
  520. },
  521. createFilter(queryString) {
  522. return (restaurant) => {
  523. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  524. };
  525. },
  526. handleSelect(item) {
  527. console.log(item);
  528. },
  529. getAddress(data) {
  530. console.log("getAddress", data)
  531. if (data[4] == 'source') {
  532. this.newSelectedOptions = data[0] + '/' + data[1] + '/' + data[2]
  533. this.deptBudgetList.sourceProvince = data[0]
  534. this.deptBudgetList.sourceCity = data[1]
  535. this.deptBudgetList.sourceArea = data[2]
  536. this.deptBudgetList.sourceGoods = data[3]
  537. } else {
  538. this.newSelectedOptions1 = data[0] + '/' + data[1] + '/' + data[2]
  539. this.deptBudgetList.deliveryProvince = data[0]
  540. this.deptBudgetList.deliveryCity = data[1]
  541. this.deptBudgetList.deliveryArea = data[2]
  542. this.deptBudgetList.placeDelivery = data[3]
  543. }
  544. },
  545. mapInputClick(type) {
  546. this.dialogVisible = true
  547. this.type = type
  548. },
  549. marker: function(item) {
  550. this.deptBudgetList.warehousePositioning =
  551. item.lnglat.lat + ',' + item.lnglat.lng
  552. },
  553. selectedAddress(e) {
  554. this.deptBudgetList.warehousePositioning =
  555. e.center.lat + ',' + e.center.lng
  556. },
  557. provinceChange(e) {
  558. console.log(CodeToText[e])
  559. },
  560. blurMap() {
  561. this.dialogVisible = false
  562. },
  563. focusMap() {
  564. this.dialogVisible = true
  565. },
  566. dataFilter(val) {
  567. this.deptBudgetList.personCharge = val
  568. if (val) {
  569. //val存在
  570. this.options = this.staffList.filter((item) => {
  571. if (
  572. !!~item.staffName.indexOf(val) ||
  573. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  574. ) {
  575. return true
  576. }
  577. })
  578. } else {
  579. //val为空时,还原数组
  580. this.options = this.staffList
  581. }
  582. },
  583. selectstaff(e) {
  584. for (var i = 0; i < this.staffList.length; i++) {
  585. if (this.staffList[i].staffName == e) {
  586. this.deptBudgetList.personPhone = this.staffList[i].staffMobilePhone
  587. this.deptBudgetList.personChargeKey = this.staffList[i].staffId
  588. }
  589. }
  590. },
  591. // 关闭 dialog时 处理文件url 初始化upload组件
  592. handleClose() {
  593. this.dialogViewSpareMoney = false
  594. },
  595. handleChange(value) {
  596. this.selectedOptions = value
  597. },
  598. handleChange1(value) {
  599. this.selectedOptions1 = value
  600. },
  601. weightchange(e) {
  602. this.deptBudgetList.finalTradingVolume = e
  603. },
  604. pricechange(e) {
  605. this.deptBudgetList.totalContractPrice = e * this.deptBudgetList.weight
  606. },
  607. returnsales() {
  608. this.$router.push({
  609. path: 'buyContract'
  610. })
  611. },
  612. loaddata() {
  613. // 包装方式
  614. packList({
  615. constId: 'CON1'
  616. })
  617. .toPromise()
  618. .then((response) => {
  619. this.packtypeList = response
  620. })
  621. // 验收方式
  622. this.getUnitList()
  623. // 货名
  624. packList({
  625. constId: 'CON2'
  626. })
  627. .toPromise()
  628. .then((response) => {
  629. this.goodnameList = response
  630. })
  631. // 品级
  632. packList({
  633. constId: 'CON3'
  634. })
  635. .toPromise()
  636. .then((response) => {
  637. this.gradeList = response
  638. })
  639. // 双章
  640. packList({
  641. constId: 'CON4'
  642. })
  643. .toPromise()
  644. .then((response) => {
  645. this.ChapterTwoList = response
  646. })
  647. //关联合同
  648. getRelationContractNo({
  649. agreementType: '采购合同',
  650. goodsType: 1
  651. })
  652. .toPromise()
  653. .then((response) => {
  654. this.contractNoList = response
  655. })
  656. },
  657. selectRelation(e) {
  658. for (var i = 0; i < this.contractNoList.length; i++) {
  659. if (this.contractNoList[i].contractNo == e) {
  660. this.deptBudgetList = this.contractNoList[i]
  661. this.deptBudgetList.agreementNo = this.contractNoList[i].contractNo
  662. this.deptBudgetList.agreementType = '补充协议'
  663. }
  664. }
  665. },
  666. onChange() {
  667. this.$refs.upload
  668. .handleSaveBill()
  669. .then(async response => {
  670. this.deptBudgetList.addressUrl = response
  671. })
  672. .catch(res => {
  673. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  674. this.$refs.upload.clearFiles()
  675. })
  676. },
  677. getUnitList() {
  678. xiala({
  679. compId: sessionStorage.getItem('ws-pf_compId'),
  680. constCode: 'TYPEYAN',
  681. })
  682. .toPromise()
  683. .then((response) => {
  684. this.unitList = response
  685. let currItem
  686. this.unitList.forEach((item, index, arr) => {
  687. item.flag = 'delete'
  688. if (this.vModel == item.constKey) {
  689. currItem = item
  690. }
  691. })
  692. //
  693. if (currItem) {
  694. this.selectContract(currItem.constValue)
  695. }
  696. })
  697. },
  698. submit() {
  699. if (!this.deptBudgetList.contractNo) {
  700. this.$message({
  701. message: '合同编号不能为空',
  702. type: 'warning',
  703. })
  704. return
  705. }
  706. if (
  707. this.deptBudgetList.contractNo.length < 6 ||
  708. this.deptBudgetList.contractNo.length > 50
  709. ) {
  710. this.$message({
  711. message: '合同编号长度不符合要求,请输入6到50个字符之内!',
  712. type: 'warning',
  713. })
  714. return
  715. }
  716. if (!this.deptBudgetList.shippingType) {
  717. this.$message({
  718. message: '运输方式不能为空',
  719. type: 'warning',
  720. })
  721. return
  722. }
  723. if (
  724. this.deptBudgetList.shippingType.length < 1 ||
  725. this.deptBudgetList.shippingType.length > 20
  726. ) {
  727. this.$message({
  728. message: '运输方式长度不符合要求,请输入1到20个字符之内!',
  729. type: 'warning',
  730. })
  731. return
  732. }
  733. if (!this.deptBudgetList.buyer) {
  734. this.$message({
  735. message: '买方名称不能为空',
  736. type: 'warning',
  737. })
  738. return
  739. }
  740. if (this.deptBudgetList.buyer.length > 30) {
  741. this.$message({
  742. message: '买方名称长度不符合要求,请输入30个字符之内!',
  743. type: 'warning',
  744. })
  745. return
  746. }
  747. if (!this.deptBudgetList.settlementMethod) {
  748. this.$message({
  749. message: '结算方式不能为空',
  750. type: 'warning',
  751. })
  752. return
  753. }
  754. if (
  755. this.deptBudgetList.settlementMethod.length < 1 ||
  756. this.deptBudgetList.settlementMethod.length > 20
  757. ) {
  758. this.$message({
  759. message: '结算方式长度不符合要求,请输入1到20个字符之内!',
  760. type: 'warning',
  761. })
  762. return
  763. }
  764. if (!this.deptBudgetList.seller) {
  765. this.$message({
  766. message: '请输入卖方名称!',
  767. type: 'warning',
  768. })
  769. return
  770. }
  771. if (this.deptBudgetList.seller.length > 30) {
  772. this.$message({
  773. message: '卖方名称长度不符合要求,请输入30个字符之内!',
  774. type: 'warning',
  775. })
  776. return
  777. }
  778. if (!this.deptBudgetList.buyerPhone) {
  779. this.$message({
  780. message: '请输入买方电话!',
  781. type: 'warning',
  782. })
  783. return
  784. }
  785. if (isNaN(this.deptBudgetList.buyerPhone)) {
  786. this.$message({
  787. message: '输入买方电话有误!',
  788. type: 'warning',
  789. })
  790. return
  791. }
  792. if (
  793. this.deptBudgetList.buyerPhone.length < 7 ||
  794. this.deptBudgetList.buyerPhone.length > 20
  795. ) {
  796. this.$message({
  797. message: '买方电话长度不符合要求,请输入7到20个字符之内!',
  798. type: 'warning',
  799. })
  800. return
  801. }
  802. if (!this.deptBudgetList.sellerPhone) {
  803. this.$message({
  804. message: '请输入卖方电话!',
  805. type: 'warning',
  806. })
  807. return
  808. }
  809. if (isNaN(this.deptBudgetList.sellerPhone)) {
  810. this.$message({
  811. message: '输入卖方电话有误!',
  812. type: 'warning',
  813. })
  814. return
  815. }
  816. if (
  817. this.deptBudgetList.sellerPhone.length < 7 ||
  818. this.deptBudgetList.sellerPhone.length > 20
  819. ) {
  820. this.$message({
  821. message: '卖方电话长度不符合要求,请输入7到20个字符之内!',
  822. type: 'warning',
  823. })
  824. return
  825. }
  826. if (!this.deptBudgetList.acceptanceMethod) {
  827. this.$message({
  828. message: '请选择验收方式',
  829. type: 'warning',
  830. })
  831. return
  832. }
  833. if (!this.deptBudgetList.weight) {
  834. this.$message({
  835. message: '请输入重量!',
  836. type: 'warning',
  837. })
  838. return
  839. }
  840. if (
  841. isNaN(this.deptBudgetList.weight) ||
  842. (String(this.deptBudgetList.weight).indexOf('.') != -1 &&
  843. String(this.deptBudgetList.weight).length -
  844. (String(this.deptBudgetList.weight).indexOf('.') + 1) >
  845. 3) ||
  846. this.deptBudgetList.weight < 0 ||
  847. this.deptBudgetList.weight > 200000
  848. ) {
  849. this.$message({
  850. message: '输入重量有误!',
  851. type: 'warning',
  852. })
  853. return
  854. }
  855. if (!this.deptBudgetList.deliveryDateStart) {
  856. this.$message({
  857. message: '请选择交货日期(起)',
  858. type: 'warning',
  859. })
  860. return
  861. }
  862. if (!this.deptBudgetList.overShort) {
  863. this.$message({
  864. message: '请输入溢短装!',
  865. type: 'warning',
  866. })
  867. return
  868. }
  869. if (
  870. isNaN(this.deptBudgetList.overShort) ||
  871. (String(this.deptBudgetList.overShort).indexOf('.') != -1 &&
  872. String(this.deptBudgetList.overShort).length -
  873. (String(this.deptBudgetList.overShort).indexOf('.') + 1) >
  874. 2) ||
  875. this.deptBudgetList.overShort < 0 ||
  876. this.deptBudgetList.overShort > 50
  877. ) {
  878. this.$message({
  879. message: '溢短装输入有误!',
  880. type: 'warning',
  881. })
  882. return
  883. }
  884. if (!this.deptBudgetList.deliveryDateEnd) {
  885. this.$message({
  886. message: '请选择交货日期(止)',
  887. type: 'warning',
  888. })
  889. return
  890. }
  891. //时间
  892. if (
  893. new Date(this.deptBudgetList.deliveryDateStart).getTime() >
  894. new Date(this.deptBudgetList.deliveryDateEnd).getTime()
  895. ) {
  896. this.$message({
  897. message: '交货日期(止)选择错误',
  898. type: 'warning',
  899. })
  900. return
  901. }
  902. if (!this.deptBudgetList.unitContractPrice) {
  903. this.$message({
  904. message: '请输入合同单价!',
  905. type: 'warning',
  906. })
  907. return
  908. }
  909. if (
  910. isNaN(this.deptBudgetList.unitContractPrice) ||
  911. (String(this.deptBudgetList.unitContractPrice).indexOf('.') != -1 &&
  912. String(this.deptBudgetList.unitContractPrice).length -
  913. (String(this.deptBudgetList.unitContractPrice).indexOf('.') + 1) >
  914. 2) ||
  915. this.deptBudgetList.unitContractPrice <= 0 ||
  916. this.deptBudgetList.unitContractPrice > 10000
  917. ) {
  918. this.$message({
  919. message: '合同单价输入有误!',
  920. type: 'warning',
  921. })
  922. return
  923. }
  924. if (!this.deptBudgetList.totalContractPrice) {
  925. this.$message({
  926. message: '请输入合同总价!',
  927. type: 'warning',
  928. })
  929. return
  930. }
  931. if (
  932. isNaN(this.deptBudgetList.totalContractPrice) ||
  933. (String(this.deptBudgetList.totalContractPrice).indexOf('.') != -1 &&
  934. String(this.deptBudgetList.totalContractPrice).length -
  935. (String(this.deptBudgetList.totalContractPrice).indexOf('.') + 1) >
  936. 2) ||
  937. this.deptBudgetList.totalContractPrice <= 0 ||
  938. this.deptBudgetList.totalContractPrice > 1000000000
  939. ) {
  940. this.$message({
  941. message: '合同总价输入有误!',
  942. type: 'warning',
  943. })
  944. return
  945. }
  946. if (!this.newSelectedOptions) {
  947. this.$message({
  948. message: '请选择货源所在地区!',
  949. type: 'warning',
  950. })
  951. return
  952. }
  953. if (!this.deptBudgetList.sourceGoods) {
  954. this.$message({
  955. message: '请输入货源详细地址!',
  956. type: 'warning',
  957. })
  958. return
  959. }
  960. if (!this.newSelectedOptions1) {
  961. this.$message({
  962. message: '请选择交货所在地区!',
  963. type: 'warning',
  964. })
  965. return
  966. }
  967. if (!this.deptBudgetList.placeDelivery) {
  968. this.$message({
  969. message: '请输入交货详细地址!',
  970. type: 'warning',
  971. })
  972. return
  973. }
  974. if (!this.deptBudgetList.signingDate) {
  975. this.$message({
  976. message: '请选择签订日期',
  977. type: 'warning',
  978. })
  979. return
  980. }
  981. if (
  982. isNaN(this.deptBudgetList.finalTradingVolume) ||
  983. (String(this.deptBudgetList.finalTradingVolume).indexOf('.') != -1 &&
  984. String(this.deptBudgetList.finalTradingVolume).length -
  985. (String(this.deptBudgetList.finalTradingVolume).indexOf('.') + 1) >
  986. 3) ||
  987. this.deptBudgetList.finalTradingVolume < 0 ||
  988. this.deptBudgetList.finalTradingVolume > 200000
  989. ) {
  990. this.$message({
  991. message: '最终实际成交量有误!',
  992. type: 'warning',
  993. })
  994. return
  995. }
  996. //货物信息
  997. if (!this.deptBudgetList.contractGoodsInfo.goodsName) {
  998. this.$message({
  999. message: '请选择货名',
  1000. type: 'warning',
  1001. })
  1002. return
  1003. }
  1004. if (!this.deptBudgetList.contractGoodsInfo.waterContent) {
  1005. this.$message({
  1006. message: '请输入水分',
  1007. type: 'warning',
  1008. })
  1009. return
  1010. }
  1011. if (
  1012. this.deptBudgetList.contractGoodsInfo.waterContent &&
  1013. String(this.deptBudgetList.contractGoodsInfo.waterContent).indexOf('.') != -1 &&
  1014. String(this.deptBudgetList.contractGoodsInfo.waterContent).length -
  1015. (String(this.deptBudgetList.contractGoodsInfo.waterContent).indexOf('.') + 1) >
  1016. 2 || this.deptBudgetList.contractGoodsInfo.waterContent > 40 || this.deptBudgetList.contractGoodsInfo
  1017. .waterContent < 0
  1018. ) {
  1019. this.$message({
  1020. message: '水分输入错误',
  1021. type: 'warning',
  1022. })
  1023. return
  1024. }
  1025. if (!this.deptBudgetList.contractGoodsInfo.grade) {
  1026. this.$message({
  1027. message: '请选择品级',
  1028. type: 'warning',
  1029. })
  1030. return
  1031. }
  1032. if (!this.deptBudgetList.contractGoodsInfo.impurity) {
  1033. this.$message({
  1034. message: '请输入杂质',
  1035. type: 'warning',
  1036. })
  1037. return
  1038. }
  1039. if (
  1040. this.deptBudgetList.contractGoodsInfo.impurity &&
  1041. String(this.deptBudgetList.contractGoodsInfo.impurity).indexOf('.') != -1 &&
  1042. String(this.deptBudgetList.contractGoodsInfo.impurity).length -
  1043. (String(this.deptBudgetList.contractGoodsInfo.impurity).indexOf('.') + 1) >
  1044. 2 || this.deptBudgetList.contractGoodsInfo.impurity > 40 || this.deptBudgetList.contractGoodsInfo.impurity < 0
  1045. ) {
  1046. this.$message({
  1047. message: '杂质输入错误',
  1048. type: 'warning',
  1049. })
  1050. return
  1051. }
  1052. if (!this.deptBudgetList.contractGoodsInfo.bulkDensity) {
  1053. this.$message({
  1054. message: '请输入容重',
  1055. type: 'warning',
  1056. })
  1057. return
  1058. }
  1059. if (
  1060. (this.deptBudgetList.contractGoodsInfo.bulkDensity &&
  1061. String(this.deptBudgetList.contractGoodsInfo.bulkDensity).indexOf('.') != -1 &&
  1062. String(this.deptBudgetList.contractGoodsInfo.bulkDensity).length -
  1063. (String(this.deptBudgetList.contractGoodsInfo.bulkDensity).indexOf('.') + 1) >
  1064. 2) || this.deptBudgetList.contractGoodsInfo.bulkDensity > 1000 || this.deptBudgetList.contractGoodsInfo
  1065. .bulkDensity < 0
  1066. ) {
  1067. this.$message({
  1068. message: '容重输入错误',
  1069. type: 'warning',
  1070. })
  1071. return
  1072. }
  1073. if (!this.deptBudgetList.contractGoodsInfo.mildewGrain) {
  1074. this.$message({
  1075. message: '请输入霉变粒',
  1076. type: 'warning',
  1077. })
  1078. return
  1079. }
  1080. if (
  1081. !this.deptBudgetList.contractGoodsInfo.mildewGrain ||
  1082. (String(this.deptBudgetList.contractGoodsInfo.mildewGrain).indexOf(
  1083. '.'
  1084. ) != -1 &&
  1085. String(this.deptBudgetList.contractGoodsInfo.mildewGrain).length -
  1086. (String(this.deptBudgetList.contractGoodsInfo.mildewGrain).indexOf(
  1087. '.'
  1088. ) +
  1089. 1) >
  1090. 2 || this.deptBudgetList.contractGoodsInfo.mildewGrain > 40 || this.deptBudgetList.contractGoodsInfo
  1091. .mildewGrain < 0)
  1092. ) {
  1093. this.$message({
  1094. message: '霉变粒输入错误',
  1095. type: 'warning',
  1096. })
  1097. return
  1098. }
  1099. if (!this.deptBudgetList.contractGoodsInfo.jiaorenli) {
  1100. this.$message({
  1101. message: '请输入热损伤',
  1102. type: 'warning',
  1103. })
  1104. return
  1105. }
  1106. if (
  1107. !this.deptBudgetList.contractGoodsInfo.jiaorenli ||
  1108. (String(this.deptBudgetList.contractGoodsInfo.jiaorenli).indexOf('.') !=
  1109. -1 &&
  1110. String(this.deptBudgetList.contractGoodsInfo.jiaorenli).length -
  1111. (String(this.deptBudgetList.contractGoodsInfo.jiaorenli).indexOf(
  1112. '.'
  1113. ) +
  1114. 1) >
  1115. 2 || this.deptBudgetList.contractGoodsInfo.jiaorenli > 40 || this.deptBudgetList.contractGoodsInfo
  1116. .jiaorenli < 0)
  1117. ) {
  1118. this.$message({
  1119. message: '热损伤输入错误',
  1120. type: 'warning',
  1121. })
  1122. return
  1123. }
  1124. if (!this.deptBudgetList.contractGoodsInfo.imperfectGrain) {
  1125. this.$message({
  1126. message: '请输入不完善粒',
  1127. type: 'warning',
  1128. })
  1129. return
  1130. }
  1131. if (
  1132. !this.deptBudgetList.contractGoodsInfo.imperfectGrain ||
  1133. (String(this.deptBudgetList.contractGoodsInfo.imperfectGrain).indexOf(
  1134. '.'
  1135. ) != -1 &&
  1136. String(this.deptBudgetList.contractGoodsInfo.imperfectGrain).length -
  1137. (String(
  1138. this.deptBudgetList.contractGoodsInfo.imperfectGrain
  1139. ).indexOf('.') +
  1140. 1) >
  1141. 2 || this.deptBudgetList.contractGoodsInfo.imperfectGrain > 40 || this.deptBudgetList.contractGoodsInfo
  1142. .imperfectGrain < 0)
  1143. ) {
  1144. this.$message({
  1145. message: '不完善粒输入错误',
  1146. type: 'warning',
  1147. })
  1148. return
  1149. }
  1150. // if (
  1151. // (!this.deptBudgetList.contractProcessInfo.goodsNameKey > 1000000000) ||
  1152. // (this.deptBudgetList.contractProcessInfo.goodsNameKey < 100) ||
  1153. // (String(this.deptBudgetList.contractProcessInfo.goodsNameKey).indexOf(
  1154. // '.'
  1155. // ) != -1 &&
  1156. // String(this.deptBudgetList.contractProcessInfo.goodsNameKey).length -
  1157. // (String(
  1158. // this.deptBudgetList.contractProcessInfo.goodsNameKey
  1159. // ).indexOf('.') +
  1160. // 1) >
  1161. // 2)
  1162. // ) {
  1163. // this.$message({
  1164. // message: '合同收入金额输入错误',
  1165. // type: 'warning',
  1166. // })
  1167. // return
  1168. // }
  1169. if (
  1170. (this.deptBudgetList.contractProcessInfo.waterContent > 10000000) ||
  1171. (this.deptBudgetList.contractProcessInfo.waterContent < 0) ||
  1172. (String(this.deptBudgetList.contractProcessInfo.waterContent).indexOf(
  1173. '.'
  1174. ) != -1 &&
  1175. String(this.deptBudgetList.contractProcessInfo.waterContent).length -
  1176. (String(
  1177. this.deptBudgetList.contractProcessInfo.waterContent
  1178. ).indexOf('.') +
  1179. 1) >
  1180. 2)
  1181. ) {
  1182. this.$message({
  1183. message: '费用支出输入错误',
  1184. type: 'warning',
  1185. })
  1186. return
  1187. }
  1188. if (
  1189. (this.deptBudgetList.contractProcessInfo.goodsName > 1000000000) |
  1190. (this.deptBudgetList.contractProcessInfo.goodsName < 0) ||
  1191. (String(this.deptBudgetList.contractProcessInfo.goodsName).indexOf(
  1192. '.'
  1193. ) != -1 &&
  1194. String(this.deptBudgetList.contractProcessInfo.goodsName).length -
  1195. (String(this.deptBudgetList.contractProcessInfo.goodsName).indexOf(
  1196. '.'
  1197. ) +
  1198. 1) >
  1199. 2)
  1200. ) {
  1201. this.$message({
  1202. message: '已开发票金额输入错误',
  1203. type: 'warning',
  1204. })
  1205. return
  1206. }
  1207. if (
  1208. (this.deptBudgetList.contractProcessInfo.impurity > 1000000000) |
  1209. (this.deptBudgetList.contractProcessInfo.impurity < 0) ||
  1210. (String(this.deptBudgetList.contractProcessInfo.impurity).indexOf(
  1211. '.'
  1212. ) != -1 &&
  1213. String(this.deptBudgetList.contractProcessInfo.impurity).length -
  1214. (String(this.deptBudgetList.contractProcessInfo.impurity).indexOf(
  1215. '.'
  1216. ) +
  1217. 1) >
  1218. 2)
  1219. ) {
  1220. this.$message({
  1221. message: '未开发票金额输入错误',
  1222. type: 'warning',
  1223. })
  1224. return
  1225. }
  1226. if (
  1227. (!this.deptBudgetList.contractProcessInfo.mildewGrain > 1000000000) |
  1228. (this.deptBudgetList.contractProcessInfo.mildewGrain < 0) ||
  1229. (String(this.deptBudgetList.contractProcessInfo.mildewGrain).indexOf(
  1230. '.'
  1231. ) != -1 &&
  1232. String(this.deptBudgetList.contractProcessInfo.mildewGrain).length -
  1233. (String(
  1234. this.deptBudgetList.contractProcessInfo.mildewGrain
  1235. ).indexOf('.') +
  1236. 1) >
  1237. 2)
  1238. ) {
  1239. this.$message({
  1240. message: '未回款金额输入错误',
  1241. type: 'warning',
  1242. })
  1243. return
  1244. }
  1245. this.$refs.deptBudgetList.validate((valid) => {
  1246. if (valid) {
  1247. this.deptBudgetList.compId = this.compId
  1248. this.deptBudgetList.contractType = 2
  1249. this.deptBudgetList.goodsType = 1
  1250. addList(this.deptBudgetList)
  1251. .toPromise()
  1252. .then((response) => {
  1253. // 存储买方、卖方、买方电话、卖方电话
  1254. let _data = {
  1255. byer: this.deptBudgetList.buyer,
  1256. seller: this.deptBudgetList.seller,
  1257. buyerPhone: this.deptBudgetList.buyerPhone,
  1258. sellerPhone: this.deptBudgetList.sellerPhone
  1259. }
  1260. if (this.restaurants1.length <= 20) {
  1261. this.restaurants1 = this.restaurants1.filter(function(val) {
  1262. if (val.value != _data.byer) {
  1263. return val
  1264. }
  1265. })
  1266. this.restaurants1.unshift({
  1267. value: _data.byer
  1268. })
  1269. } else {
  1270. this.restaurants1.unshift({
  1271. value: _data.byer
  1272. }).pop({
  1273. value: _data.byer
  1274. })
  1275. }
  1276. localStorage.setItem('deptBudgetList_data1', JSON.stringify(this.restaurants1));
  1277. if (this.restaurants2.length <= 20) {
  1278. this.restaurants2 = this.restaurants2.filter(function(val) {
  1279. if (val.value != _data.seller) {
  1280. return val
  1281. }
  1282. })
  1283. this.restaurants2.unshift({
  1284. value: _data.seller
  1285. })
  1286. } else {
  1287. this.restaurants2.unshift({
  1288. value: _data.seller
  1289. }).pop({
  1290. value: _data.seller
  1291. })
  1292. }
  1293. localStorage.setItem('deptBudgetList_data2', JSON.stringify(this.restaurants2));
  1294. if (this.restaurants2.length <= 20) {
  1295. this.restaurants3 = this.restaurants3.filter(function(val) {
  1296. if (val.value != _data.buyerPhone) {
  1297. return val
  1298. }
  1299. })
  1300. this.restaurants3.unshift({
  1301. value: _data.buyerPhone
  1302. })
  1303. } else {
  1304. this.restaurants3.unshift({
  1305. value: _data.buyerPhone
  1306. }).pop({
  1307. value: _data.buyerPhone
  1308. })
  1309. }
  1310. localStorage.setItem('deptBudgetList_data3', JSON.stringify(this.restaurants3));
  1311. if (this.restaurants4.length <= 20) {
  1312. this.restaurants4 = this.restaurants3.filter(function(val) {
  1313. if (val.value != _data.sellerPhone) {
  1314. return val
  1315. }
  1316. })
  1317. this.restaurants4.unshift({
  1318. value: _data.sellerPhone
  1319. })
  1320. } else {
  1321. this.restaurants4.unshift({
  1322. value: _data.sellerPhone
  1323. }).pop({
  1324. value: _data.sellerPhone
  1325. })
  1326. }
  1327. localStorage.setItem('deptBudgetList_data4', JSON.stringify(this.restaurants4));
  1328. this.$message.success('添加成功')
  1329. this.deptBudgetList = {
  1330. deliverType: '1',
  1331. agreementType: '采购合同',
  1332. finalTradingVolume: 0,
  1333. totalContractPrice: 0,
  1334. contractGoodsInfo: {
  1335. goodsName: '',
  1336. },
  1337. contractProcessInfo: {},
  1338. addressUrl: '',
  1339. }
  1340. this.$router.push({
  1341. path: 'buyContract'
  1342. })
  1343. })
  1344. } else {
  1345. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1346. return false
  1347. }
  1348. })
  1349. },
  1350. resetForm(deptBudgetList) {
  1351. this.$refs[deptBudgetList].resetFields()
  1352. },
  1353. //选择合同类型
  1354. selectType(e) {
  1355. for (var i = 0; i < this.invoiceList.length; i++) {
  1356. if (this.agreementList[i].constValue == e) {
  1357. this.deptBudgetList.agreementType = this.agreementList[i].constValue
  1358. }
  1359. }
  1360. },
  1361. addClick() {
  1362. this.unitList.push({
  1363. flag: 'add',
  1364. constValue: '',
  1365. constKey: '',
  1366. })
  1367. },
  1368. saveClick(item, index) {
  1369. if (Object.is(item.id, 1)) {
  1370. return
  1371. }
  1372. if (Object.is(this.unitList[index].flag, 'delete')) {
  1373. this.$set(this.unitList, index, {
  1374. flag: 'check'
  1375. })
  1376. } else {
  1377. this.$set(this.unitList, index, {
  1378. flag: 'delete'
  1379. })
  1380. }
  1381. if (!item.constValue) {
  1382. this.unitList.splice(index, 1)
  1383. return
  1384. }
  1385. if (item.flag == 'add') {
  1386. item.constKey = Math.random() * 20
  1387. this.acceptanceCheck.compId = this.compId
  1388. this.acceptanceCheck.constKey = item.constKey
  1389. this.acceptanceCheck.constCode = 'TYPEYAN'
  1390. this.acceptanceCheck.constValue = item.constValue
  1391. this.acceptanceCheck.id = item.id
  1392. addxiala(this.acceptanceCheck)
  1393. .toPromise()
  1394. .then((response) => {
  1395. this.getUnitList()
  1396. })
  1397. } else if (item.flag == 'check') {
  1398. this.acceptanceCheck.compId = this.compId
  1399. this.acceptanceCheck.constKey = item.constKey
  1400. this.acceptanceCheck.constCode = 'TYPEYAN'
  1401. this.acceptanceCheck.constValue = item.constValue
  1402. this.acceptanceCheck.id = item.id
  1403. editxiala(this.acceptanceCheck)
  1404. .toPromise()
  1405. .then((response) => {
  1406. this.getUnitList()
  1407. })
  1408. }
  1409. },
  1410. selectChapterTwo(e) {
  1411. for (var i = 0; i < this.ChapterTwoList.length; i++) {
  1412. if (this.ChapterTwoList[i].constValue == e) {
  1413. this.deptBudgetList.gradeKey = this.ChapterTwoList[i].constKey
  1414. }
  1415. }
  1416. },
  1417. selectunitList(e) {
  1418. for (var i = 0; i < this.unitList.length; i++) {
  1419. if (this.unitList[i].constValue == e) {
  1420. this.deptBudgetList.acceptanceMethodKey = this.unitList[i].constKey
  1421. }
  1422. }
  1423. },
  1424. selectgrade(e) {
  1425. for (var i = 0; i < this.gradeList.length; i++) {
  1426. if (this.gradeList[i].constValue == e) {
  1427. this.deptBudgetList.gradeKey = this.gradeList[i].constKey
  1428. }
  1429. }
  1430. },
  1431. selectgoodsName(e) {
  1432. for (var i = 0; i < this.goodnameList.length; i++) {
  1433. if (this.goodnameList[i].constValue == e) {
  1434. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  1435. this.deptBudgetList.contractGoodsInfo.goodsNameKey = this.goodnameList[i].constKey
  1436. }
  1437. }
  1438. },
  1439. selectpackingMethod(e) {
  1440. for (var i = 0; i < this.packtypeList.length; i++) {
  1441. if (this.packtypeList[i].constValue == e) {
  1442. this.deptBudgetList.packingMethodKey = this.packtypeList[i].constKey
  1443. }
  1444. }
  1445. },
  1446. // 编辑
  1447. editClick(item, index) {
  1448. const map = JSON.parse(JSON.stringify(item))
  1449. if (Object.is(item.id, 1)) {
  1450. return
  1451. }
  1452. if (Object.is(this.unitList[index].flag, 'delete')) {
  1453. map.flag = 'check'
  1454. this.$set(this.unitList, index, map)
  1455. } else {
  1456. map.flag = 'delete'
  1457. this.$set(this.unitList, index, map)
  1458. }
  1459. },
  1460. // 删除
  1461. deleteClick(item, index) {
  1462. if (Object.is(item.constKey, 1)) {
  1463. return
  1464. }
  1465. if (!item.constValue) {
  1466. this.unitList.splice(index, 1)
  1467. return
  1468. }
  1469. delxiala({
  1470. id: this.unitList[index].id
  1471. })
  1472. .toPromise()
  1473. .then((response) => {
  1474. this.getUnitList()
  1475. this.pleaseChoose = ''
  1476. })
  1477. },
  1478. },
  1479. }
  1480. </script>
  1481. <style lang="scss" scoped>
  1482. .el-form {
  1483. padding: 0 15%;
  1484. }
  1485. /deep/.ws-info-table .el-form-item {
  1486. border-right: 1px solid #cdd2dc;
  1487. border-bottom: 1px solid #cdd2dc;
  1488. }
  1489. .readonly {
  1490. position: relative;
  1491. }
  1492. .readonly:after {
  1493. content: '*';
  1494. color: #ff2727;
  1495. position: absolute;
  1496. right: 8px;
  1497. z-index: 10;
  1498. top: 21%;
  1499. font-size: 20px;
  1500. }
  1501. .title {
  1502. position: relative;
  1503. }
  1504. .title::before {
  1505. content: '';
  1506. display: inline-block;
  1507. width: 5px;
  1508. height: 30px;
  1509. background: #5473e8;
  1510. position: absolute;
  1511. left: 0;
  1512. }
  1513. .el-button--primary {
  1514. background-color: #5878e8;
  1515. border-color: #5878e8;
  1516. }
  1517. .el-col {
  1518. background: #f6f7fc;
  1519. }
  1520. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1521. padding: 0 25px;
  1522. border-left: 1px solid #cdd2dc;
  1523. background: #fafbfc;
  1524. }
  1525. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1526. width: 140px;
  1527. text-align: center;
  1528. background: #f0f2f6;
  1529. // border: 1px solid #cdd2dc;
  1530. }
  1531. .button-container {
  1532. display: flex;
  1533. flex-wrap: nowrap;
  1534. justify-content: space-between;
  1535. align-items: center;
  1536. background-color: #fff;
  1537. width: 100%;
  1538. height: 50px;
  1539. padding: 0 10px;
  1540. &>div {
  1541. margin-left: 10px;
  1542. display: flex;
  1543. flex-wrap: nowrap;
  1544. flex-direction: row;
  1545. &>span {
  1546. line-height: 50px;
  1547. }
  1548. }
  1549. /deep/.auditFlow-box {
  1550. position: unset;
  1551. margin-left: 10px;
  1552. &/deep/.auditFlow-icon {
  1553. width: auto;
  1554. padding-right: 30px;
  1555. }
  1556. &/deep/.auditFlow-main {
  1557. position: absolute;
  1558. }
  1559. }
  1560. }
  1561. .box-app {
  1562. display: inline-block;
  1563. float: left;
  1564. margin-left: 30px;
  1565. line-height: 50px;
  1566. }
  1567. /deep/.el-dialog {
  1568. .el-form-item {
  1569. margin-bottom: 0 !important;
  1570. .el-input--medium {
  1571. textarea {
  1572. min-height: 100px !important;
  1573. }
  1574. }
  1575. }
  1576. }
  1577. .collapse-bottom {
  1578. margin-bottom: 20px;
  1579. }
  1580. .input-main .textarea .el-textarea__inner {
  1581. width: 100%;
  1582. z-index: 1;
  1583. }
  1584. .bg-left {
  1585. padding-left: 30px;
  1586. }
  1587. .bg-right {
  1588. padding-right: 10px;
  1589. text-align: right;
  1590. }
  1591. .bg-bottom {
  1592. margin: 15px 0px;
  1593. }
  1594. .wenzi h3 {
  1595. display: inline-block;
  1596. left: 10px;
  1597. }
  1598. .wenzi p {
  1599. display: inline-block;
  1600. }
  1601. .upload-demo {
  1602. margin-top: 10px;
  1603. }
  1604. .center {
  1605. width: 70%;
  1606. margin: 0 auto;
  1607. }
  1608. .el-form-item {
  1609. width: 50%;
  1610. }
  1611. .el-form-item__label {
  1612. text-align: center;
  1613. }
  1614. .ce {
  1615. width: 900px;
  1616. margin: 0 auto;
  1617. }
  1618. /*.crt-main .textarea /deep/ .el-form-item__label {*/
  1619. /* height: 82px;*/
  1620. /*}*/
  1621. // 控制select为只读的时候显示样式
  1622. .hide-sel {
  1623. .el-input__inner {
  1624. border: 0px;
  1625. }
  1626. .el-icon-arrow-up {
  1627. display: none;
  1628. }
  1629. .el-textarea__inner {
  1630. background-color: #fff !important;
  1631. border: 0;
  1632. }
  1633. .el-date-editor {
  1634. i {
  1635. display: none;
  1636. }
  1637. }
  1638. .is-disabled {
  1639. .el-input__inner:hover {
  1640. background-color: #fff !important;
  1641. border: 0;
  1642. }
  1643. color: #606266;
  1644. .el-input__inner {
  1645. background-color: #fff !important;
  1646. border: 0;
  1647. color: #606266;
  1648. }
  1649. .el-textarea__inner {
  1650. background-color: #fff !important;
  1651. border: 0;
  1652. color: #606266;
  1653. }
  1654. }
  1655. }
  1656. // 控制select为只读的时候显示样式
  1657. /deep/.ws-class-table-col {
  1658. height: auto;
  1659. padding: 0px 2px;
  1660. /deep/.el-input__inner {
  1661. padding: 0px 2px;
  1662. }
  1663. }
  1664. /deep/.is-disabled {
  1665. .el-input__prefix,
  1666. .el-input__suffix {
  1667. display: none;
  1668. }
  1669. .el-input__inner {
  1670. background-color: #fff;
  1671. border-color: #fff !important;
  1672. color: #000 !important;
  1673. font-size: 14px;
  1674. cursor: text;
  1675. padding: 0 !important;
  1676. }
  1677. }
  1678. .winseaview-view {
  1679. padding: 0 0 20px;
  1680. }
  1681. .container {
  1682. overflow: scroll;
  1683. height: 93vh;
  1684. }
  1685. /deep/.ws-info-table[data-v-850a44a6] .el-form-item .el-form-item__label {
  1686. width: 130px;
  1687. }
  1688. .el-textarea {
  1689. width: 101%;
  1690. }
  1691. .addressUrls {
  1692. width: 100%;
  1693. display: flex;
  1694. margin-top: 10px;
  1695. }
  1696. .addressUrls-item {
  1697. position: relative;
  1698. display: flex;
  1699. }
  1700. .icon-guanbi {
  1701. position: absolute;
  1702. right: 8px;
  1703. }
  1704. .addressUrl {
  1705. margin: 0px 10px;
  1706. border-radius: 3px;
  1707. }
  1708. //上传文件成功标识
  1709. /deep/.el-upload-list__item-status-label {
  1710. position: absolute;
  1711. right: 22px;
  1712. top: -1px;
  1713. line-height: inherit;
  1714. display: none;
  1715. }
  1716. .map {
  1717. position: fixed;
  1718. top: 0;
  1719. bottom: 0;
  1720. left: 0;
  1721. right: 0;
  1722. margin: auto;
  1723. width: 800px;
  1724. height: 400px;
  1725. background: gainsboro;
  1726. border-radius: 20px;
  1727. padding: 10px;
  1728. box-sizing: border-box;
  1729. z-index: 99;
  1730. }
  1731. .amap-container {
  1732. width: 100% !important;
  1733. }
  1734. .address-btn {
  1735. width: 100%;
  1736. text-align: left;
  1737. }
  1738. .inline-input {
  1739. width: 100%;
  1740. }
  1741. </style>