purchaseContractAdd.vue 60 KB

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