add.vue 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091
  1. <template>
  2. <div id="addDemandList">
  3. <el-card style="position: relative;">
  4. <span>基本信息</span>
  5. <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="auto" :show-message="false">
  6. <el-row :gutter="10">
  7. <el-col :span="1.5">
  8. <el-form-item label="业务类型" prop="billType" :rules="{ required: true, message: '请选择业务类型', trigger: 'blur' }">
  9. <el-select clearable v-model="basicForm.billType" @change="changeBillType(basicForm.billType)" :disabled="sonDisable" size="mini" style="width: 200px">
  10. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="1.5">
  16. <el-form-item label="需求客户">
  17. <el-select clearable size="mini" v-model="basicForm.customer" :disabled="sonDisable" @clear="cleanCustomer" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
  18. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  19. </el-select>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="1.5">
  23. <el-form-item label="需求人员">
  24. <el-select clearable size="mini" v-model="basicForm.demandPersonal" :disabled="sonDisable" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  25. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  26. </el-select>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="1.5">
  30. <el-form-item label="需求部门" prop="demandDept" :rules="{ required: true, message: '请选择需求部门', trigger: 'blur' }">
  31. <el-select clearable v-model="basicForm.demandDept" size="mini" :disabled="sonDisable" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  32. <el-option
  33. v-for="item in deptOptions"
  34. :key="item.id"
  35. :label="item.name"
  36. :value="item.id">
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="1.5">
  42. <el-form-item label="需求计划" prop="planType" :rules="{ required: true, message: '请选择需求计划', trigger: 'blur' }">
  43. <el-select :disabled="sonDisable" v-model="basicForm.planType" size="mini" style="width: 200px" @change="changeplanType(basicForm.planType)">
  44. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
  51. <el-date-picker
  52. v-model="basicForm.demandDate"
  53. disabled
  54. clearable
  55. type="date"
  56. value-format="yyyy-MM-dd"
  57. @change="changeDemandDate"
  58. size="mini"
  59. style="width: 200px"
  60. >
  61. </el-date-picker>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="1.5">
  65. <el-form-item label="制单日期" prop="createTime">
  66. <el-date-picker
  67. v-model="basicForm.createTime"
  68. disabled
  69. clearable
  70. type="date"
  71. value-format="yyyy-MM-dd"
  72. size="mini"
  73. style="width: 200px"
  74. >
  75. </el-date-picker>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-form-item label="是否客户指定">
  80. <el-select clearable @change="isCustomer" v-model="basicForm.isCustomerSpecified" :disabled="sonDisable" size="mini" style="width: 200px">
  81. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-form-item label="备注">
  88. <el-input
  89. v-model.trim="basicForm.remark"
  90. size="mini"
  91. :disabled="sonDisable"
  92. clearable
  93. style="width: 200px"
  94. />
  95. </el-form-item>
  96. </el-col>
  97. <!-- <el-col :span="1.5">
  98. <el-form-item label="需求客户名称">
  99. <el-input disabled v-model="basicForm.customerName" size="mini" style="width: 200px"></el-input>
  100. </el-form-item>
  101. </el-col> -->
  102. <el-col :span="1.5">
  103. <el-form-item label="需求单号">
  104. <el-input
  105. v-model="basicForm.code"
  106. size="mini"
  107. disabled
  108. style="width: 200px"
  109. />
  110. </el-form-item>
  111. </el-col>
  112. <!-- <el-col :span="1.5">
  113. <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
  114. <el-select clearable size="mini" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
  115. <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
  116. </el-select>
  117. </el-form-item>
  118. </el-col> -->
  119. <el-col :span="1.5">
  120. <el-form-item label="单据状态">
  121. <el-select disabled v-model="basicForm.status" size="mini" style="width: 200px">
  122. <el-option v-for="dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="1.5">
  128. <el-form-item label="客户负责人">
  129. <el-select disabled size="mini" v-model="basicForm.customerPrincipal" style="width: 200px">
  130. <el-option v-for="item in manOptions" :key="item.id" :label="item.name" :value="item.code"/>
  131. </el-select>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="1.5">
  135. <el-form-item label="单据来源">
  136. <el-select v-model="basicForm.source" disabled size="mini" style="width: 200px">
  137. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  138. </el-option>
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="1.5">
  143. <el-form-item label="是否超需求可用周期">
  144. <el-select v-model="basicForm.isBeyondRap" disabled size="mini" style="width: 200px">
  145. <el-option v-for=" item in options" :key="item.value" :label="item.label" :value="item.value">
  146. </el-option>
  147. </el-select>
  148. </el-form-item>
  149. </el-col>
  150. </el-row>
  151. <div class="btn_grooup">
  152. <span>明细信息</span>
  153. <div>
  154. <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
  155. <el-button type="primary" size="mini" @click="delLines" v-if="!sonDisable">删行</el-button>
  156. <el-button type="primary" size="mini" v-if="!sonDisable" @click.stop="adjustPl">批量调整</el-button>
  157. <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
  158. </div>
  159. </div>
  160. <ux-grid
  161. v-loading="loading"
  162. :data="basicForm.puDemandItemList"
  163. border
  164. :cell-style="{ borderColor: '#c0c0c0' }"
  165. :header-cell-style="{ borderColor: '#c0c0c0' }"
  166. class="exporttable"
  167. height="410"
  168. max-height="410"
  169. style="font-size: 12px;"
  170. @selection-change="handleSelectionChange"
  171. :cell-class-name="cellClassName"
  172. ref="table"
  173. :rules="tableRules"
  174. show-header-overflow="tooltip"
  175. show-overflow="tooltip"
  176. keep-source
  177. beautifyTable
  178. show-summary
  179. :summary-method="jisuan"
  180. :checkbox-config="{highlight: true, trigger: 'row'}"
  181. :edit-config="{trigger: 'click', mode: 'row'}"
  182. :validConfig="{autoPos: true}">
  183. >
  184. <ux-table-column resizable type="checkbox" fixed="left"/>
  185. <!-- <ux-table-column resizable title="序号" type="index" align="center" width="50px"/> -->
  186. <ux-table-column resizable title="行号" align="center" field="rowNo" width="50px">
  187. <template v-slot="scope">
  188. {{ scope.row.rowNo = scope.rowIndex + 1 + "0" }}
  189. </template>
  190. </ux-table-column>
  191. <ux-table-column resizable title="默认采购组织" align="center" field="purOrgName" width="100px"/>
  192. <ux-table-column resizable title="需求客户" align="center" field="demandCustomerName" width="100px"/>
  193. <ux-table-column resizable title="行状态" align="center" field="status" :formatter="hangStatus" width="100px"/>
  194. <ux-table-column resizable title="物料编码" align="center" field="materialCode" width="150px" :render-header="addRedStar" :edit-render="{autofocus: '.el-input__inner'}">
  195. <template v-slot:edit="scope">
  196. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.materialCode" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  197. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.rowIndex)"></el-button>
  198. </el-input>
  199. </template>
  200. </ux-table-column>
  201. <ux-table-column resizable title="物料名称" align="center" field="materialName" width="100px"/>
  202. <ux-table-column resizable title="规格" align="center" field="specification" width="50px"/>
  203. <ux-table-column resizable title="型号" align="center" field="model" width="50px"/>
  204. <ux-table-column resizable title="单位" align="center" field="unitName" width="50px"/>
  205. <ux-table-column resizable title="生产厂家/代理人" align="center" field="manufacturerName" width="100px"/>
  206. <ux-table-column resizable title="最小包装" align="center" field="minPackage" width="80px"/>
  207. <ux-table-column resizable title="月均销量" align="center" field="averageQtyMonth" width="80px"/>
  208. <ux-table-column resizable title="需求可用周期" align="center" field="demandPeriod" width="80px"/>
  209. <ux-table-column resizable title="实际(业务)需求量" align="center" field="qty" width="150px" :render-header="addRedStar" edit-render>
  210. <template v-slot:edit="scope">
  211. <el-input type="number" min="0" clearable :disabled="sonDisable" size="mini" v-model="scope.row.qty" @paste.native="pasteMe($event, scope, scope.rowIndex)"/>
  212. </template>
  213. </ux-table-column>
  214. <ux-table-column resizable title="紧急标识" align="center" field="isUrgency" width="100px" edit-render>
  215. <template v-slot:edit="scope">
  216. <el-switch
  217. v-model="scope.row.isUrgency"
  218. :disabled="sonDisable"
  219. active-value="Y"
  220. inactive-value="N"
  221. active-color="#13ce66"
  222. inactive-color="#a1a3a9">
  223. </el-switch>
  224. </template>
  225. <template v-slot="{ row }">{{ row.isUrgency == 'Y' ? '是' : '否' }}</template>
  226. </ux-table-column>
  227. <ux-table-column resizable title="收货仓库" align="center" field="deliveryWarehouseName" width="200px" edit-render>
  228. <template v-slot:edit="scope">
  229. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryWarehouseName" @clear="clearHang(scope.rowIndex, '选择收货仓库')">
  230. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseCangKu(scope.rowIndex, 'WAREHOUSE_PARAM', true, '选择收货仓库', scope.row.puOrg)"></el-button>
  231. </el-input>
  232. </template>
  233. </ux-table-column>
  234. <ux-table-column resizable title="收货货位" align="center" field="deliveryAllocationName" width="200px" edit-render>
  235. <template v-slot:edit="scope">
  236. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAllocationName" @clear="clearHang(scope.rowIndex, '选择收货货位')">
  237. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="choosehuoWei(scope.rowIndex, 'ALLOCATION_PARAM', true, '选择收货货位', scope.row.deliveryWarehouse)"></el-button>
  238. </el-input>
  239. </template>
  240. </ux-table-column>
  241. <ux-table-column resizable title="业务备注" align="center" field="remark" width="150px" edit-render>
  242. <template v-slot:edit="scope">
  243. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.remark"/>
  244. </template>
  245. </ux-table-column>
  246. <ux-table-column resizable title="物料一级分类" align="center" field="materialClassifyOneName" width="100px"/>
  247. <ux-table-column resizable title="物料二级分类" align="center" field="materialClassifyTwoName" width="100px"/>
  248. <ux-table-column resizable title="物料三级分类" align="center" field="materialClassifyThreeName" width="100px"/>
  249. <ux-table-column resizable title="物料四级分类" align="center" field="materialClassifyFourName" width="100px"/>
  250. <ux-table-column resizable title="最小批量" align="center" field="minBatch" width="100px"/>
  251. <ux-table-column resizable title="最小订货量" align="center" field="minOrderQty" width="100px"/>
  252. <ux-table-column resizable title="采购员" align="center" field="buyerName" width="100px"/>
  253. <!-- <ux-table-column resizable title="采购员" align="center" field="buyer"/> -->
  254. <ux-table-column resizable title="采购周期" align="center" field="puPeriod" width="100px"/>
  255. <ux-table-column resizable title="交货日期" align="center" field="deliveryDate" width="230px" edit-render>
  256. <template v-slot:edit="scope">
  257. <el-date-picker
  258. v-model="scope.row.deliveryDate"
  259. :disabled="sonDisable"
  260. clearable
  261. type="date"
  262. size="mini"
  263. value-format="yyyy-MM-dd"
  264. :picker-options="pickerOptionsEnd"
  265. placeholder="选择日期">
  266. </el-date-picker>
  267. </template>
  268. </ux-table-column>
  269. <ux-table-column resizable title="有效期" align="center" field="expiry" width="100px"/>
  270. <ux-table-column resizable title="有效期单位" align="center" field="expiryUnit" width="100px"/>
  271. <!-- <ux-table-column resizable title="安全库存" align="center" field="safeStock" width="100px"/> -->
  272. <ux-table-column resizable title="注册人" align="center" field="registrant" width="100px"/>
  273. <!-- <ux-table-column resizable title="预留比例" align="center" field="reservedProportion" width="120px" edit-render>
  274. <template v-slot:edit="scope">
  275. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @clear="cleanYLSL(scope)">
  276. <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
  277. </el-option>
  278. </el-select>
  279. </template>
  280. </ux-table-column> -->
  281. <!-- <ux-table-column resizable title="预留周期" align="center" field="reservedPeriod" width="120px" edit-render>
  282. <template v-slot:edit="scope">
  283. <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedPeriod"></el-input>
  284. </template>
  285. </ux-table-column>
  286. <ux-table-column resizable title="预留数量" align="center" field="reservedQty" width="120px" edit-render>
  287. <template v-slot:edit="scope">
  288. <el-input type="number" min="0" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" @input="scope.row.reservedQty=Math.ceil(scope.row.reservedQty)" clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedQty"></el-input>
  289. </template>
  290. </ux-table-column> -->
  291. <ux-table-column resizable title="集团预测分类" align="center" field="forecastClassify" width="120px"/>
  292. <ux-table-column resizable title="近一月需求" align="center" field="onemonthAvgVolume" width="100px"/>
  293. <ux-table-column resizable title="近三月需求" align="center" field="threemonthAvgVolume" width="100px"/>
  294. <ux-table-column resizable title="采购在途" align="center" field="puFreight" width="100px"/>
  295. <ux-table-column resizable title="补单标识" align="center" field="isReplenishment" width="100px" edit-render>
  296. <template v-slot:edit="scope">
  297. <el-switch
  298. v-model="scope.row.isReplenishment"
  299. disabled
  300. active-value="Y"
  301. inactive-value="N"
  302. active-color="#13ce66"
  303. inactive-color="#a1a3a9">
  304. </el-switch>
  305. </template>
  306. <template v-slot="{ row }">{{ row.isReplenishment == 'Y' ? '是' : '否' }}</template>
  307. </ux-table-column>
  308. <ux-table-column resizable title="补单供应商" align="center" field="additionalSupplierName" width="200px" :render-header="anotherRedStar" edit-render>
  309. <template v-slot:edit="scope">
  310. <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.rowIndex, '选择补单供应商')" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  311. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.rowIndex, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
  312. </el-input>
  313. </template>
  314. </ux-table-column>
  315. <ux-table-column resizable title="末级供应库存组织" align="center" field="lastStockOrgName" width="180px"></ux-table-column>
  316. <ux-table-column resizable title="末级供应仓库" align="center" field="lastWarehouseName" width="150px"/>
  317. <ux-table-column resizable title="末级供应货位" align="center" field="lastAllocationName" width="150px"/>
  318. <ux-table-column resizable title="中心仓可用量" align="center" field="centralWarehouseQty" width="120px"/>
  319. <ux-table-column resizable title="调拨状态" align="center" field="statusAllot" width="100px" edit-render>
  320. <template v-slot:edit="scope">
  321. <el-switch
  322. v-model="scope.row.statusAllot"
  323. :disabled="sonDisable"
  324. active-value="Y"
  325. inactive-value="N"
  326. active-color="#13ce66"
  327. inactive-color="#a1a3a9">
  328. </el-switch>
  329. </template>
  330. <template v-slot="{ row }">{{ row.statusAllot == 'Y' ? '是' : '否' }}</template>
  331. </ux-table-column>
  332. <ux-table-column resizable title="调拨单号" align="center" field="allotCode"></ux-table-column>
  333. <ux-table-column resizable title="调拨占有量" align="center" field="allotQty" width="100px"/>
  334. <ux-table-column resizable title="最终净需求量" align="center" field="resDemandQty" width="120px"/>
  335. <ux-table-column resizable title="关闭数量" align="center" field="closeQty" width="80px"/>
  336. <ux-table-column resizable title="最终采购执行数量" align="center" field="executeQty" width="150px">
  337. <template v-slot:edit="scope">
  338. {{ scope.row.executeQty ? scope.row.executeQty : 0 }}
  339. </template>
  340. </ux-table-column>
  341. <ux-table-column resizable title="收货地址" align="center" field="deliveryAddressName" width="200px" edit-render>
  342. <template v-slot:edit="scope">
  343. <el-input clearable :disabled="sonDisable" size="mini" v-model="scope.row.deliveryAddressName" @clear="clearHang(scope.rowIndex, '选择收货地址')" @paste.native="pasteMe($event, scope, scope.rowIndex)">
  344. <el-button size="mini" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseDept(scope.rowIndex, 'ADDRESS_PARAM', true, '选择收货地址')"></el-button>
  345. </el-input>
  346. </template>
  347. </ux-table-column>
  348. <ux-table-column resizable title="联系人" align="center" field="contacts" width="100px"/>
  349. <ux-table-column resizable title="联系人电话" align="center" field="contactsPhone" width="150px"/>
  350. <ux-table-column resizable title="详细地址" align="center" field="address" width="150px"/>
  351. <ux-table-column resizable title="价格类型" align="center" field="priceType" width="120px" edit-render>
  352. <template v-slot:edit="scope">
  353. <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.priceType">
  354. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  355. </el-option>
  356. </el-select>
  357. </template>
  358. <template v-slot="{ row }">{{ row.priceType == 'order' ? '订货价' : row.priceType == 'consignment' ? '寄售价' : row.priceType == 'adjusted' ? '调货价' : ''}}</template>
  359. </ux-table-column>
  360. <ux-table-column resizable title="是否客户指定" align="center" field="isCustomerSpecified" width="120px" edit-render>
  361. <template v-slot:edit="scope">
  362. <el-switch
  363. v-model="scope.row.isCustomerSpecified"
  364. disabled
  365. active-value="Y"
  366. inactive-value="N"
  367. active-color="#13ce66"
  368. inactive-color="#a1a3a9">
  369. </el-switch>
  370. </template>
  371. <template v-slot="{ row }">{{ row.isCustomerSpecified == 'Y' ? '是' : '否' }}</template>
  372. </ux-table-column>
  373. <!-- <ux-table-column resizable title="批号锁定标识" align="center" field="isBatchLock" width="100px">
  374. <template v-slot:edit="scope">
  375. <el-form-item class="hang">
  376. <el-switch
  377. v-model="scope.row.isBatchLock"
  378. :disabled="sonDisable"
  379. active-value="Y"
  380. inactive-value="N"
  381. active-color="#13ce66"
  382. inactive-color="#a1a3a9">
  383. </el-switch>
  384. </el-form-item>
  385. </template>
  386. </ux-table-column> -->
  387. <ux-table-column resizable title="采购备注" align="center" field="updateCause" width="100px"/>
  388. <ux-table-column resizable title="可用量" align="center" field="availableQty" width="100px"/>
  389. <ux-table-column
  390. fixed="right"
  391. title="操作"
  392. width="100px"
  393. align="center"
  394. >
  395. <template slot-scope="scope">
  396. <el-button type="text" size="mini" :disabled="sonDisable" @click="delLine(scope.rowIndex, scope.row)">删除</el-button>
  397. </template>
  398. </ux-table-column>
  399. </ux-grid>
  400. </el-form>
  401. <div class="btn_group">
  402. <el-button type="primary" size="mini" @click="jumpOA" v-if="sonPageStu == 'check' && (row.status == '1' || row.status == '2') && basicForm.flowId">流程跳转</el-button>
  403. <el-button type="primary" size="mini" @click="copy" v-if="sonPageStu == 'check'">复制</el-button>
  404. <el-button type="primary" size="mini" @click="editPage" v-if="sonPageStu == 'check' && row.status == '0'">编辑</el-button>
  405. <el-button type="primary" size="mini" @click="save" v-if="sonPageStu == 'add' || sonPageStu == 'edit'">保存</el-button>
  406. <el-button type="primary" size="mini" @click="submit" v-if="sonPageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
  407. <el-button size="mini" plain @click="back">返回</el-button>
  408. </div>
  409. </el-card>
  410. <Reserved v-if="dialog.config" :isVisible="dialog.config" :info="row" @updateReserved="updateReserved"/>
  411. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  412. <popDialog ref="materialRefer" @doSubmit="selectMaterial" :single="false" />
  413. <!-- 批量调整参数 -->
  414. <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="38%">
  415. <el-row style="margin-bottom: 10px;">
  416. <el-col :span="6" class="pltzTxt">默认采购组织</el-col>
  417. <el-col :span="14">
  418. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.purOrgName" @clear="clearHang(0, 'cgzz')" @focus="chooseOrg('ORG_PARAM', true, '采购组织')">
  419. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ORG_PARAM', true, '采购组织')"></el-button>
  420. </el-input>
  421. </el-col>
  422. </el-row>
  423. <el-row style="margin-bottom: 10px;">
  424. <el-col :span="6" class="pltzTxt">价格类型</el-col>
  425. <el-col :span="14">
  426. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.priceType">
  427. <el-option v-for=" dict in dict.type.sys_price_type" :key="dict.value" :label="dict.label" :value="dict.value">
  428. </el-option>
  429. </el-select>
  430. </el-col>
  431. </el-row>
  432. <el-row style="margin-bottom: 10px;">
  433. <el-col :span="6" class="pltzTxt">采购员</el-col>
  434. <el-col :span="14">
  435. <el-select class="pltzIpt" clearable size="mini" v-model="adjust.purchaseMan" @focus="chooseOrg('CONTACTS_PARAM', true, '采购员')">
  436. <el-option v-for="item in purchaseManOptions" :key="item.id" :label="item.name" :value="item.code" />
  437. </el-select>
  438. </el-col>
  439. </el-row>
  440. <el-row style="margin-bottom: 10px;">
  441. <el-col :span="6" class="pltzTxt">收货仓库</el-col>
  442. <el-col :span="14">
  443. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.warehouseName" @clear="clearHang(0, 'shck')" @focus="adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)">
  444. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustCangku('WAREHOUSE_PARAM', true, '收货仓库', adjust.puOrg)"></el-button>
  445. </el-input>
  446. </el-col>
  447. </el-row>
  448. <el-row style="margin-bottom: 10px;">
  449. <el-col :span="6" class="pltzTxt">收货货位</el-col>
  450. <el-col :span="14">
  451. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.allocationName" @clear="clearHang(0, 'shhw')" @focus="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)">
  452. <el-button size="mini" slot="append" icon="el-icon-more" @click="adjustHuoWei('ALLOCATION_PARAM', true, '收货货位', adjust.warehouse)"></el-button>
  453. </el-input>
  454. </el-col>
  455. </el-row>
  456. <el-row style="margin-bottom: 10px;">
  457. <el-col :span="6" class="pltzTxt">补单供应商</el-col>
  458. <el-col :span="14">
  459. <el-input class="pltzIpt" clearable :disabled="sonDisable || BDZT" size="mini" @clear="clearHang(0, 'bdgys')" v-model="adjust.additionalSupplierName" @focus="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')">
  460. <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"></el-button>
  461. </el-input>
  462. </el-col>
  463. </el-row>
  464. <el-row style="margin-bottom: 10px;">
  465. <el-col :span="6" class="pltzTxt">业务备注</el-col>
  466. <el-col :span="14">
  467. <el-input class="pltzIpt" clearable size="mini" v-model="adjust.remark"/>
  468. </el-col>
  469. </el-row>
  470. <el-row style="margin-bottom: 10px;">
  471. <el-col :span="6" class="pltzTxt">收货地址</el-col>
  472. <el-col :span="14">
  473. <el-input class="pltzIpt" clearable size="mini" @clear="clearHang(0, 'shdz')" v-model="adjust.deliveryAddressName">
  474. <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ADDRESS_PARAM', true, '收货地址')"></el-button>
  475. </el-input>
  476. </el-col>
  477. </el-row>
  478. <el-row style="margin-bottom: 10px;">
  479. <el-col :span="6" class="pltzTxt">收货地址编码</el-col>
  480. <el-col :span="14">
  481. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.deliveryAddress"/>
  482. </el-col>
  483. </el-row>
  484. <el-row style="margin-bottom: 10px;">
  485. <el-col :span="6" class="pltzTxt">联系人</el-col>
  486. <el-col :span="14">
  487. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contacts"/>
  488. </el-col>
  489. </el-row>
  490. <el-row style="margin-bottom: 10px;">
  491. <el-col :span="6" class="pltzTxt">联系人电话</el-col>
  492. <el-col :span="14">
  493. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.contactsPhone"/>
  494. </el-col>
  495. </el-row>
  496. <el-row style="margin-bottom: 10px;">
  497. <el-col :span="6" class="pltzTxt">详细地址</el-col>
  498. <el-col :span="14">
  499. <el-input class="pltzIpt" disabled clearable size="mini" v-model="adjust.address"/>
  500. </el-col>
  501. </el-row>
  502. <div slot="footer">
  503. <el-button size="mini" type="primary" @click="confirmAdjust">确 认</el-button>
  504. <el-button size="mini" @click="adjust.open = false">取 消</el-button>
  505. </div>
  506. </el-dialog>
  507. </div>
  508. </template>
  509. <script>
  510. import Reserved from './reserved.vue'
  511. import Refers from '@/components/Refers/refers.vue'
  512. import {addDemand,getDemandDetail, getDemandSonDetail, editDemand, submitDemand, queryMan, toOA, confirmSubmit } from '@/api/purchase/purchaseDemand.js'
  513. // 用于回显参照框数据
  514. import {getRefer} from '@/api/purchase/basic.js'
  515. // 明细行选择物料参照
  516. import popDialog from '@/components/PopDialog/index.vue'
  517. import ElTableInfiniteScroll from "el-table-infinite-scroll";
  518. import 'regenerator-runtime/runtime'
  519. export default {
  520. directives: {
  521. "el-table-infinite-scroll": ElTableInfiniteScroll,
  522. },
  523. name: 'addDemandList',
  524. props: ['pageStu','row', 'disable'],
  525. dicts: ['sys_processing_mode', 'sys_plan_type', 'sys_status', 'sys_bill_source', 'sys_business','sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  526. components: {
  527. Reserved,
  528. Refers,
  529. popDialog
  530. },
  531. model: {
  532. prop: 'isList',
  533. event: 'jugislist'
  534. },
  535. data() {
  536. return {
  537. loading: true,
  538. // 不能直接改变props传来的值
  539. sonPageStu: this.pageStu,
  540. sonDisable: this.disable,
  541. // BDZT是补单供应商是否可以编辑条件
  542. BDZT: true,
  543. dialog: {
  544. config: false
  545. },
  546. basicForm: {
  547. code: '',
  548. org: '',
  549. orgName: '',
  550. demandBusinessType: '1',
  551. status: '0',
  552. customer: '',
  553. customerName: '',
  554. customerCode: '',
  555. customerPrincipal: '',
  556. demandPersonal: '',
  557. demandPersonalName: '',
  558. demandDept: '',
  559. demandDeptName: '',
  560. planType: 'ZJH',
  561. demandDate: '',
  562. source: '4',
  563. isBeyondRap: '',
  564. billType: 'ZQBH',
  565. isCustomerSpecified: 'N',
  566. isProcess: '',
  567. isMonthleyCalculate: '',
  568. createTime: this.parseTime(new Date().getTime()),
  569. remark: '',
  570. puDemandItemList: []
  571. },
  572. delDemandItemList: [],
  573. options: [{
  574. value: 'Y', label: '是',
  575. }, {
  576. value: 'N', label: '否'
  577. }],
  578. basicRules: {},
  579. tableList: [],
  580. referCondition: {
  581. type: '',
  582. isPage: true,
  583. title: '',
  584. },
  585. // referCondition: {
  586. // type: '',
  587. // isPage: true,
  588. // title: '',
  589. // },
  590. tableIndex: null,
  591. ids: [],
  592. orgOptions: [],
  593. manOptions: [],
  594. personOptions: [],
  595. deptOptions: [],
  596. customerOptions: [],
  597. pickerOptionsEnd: {
  598. disabledDate: (time) => {
  599. return time.getTime() < new Date(this.basicForm.demandDate).getTime() - 8.64e7
  600. }
  601. },
  602. isBDXQ: false,
  603. isYl: false,
  604. // 批量调整参数
  605. adjust: {
  606. open: false,
  607. puOrg: '',
  608. purOrgName: '',
  609. priceType: '',
  610. purchaseMan: '',
  611. purchaseManName: '',
  612. warehouse: '',
  613. warehouseName: '',
  614. csFlag: '',
  615. allocation: '',
  616. allocationName: '',
  617. additionalSupplier: '',
  618. additionalSupplierName: '',
  619. remark:'',
  620. deliveryAddress: '',
  621. deliveryAddressName: '',
  622. contacts: '',
  623. contactsPhone: '',
  624. address: ''
  625. },
  626. purchaseManOptions: [],
  627. sonModel: {
  628. rowNo: null,
  629. contacts: null,
  630. id: null,
  631. demandId: null,
  632. status: null,
  633. materialCategory: null,
  634. buyer: null,
  635. buyerName: null,
  636. mateiralClassifyOne: null,
  637. materialClassifyOneName: null,
  638. materialClassifyTwo: null,
  639. materialClassifyTwoName: null,
  640. materialClassifyThree: null,
  641. materialClassifyThreeName: null,
  642. materialClassifyFour: null,
  643. materialClassifyFourName: null,
  644. materialCode: null,
  645. material: null,
  646. materialName: null,
  647. classifyId: null,
  648. specification: null,
  649. unit: null,
  650. unitName: null,
  651. manufacturerName: null,
  652. registrant: null,
  653. puPeriod: null,
  654. expiryUnit: null,
  655. expiry: null,
  656. minPackage: null,
  657. minOrderQty: null,
  658. minBatch: null,
  659. safeStock: null,
  660. averageQtyMonth: null,
  661. qty: null,
  662. adjustmentPersonal: null,
  663. adjustmentTime: null,
  664. manualRegulation: null,
  665. updateCause: null,
  666. reservedProportion: null,
  667. reservedPeriod: null,
  668. reservedQty: null,
  669. demandPeriod: null,
  670. forecastClassify: null,
  671. onemonthAvgVolume: null,
  672. threemonthAvgVolume: null,
  673. puFreight: null,
  674. deliveryDate: null,
  675. isUrgency: 'N',
  676. isReplenishment: 'N',
  677. isBatchLock: 'N',
  678. isCustomerSpecified: '',
  679. remark: null,
  680. puRemark: null,
  681. lastWarehouseQty: null,
  682. resDemandQty: null,
  683. lastWarehouse: null,
  684. lastWarehouseName: null,
  685. deliveryWarehouse: null,
  686. deliveryWarehouseName: null,
  687. lastAllocation: null,
  688. lastAllocationName: null,
  689. deliveryAllocation: null,
  690. deliveryAllocationName: null,
  691. passageOn: null,
  692. puOrg: null,
  693. purOrgName: null,
  694. lastStockQty: null,
  695. superiorCenterQty: null,
  696. superiorAllotQty: null,
  697. availableQty: null,
  698. statusAllot: 'N',
  699. additionalSupplier: null,
  700. additionalSupplierName: null,
  701. periodUnit: null,
  702. demandCustomer: null,
  703. demandCustomerName: null,
  704. lastStockOrg: null,
  705. lastStockOrgName: null,
  706. superiorStockOrg: null,
  707. superiorStockOrgName: null,
  708. allotCode: null,
  709. deliveryAddress: null,
  710. deliveryAddressName: null,
  711. contacts: null,
  712. contactsPhone: null,
  713. address: null,
  714. source: null,
  715. priceType: 'order',
  716. puManagerApprover: null,
  717. puManagerApproverName: null,
  718. processTime: null,
  719. affirmer: null,
  720. tenantId: null,
  721. revision: null,
  722. createBy: null,
  723. createByName: null,
  724. createTime: null,
  725. updateBy: null,
  726. updateByName: null,
  727. updateTime: null,
  728. delFlag: 0,
  729. csFlag: 'N',
  730. // 新增字段
  731. model: null,
  732. storageCondition: null,
  733. transportationCondition: null,
  734. },
  735. // 无限滚动配置
  736. loadDisabled: true,
  737. page: 0,
  738. total: 5,
  739. // 表格校验规则
  740. tableRules: {
  741. materialCode : [{required: true, message: '物料编码必填'}],
  742. qty: [{required: true, message: '实际业务需求量必填'}],
  743. },
  744. }
  745. },
  746. created() {
  747. if(this.pageStu == 'check') {
  748. console.log('数据', this.row)
  749. this.getDetails(this.row)
  750. } else if(this.pageStu == 'edit') {
  751. this.getDetails(this.row)
  752. } else if (this.pageStu == 'add') {
  753. // 新增时判断需求日期
  754. this.dafaultDate()
  755. this.loading = false
  756. this.basicForm.demandPersonal = this.$store.state.user.name
  757. this.basicForm.demandPersonalName = this.$store.state.user.nickName
  758. this.basicForm.demandDept = this.$store.state.user.deptId
  759. this.basicForm.demandDeptName = this.$store.state.user.deptName
  760. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  761. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  762. }
  763. },
  764. methods: {
  765. // 默认需求日期根据当天星期几判断
  766. dafaultDate() {
  767. // 获取当前时间
  768. let date = new Date()
  769. //获取当前时间的年份转为字符串
  770. let year = date.getFullYear().toString()
  771. //获取月份,由于月份从0开始,此处要加1,判断是否小于10,如果是在字符串前面拼接'0'
  772. let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString() //'04'
  773. //获取天,判断是否小于10,如果是在字符串前面拼接'0'
  774. let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'12'
  775. let today = year + '-' + month + '-' + da
  776. console.log('今天日期',today)
  777. let weekDay = date.getDay()
  778. console.log('今天星期几', weekDay)
  779. // 改变需求计划的判断写这里面了
  780. if (this.basicForm.planType == 'JJXQ') {
  781. this.basicForm.demandDate = today
  782. } else {
  783. if (weekDay == 0) {this.basicForm.demandDate = this.getNextDate(today, 2)}
  784. else if (weekDay == 1) {this.basicForm.demandDate = this.getNextDate(today, 1)}
  785. else if (weekDay == 2) {this.basicForm.demandDate = today}
  786. else if (weekDay == 3) {this.basicForm.demandDate = this.getNextDate(today, 6)}
  787. else if (weekDay == 4) {this.basicForm.demandDate = this.getNextDate(today, 5)}
  788. else if (weekDay == 5) {this.basicForm.demandDate = this.getNextDate(today, 4)}
  789. else if (weekDay == 6) {this.basicForm.demandDate = this.getNextDate(today, 3)}
  790. // console.log(this.getNextDate(today, 2))
  791. }
  792. },
  793. // 获取某天日期的下一天,默认为第二天 默认输出格式为yyyy-mm-dd
  794. getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
  795. if (date) {
  796. date = date.match(/\d+/g).join('-'); // 格式为2022年09月19日处理
  797. const nDate = new Date(date);
  798. nDate.setDate(nDate.getDate() + day);
  799. const formatObj = {
  800. y: nDate.getFullYear(),
  801. m: nDate.getMonth() + 1,
  802. d: nDate.getDate(),
  803. };
  804. return format.replace(/{([ymd])+}/g, (result, key) => {
  805. const value = formatObj[key];
  806. return value.toString().padStart(2, '0');
  807. });
  808. } else {
  809. console.log('date格式不正确');
  810. }
  811. },
  812. // 改变需求计划改变需求日期
  813. changeplanType(val) {
  814. this.dafaultDate()
  815. console.log(val)
  816. if (val == 'JJXQ') {
  817. this.basicForm.billType = 'JJXQ'
  818. } else {
  819. if (this.basicForm.billType == 'JJXQ') {
  820. this.basicForm.billType = ''
  821. }
  822. }
  823. if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  824. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  825. } else {
  826. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'N'})
  827. }
  828. },
  829. // 无限滚动加载配置
  830. load() {
  831. if (this.loadDisabled) return;
  832. this.page++;
  833. if (this.page <= this.total) {
  834. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.concat(this.basicForm.puDemandItemList);
  835. }
  836. if (this.page === this.total) {
  837. this.loadDisabled = true;
  838. }
  839. },
  840. // 改变单据日期时清空子表的调拨日期
  841. changeDemandDate() {
  842. this.basicForm.puDemandItemList.forEach(item => {
  843. item.deliveryDate = null
  844. })
  845. },
  846. // 更改业务类型调整明细行内补单或紧急标识
  847. changeBillType(val) {
  848. if (val == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
  849. this.isBDXQ = true
  850. this.BDZT = false
  851. this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
  852. } else {
  853. this.isBDXQ = false
  854. this.BDZT = true
  855. this.basicForm.puDemandItemList.forEach(item => {
  856. item.isReplenishment = 'N'
  857. item.additionalSupplier = null
  858. item.additionalSupplierName = null
  859. })
  860. }
  861. if (val == 'JJXQ') {
  862. this.basicForm.planType = 'JJXQ'
  863. // 判断需求日期
  864. this.dafaultDate()
  865. } else {
  866. if (this.basicForm.planType == 'JJXQ') {
  867. this.basicForm.planType = ''
  868. }
  869. }
  870. if (val == 'JJXQ' && this.basicForm.puDemandItemList.length != 0) {
  871. this.basicForm.puDemandItemList.forEach(item => {item.isUrgency = 'Y'})
  872. } else {
  873. this.basicForm.puDemandItemList.forEach(item => { item.isUrgency = 'N' })
  874. }
  875. },
  876. // 改变是否客户指定
  877. isCustomer() {
  878. if (this.basicForm.isCustomerSpecified == 'Y' && this.basicForm.puDemandItemList.length != 0) {
  879. this.basicForm.puDemandItemList.forEach(item => {item.isCustomerSpecified = 'Y'})
  880. } else {
  881. this.basicForm.puDemandItemList.forEach(item => {item.isCustomerSpecified = 'N'})
  882. }
  883. },
  884. hangStatus(row) {
  885. switch (row.row.status) {
  886. case '0':
  887. return '需补货'
  888. case '1':
  889. return '待计划确认'
  890. case '2':
  891. return '计划已确认'
  892. case '3':
  893. return '计划已审核'
  894. case '4':
  895. return '行关闭'
  896. case '5':
  897. return '总供应可满足'
  898. }
  899. },
  900. // 清空
  901. cleanYLSL(scope) {
  902. scope.row.reservedQty = ''
  903. scope.row.reservedPeriod = ''
  904. },
  905. copy() {
  906. this.$modal.notifySuccess("复制成功");
  907. this.sonPageStu = 'add'
  908. this.sonDisable = false
  909. // this.getDetails(this.row)
  910. this.basicForm.id = ''
  911. this.basicForm.code = ''
  912. this.basicForm.createBy = ''
  913. this.basicForm.source = '4'
  914. this.basicForm.isCustomerSpecified = 'N'
  915. this.basicForm.flowId = ''
  916. this.basicForm.demandPersonal = this.$store.state.user.name
  917. this.basicForm.demandPersonalName = this.$store.state.user.nickName
  918. this.basicForm.demandDept = this.$store.state.user.deptId
  919. this.basicForm.demandDeptName = this.$store.state.user.deptName
  920. // 复制时判断需求日期
  921. this.dafaultDate()
  922. if (this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  923. if (this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  924. this.basicForm.puDemandItemList.forEach(item => {
  925. item.status = ''
  926. item.buyerName = ''
  927. item.buyer = ''
  928. item.reservedProportion = ''
  929. item.reservedPeriod = ''
  930. item.reservedQty = ''
  931. item.averageQtyMonth = ''
  932. item.demandPeriod = ''
  933. item.forecastClassify = ''
  934. item.onemonthAvgVolume = ''
  935. item.threemonthAvgVolume = ''
  936. item.puFreight = ''
  937. item.superiorAllotQty = ''
  938. item.resDemandQty = ''
  939. item.executeQty = ''
  940. item.deliveryWarehouseName = ''
  941. item.deliveryWarehouse = ''
  942. item.deliveryAllocationName = ''
  943. item.deliveryAllocation = ''
  944. item.lastWarehouseName = ''
  945. item.lastAllocationName = ''
  946. item.availableQty = ''
  947. item.lastStockOrgName = ''
  948. item.centralWarehouseQty = ''
  949. item.allotCode = ''
  950. item.allotQty = ''
  951. item.deliveryAddress = ''
  952. item.deliveryAddressName = ''
  953. item.contacts = ''
  954. item.contactsPhone = ''
  955. item.address = ''
  956. item.statusAllot = 'N'
  957. })
  958. },
  959. editPage() {
  960. this.sonPageStu = 'edit'
  961. this.sonDisable = false
  962. },
  963. handleData() {
  964. console.log('222')
  965. // 复制新增把id,需求单号,创建人置为空,子表去掉id
  966. this.basicForm.id = ''
  967. this.basicForm.code = ''
  968. this.basicForm.createBy = ''
  969. this.basicForm.source = '4'
  970. if (this.basicForm.puDemandItemList.length !== 0) {
  971. this.basicForm.puDemandItemList.forEach(item => {
  972. if (item.id) {
  973. delete item.id
  974. }
  975. if (item.demandId) {
  976. delete item.demandId
  977. }
  978. if (item.allotCode) {
  979. delete item.allotCode
  980. }
  981. })
  982. }
  983. },
  984. async save() {
  985. if(this.basicForm.puDemandItemList.length !== 0) {
  986. this.$refs['basic'].validate((valid, obj) => {
  987. if(valid) {
  988. // 加上表格校验
  989. this.$refs.table.fullValidate().then(data=> {
  990. if(!data) {
  991. this.$modal.loading("保存中...");
  992. if(this.sonPageStu == 'add') {
  993. this.handleData()
  994. addDemand(this.basicForm).then(res => {
  995. if (res.code === 200) {
  996. this.$modal.notifySuccess(res.msg);
  997. this.$modal.closeLoading();
  998. this.back()
  999. }
  1000. }).catch(err => {
  1001. // 加入定时器防止报错关不掉遮罩
  1002. setTimeout(() => {
  1003. let errorList = JSON.parse(err.message).rowList
  1004. console.log(errorList)
  1005. this.gainRed(errorList)
  1006. }, 500)
  1007. this.$modal.closeLoading();
  1008. })
  1009. } else if (this.sonPageStu == 'edit') {
  1010. let list = []
  1011. list.push(...this.basicForm.puDemandItemList, ...this.delDemandItemList)
  1012. // 深拷贝一下参数对象
  1013. let param = JSON.parse(JSON.stringify(this.basicForm))
  1014. console.log('深拷贝对象',param);
  1015. param.puDemandItemList = list
  1016. // this.basicForm.puDemandItemList.push(...this.delDemandItemList)
  1017. editDemand(param).then(res => {
  1018. if (res.code === 200) {
  1019. this.$modal.notifySuccess(res.msg);
  1020. this.$modal.closeLoading();
  1021. this.back()
  1022. }
  1023. }).catch(err => {
  1024. // 加入定时器防止报错关不掉遮罩
  1025. setTimeout(() => {
  1026. let errorList = JSON.parse(err.message).rowList
  1027. // console.log(errorList)
  1028. this.gainRed(errorList)
  1029. },500)
  1030. this.$modal.closeLoading();
  1031. })
  1032. }
  1033. } else {
  1034. let masStr = ''
  1035. Object.values(data).forEach(errList => {
  1036. console.log('data',data)
  1037. console.log(errList)
  1038. // 将子表下标加入进入标识字段
  1039. this.basicForm.puDemandItemList.forEach((item,index) => {
  1040. item.rightIndex = index
  1041. })
  1042. console.log('所有列表', this.basicForm.puDemandItemList)
  1043. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1044. let rightList = this.basicForm.puDemandItemList.filter((item, index) => {
  1045. return errList.find(item2 => {
  1046. return item2.rowIndex !== item.rightIndex
  1047. })
  1048. })
  1049. console.log('xxx',rightList)
  1050. rightList.forEach(items => {
  1051. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
  1052. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
  1053. }
  1054. })
  1055. errList.forEach(params => {
  1056. let { rowIndex, column, rules } = params
  1057. rules.forEach(rule => {
  1058. masStr += `第 ${rowIndex + 1} 行${rule.message};`
  1059. })
  1060. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`)) {
  1061. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`).style.background = '#f34b4bb8'
  1062. }
  1063. })
  1064. })
  1065. this.$modal.notifyError(masStr);
  1066. }
  1067. })
  1068. } else {
  1069. // 校验加弹窗
  1070. const jiaoyan = []
  1071. for(let key in obj) {
  1072. jiaoyan.push(obj[key][0].message);
  1073. }
  1074. this.$modal.notifyWarning(jiaoyan[0]);
  1075. return false
  1076. }
  1077. })
  1078. } else {
  1079. this.$modal.notifyWarning("明细信息不能为空!");
  1080. }
  1081. },
  1082. // 后端校验标红方法
  1083. gainRed(errList) {
  1084. // 将子表下标加入进入标识字段
  1085. this.basicForm.puDemandItemList.forEach((item,index) => {
  1086. item.rightIndex = index
  1087. })
  1088. console.log('所有列表', this.basicForm.puDemandItemList)
  1089. // 将校验未通过的项与整个表格数据进行过滤对比,得出校验通过的数据
  1090. let rightList = this.basicForm.puDemandItemList.filter((item, index) => {
  1091. return errList.find(item2 => {
  1092. return item2.rowIndex !== item.rightIndex
  1093. })
  1094. })
  1095. console.log('xxx',rightList)
  1096. rightList.forEach(items => {
  1097. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
  1098. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
  1099. }
  1100. })
  1101. errList.forEach(item => {
  1102. if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`)) {
  1103. this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`).style.background = '#f34b4bb8'
  1104. }
  1105. })
  1106. },
  1107. submit() {
  1108. this.$modal.loading("提交中...");
  1109. submitDemand(this.basicForm).then(res => {
  1110. if (res.code === 200) {
  1111. this.$modal.notifySuccess("提交成功");
  1112. this.$modal.closeLoading();
  1113. this.back()
  1114. }
  1115. if (res.code === 233) {
  1116. this.$modal.confirm(res.msg).then(function() {
  1117. // 确认
  1118. }).then(() => {
  1119. confirmSubmit(this.basicForm).then(res => {
  1120. if (res.code === 200) {
  1121. this.$modal.notifySuccess("提交成功");
  1122. this.$modal.closeLoading();
  1123. this.back()
  1124. }
  1125. }).catch(err => {
  1126. this.$modal.closeLoading();
  1127. })
  1128. // 取消
  1129. }).catch(() => {
  1130. this.$modal.closeLoading();
  1131. })
  1132. this.$modal.closeLoading();
  1133. }
  1134. }).catch(err => {
  1135. // 加入定时器防止报错关不掉遮罩
  1136. setTimeout(() => {
  1137. let errorList = JSON.parse(err.message).rowList
  1138. console.log(errorList)
  1139. this.gainRed(errorList)
  1140. }, 500)
  1141. this.$modal.closeLoading();
  1142. })
  1143. },
  1144. // 增行
  1145. addLine() {
  1146. const newLine = {...this.sonModel}
  1147. newLine.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1148. newLine.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1149. newLine.demandCustomer = this.basicForm.customer
  1150. newLine.demandCustomerName = this.basicForm.customerName
  1151. this.basicForm.puDemandItemList.push(newLine)
  1152. // 补单需求状态改变
  1153. if (this.basicForm.billType == 'BDXQ') {
  1154. this.BDZT = false
  1155. } else {
  1156. this.BDZT = true
  1157. }
  1158. },
  1159. delLine(index, row) {
  1160. row.delFlag = '2'
  1161. let delList = []
  1162. delList = this.basicForm.puDemandItemList.filter(item => {
  1163. return item.delFlag == '2'
  1164. })
  1165. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  1166. return item.delFlag == '0'
  1167. })
  1168. this.delDemandItemList.push(...delList)
  1169. console.log('删除的数组',this.delDemandItemList)
  1170. },
  1171. // 批量删除行
  1172. delLines() {
  1173. let delArr = this.$refs.table.getCheckboxRecords()
  1174. if (delArr.length !== 0) {
  1175. delArr.forEach(item => {
  1176. item.delFlag = '2'
  1177. })
  1178. console.log('kk',this.basicForm.puDemandItemList)
  1179. let delList = []
  1180. delList = this.basicForm.puDemandItemList.filter(item => {
  1181. return item.delFlag == '2'
  1182. })
  1183. this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
  1184. return item.delFlag == '0'
  1185. })
  1186. this.delDemandItemList.push(...delList)
  1187. } else {
  1188. this.$modal.notifyWarning('请至少选择一条明细!')
  1189. }
  1190. },
  1191. back() {
  1192. console.log('打印人员信息看看', this.$store.state)
  1193. this.$emit('jugislist', true)
  1194. this.$emit('refresh')
  1195. },
  1196. // 如果需要回显则调用详情接口
  1197. getDetails(row) {
  1198. getDemandDetail(row.id).then(res => {
  1199. if (res.code === 200) {
  1200. // this.basicForm = res.data
  1201. let reciveForm = res.data
  1202. let params = {...{id: row.id}, ...{pageNum:1, pageSize: 10}}
  1203. getDemandSonDetail(params).then(res => {
  1204. if (res.code === 200) {
  1205. reciveForm.puDemandItemList = res.data
  1206. console.log('reciveForm',reciveForm)
  1207. this.basicForm = reciveForm
  1208. if(this.basicForm.org) { this.reBackRefer('ORG_PARAM', this.basicForm.org) }
  1209. if(this.basicForm.customer) { this.reBackRefer('CUSTOMER_PARAM', this.basicForm.customer) }
  1210. if(this.basicForm.customerPrincipal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.customerPrincipal, '客户负责人') }
  1211. if(this.basicForm.demandPersonal) { this.reBackRefer('CONTACTS_PARAM', this.basicForm.demandPersonal, '需求人员') }
  1212. if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
  1213. // 详情时将收货仓库id赋值给stordocId
  1214. // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
  1215. if(this.basicForm.billType == 'BDXQ') {
  1216. this.BDZT = false
  1217. this.isBDXQ = true
  1218. } else {
  1219. this.BDZT = true
  1220. this.isBDXQ = false
  1221. }
  1222. }
  1223. }).then(() => {
  1224. this.loading = false
  1225. }).catch(err => {
  1226. this.loading = false
  1227. })
  1228. }
  1229. })
  1230. },
  1231. // 单元格标红
  1232. cellClassName({row, column, rowIndex, columnIndex}) {
  1233. if(this.basicForm.isCustomerSpecified == 'N' && column.title == "需求可用周期" && Number(row.demandPeriod) > 1.5 && Number(row.qty) > Number(row.minOrderQty)) {
  1234. return 'success-row';
  1235. }
  1236. },
  1237. handleSelectionChange(selection) {
  1238. this.ids = selection.map(item =>{
  1239. return item.id
  1240. })
  1241. console.log('选中数组', this.ids)
  1242. },
  1243. rowSelect(row) {
  1244. this.$refs.table.toggleRowSelection(row);
  1245. },
  1246. // 点击预留单展示
  1247. showReserved() {
  1248. this.dialog.config = true
  1249. },
  1250. // 修改是否让页面显示与隐藏的事件
  1251. updateReserved (val) {
  1252. this.dialog.config = val
  1253. },
  1254. // 回显参照框
  1255. reBackRefer(type, id, title) {
  1256. getRefer({type: type, id: id}).then(res => {
  1257. if(type == 'ORG_PARAM') {
  1258. this.orgOptions = res.rows
  1259. }
  1260. if (type == 'CUSTOMER_PARAM') {
  1261. this.customerOptions = res.rows
  1262. }
  1263. if (type == 'CONTACTS_PARAM' && title == '需求人员') {
  1264. this.personOptions = res.rows
  1265. }
  1266. if (type == 'CONTACTS_PARAM' && title == '客户负责人') {
  1267. this.manOptions = res.rows
  1268. }
  1269. if (type == 'DEPT_PARAM') {
  1270. this.deptOptions = res.rows
  1271. }
  1272. })
  1273. },
  1274. chooseOrg(type, isPage, title) {
  1275. this.referCondition.type = type
  1276. this.referCondition.isPage = isPage
  1277. this.referCondition.title = title
  1278. this.$refs.refer.init(this.referCondition)
  1279. },
  1280. selectionsToInput(selection) {
  1281. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '选择组织') {
  1282. this.orgOptions = selection
  1283. this.basicForm.org = selection[0].id
  1284. this.basicForm.orgName = selection[0].name
  1285. }
  1286. if(this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  1287. this.customerOptions = selection
  1288. this.basicForm.customer = selection[0].id
  1289. this.basicForm.customerName = selection[0].name
  1290. this.basicForm.customerCode = selection[0].code
  1291. if(this.basicForm.puDemandItemList.length !== 0) {
  1292. this.basicForm.puDemandItemList.forEach(item => {
  1293. item.demandCustomerName = this.basicForm.customerName
  1294. item.demandCustomer = this.basicForm.customer
  1295. item.status = ''
  1296. item.buyerName = ''
  1297. item.buyer = ''
  1298. item.reservedProportion = ''
  1299. item.reservedPeriod = ''
  1300. item.reservedQty = ''
  1301. item.averageQtyMonth = ''
  1302. item.demandPeriod = ''
  1303. item.forecastClassify = ''
  1304. item.onemonthAvgVolume = ''
  1305. item.threemonthAvgVolume = ''
  1306. item.puFreight = ''
  1307. item.superiorAllotQty = ''
  1308. item.resDemandQty = ''
  1309. item.executeQty = ''
  1310. item.deliveryWarehouseName = ''
  1311. item.deliveryWarehouse = ''
  1312. item.deliveryAllocationName = ''
  1313. item.deliveryAllocation = ''
  1314. item.lastWarehouseName = ''
  1315. item.lastAllocationName = ''
  1316. item.availableQty = ''
  1317. item.lastStockOrgName = ''
  1318. item.centralWarehouseQty = ''
  1319. item.allotCode = ''
  1320. item.deliveryAddress = ''
  1321. item.deliveryAddressName = ''
  1322. item.contacts = ''
  1323. item.contactsPhone = ''
  1324. item.address = ''
  1325. })
  1326. }
  1327. }
  1328. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '需求人员') {
  1329. this.personOptions = selection
  1330. this.basicForm.demandPersonal = selection[0].code
  1331. this.basicForm.demandPersonalName = selection[0].name
  1332. }
  1333. if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '采购组织') {
  1334. this.adjust.puOrg = selection[0].id
  1335. this.adjust.purOrgName = selection[0].name
  1336. }
  1337. if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
  1338. this.purchaseManOptions = selection
  1339. this.adjust.purchaseMan = selection[0].code
  1340. this.adjust.purchaseManName = selection[0].name
  1341. }
  1342. if(this.referCondition.type == 'SUPPLIER_PARAM' && this.referCondition.title == '补单供应商') {
  1343. this.adjust.additionalSupplier = selection[0].id
  1344. this.adjust.additionalSupplierName = selection[0].name
  1345. }
  1346. if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
  1347. this.adjust.warehouse = selection[0].id
  1348. this.adjust.warehouseName = selection[0].name
  1349. this.adjust.csFlag = selection[0].csFlag
  1350. this.adjust.allocation = ''
  1351. this.adjust.allocationName = ''
  1352. this.adjust.deliveryAddressName = ''
  1353. this.adjust.deliveryAddress = ''
  1354. this.adjust.contacts = ''
  1355. this.adjust.contactsPhone = ''
  1356. this.adjust.address = ''
  1357. // 选择完清空参数里面的组织id
  1358. this.referCondition.pkOrg = ''
  1359. }
  1360. if(this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '收货货位') {
  1361. this.adjust.allocation = selection[0].id
  1362. this.adjust.allocationName = selection[0].name
  1363. }
  1364. if(this.referCondition.type == 'ADDRESS_PARAM' && this.referCondition.title == '收货地址') {
  1365. this.adjust.deliveryAddressName = selection[0].name
  1366. this.adjust.deliveryAddress = selection[0].code
  1367. this.adjust.contacts = selection[0].contactsName
  1368. this.adjust.contactsPhone = selection[0].contactsPhone
  1369. this.adjust.address = selection[0].address
  1370. }
  1371. if(this.referCondition.type == 'DEPT_PARAM') {
  1372. this.deptOptions = selection
  1373. this.basicForm.demandDept = selection[0].id
  1374. this.basicForm.demandDeptName = selection[0].name
  1375. }
  1376. if(this.referCondition.title == '选择收货仓库') {
  1377. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
  1378. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
  1379. this.basicForm.puDemandItemList[this.tableIndex].csFlag = selection[0].csFlag
  1380. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1381. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1382. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1383. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1384. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1385. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1386. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1387. // 选择完清空参数里面的组织id
  1388. this.referCondition.pkOrg = ''
  1389. }
  1390. if(this.referCondition.title == '选择收货货位') {
  1391. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = selection[0].id
  1392. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = selection[0].name
  1393. }
  1394. if(this.referCondition.title == '选择补单供应商') {
  1395. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = selection[0].id
  1396. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = selection[0].name
  1397. }
  1398. if(this.referCondition.title == '选择收货地址') {
  1399. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = selection[0].name
  1400. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = selection[0].code
  1401. this.basicForm.puDemandItemList[this.tableIndex].contacts = selection[0].contactsName
  1402. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = selection[0].contactsPhone
  1403. this.basicForm.puDemandItemList[this.tableIndex].address = selection[0].address
  1404. }
  1405. },
  1406. // 粘贴来的数据
  1407. async pasteMe(e, scope, index) {
  1408. this.$modal.loading("正在处理数据...");
  1409. e.preventDefault() //阻止默认粘贴事件
  1410. let source = e.clipboardData.getData("Text");
  1411. console.log('scope', scope.column.property)
  1412. // 首先对源头进行解析
  1413. let rows = source.split("\r\n"); // 拆成一个数组
  1414. // 数组去除空字符串
  1415. rows = rows.filter(item => {
  1416. return item && item.trim()
  1417. })
  1418. if (rows.length < 100) {
  1419. // 粘贴物料编码
  1420. if(scope.column.property == 'materialCode') {
  1421. await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
  1422. this.$modal.closeLoading();
  1423. if (res.code === 200) {
  1424. let rowList = res.rows
  1425. let newLine = []
  1426. for (let i = 0; i<rowList.length; i++) {
  1427. let line = {...this.sonModel}
  1428. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1429. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1430. line.demandCustomer = this.basicForm.customer
  1431. line.demandCustomerName = this.basicForm.customerName
  1432. line.materialCode = rowList[i].code
  1433. line.material = rowList[i].id
  1434. line.materialName = rowList[i].name
  1435. line.classifyId = rowList[i].classifyId
  1436. line.materialClassifyOneName = rowList[i].oneClass
  1437. line.materialClassifyTwoName = rowList[i].twoClass
  1438. line.materialClassifyThreeName = rowList[i].threeClass
  1439. line.materialClassifyFourName = rowList[i].fourClass
  1440. line.specification = rowList[i].specification
  1441. line.model = rowList[i].model
  1442. line.unit = rowList[i].unitId
  1443. line.unitName = rowList[i].unitIdName
  1444. line.registrant = rowList[i].registrant
  1445. line.manufacturerName = rowList[i].manufacturerIdName
  1446. line.puPeriod = rowList[i].deliveryPeriod
  1447. line.expiry = rowList[i].usefulLife
  1448. line.expiryUnit = rowList[i].expiryUnitIdName
  1449. // line.minPackage = rowList[i].usefulLife
  1450. line.minPackage = rowList[i].minPackQty
  1451. line.minOrderQty = rowList[i].minOrderQty
  1452. line.minBatch = rowList[i].minBatchQty
  1453. line.safeStock = rowList[i].safeStock
  1454. line.purOrgName = rowList[i].purchasingOrganizationName
  1455. line.puOrg = rowList[i].purchasingOrganization
  1456. // 物料存储条件和运输条件
  1457. line.transportationCondition = rowList[i].transportationCondition
  1458. line.storageCondition = rowList[i].storageCondition
  1459. newLine.push(line)
  1460. console.log('临时数组', newLine)
  1461. }
  1462. // 删除指定下标
  1463. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1464. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1465. }
  1466. }).then(() => {
  1467. this.$refs.table.doLayout()
  1468. }).catch(err => {
  1469. this.$modal.closeLoading();
  1470. })
  1471. // 粘贴实际业务需求量
  1472. }else if(scope.column.property == 'qty') {
  1473. console.log('复制内容:', rows)
  1474. let newLine = []
  1475. if(this.basicForm.puDemandItemList.length <= 1) {
  1476. for (let i = 0; i<rows.length; i++) {
  1477. let line = {...this.sonModel}
  1478. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1479. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1480. line.demandCustomer = this.basicForm.customer
  1481. line.demandCustomerName = this.basicForm.customerName
  1482. line.qty = rows[i]
  1483. newLine.push(line)
  1484. }
  1485. // 删除指定下标
  1486. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1487. this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
  1488. this.$refs.table.doLayout()
  1489. this.$modal.closeLoading();
  1490. } else {
  1491. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1492. this.basicForm.puDemandItemList[i].qty = rows[j]
  1493. }
  1494. this.$refs.table.doLayout()
  1495. this.$modal.closeLoading();
  1496. }
  1497. // 粘贴补单供应商
  1498. }else if(scope.column.property == 'additionalSupplierName') {
  1499. await getRefer({ type: 'SUPPLIER_PARAM', searchList: rows }).then(res => {
  1500. this.$modal.closeLoading();
  1501. if (res.code === 200) {
  1502. let rowList = res.rows
  1503. let newLine = []
  1504. for (let i = 0; i<rowList.length; i++) {
  1505. let line = {...this.sonModel}
  1506. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1507. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1508. line.demandCustomer = this.basicForm.customer
  1509. line.demandCustomerName = this.basicForm.customerName
  1510. line.additionalSupplier = rowList[i].id
  1511. line.additionalSupplierName = rowList[i].name
  1512. newLine.push(line)
  1513. console.log('临时数组', newLine)
  1514. }
  1515. if(this.basicForm.puDemandItemList.length <= 1) {
  1516. // 删除指定下标
  1517. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1518. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1519. } else {
  1520. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1521. this.basicForm.puDemandItemList[i].additionalSupplier = newLine[j].additionalSupplier
  1522. this.basicForm.puDemandItemList[i].additionalSupplierName = newLine[j].additionalSupplierName
  1523. }
  1524. this.$refs.table.doLayout()
  1525. this.$modal.closeLoading();
  1526. }
  1527. }
  1528. }).then(() => {
  1529. this.$refs.table.doLayout()
  1530. }).catch(err => {
  1531. this.$modal.closeLoading();
  1532. })
  1533. }else if(scope.column.property == 'deliveryAddressName') {
  1534. await getRefer({ type: 'ADDRESS_PARAM', searchList: rows }).then(res => {
  1535. this.$modal.closeLoading();
  1536. if (res.code === 200) {
  1537. let rowList = res.rows
  1538. let newLine = []
  1539. for (let i = 0; i<rowList.length; i++) {
  1540. let line = {...this.sonModel}
  1541. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1542. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1543. line.demandCustomer = this.basicForm.customer
  1544. line.demandCustomerName = this.basicForm.customerName
  1545. line.deliveryAddressName = rowList[i].name
  1546. line.deliveryAddress = rowList[i].code
  1547. line.contacts = rowList[i].contactsName
  1548. line.contactsPhone = rowList[i].contactsPhone
  1549. line.address = rowList[i].address
  1550. newLine.push(line)
  1551. console.log('临时数组', newLine)
  1552. }
  1553. if(this.basicForm.puDemandItemList.length <= 1) {
  1554. // 删除指定下标
  1555. this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
  1556. this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
  1557. } else {
  1558. for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
  1559. this.basicForm.puDemandItemList[i].deliveryAddressName = newLine[j].deliveryAddressName
  1560. this.basicForm.puDemandItemList[i].deliveryAddress = newLine[j].deliveryAddress
  1561. this.basicForm.puDemandItemList[i].contacts = newLine[j].contacts
  1562. this.basicForm.puDemandItemList[i].contactsPhone = newLine[j].contactsPhone
  1563. this.basicForm.puDemandItemList[i].address = newLine[j].address
  1564. }
  1565. this.$refs.table.doLayout()
  1566. this.$modal.closeLoading();
  1567. }
  1568. }
  1569. }).then(() => {
  1570. this.$refs.table.doLayout()
  1571. }).catch(err => {
  1572. this.$modal.closeLoading();
  1573. })
  1574. }
  1575. } else {
  1576. this.$modal.notifyWarning("复制长度不能超过100!");
  1577. this.$modal.closeLoading();
  1578. }
  1579. },
  1580. // 明细行选择物料编码带出数据
  1581. chooseMaterial(index) {
  1582. console.log("🚀 ~ file: add.vue:790 ~ chooseMaterial ~ index:", index)
  1583. this.tableIndex = index
  1584. // 传0只展示同步NC了的物料
  1585. this.$refs.materialRefer.init(0)
  1586. },
  1587. selectMaterial(selection) {
  1588. console.log('选中的物料', selection)
  1589. if (selection.length <= 1) {
  1590. // 选择新物料时先清空行内其他信息
  1591. this.basicForm.puDemandItemList[this.tableIndex].reservedProportion = null
  1592. this.basicForm.puDemandItemList[this.tableIndex].reservedPeriod = null
  1593. this.basicForm.puDemandItemList[this.tableIndex].reservedQty = null
  1594. this.basicForm.puDemandItemList[this.tableIndex].qty = null
  1595. this.basicForm.puDemandItemList[this.tableIndex].deliveryDate = null
  1596. this.basicForm.puDemandItemList[this.tableIndex].remark = null
  1597. this.basicForm.puDemandItemList[this.tableIndex].resDemandQty = null
  1598. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = null
  1599. this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = null
  1600. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
  1601. this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
  1602. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplier = null
  1603. this.basicForm.puDemandItemList[this.tableIndex].additionalSupplierName = null
  1604. this.basicForm.puDemandItemList[this.tableIndex].periodUnit = null
  1605. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddressName = null
  1606. this.basicForm.puDemandItemList[this.tableIndex].deliveryAddress = null
  1607. this.basicForm.puDemandItemList[this.tableIndex].contacts = null
  1608. this.basicForm.puDemandItemList[this.tableIndex].contactsPhone = null
  1609. this.basicForm.puDemandItemList[this.tableIndex].address = null
  1610. this.basicForm.puDemandItemList[this.tableIndex].priceType = 'order'
  1611. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouseName = null
  1612. this.basicForm.puDemandItemList[this.tableIndex].lastWarehouse = null
  1613. this.basicForm.puDemandItemList[this.tableIndex].lastAllocation = null
  1614. this.basicForm.puDemandItemList[this.tableIndex].lastAllocationName = null
  1615. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOne = null
  1616. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwo = null
  1617. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThree = null
  1618. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFour = null
  1619. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrg = null
  1620. this.basicForm.puDemandItemList[this.tableIndex].lastStockOrgName = null
  1621. this.basicForm.puDemandItemList[this.tableIndex].buyer = null
  1622. this.basicForm.puDemandItemList[this.tableIndex].buyerName = null
  1623. // 通过选择物料查询采购员
  1624. queryMan(selection[0].id).then(res => {
  1625. if(res.code === 200 && res.rows.length !== 0) {
  1626. this.basicForm.puDemandItemList[this.tableIndex].buyer = res.rows[0].buyer
  1627. this.basicForm.puDemandItemList[this.tableIndex].buyerName = res.rows[0].buyerName
  1628. }
  1629. })
  1630. this.basicForm.puDemandItemList[this.tableIndex].materialCode = selection[0].code
  1631. this.basicForm.puDemandItemList[this.tableIndex].material = selection[0].id
  1632. this.basicForm.puDemandItemList[this.tableIndex].materialName = selection[0].name
  1633. this.basicForm.puDemandItemList[this.tableIndex].classifyId = selection[0].classifyId
  1634. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyOneName = selection[0].oneClass
  1635. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyTwoName = selection[0].twoClass
  1636. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyThreeName = selection[0].threeClass
  1637. this.basicForm.puDemandItemList[this.tableIndex].materialClassifyFourName = selection[0].fourClass
  1638. this.basicForm.puDemandItemList[this.tableIndex].specification = selection[0].specification
  1639. this.basicForm.puDemandItemList[this.tableIndex].model = selection[0].model
  1640. this.basicForm.puDemandItemList[this.tableIndex].unit = selection[0].unitId
  1641. this.basicForm.puDemandItemList[this.tableIndex].unitName = selection[0].unitIdName
  1642. this.basicForm.puDemandItemList[this.tableIndex].registrant = selection[0].registrant
  1643. this.basicForm.puDemandItemList[this.tableIndex].manufacturerName = selection[0].manufacturerIdName
  1644. this.basicForm.puDemandItemList[this.tableIndex].puPeriod = selection[0].deliveryPeriod
  1645. this.basicForm.puDemandItemList[this.tableIndex].expiry = selection[0].usefulLife
  1646. this.basicForm.puDemandItemList[this.tableIndex].expiryUnit = selection[0].expiryUnitIdName
  1647. // this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].usefulLife
  1648. this.basicForm.puDemandItemList[this.tableIndex].minPackage = selection[0].minPackQty
  1649. this.basicForm.puDemandItemList[this.tableIndex].minOrderQty = selection[0].minOrderQty
  1650. this.basicForm.puDemandItemList[this.tableIndex].minBatch = selection[0].minBatchQty
  1651. this.basicForm.puDemandItemList[this.tableIndex].safeStock = selection[0].safeStock
  1652. this.basicForm.puDemandItemList[this.tableIndex].purOrgName = selection[0].purchasingOrganizationName
  1653. this.basicForm.puDemandItemList[this.tableIndex].puOrg = selection[0].purchasingOrganization
  1654. // 物料存储条件和运输条件
  1655. this.basicForm.puDemandItemList[this.tableIndex].transportationCondition = selection[0].transportationCondition
  1656. this.basicForm.puDemandItemList[this.tableIndex].storageCondition = selection[0].storageCondition
  1657. // 选中骨科耗材时候的物料,需求客户不必填
  1658. } else {
  1659. console.log('xxxxx', selection)
  1660. let newLine = []
  1661. for (let i = 0;i<selection.length;i++) {
  1662. let line = {...this.sonModel}
  1663. line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
  1664. line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
  1665. line.demandCustomer = this.basicForm.customer
  1666. line.demandCustomerName = this.basicForm.customerName
  1667. // 通过选择物料查询采购员
  1668. queryMan(selection[i].id).then(res => {
  1669. if (res.code === 200 && res.rows.length !== 0) {
  1670. line.buyer = res.rows[0].buyer
  1671. line.buyerName = res.rows[0].buyerName
  1672. }
  1673. })
  1674. line.materialCode = selection[i].code
  1675. line.material = selection[i].id
  1676. line.materialName = selection[i].name
  1677. line.classifyId = selection[i].classifyId
  1678. line.materialClassifyOneName = selection[i].oneClass
  1679. line.materialClassifyTwoName = selection[i].twoClass
  1680. line.materialClassifyThreeName = selection[i].threeClass
  1681. line.materialClassifyFourName = selection[i].fourClass
  1682. line.specification = selection[i].specification
  1683. line.model = selection[i].model
  1684. line.unit = selection[i].unitId
  1685. line.unitName = selection[i].unitIdName
  1686. line.registrant = selection[i].registrant
  1687. line.manufacturerName = selection[i].manufacturerIdName
  1688. line.puPeriod = selection[i].deliveryPeriod
  1689. line.expiry = selection[i].usefulLife
  1690. line.expiryUnit = selection[i].expiryUnitIdName
  1691. // line.minPackage = selection[i].usefulLife
  1692. line.minPackage = selection[i].minPackQty
  1693. line.minOrderQty = selection[i].minOrderQty
  1694. line.minBatch = selection[i].minBatchQty
  1695. line.safeStock = selection[i].safeStock
  1696. line.purOrgName = selection[i].purchasingOrganizationName
  1697. line.puOrg = selection[i].purchasingOrganization
  1698. // 物料存储条件和运输条件
  1699. line.transportationCondition = selection[i].transportationCondition
  1700. line.storageCondition = selection[i].storageCondition
  1701. // this.basicForm.puDemandItemList.push(line)
  1702. newLine.push(line)
  1703. }
  1704. // 删除指定下标
  1705. this.basicForm.puDemandItemList.splice(this.tableIndex,1,...newLine)
  1706. // this.basicForm.puDemandItemList.splice(this.tableIndex,1)
  1707. }
  1708. },
  1709. // 明细行选择参照
  1710. chooseDept(index, type, isPage, title) {
  1711. this.tableIndex = index
  1712. this.referCondition.type = type
  1713. this.referCondition.isPage = isPage
  1714. this.referCondition.title = title
  1715. this.$refs.refer.init(this.referCondition)
  1716. },
  1717. // 明细行选择仓库需要先确认采购组织
  1718. chooseCangKu(index, type, isPage, title, pkOrg) {
  1719. this.tableIndex = index
  1720. this.referCondition.type = type
  1721. this.referCondition.isPage = isPage
  1722. this.referCondition.title = title
  1723. if(pkOrg) {
  1724. this.referCondition.pkOrg = pkOrg
  1725. this.$refs.refer.init(this.referCondition)
  1726. } else {
  1727. this.$modal.notifyWarning("请先确认默认采购组织");
  1728. }
  1729. },
  1730. // 明细行选择货位先确认仓库
  1731. choosehuoWei(index, type, isPage, title, stordocId) {
  1732. this.tableIndex = index
  1733. this.referCondition.type = type
  1734. this.referCondition.isPage = isPage
  1735. this.referCondition.title = title
  1736. // 选择收货货位前先选择收货仓库
  1737. if(stordocId) {
  1738. this.referCondition.stordocId = stordocId
  1739. this.$refs.refer.init(this.referCondition)
  1740. } else {
  1741. this.$modal.notifyWarning("请先选择收货仓库");
  1742. }
  1743. },
  1744. // 明细行清空收货仓库,货位,收货地址档案等
  1745. clearHang(index, title) {
  1746. if (title == '选择收货仓库') {
  1747. this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
  1748. this.basicForm.puDemandItemList[index].deliveryWarehouse = null
  1749. this.basicForm.puDemandItemList[index].csFlag = null
  1750. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1751. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1752. }
  1753. if (title == '选择收货货位') {
  1754. this.basicForm.puDemandItemList[index].deliveryAllocationName = null
  1755. this.basicForm.puDemandItemList[index].deliveryAllocation = null
  1756. }
  1757. if (title == '选择收货地址') {
  1758. this.basicForm.puDemandItemList[index].deliveryAddressName = null
  1759. this.basicForm.puDemandItemList[index].deliveryAddress = null
  1760. this.basicForm.puDemandItemList[index].contacts = null
  1761. this.basicForm.puDemandItemList[index].contactsPhone = null
  1762. this.basicForm.puDemandItemList[index].address = null
  1763. }
  1764. if (title == '选择补单供应商') {
  1765. this.basicForm.puDemandItemList[index].additionalSupplierName = null
  1766. this.basicForm.puDemandItemList[index].additionalSupplier = null
  1767. }
  1768. // 清空批量调整内字段
  1769. if (title == 'cgzz') {
  1770. this.adjust.purOrgName = ''
  1771. this.adjust.puOrg = ''
  1772. this.adjust.warehouse = ''
  1773. this.adjust.warehouseName = ''
  1774. this.adjust.allocation = ''
  1775. this.adjust.allocationName = ''
  1776. }
  1777. if (title == 'shck') {
  1778. this.adjust.warehouse = ''
  1779. this.adjust.warehouseName = ''
  1780. this.adjust.allocation = ''
  1781. this.adjust.allocationName = ''
  1782. this.adjust.csFlag = ''
  1783. }
  1784. if (title == 'shhw') {
  1785. this.adjust.allocation = ''
  1786. this.adjust.allocationName = ''
  1787. }
  1788. if (title == 'bdgys') {
  1789. this.adjust.additionalSupplier = ''
  1790. this.adjust.additionalSupplierName = ''
  1791. }
  1792. if (title == 'shdz') {
  1793. this.adjust.deliveryAddressName = ''
  1794. this.adjust.deliveryAddress = ''
  1795. this.adjust.contacts = ''
  1796. this.adjust.contactsPhone = ''
  1797. this.adjust.address = ''
  1798. }
  1799. },
  1800. // 清除需求客户将明细行内也清空
  1801. cleanCustomer() {
  1802. this.basicForm.customer = ''
  1803. this.basicForm.customerName = ''
  1804. this.basicForm.customerCode = ''
  1805. if (this.basicForm.puDemandItemList.length !== 0) {
  1806. this.basicForm.puDemandItemList.forEach(item => {
  1807. item.demandCustomerName = ''
  1808. item.demandCustomer = ''
  1809. item.status = ''
  1810. item.buyerName = ''
  1811. item.buyer = ''
  1812. item.reservedProportion = ''
  1813. item.reservedPeriod = ''
  1814. item.reservedQty = ''
  1815. item.averageQtyMonth = ''
  1816. item.demandPeriod = ''
  1817. item.forecastClassify = ''
  1818. item.onemonthAvgVolume = ''
  1819. item.threemonthAvgVolume = ''
  1820. item.puFreight = ''
  1821. item.superiorAllotQty = ''
  1822. item.resDemandQty = ''
  1823. item.executeQty = ''
  1824. item.deliveryWarehouseName = ''
  1825. item.deliveryWarehouse = ''
  1826. item.deliveryAllocationName = ''
  1827. item.deliveryAllocation = ''
  1828. item.lastWarehouseName = ''
  1829. item.lastAllocationName = ''
  1830. item.availableQty = ''
  1831. item.lastStockOrgName = ''
  1832. item.centralWarehouseQty = ''
  1833. item.allotCode = ''
  1834. item.deliveryAddress = ''
  1835. item.deliveryAddressName = ''
  1836. item.contacts = ''
  1837. item.contactsPhone = ''
  1838. item.address = ''
  1839. })
  1840. }
  1841. },
  1842. // 批量调整
  1843. adjustPl() {
  1844. if(this.ids.length == 0) {
  1845. this.$modal.notifyWarning('请至少选择一项数据进行操作!')
  1846. } else {
  1847. this.adjust.open = true
  1848. }
  1849. },
  1850. // 批量调整确认
  1851. confirmAdjust() {
  1852. console.log('data', this.adjust)
  1853. if (this.adjust.csFlag == 'N' || this.adjust.csFlag == '' || this.adjust.allocationName) {
  1854. this.basicForm.puDemandItemList.forEach(item => {
  1855. this.ids.some(val => {
  1856. if(val == item.id) {
  1857. if(this.adjust.purchaseMan) {
  1858. item.buyer = this.adjust.purchaseMan
  1859. item.buyerName = this.adjust.purchaseManName
  1860. }
  1861. if(this.adjust.priceType) {
  1862. item.priceType = this.adjust.priceType
  1863. }
  1864. if(this.adjust.additionalSupplierName) {
  1865. item.additionalSupplier = this.adjust.additionalSupplier
  1866. item.additionalSupplierName = this.adjust.additionalSupplierName
  1867. }
  1868. if(this.adjust.purOrgName) {
  1869. item.purOrgName = this.adjust.purOrgName
  1870. item.puOrg = this.adjust.puOrg
  1871. item.deliveryWarehouse = this.adjust.warehouse
  1872. item.deliveryWarehouseName = this.adjust.warehouseName
  1873. item.deliveryAllocation = this.adjust.allocation
  1874. item.deliveryAllocationName = this.adjust.allocationName
  1875. item.deliveryAddressName = this.adjust.deliveryAddressName
  1876. item.deliveryAddress = this.adjust.deliveryAddress
  1877. item.contacts = this.adjust.contacts
  1878. item.contactsPhone = this.adjust.contactsPhone
  1879. item.address = this.adjust.address
  1880. }
  1881. if(this.adjust.warehouseName) {
  1882. item.deliveryWarehouse = this.adjust.warehouse
  1883. item.deliveryWarehouseName = this.adjust.warehouseName
  1884. item.csFlag = this.adjust.csFlag
  1885. item.deliveryAllocation = this.adjust.allocation
  1886. item.deliveryAllocationName = this.adjust.allocationName
  1887. }
  1888. // if(this.adjust.allocationName) {
  1889. // item.deliveryAllocation = this.adjust.allocation
  1890. // item.deliveryAllocationName = this.adjust.allocationName
  1891. // }
  1892. if(this.adjust.remark) {
  1893. item.remark = this.adjust.remark
  1894. }
  1895. if(this.adjust.deliveryAddressName) {
  1896. item.deliveryAddressName = this.adjust.deliveryAddressName
  1897. item.deliveryAddress = this.adjust.deliveryAddress
  1898. item.contacts = this.adjust.contacts
  1899. item.contactsPhone = this.adjust.contactsPhone
  1900. item.address = this.adjust.address
  1901. }
  1902. }
  1903. this.adjust.open = false
  1904. })
  1905. })
  1906. } else {
  1907. this.$modal.notifyWarning('收货仓库存在收货货位,请填写!')
  1908. }
  1909. },
  1910. // 批量调整选择仓库
  1911. adjustCangku(type, isPage, title, pkOrg) {
  1912. this.referCondition.type = type
  1913. this.referCondition.isPage = isPage
  1914. this.referCondition.title = title
  1915. if (pkOrg) {
  1916. this.referCondition.pkOrg = pkOrg
  1917. this.$refs.refer.init(this.referCondition)
  1918. } else {
  1919. this.$modal.notifyWarning("请先选择默认采购组织");
  1920. }
  1921. },
  1922. // 批量调整选择货位
  1923. adjustHuoWei(type, isPage, title, stordocId) {
  1924. this.referCondition.type = type
  1925. this.referCondition.isPage = isPage
  1926. this.referCondition.title = title
  1927. // 选择收货货位前先选择收货仓库
  1928. if (stordocId) {
  1929. this.referCondition.stordocId = stordocId
  1930. this.$refs.refer.init(this.referCondition)
  1931. } else {
  1932. this.$modal.notifyWarning("请先选择收货仓库");
  1933. }
  1934. },
  1935. // 关闭清空批量调整数据
  1936. closeEvent() {
  1937. this.adjust = {
  1938. open: false,
  1939. puOrg: '',
  1940. purOrgName: '',
  1941. priceType: '',
  1942. purchaseMan: '',
  1943. purchaseManName: '',
  1944. warehouse: '',
  1945. warehouseName: '',
  1946. csFlag: '',
  1947. allocation: '',
  1948. allocationName: '',
  1949. additionalSupplier: '',
  1950. additionalSupplierName: '',
  1951. remark: '',
  1952. deliveryAddress: '',
  1953. deliveryAddressName: '',
  1954. contacts: '',
  1955. contactsPhone: '',
  1956. address: ''
  1957. }
  1958. },
  1959. // 必选标识
  1960. addRedStar(h, { column }) {
  1961. return [
  1962. h('span', { style: 'color: #F56C6C' }, '*'),
  1963. h('span', ' ' + column.label)
  1964. ];
  1965. },
  1966. // 表格表头标星
  1967. anotherRedStar(h, { column }) {
  1968. if(this.isBDXQ) {
  1969. return [
  1970. h('span', { style: 'color: #F56C6C' }, '*'),
  1971. h('span', ' ' + column.label)
  1972. ];
  1973. } else {
  1974. return [
  1975. h('span', ' ' + column.label)
  1976. ];
  1977. }
  1978. },
  1979. // 流程跳转
  1980. jumpOA() {
  1981. toOA(this.$store.state.user.name, this.basicForm.flowId).then(res => {
  1982. if(res.code === 200) {
  1983. window.open(res.oaUrl)
  1984. }
  1985. })
  1986. },
  1987. jisuan({columns, data}) {
  1988. // console.log('生效了吗', {columns, data})
  1989. const means = [] // 合计
  1990. columns.forEach((column, columnIndex) => {
  1991. if (columnIndex === 0) {
  1992. means.push('合计')
  1993. } else {
  1994. const values = data.map(item => Number(item[column.property]));
  1995. // 合计
  1996. if (column.property === 'qty') {
  1997. means[columnIndex] = values.reduce((prev, curr) => {
  1998. const value = Number(curr);
  1999. if (!isNaN(value)) {
  2000. return prev + curr;
  2001. } else {
  2002. return prev;
  2003. }
  2004. }, 0);
  2005. // means[columnIndex] += ' 元'
  2006. // 改变了ele的合计方式,扩展了合计场景
  2007. // 你以为就只有上面这样玩吗?错啦,你还可以自定义样式哦
  2008. // means[columnIndex] = '<span style="color: red">' + means[columnIndex] + '元</span>'
  2009. means[columnIndex] = + means[columnIndex]
  2010. } else {
  2011. means[columnIndex] = '';
  2012. }
  2013. }
  2014. })
  2015. // 返回一个二维数组的表尾合计(不要平均值,你就不要在数组中添加)
  2016. return [means]
  2017. }
  2018. }
  2019. }
  2020. </script>
  2021. <style lang="scss" scoped>
  2022. .btn_group {
  2023. // width: 100%;
  2024. // margin: 20px 0;
  2025. display: flex;
  2026. justify-content: space-between;
  2027. position: absolute;
  2028. top: 10px;right: 20px;
  2029. }
  2030. .btn_grooup {
  2031. margin-bottom: 10px;
  2032. display: flex;
  2033. justify-content: space-between;
  2034. }
  2035. .hang {
  2036. margin: auto;
  2037. }
  2038. .hang ::v-deep .el-form-item__content{
  2039. margin-left: 0px !important;
  2040. }
  2041. // .el-table ::v-deep .el-form-item__error{
  2042. // padding-top: 0;
  2043. // top: 70%
  2044. // }
  2045. ::v-deep .elx-body--row .success-row {
  2046. background-color: #ff8a8a!important;
  2047. }
  2048. ::v-deep .uxbeautifyTableClass .elx-table--header-wrapper {
  2049. color: #606266;
  2050. }
  2051. .pltzTxt{
  2052. text-align: right;
  2053. font-size: medium;
  2054. padding-right: 2%;
  2055. }
  2056. .pltzIpt{
  2057. width: 90%;
  2058. }
  2059. </style>