purchaseContractAdd.vue 61 KB

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