engin_form.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" :content="listItem ? '编辑-发货申请' : '新增-发货申请'"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">工程发货申请单信息</div>
  6. </div>
  7. <div style="font-size: 12px; color: #333; margin-bottom: 20px">
  8. 注:发货申请时,库存数量为实时数量,请选择完成选择后及时保存提交,否则数量可能有变,被其他商家开单而导致库存不足。
  9. </div>
  10. <el-form
  11. ref="mainForm"
  12. :model="mainForm"
  13. :rules="mainFormRules"
  14. label-width="100px"
  15. size="small"
  16. label-position="right"
  17. >
  18. <el-row :gutter="20">
  19. <el-col :xs="24" :sm="12" :lg="8">
  20. <el-form-item label="发货申请单" prop="orderNum">
  21. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  25. <el-form-item label="单据日期" prop="orderDate">
  26. <el-date-picker
  27. v-model="mainForm.orderDate"
  28. disabled
  29. type="date"
  30. value-format="yyyy-MM-dd"
  31. style="width: 100%"
  32. placeholder="选择日期"
  33. >
  34. </el-date-picker>
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. <el-row :gutter="20">
  39. <el-col :xs="24" :sm="12" :lg="8">
  40. <el-form-item label="经销商编号" prop="jxsNum">
  41. <el-input v-model="mainForm.jxsNum" disabled></el-input>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :xs="24" :sm="12" :lg="16">
  45. <el-form-item label="经销商名称" prop="jxsName">
  46. <el-input v-model="mainForm.jxsName" disabled></el-input>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row :gutter="20">
  51. <el-col :xs="24" :sm="12" :lg="8">
  52. <el-form-item label="工程登录编号" prop="loginNum">
  53. <div style="display: flex">
  54. <el-input v-model="mainForm.loginNum" :disabled="isDealer" placeholder="请输入工程登录编号"></el-input>
  55. <el-button style="margin-left: 10px" @click="openDialog">引用</el-button>
  56. </div>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="8">
  60. <el-form-item label="家用项目类别" prop="enginName">
  61. <el-input v-model="mainForm.enginName" placeholder="请输入家用项目类别" :disabled="isDealer"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="8">
  65. <el-form-item label="商用项目名称" prop="refProjectName">
  66. <el-input
  67. v-model="mainForm.refProjectName"
  68. placeholder="请输入商用项目名称"
  69. :disabled="isDealer"
  70. ></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :xs="24" :sm="12" :lg="8">
  74. <el-form-item label="工程登录类型" prop="loginType">
  75. <el-select style="width: 100%" v-model="mainForm.loginType" placeholder="请输入工程登录类型" disabled>
  76. <el-option
  77. v-for="item in [
  78. {label:'家用', value:'HOME'},
  79. {label:'商用', value:'TRADE'},
  80. ]"
  81. :key="item.value"
  82. :label="item.label"
  83. :value="item.value"
  84. >
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. </el-col>
  89. <el-col :xs="24" :sm="12" :lg="8">
  90. <el-form-item label="跨厂区编号" prop="factoryNum">
  91. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨厂区编号" disabled></el-input>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :xs="24" :sm="12" :lg="8">
  95. <el-form-item label="使用单位" prop="company">
  96. <el-input v-model="mainForm.company" placeholder="请输入使用单位" disabled></el-input>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :xs="24" :sm="12" :lg="8">
  100. <el-form-item label="文件编号" prop="fileNo">
  101. <el-input v-model="mainForm.fileNo" placeholder="请输入文件编号" disabled></el-input>
  102. </el-form-item>
  103. </el-col>
  104. <el-col :xs="24" :sm="12" :lg="8">
  105. <el-form-item label="行业类别" prop="refTradeCategory">
  106. <el-input v-model="mainForm.refTradeCategory" placeholder="请输入文件编号" :disabled="isDealer"></el-input>
  107. </el-form-item>
  108. </el-col>
  109. <!-- <el-col :xs="24" :sm="12" :lg="8">
  110. <el-form-item label="项目类型" prop="refTradeCategory">
  111. <el-input v-model="mainForm.refTradeCategory" placeholder="请输入文件编号" disabled></el-input>
  112. </el-form-item>
  113. </el-col> -->
  114. </el-row>
  115. <el-row :gutter="20">
  116. <el-col :xs="24" :sm="12" :lg="8">
  117. <el-form-item label="联系人" prop="contactMan">
  118. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" disabled></el-input>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :xs="24" :sm="12" :lg="8">
  122. <el-form-item label="固定电话" prop="tel">
  123. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" disabled></el-input>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="12" :lg="8">
  127. <el-form-item label="移动电话" prop="phone">
  128. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" disabled></el-input>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :xs="24" :sm="24" :lg="24">
  132. <el-form-item label="安装地址" prop="address">
  133. <el-input v-model="mainForm.address" placeholder="请输入安装地址" disabled></el-input>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :xs="24" :sm="24" :lg="24">
  137. <el-form-item label="备注" prop="remark">
  138. <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
  139. </el-form-item>
  140. </el-col>
  141. </el-row>
  142. <el-row :gutter="20">
  143. <el-col :xs="24" :sm="8" :lg="8">
  144. <el-form-item label="附件" prop="fileUrl">
  145. <fileUpload :fileList="fileList" multiple />
  146. </el-form-item>
  147. </el-col>
  148. </el-row>
  149. <el-row :gutter="20">
  150. <el-col :xs="24" :sm="12" :lg="8">
  151. <el-form-item label="制单人" prop="createMan">
  152. <el-input v-model="mainForm.createMan" disabled></el-input>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  156. <el-form-item label="制单日期" prop="createDate">
  157. <el-date-picker
  158. v-model="mainForm.createDate"
  159. disabled
  160. type="datetime"
  161. value-format="yyyy-MM-dd hh:mm:ss"
  162. style="width: 100%"
  163. placeholder="选择日期"
  164. >
  165. </el-date-picker>
  166. </el-form-item>
  167. </el-col>
  168. <el-col :xs="24" :sm="24" :lg="24" v-if="mainForm.examineRemark">
  169. <el-form-item label="审批说明" prop="examineRemark">
  170. <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled></el-input>
  171. </el-form-item>
  172. </el-col>
  173. </el-row>
  174. </el-form>
  175. <div class="main-title">
  176. <div class="title">货品信息</div>
  177. </div>
  178. <div class="table" style="margin-top: 20px">
  179. <el-table
  180. :data="goodsList"
  181. element-loading-text="Loading"
  182. border
  183. fit
  184. highlight-current-row
  185. stripe
  186. max-height="400"
  187. >
  188. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  189. <el-table-column
  190. align="center"
  191. label="引用单号"
  192. prop="enginOrderNo"
  193. min-width="180"
  194. show-overflow-tooltip
  195. ></el-table-column>
  196. <el-table-column
  197. align="center"
  198. label="单号类型"
  199. prop="saleTypeName"
  200. min-width="100"
  201. show-overflow-tooltip
  202. ></el-table-column>
  203. <el-table-column
  204. align="center"
  205. label="销售类型"
  206. prop="saleTypeName"
  207. min-width="100"
  208. show-overflow-tooltip
  209. ></el-table-column>
  210. <el-table-column
  211. align="center"
  212. label="物料编码"
  213. prop="materialCode"
  214. min-width="120"
  215. show-overflow-tooltip
  216. ></el-table-column>
  217. <el-table-column
  218. align="center"
  219. label="产品编码"
  220. prop="materialOldNumber"
  221. min-width="120"
  222. show-overflow-tooltip
  223. ></el-table-column>
  224. <el-table-column
  225. align="center"
  226. label="产品名称"
  227. prop="materialName"
  228. min-width="160"
  229. show-overflow-tooltip
  230. ></el-table-column>
  231. <el-table-column
  232. align="center"
  233. label="规格型号"
  234. prop="specification"
  235. min-width="160"
  236. show-overflow-tooltip
  237. ></el-table-column>
  238. <el-table-column
  239. align="center"
  240. label="单位"
  241. prop="unit"
  242. min-width="100"
  243. show-overflow-tooltip
  244. ></el-table-column>
  245. <el-table-column align="center" label="数量" prop="invoiceNum" min-width="110" show-overflow-tooltip>
  246. <template slot-scope="scope">
  247. <el-input v-model="scope.row.invoiceNum" size="small"></el-input>
  248. </template>
  249. </el-table-column>
  250. <el-table-column align="center" label="表头备注" prop="headerRemark" min-width="160" show-overflow-tooltip>
  251. <template slot-scope="scope">
  252. <el-input v-model="scope.row.headerRemark" size="small"></el-input>
  253. </template>
  254. </el-table-column>
  255. <el-table-column align="center" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip>
  256. <template slot-scope="scope">
  257. <el-input v-model="scope.row.invoiceRemark" size="small"></el-input>
  258. </template>
  259. </el-table-column>
  260. <el-table-column align="center" label="操作" width="100" fixed="right">
  261. <template slot-scope="scope">
  262. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  263. </template>
  264. </el-table-column>
  265. </el-table>
  266. </div>
  267. <div class="page-footer">
  268. <div class="footer" :class="classObj">
  269. <!-- <el-button type="primary" @click="clickSubmitForm('SAVE')">保 存</el-button> -->
  270. <el-button type="primary" @click="clickSubmitForm('WAIT')">提交审核</el-button>
  271. <el-popconfirm title="确定关闭吗?" @confirm="goBack" style="margin-left: 10px">
  272. <el-button slot="reference">返回列表</el-button>
  273. </el-popconfirm>
  274. </div>
  275. </div>
  276. <el-dialog title="添加引用" append-to-body :visible.sync="isShowDialog" width="80%">
  277. <el-form ref="screenForm" :model="screenForm" size="small" label-position="left" label-width="100px">
  278. <el-row :gutter="20">
  279. <el-col :xs="12" :sm="12" :lg="6">
  280. <el-form-item prop="loginNum" label="工程登录编号">
  281. <el-input v-model="screenForm.loginNum" placeholder="请输入工程登录编号"></el-input>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :xs="12" :sm="12" :lg="6">
  285. <el-form-item prop="enginName" label="家用项目类别">
  286. <el-input v-model="screenForm.enginName" placeholder="请输入家用项目类别"></el-input>
  287. </el-form-item>
  288. </el-col>
  289. <!-- <el-col :xs="24" :sm="12" :lg="8">
  290. <el-form-item label="商用项项目名称" prop="refProjectName">
  291. <el-input v-model="screenForm.refProjectName" placeholder="请输入家用项目类别" :disabled="isDealer"></el-input>
  292. </el-form-item>
  293. </el-col> -->
  294. <el-col :xs="12" :sm="12" :lg="6">
  295. <el-form-item prop="model" label="规格型号">
  296. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  297. </el-form-item>
  298. </el-col>
  299. <el-col :xs="12" :sm="12" :lg="6">
  300. <el-form-item label="发货申请日期" prop="date">
  301. <el-date-picker
  302. v-model="screenForm.date"
  303. type="datetimerange"
  304. :default-time="['00:00:00', '23:59:59']"
  305. range-separator="至"
  306. style="width: 100%; height: 33px"
  307. value-format="yyyy-MM-dd HH:mm:ss"
  308. start-placeholder="开始日期"
  309. end-placeholder="结束日期"
  310. >
  311. </el-date-picker>
  312. </el-form-item>
  313. </el-col>
  314. <el-col :xs="12" :sm="12" :lg="6">
  315. <el-form-item prop="warehouse" label="选择仓库">
  316. <el-select
  317. v-model="screenForm.warehouse"
  318. placeholder="请选择仓库"
  319. size="small"
  320. filterable
  321. clearable
  322. :disabled="listItem ? isDealer ? goodsList.length > 0 || tableSelection.length > 0 : false: false"
  323. style="width: 100%"
  324. >
  325. <el-option
  326. :label="item.name"
  327. :value="item.id"
  328. v-for="(item, index) in warehouseList"
  329. :key="index"
  330. ></el-option>
  331. </el-select>
  332. </el-form-item>
  333. </el-col>
  334. <el-col :xs="12" :sm="6" :lg="6">
  335. <el-form-item prop="type" label="存货类别">
  336. <el-select
  337. v-model="screenForm.type"
  338. placeholder="选择存货类别"
  339. style="width: 100%"
  340. :disabled="goodsList.length > 0"
  341. >
  342. <el-option
  343. v-for="item in categoryList"
  344. :key="item.id"
  345. :label="item.name"
  346. :value="item.id"
  347. ></el-option>
  348. </el-select>
  349. </el-form-item>
  350. </el-col>
  351. <el-col :xs="12" :sm="12" :lg="12" class="tr">
  352. <el-form-item label="">
  353. <el-button size="small" @click="resetScreenForm">清空</el-button>
  354. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  355. </el-form-item>
  356. </el-col>
  357. </el-row>
  358. </el-form>
  359. <div class="table">
  360. <el-table
  361. :data="tableGoodsList"
  362. element-loading-text="Loading"
  363. border
  364. fit
  365. highlight-current-row
  366. stripe
  367. height="400"
  368. @selection-change="tableSelectionChange"
  369. >
  370. <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect"></el-table-column>
  371. <el-table-column align="center" label="新旧单标识" prop="mainOrderId" min-width="140" show-overflow-tooltip>
  372. <template slot-scope="scope">
  373. {{ scope.row.orderBase == 1 ? '新单' : '旧单' }}
  374. </template>
  375. </el-table-column>
  376. <el-table-column align="center" label="订单类型" prop="orderType" min-width="180" show-overflow-tooltip>
  377. <template slot-scope="scope">
  378. {{ scope.row.orderType | orderTypeFilter }}
  379. </template>
  380. </el-table-column>
  381. <el-table-column
  382. align="center"
  383. label="工程登录编号"
  384. prop="refEnginRecordNo"
  385. min-width="200"
  386. show-overflow-tooltip
  387. ></el-table-column>
  388. <!-- <el-table-column align="center" label="表头登录类型" prop="refPromiseStatus" min-width="200" show-overflow-tooltip></el-table-column>
  389. <el-table-column align="center" label="项目类别" prop="refProjectCategory" min-width="200" show-overflow-tooltip></el-table-column>
  390. <el-table-column align="center" label="行业类别" prop="refTradeCategory" min-width="200" show-overflow-tooltip></el-table-column> -->
  391. <el-table-column
  392. align="center"
  393. label="销售类型"
  394. prop="saleTypeName"
  395. min-width="100"
  396. show-overflow-tooltip
  397. ></el-table-column>
  398. <el-table-column
  399. align="center"
  400. label="物料编码"
  401. prop="materialCode"
  402. min-width="120"
  403. show-overflow-tooltip
  404. ></el-table-column>
  405. <el-table-column
  406. align="center"
  407. label="产品编码"
  408. prop="materialOldNumber"
  409. min-width="120"
  410. show-overflow-tooltip
  411. ></el-table-column>
  412. <el-table-column
  413. align="center"
  414. label="产品名称"
  415. prop="materialName"
  416. min-width="160"
  417. show-overflow-tooltip
  418. ></el-table-column>
  419. <el-table-column
  420. align="center"
  421. label="规格型号"
  422. prop="specification"
  423. min-width="160"
  424. show-overflow-tooltip
  425. ></el-table-column>
  426. <el-table-column
  427. align="center"
  428. label="单位"
  429. prop="unit"
  430. min-width="80"
  431. show-overflow-tooltip
  432. ></el-table-column>
  433. <el-table-column
  434. align="center"
  435. label="订单数量"
  436. prop="qty"
  437. min-width="80"
  438. show-overflow-tooltip
  439. ></el-table-column>
  440. <el-table-column
  441. align="center"
  442. label="已申请数量"
  443. prop="alreadyInvoiceNum"
  444. min-width="100"
  445. show-overflow-tooltip
  446. ></el-table-column>
  447. <el-table-column
  448. align="center"
  449. label="已申请未出货数量"
  450. prop="sendQty"
  451. min-width="100"
  452. show-overflow-tooltip
  453. ></el-table-column>
  454. <el-table-column
  455. align="center"
  456. label="未申请数量"
  457. prop="refundableQty"
  458. min-width="100"
  459. show-overflow-tooltip
  460. ></el-table-column>
  461. <el-table-column align="center" label="本次申请数量" prop="invoiceNum" min-width="110" show-overflow-tooltip>
  462. <template slot-scope="scope">
  463. <el-input v-model="scope.row.invoiceNum" size="small"></el-input>
  464. </template>
  465. </el-table-column>
  466. <!-- <el-table-column align="center" label="总库存数量" prop="stockAdequate" min-width="100" show-overflow-tooltip>
  467. <template slot-scope="scope">
  468. {{stockFilter(scope.row, 1)}}
  469. </template>
  470. </el-table-column> -->
  471. <el-table-column
  472. align="center"
  473. label="对应库存数量"
  474. prop="stockCorrespond"
  475. min-width="110"
  476. show-overflow-tooltip
  477. >
  478. <template slot-scope="scope">
  479. {{ stockFilter(scope.row, 2) }}
  480. </template>
  481. </el-table-column>
  482. </el-table>
  483. <div class="pagination clearfix" style="margin-top: 10px">
  484. <div class="fr">
  485. <el-pagination
  486. @current-change="handleTableCurrentChange"
  487. :current-page="currentPage"
  488. :page-size="10"
  489. background
  490. layout="prev, pager, next"
  491. :total="listTotal"
  492. >
  493. </el-pagination>
  494. </div>
  495. </div>
  496. </div>
  497. <span slot="footer" class="dialog-footer">
  498. <el-button @click="closeDialog">取 消</el-button>
  499. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  500. </span>
  501. </el-dialog>
  502. </div>
  503. </template>
  504. <script>
  505. import {
  506. getEnginDetail,
  507. addEngin,
  508. editEngin,
  509. getEnginGoodsList,
  510. getWarehouseList,
  511. getDealerList,
  512. getEnginGoodsDetail
  513. } from '@/api/supply/apply'
  514. import { getDictList, getCategoryList } from '@/api/common'
  515. import { findElem } from '@/utils/util'
  516. import fileUpload from '@/components/Common/file-upload.vue'
  517. export default {
  518. components: {
  519. fileUpload
  520. },
  521. name: 'EnginForm',
  522. componentName: 'EnginForm',
  523. props: ['listItem'],
  524. filters: {
  525. orderTypeFilter(val) {
  526. const MAP = {
  527. HOME: '家用单',
  528. TRADE: '商用单',
  529. RETAIL: '零售单',
  530. RETAIL_POLICY: '销售政策单',
  531. PERMU_HOME: '置换家用单',
  532. PERMU_TRADE: '置换商用单',
  533. PERMU_RETAIL: '置换零售单',
  534. PERMU_RETAIL_POLICY: '置换销售政策单',
  535. REQUISITION_HOME: '调拨家用单',
  536. REQUISITION_TRADE: '调拨商用单',
  537. REQUISITION_RETAIL: '调拨零售单',
  538. REQUISITION_RETAIL_POLICY: '调拨销售政策单'
  539. }
  540. return MAP[val]
  541. }
  542. },
  543. data() {
  544. return {
  545. mainForm: {
  546. orderNum: '',
  547. orderDate: '',
  548. jxsNum: '',
  549. jxsName: '',
  550. loginNum: '',
  551. enginName: '',
  552. loginType: '',
  553. factoryNum: '',
  554. company: '',
  555. fileNo: '',
  556. contactMan: '',
  557. tel: '',
  558. phone: '',
  559. address: '',
  560. remark: '',
  561. createMan: '',
  562. createDate: '',
  563. examineRemark: '',
  564. refProjectName: '',
  565. refTradeCategory: ''
  566. },
  567. mainFormRules: {
  568. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  569. },
  570. dealerList: [],
  571. fileList: [],
  572. goodsList: [],
  573. warehouseList: [],
  574. isShowDialog: false,
  575. screenForm: {
  576. loginNum: '',
  577. enginName: '',
  578. model: '',
  579. date: [],
  580. warehouse: '',
  581. type: '',
  582. refProjectName: ''
  583. },
  584. currentPage: 1,
  585. listTotal: 0,
  586. typeList: [],
  587. stockList: [],
  588. categoryList: [],
  589. tableGoodsList: [],
  590. tableSelection: []
  591. }
  592. },
  593. computed: {
  594. sidebar() {
  595. return this.$store.state.app.sidebar
  596. },
  597. classObj() {
  598. return {
  599. hideSidebar: !this.sidebar.opened,
  600. openSidebar: this.sidebar.opened
  601. }
  602. },
  603. isDealer() {
  604. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  605. }
  606. },
  607. created() {
  608. this.getDictList()
  609. this.getWarehouseList()
  610. this.getDealerList()
  611. this.getCategoryList()
  612. if (this.listItem) {
  613. this.getDetail()
  614. } else {
  615. this.mainForm.jxsNum = JSON.parse(localStorage.getItem('supply_user')).customerNumber
  616. this.mainForm.jxsName = JSON.parse(localStorage.getItem('supply_user')).customerName
  617. this.mainForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
  618. this.mainForm.createDate = this.getDate()
  619. }
  620. },
  621. methods: {
  622. // 返回列表
  623. goBack() {
  624. this.$emit('backListFormDetail')
  625. },
  626. getDate() {
  627. var date = new Date()
  628. var seperator1 = '-'
  629. var year = date.getFullYear()
  630. var month = date.getMonth() + 1
  631. var strDate = date.getDate()
  632. if (month >= 1 && month <= 9) {
  633. month = '0' + month
  634. }
  635. if (strDate >= 0 && strDate <= 9) {
  636. strDate = '0' + strDate
  637. }
  638. var currentdate = year + seperator1 + month + seperator1 + strDate
  639. return currentdate
  640. },
  641. // 获取详情
  642. getDetail() {
  643. getEnginDetail({ id: this.listItem.id }).then(res => {
  644. let data = res.data
  645. this.mainForm.orderNum = data.id
  646. this.mainForm.orderDate = data.orderTime.slice(0, 10)
  647. this.mainForm.jxsNum = data.customerNumber
  648. this.mainForm.jxsName = data.customerName
  649. this.mainForm.loginNum = data.refEnginRecordNo
  650. this.mainForm.loginType = data.enginOrderType
  651. this.mainForm.factoryNum = data.refFactoryNo
  652. this.mainForm.company = data.refUseUnit
  653. this.mainForm.saleType = data.saleTypeId
  654. this.mainForm.contactMan = data.refLinkman
  655. this.mainForm.tel = data.refTel
  656. this.mainForm.phone = data.refPhone
  657. this.mainForm.address = data.refInstallAddress
  658. this.mainForm.createMan = data.createBy
  659. this.mainForm.createDate = data.createTime
  660. this.mainForm.remark = data.remark
  661. this.mainForm.examineRemark = data.approvalRemark
  662. this.mainForm.fileNo = data.fileNo
  663. this.mainForm.refProjectName = data.refProjectName
  664. this.mainForm.enginName = data.refProjectCategory
  665. this.mainForm.refTradeCategory = data.refTradeCategory
  666. this.screenForm.warehouse = data.correspondId
  667. // this.screenForm.refProjectName = data.refProjectName
  668. data.salesOrderPictures.forEach(k => {
  669. k.name = k.fileName
  670. k.url = k.fileUrl
  671. })
  672. this.fileList = data.salesOrderPictures
  673. // data.orders.forEach(item => {
  674. // item.orderId = item.id;
  675. // })
  676. if (data.orders.length) {
  677. this.screenForm.type = data.orders[0].k3CategoryId
  678. }
  679. this.goodsList = data.orders
  680. })
  681. },
  682. // 获取仓库列表
  683. getWarehouseList() {
  684. getWarehouseList({
  685. pageNum: 1,
  686. pageSize: -1
  687. }).then(res => {
  688. this.warehouseList = res.data.records
  689. })
  690. },
  691. getDictList() {
  692. getDictList({ sysDictEnum: 'PRODUCT_TYPE' }).then(res => {
  693. this.typeList = res.data
  694. })
  695. getDictList({ sysDictEnum: 'STOCK_ORDER' }).then(res => {
  696. this.stockList = res.data
  697. })
  698. },
  699. // 获取经销商列表
  700. getDealerList() {
  701. getDealerList({
  702. pageNum: 1,
  703. pageSize: -1,
  704. bindUser: false
  705. }).then(res => {
  706. this.dealerList = res.data.records
  707. })
  708. },
  709. // 获取存货类别列表
  710. getCategoryList() {
  711. getCategoryList({
  712. pageNum: 1,
  713. pageSize: -1
  714. }).then(res => {
  715. this.categoryList = res.data.records
  716. })
  717. },
  718. // 库存字段
  719. stockFilter(item, type) {
  720. let STOCK_ORDER_INVOICE = this.stockList.find(o => o.dictCode == 'STOCK_ORDER_INVOICE').dictValue
  721. if (type === 1) {
  722. return item.stockAdequate > STOCK_ORDER_INVOICE ? '充足' : item.stockAdequate
  723. }
  724. if (type === 2) {
  725. if (item.stockCorrespond <= 0) {
  726. return '无货'
  727. } else if (item.stockCorrespond >= 1 && item.stockCorrespond <= 30) {
  728. return item.stockCorrespond
  729. } else if (item.stockCorrespond >= 31 && item.stockCorrespond <= 1000) {
  730. return '有货'
  731. } else {
  732. return '充足'
  733. }
  734. // return item.stockCorrespond > STOCK_ORDER_INVOICE ? '充足' : item.stockCorrespond;
  735. }
  736. },
  737. // 获取商品列表
  738. getGoodsList() {
  739. const categoryName = this.categoryList.find(k=>k.id == this.screenForm.type )?.name || ''
  740. getEnginGoodsList({
  741. pageNum: this.currentPage,
  742. pageSize: 10,
  743. refEnginRecordNo: this.screenForm.loginNum,
  744. refProjectName: this.screenForm.enginName,
  745. // refProjectCategory:this.screenForm.enginName,
  746. specification: this.screenForm.model,
  747. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  748. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  749. correspondId: this.screenForm.warehouse,
  750. categoryName
  751. }).then(res => {
  752. let oldGoodsList = this.goodsList
  753. let newGoodsList = res.data.records
  754. for (let i = 0; i < oldGoodsList.length; i++) {
  755. let oldItem = oldGoodsList[i]
  756. for (let j = 0; j < newGoodsList.length; j++) {
  757. let newItem = newGoodsList[j]
  758. if (newItem.orderId === oldItem.orderId) {
  759. newGoodsList[j].selected = true
  760. break
  761. }
  762. }
  763. }
  764. newGoodsList.forEach(item => {
  765. item.invoiceNum = item.refundableQty
  766. })
  767. this.tableGoodsList = newGoodsList
  768. this.listTotal = res.data.total
  769. })
  770. },
  771. // 查询重复值并禁选
  772. checkboxSelect(row, rowIndex) {
  773. if (row.selected) {
  774. return false // 禁用
  775. } else {
  776. return true // 不禁用
  777. }
  778. },
  779. // 点击 选择商品
  780. openDialog() {
  781. this.isShowDialog = true
  782. if (this.screenForm.warehouse) {
  783. this.getGoodsList()
  784. }
  785. },
  786. // 提交筛选表单
  787. submitScreenForm() {
  788. if (!this.screenForm.warehouse) {
  789. return this.$errorMsg('请选择仓库')
  790. }
  791. this.currentPage = 1
  792. this.getGoodsList()
  793. },
  794. // 重置筛选表单
  795. resetScreenForm() {
  796. this.$refs.screenForm.resetFields()
  797. this.currentPage = 1
  798. this.tableGoodsList = []
  799. // this.getGoodsList();
  800. },
  801. // 更改列表当前页
  802. handleTableCurrentChange(val) {
  803. if (this.tableSelection.length > 0) {
  804. return this.$errorMsg('已选择产品不可切换')
  805. }
  806. this.currentPage = val
  807. this.getGoodsList()
  808. },
  809. // 关闭 弹窗
  810. closeDialog() {
  811. this.isShowDialog = false
  812. },
  813. // 列表选择
  814. tableSelectionChange(val) {
  815. this.tableSelection = val
  816. },
  817. // 检查是否一致
  818. isAllEqual(array) {
  819. if (array.length > 0) {
  820. return !array.some(function (item, index) {
  821. return item.enginOrderNo !== array[0].enginOrderNo
  822. })
  823. } else {
  824. return true
  825. }
  826. },
  827. // 确定 添加产品
  828. submitAddGoods() {
  829. let list = this.goodsList.concat(this.tableSelection)
  830. if (!this.isAllEqual(list)) {
  831. return this.$errorMsg('只能选择同一个工程编号的订单')
  832. }
  833. for (let i = 0; i < this.tableSelection.length; i++) {
  834. for (let j = i + 1; j < this.tableSelection.length; j++) {
  835. if (this.tableSelection[i].orderBase !== this.tableSelection[j].orderBase) {
  836. return this.$errorMsg('只能选择新单或旧单')
  837. }
  838. }
  839. if (this.tableSelection[i].invoiceNum === '') {
  840. this.$errorMsg('请输入申请数量')
  841. return
  842. }
  843. // if(this.tableSelection[i].invoiceNum > this.tableSelection[i].refundableQty) {
  844. // this.$errorMsg('申请数量不能大于未申请数量');
  845. // return;
  846. // }
  847. }
  848. this.isShowDialog = false
  849. this.tableGoodsList = []
  850. this.goodsList = this.goodsList.concat(this.tableSelection)
  851. this.getEnginGoodsDetail(this.tableSelection[0].enginOrderNo)
  852. },
  853. getEnginGoodsDetail(enginOrderNo) {
  854. getEnginGoodsDetail({ enginOrderNo }).then(res => {
  855. let data = res.data
  856. this.mainForm.loginNum = data.refEnginRecordNo
  857. this.mainForm.enginName = data.refProjectCategory
  858. this.mainForm.refProjectName = data.refProjectName
  859. this.mainForm.loginType = data.enginOrderType
  860. this.mainForm.factoryNum = data.refFactoryNo
  861. this.mainForm.company = data.refUseUnit
  862. this.mainForm.saleType = data.saleTypeId
  863. this.mainForm.contactMan = data.refLinkman
  864. this.mainForm.tel = data.refTel
  865. this.mainForm.phone = data.refPhone
  866. this.mainForm.address = data.refInstallAddress
  867. this.mainForm.remark = data.remark
  868. this.mainForm.fileNo = data.fileNo
  869. this.mainForm.refTradeCategory = data.refTradeCategory
  870. })
  871. },
  872. // 删除产品
  873. deleteItem(index) {
  874. this.goodsList.splice(index, 1)
  875. },
  876. // 保存
  877. clickSubmitForm(status) {
  878. this.$refs.mainForm.validate(valid => {
  879. if (valid) {
  880. if (this.goodsList.length < 1) {
  881. return this.$errorMsg('请添加引用')
  882. }
  883. for (let i = 0; i < this.goodsList.length; i++) {
  884. if (!Number(this.goodsList[i].invoiceNum)) {
  885. this.$errorMsg('请输入申请数量')
  886. return
  887. }
  888. // if(this.goodsList[i].invoiceNum > this.goodsList[i].refundableQty) {
  889. // this.$errorMsg('申请数量不能大于未申请数量');
  890. // return;
  891. // }
  892. }
  893. if (!this.screenForm.warehouse) {
  894. return this.$errorMsg('请选择仓库')
  895. }
  896. const salesOrderPictures = []
  897. if (this.fileList.length) {
  898. this.fileList.forEach(k => {
  899. salesOrderPictures.push({
  900. fileName: k.name,
  901. fileUrl: k.url,
  902. salesId: this.goodsList[0].id
  903. })
  904. })
  905. }
  906. let correspondName = this.warehouseList[findElem(this.warehouseList, 'id', this.screenForm.warehouse)].name
  907. this.goodsList.forEach(k=>{
  908. k.k3CategoryId = this.goodsList[0].k3CategoryId
  909. k.k3ServiceName = this.goodsList[0].k3ServiceName
  910. })
  911. let params = {
  912. // orderTime: this.mainForm.orderDate + ' 00:00:00',
  913. refEnginRecordNo: this.mainForm.loginNum,
  914. refProjectName: this.mainForm.refProjectName,
  915. refTradeCategory: this.mainForm.refTradeCategory,
  916. refProjectCategory: this.mainForm.enginName,
  917. enginOrderType: this.mainForm.loginType,
  918. refFactoryNo: this.mainForm.factoryNum,
  919. refUseUnit: this.mainForm.company,
  920. refLinkman: this.mainForm.contactMan,
  921. refTel: this.mainForm.tel,
  922. refPhone: this.mainForm.phone,
  923. refInstallAddress: this.mainForm.address,
  924. remark: this.mainForm.remark,
  925. fileNo: this.mainForm.fileNo,
  926. fileUrl: this.fileList && this.fileList.length > 0 ? this.fileList[0].url : '',
  927. fileName: this.fileList && this.fileList.length > 0 ? this.fileList[0].name : '',
  928. correspondId: this.screenForm.warehouse,
  929. correspondName,
  930. orders: this.goodsList,
  931. examineStatus: status,
  932. salesOrderPictures
  933. }
  934. if (this.listItem) {
  935. params.id = this.listItem.id
  936. editEngin(params).then(res => {
  937. this.$emit('shuaxinlb')
  938. this.$successMsg('编辑成功')
  939. this.goBack()
  940. // this.$parent?.getList();
  941. })
  942. } else {
  943. addEngin(params).then(res => {
  944. this.$emit('shuaxinlb')
  945. this.$successMsg('添加成功')
  946. this.goBack()
  947. // this.$parent?.getList();
  948. })
  949. }
  950. }
  951. })
  952. }
  953. }
  954. }
  955. </script>
  956. <style scoped lang="scss">
  957. .detail-container {
  958. width: 100%;
  959. height: 100%;
  960. }
  961. .main-title {
  962. display: flex;
  963. justify-content: space-between;
  964. align-items: center;
  965. margin-top: 20px;
  966. height: 60px;
  967. border-bottom: 1px solid #dcdfe6;
  968. margin-bottom: 20px;
  969. .title {
  970. font-size: 16px;
  971. font-weight: 600;
  972. padding-left: 10px;
  973. }
  974. }
  975. </style>