purchaseContractAdd.vue 60 KB

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