engin_form.vue 31 KB

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