index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <el-select v-model="getdataListParm.parammaps.pastureName" style="width: 140px;" placeholder="牧场" class="filter-item">
  5. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  6. </el-select>
  7. <el-select v-model="getdataListParm.parammaps.pastureNameIN" style="width: 140px;" clearable placeholder="调入牧场" class="filter-item">
  8. <el-option v-for="item in findAllPasture2" :key="item.id" :label="item.pastureName" :value="item.name" />
  9. </el-select>
  10. <el-input v-model="getdataListParm.parammaps.applyCode" placeholder="调拨单号" style="width: 200px;" class="filter-item" />
  11. <el-select v-model="getdataListParm.parammaps.statue" style="width: 140px;" clearable placeholder="调拨状态" class="filter-item">
  12. <el-option v-for="item in statues" :key="item.id" :label="item.name" :value="item.id" />
  13. </el-select>
  14. <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
  15. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search1">搜索</el-button>
  16. <div>
  17. <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>
  18. <el-button v-waves class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
  19. <el-button class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-upload2" @click="sapUpload">SAP上传</el-button>
  20. </div>
  21. </div>
  22. <el-table
  23. :key="tableKey"
  24. v-loading="listLoading"
  25. element-loading-text="给我一点时间"
  26. :data="list"
  27. border
  28. fit
  29. highlight-current-row
  30. style="width: 100%;"
  31. :row-style="rowStyle"
  32. :cell-style="cellStyle"
  33. class="elTable"
  34. @selection-change="change_table_selection"
  35. @current-change="handleCurrentChange"
  36. >
  37. <el-table-column type="selection" :selectable="checkboxInit" align="center" width="50" />
  38. <el-table-column label="序号" align="center" type="index" width="50px">
  39. <template slot-scope="scope">
  40. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="调拨单号" min-width="150px" align="center">
  44. <template slot-scope="scope">
  45. <span>{{ scope.row.applyCode }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="调出牧场" min-width="90px" align="center">
  49. <template slot-scope="scope">
  50. <span>{{ scope.row.pastureName }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="调入牧场" min-width="80px" align="center">
  54. <template slot-scope="scope">
  55. <span>{{ scope.row.pastureNameIN }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="调拨人" min-width="80px" align="center">
  59. <template slot-scope="scope">
  60. <span>{{ scope.row.emp }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="调拨日期" sortable prop="creatTime" min-width="80px" align="center" />
  64. <el-table-column label="调拨状态" min-width="80px" align="center" :formatter="statue" />
  65. <el-table-column prop="sapStatus" label="sap上传状态" min-width="80px" align="center">
  66. <template slot-scope="scope">
  67. <span v-show ="scope.row.sapStatus == 2">上传失败</span>
  68. <span v-show = "scope.row.sapStatus == 1">上传成功</span>
  69. <span v-show = "scope.row.sapStatus == 0 || typeof(scope.row.sapStatus)== 'undefined'">未上传</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  73. <template slot-scope="{row}">
  74. <el-button type="primary" size="mini" @click="form_see(row)">查看</el-button>
  75. <el-button v-if="row.statue==2 && (row.pastureId == loginPastureid)" type="success" size="mini" style="width:70px;display:inline-block" @click="handleReturn(row)">确认退回</el-button>
  76. <el-button v-else type="success" size="mini" style="width:70px;display:none" @click="handleReturn(row)">确认退回</el-button>
  77. <el-button v-if="row.statue==4 && (row.inPastureId == loginPastureid)" type="success" size="mini" style="display:inline-block" @click="handleReject(row)">驳回</el-button>
  78. <el-button v-else type="success" size="mini" style="display:none" @click="handleReject(row)">驳回</el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="getList" />
  83. <!-- 弹出层新增or修改 -->
  84. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="90%">
  85. <div class="app-container">
  86. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="100px" style="width: 90%;margin:0 auto;">
  87. <el-row>
  88. <el-col :span="8">
  89. <el-form-item label="调拨单号:" prop="applyCode">
  90. <el-input ref="applyCode" v-model="createTemp.applyCode" disabled />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="8">
  94. <el-form-item label="调出牧场:" prop="pastureId">
  95. <el-select v-model="createTemp.pastureId" placeholder="调出牧场" class="filter-item" style="width:100%">
  96. <el-option
  97. v-for="item in findAllPasture"
  98. :key="item.id"
  99. :label="item.name"
  100. :value="item.id"
  101. />
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="8">
  106. <el-form-item label="调入牧场:" prop="inPastureId">
  107. <el-select v-model="createTemp.inPastureId" placeholder="调入牧场" class="filter-item" style="width:100%">
  108. <el-option
  109. v-for="item in findAllPasture2"
  110. :key="item.id"
  111. :label="item.pastureName"
  112. :value="item.id"
  113. />
  114. </el-select>
  115. </el-form-item>
  116. </el-col>
  117. </el-row>
  118. <el-row>
  119. <el-col :span="8">
  120. <el-form-item label="调拨人:" prop="empId">
  121. <el-select v-model="createTemp.empId" placeholder="调拨人" class="filter-item" style="width:100%" @change="changeEmp">
  122. <el-option
  123. v-for="item in findAllEmploye"
  124. :key="item.id"
  125. :label="item.name"
  126. :value="item.id"
  127. />
  128. </el-select>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="8">
  132. <el-form-item label="调拨日期:" prop="applyDate">
  133. <el-date-picker
  134. v-model="createTemp.applyDate"
  135. :picker-options="pickerOptions"
  136. type="date"
  137. placeholder="调拨日期"
  138. format="yyyy-MM-dd"
  139. value-format="yyyy-MM-dd"
  140. style="width:100%"
  141. />
  142. </el-form-item>
  143. </el-col>
  144. <el-col :span="8">
  145. <el-form-item label="采购组:" prop="groupName">
  146. <el-input ref="groupName" v-model="createTemp.groupName" />
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. <el-row>
  151. <el-col :span="16">
  152. <el-form-item label="备件:" prop="partCode">
  153. <el-autocomplete
  154. v-model="createTemp.partCode"
  155. value-key="name"
  156. class="inline-input"
  157. :fetch-suggestions="sparePartSearch"
  158. placeholder="请输入备件编号或备件名称或备件规格"
  159. style="width:100%"
  160. @select="handleSelectSparePart"
  161. >
  162. <template slot-scope="{ item }">
  163. <b>备件编号:</b><div class="name" style="display: inline;">{{ item.partCode }}</div>&nbsp;
  164. | &nbsp;<b>备件名称:</b><span class="addr">{{ item.partName }}</span>&nbsp;
  165. | &nbsp;<b>备件规格:</b><span class="addr">{{ item.specification }}</span>
  166. </template>
  167. </el-autocomplete>
  168. </el-form-item>
  169. </el-col>
  170. </el-row>
  171. </el-form>
  172. <el-table
  173. :key="tableKey"
  174. v-loading="listLoading"
  175. element-loading-text="给我一点时间"
  176. :data="listAdd"
  177. border
  178. fit
  179. highlight-current-row
  180. style="width: 100%;margin-bottom:30px"
  181. :row-style="rowStyle"
  182. :cell-style="cellStyle"
  183. class="elTable"
  184. >
  185. <el-table-column label="序号" align="center" type="index" width="50px" />
  186. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90">
  187. <template slot-scope="scope">
  188. <span>{{ scope.row.partCode }}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="备件名称" prop="partName" align="center" min-width="90">
  192. <template slot-scope="scope">
  193. <span>{{ scope.row.partName }}</span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="备件规格" prop="specification" min-width="80px" align="center">
  197. <template slot-scope="scope">
  198. <span>{{ scope.row.specification }}</span>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="备件图片" prop="picpath" min-width="110px" align="center">
  202. <template slot-scope="scope">
  203. <el-popover placement="right" title="" trigger="hover">
  204. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  205. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  206. </el-popover>
  207. </template>
  208. </el-table-column>
  209. <el-table-column label="备件品牌" prop="brand" align="center" min-width="60">
  210. <template slot-scope="scope">
  211. <span>{{ scope.row.brand }}</span>
  212. </template>
  213. </el-table-column>
  214. <el-table-column label="计量单位" prop="unit" align="center" min-width="60">
  215. <template slot-scope="scope">
  216. <span>{{ scope.row.unit }}</span>
  217. </template>
  218. </el-table-column>
  219. <el-table-column label="供应商" prop="providerName" align="center" min-width="60">
  220. <template slot-scope="scope">
  221. <span>{{ scope.row.providerName }}</span>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="现有库存" prop="reportery" align="center" min-width="60">
  225. <template slot-scope="scope">
  226. <span>{{ scope.row.reportery }}</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column label="调拨数量" min-width="120px" align="center" valign="middle">
  230. <template slot-scope="scope">
  231. <el-form :model="scope.row" :rules="rules">
  232. <el-form-item prop="amount">
  233. <el-input v-model="scope.row.amount" style="margin-top:15px" />
  234. </el-form-item>
  235. </el-form>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="单价" min-width="110px" align="center" valign="middle">
  239. <template slot-scope="scope">
  240. <span>{{ scope.row.price }}</span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="总价" min-width="110px" align="center" valign="middle">
  244. <template slot-scope="scope">
  245. <span>{{ (scope.row.amount * scope.row.price) | keepTwoNum }}</span>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="备注" min-width="110px" align="center" valign="middle">
  249. <template slot-scope="scope">
  250. <el-input v-model="scope.row.note" />
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
  254. <template slot-scope="{row}">
  255. <a class="del" @click="partDelete(row)">删除</a>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. <div slot="footer" class="dialog-footer" style="bottom:10px">
  260. <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():add_dialog_save()">保存并关闭</el-button>
  261. <el-button @click="dialogFormVisible = false;getList()">取消并关闭</el-button>
  262. </div>
  263. </div>
  264. </el-dialog>
  265. <!-- 查看 -->
  266. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleSee" :close-on-click-modal="false" width="90%">
  267. <div class="app-containerSee">
  268. <el-form ref="seeTemp" :rules="rules" :model="seeTemp" label-position="right" label-width="100px" style="width: 90%;margin:0 auto;">
  269. <el-row>
  270. <el-col :span="8">
  271. <el-form-item label="调拨单号:" prop="applyCode">
  272. <el-input ref="applyCode" v-model="seeTemp.applyCode" disabled />
  273. </el-form-item>
  274. </el-col>
  275. <el-col :span="8">
  276. <el-form-item label="调出牧场:" prop="pastureName">
  277. <el-input ref="pastureName" v-model="seeTemp.pastureName" disabled />
  278. <!-- <el-select v-model="seeTemp.pastureId" disabled placeholder="调出牧场" class="filter-item" style="width:100%">
  279. <el-option
  280. v-for="item in findAllPasture"
  281. :key="item.id"
  282. :label="item.name"
  283. :value="item.id"
  284. />
  285. </el-select> -->
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="8">
  289. <el-form-item label="调入牧场:" prop="inPastureId">
  290. <el-select v-model="seeTemp.inPastureId" disabled placeholder="调入牧场" class="filter-item" style="width:100%">
  291. <el-option
  292. v-for="item in findAllPasture2"
  293. :key="item.id"
  294. :label="item.pastureName"
  295. :value="item.id"
  296. />
  297. </el-select>
  298. </el-form-item>
  299. </el-col>
  300. </el-row>
  301. <el-row>
  302. <el-col :span="8">
  303. <el-form-item label="调拨人:" prop="emp">
  304. <el-input ref="emp" v-model="seeTemp.emp" disabled />
  305. <!-- <el-select v-model="seeTemp.empId" placeholder="调拨人" disabled class="filter-item" style="width:100%" @change="changeEmp">
  306. <el-option
  307. v-for="item in findAllEmploye"
  308. :key="item.id"
  309. :label="item.name"
  310. :value="item.id"
  311. />
  312. </el-select> -->
  313. </el-form-item>
  314. </el-col>
  315. <el-col :span="8">
  316. <el-form-item label="调拨日期:" prop="applyDate">
  317. <el-date-picker
  318. v-model="seeTemp.applyDate"
  319. :picker-options="pickerOptions"
  320. type="date"
  321. disabled
  322. placeholder="调拨日期"
  323. format="yyyy-MM-dd"
  324. value-format="yyyy-MM-dd"
  325. style="width:100%"
  326. />
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. </el-form>
  331. <el-table
  332. :key="tableKey"
  333. v-loading="listLoadingSee"
  334. element-loading-text="给我一点时间"
  335. :data="listSee"
  336. border
  337. fit
  338. highlight-current-row
  339. style="width: 100%;margin-bottom:30px"
  340. :row-style="rowStyle"
  341. :cell-style="cellStyle"
  342. class="elTable"
  343. @sort-change="tableSort"
  344. >
  345. <el-table-column label="序号" align="center" type="index" width="50px" />
  346. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90">
  347. <template slot-scope="scope">
  348. <span>{{ scope.row.partCode }}</span>
  349. </template>
  350. </el-table-column>
  351. <el-table-column label="备件名称" prop="partName" align="center" min-width="90">
  352. <template slot-scope="scope">
  353. <span>{{ scope.row.partName }}</span>
  354. </template>
  355. </el-table-column>
  356. <el-table-column label="备件规格" prop="specification" min-width="80px" align="center">
  357. <template slot-scope="scope">
  358. <span>{{ scope.row.specification }}</span>
  359. </template>
  360. </el-table-column>
  361. <el-table-column label="备件图片" prop="picpath" min-width="110px" align="center">
  362. <template slot-scope="scope">
  363. <el-popover placement="right" title="" trigger="hover">
  364. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  365. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  366. </el-popover>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="备件品牌" prop="brandName" align="center" min-width="60">
  370. <template slot-scope="scope">
  371. <span>{{ scope.row.brandName }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column label="计量单位" prop="unit" align="center" min-width="60">
  375. <template slot-scope="scope">
  376. <span>{{ scope.row.unit }}</span>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="供应商" prop="providerName" align="center" min-width="60">
  380. <template slot-scope="scope">
  381. <span>{{ scope.row.providerName }}</span>
  382. </template>
  383. </el-table-column>
  384. <el-table-column label="调拨数量" sortable prop="amount" min-width="120px" align="center" valign="middle">
  385. <template slot-scope="scope">
  386. <span>{{ scope.row.amount }}</span>
  387. </template>
  388. </el-table-column>
  389. <el-table-column label="单价" sortable prop="price" min-width="110px" align="center" valign="middle">
  390. <template slot-scope="scope">
  391. <span>{{ scope.row.price }}</span>
  392. </template>
  393. </el-table-column>
  394. <el-table-column label="总价" sortable prop="sumPrice" min-width="110px" align="center" valign="middle">
  395. <template slot-scope="scope">
  396. <span>{{ scope.row.sumPrice }}</span>
  397. </template>
  398. </el-table-column>
  399. <el-table-column label="备注" min-width="110px" align="center" valign="middle">
  400. <template slot-scope="scope">
  401. <span>{{ scope.row.note }}</span>
  402. </template>
  403. </el-table-column>
  404. </el-table>
  405. <div slot="footer" class="dialog-footer" style="bottom:5px;">
  406. <el-button @click="dialogFormVisibleSee = false">关闭</el-button>
  407. </div>
  408. </div>
  409. </el-dialog>
  410. </div>
  411. </template>
  412. <script>
  413. // / 引入
  414. import { GetDataByName, GetDataByNames, PostDataByName, ExecDataByConfig, checkButtons, failproccess, SapTrans } from '@/api/common'
  415. import waves from '@/directive/waves' // waves directive
  416. import { parseTime, sortChange } from '@/utils/index.js'
  417. // eslint-disable-next-line no-unused-vars
  418. import { validateEMail } from '@/utils/validate.js'
  419. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  420. import { MessageBox } from 'element-ui'
  421. import Cookies from 'js-cookie'
  422. import { getToken } from '@/utils/auth'
  423. export default {
  424. name: 'Allot',
  425. components: { Pagination },
  426. directives: { waves },
  427. filters: {
  428. keepTwoNum(value) {
  429. value = Number(value)
  430. return value.toFixed(2)
  431. }
  432. },
  433. data() {
  434. return {
  435. isSap:1,
  436. isSrm:1,
  437. selectList: [],
  438. isAllotsap: [],
  439. currentRow:{},
  440. loginPastureid: Cookies.get('pastureid'),
  441. isokDisable: false,
  442. findAllProvider: [],
  443. findAllPasture: [],
  444. findAllPasture2: [],
  445. findAllDepart: [],
  446. findAllEmploye: [],
  447. statues: [{ id: '0', name: '调拨中' }, { id: '1', name: '调拨完成' }, { id: '2', name: '驳回中' }, { id: '3', name: '退回完成' }],
  448. requestParams: [
  449. { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
  450. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  451. { name: 'getPastureList', offset: 0, pagecount: 0, returntype: 'Map', parammaps: {}},
  452. { name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }},
  453. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }}
  454. ],
  455. pickerOptions: {
  456. disabledDate(time) {
  457. return time.getTime() > Date.now()// 当天之前的时间可选
  458. }
  459. },
  460. textMap: {
  461. create: '新增',
  462. see: '查看'
  463. },
  464. rules: {
  465. inPastureId: [{ required: true, message: '必填', trigger: 'blur' }]
  466. },
  467. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  468. cellStyle: { padding: 0 + 'px' },
  469. getdataListParm: {
  470. name: 'getBigPartTransferList',
  471. page: 1,
  472. offset: 1,
  473. pagecount: 10,
  474. returntype: 'Map',
  475. parammaps: {
  476. pastureName: Cookies.get('pasturename'),
  477. applyCode: '',
  478. statue: '',
  479. pastureNameIN: '',
  480. inputDatetime: '',
  481. startTime: '',
  482. stopTime: ''
  483. }
  484. },
  485. tableKey: 0,
  486. listLoading: true,
  487. total: 0,
  488. list: [],
  489. dialogStatus: '',
  490. dialogFormVisible: false,
  491. dialogFormVisibleSee: false,
  492. listLoadingSee: true,
  493. listSee: [],
  494. totalSee: 0,
  495. seeTemp: {},
  496. getdataListSee: {
  497. name: 'getPartTransferbybigid',
  498. returntype: 'Map',
  499. parammaps: {}
  500. },
  501. createTemp: {
  502. pastureId: this.$store.state.user.pastureid,
  503. departmentId: this.$store.state.user.departmentid,
  504. empId: this.$store.state.user.employeid,
  505. employeId: this.$store.state.user.employeid,
  506. applyDate: parseTime(new Date(), '{y}-{m}-{d}'),
  507. groupName:''
  508. },
  509. requestSparePart: {
  510. name: 'getPartsListLY',
  511. page: 1,
  512. offset: 1,
  513. pagecount: 20,
  514. returntype: 'Map',
  515. parammaps: {
  516. pastureId: Cookies.get('pastureid')
  517. }
  518. },
  519. getParmCreateNumber: {
  520. name: 'autoCreatCode',
  521. page: 0,
  522. offset: 0,
  523. pagecount: 0,
  524. returntype: 'Map',
  525. parammaps: {
  526. pastureId: Cookies.get('pastureid'),
  527. codeType: 'DB'
  528. }
  529. },
  530. // getParmCreateAmount: {
  531. // name: 'getPartsAmountList',
  532. // page: 0,
  533. // offset: 0,
  534. // pagecount: 0,
  535. // returntype: 'Map',
  536. // parammaps: {}
  537. // },
  538. listAdd: [],
  539. postDataPramas: {},
  540. requestParam: {},
  541. dialogFormVisible_Examine: false,
  542. examineTemp: {
  543. statue: 1
  544. },
  545. statueReason: false,
  546. activeList: [],
  547. active: 3
  548. }
  549. },
  550. created() {
  551. this.getDownList()
  552. this.getList()
  553. },
  554. methods: {
  555. handleCurrentChange(val) {
  556. this.currentRow = val;
  557. console.log("currentRow",this.currentRow)
  558. },
  559. checkboxInit(row,index){
  560. // console.log(row)
  561. var data1 = new Date(row.creatTime)
  562. var data2 = new Date('2022-10-25')
  563. if(data1 > data2){ return 1 } else {return 0}
  564. },
  565. //监听 - 表格 - 勾选
  566. change_table_selection(val) {
  567. this.selectList = val
  568. console.log('勾选数据selectList', this.selectList)
  569. },
  570. sapUpload(){
  571. const that = this
  572. console.log("currentRow ProofCode",this.currentRow.ProofCode)
  573. var send_data = this.selectList
  574. if(send_data.length == 0){
  575. that.$notify({ title: '失败', message: '请勾选数据!' , type: 'error', duration: 2000 })
  576. return false
  577. }
  578. console.log(that.isSap)
  579. if(that.isSap == 1){
  580. that.isSap = 0
  581. SapTrans(send_data).then(response => {
  582. console.log('response', response)
  583. if (response.msg !== 'fail') {
  584. that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  585. that.selectList = []
  586. that.getList()
  587. } else {
  588. that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  589. }
  590. })
  591. } else {
  592. that.$notify({ title: '失败', message: '正在请求中,请稍等几秒钟后再点击' , type: 'error', duration: 2000 })
  593. }
  594. setTimeout(() => {
  595. that.isSap = 1
  596. }, 3000)
  597. // if(true){
  598. //sapStatus 0 或没有 未同步,1 同步成功,2同步失败
  599. // if(this.currentRow.sapStatus){
  600. // console.log("currentRow sapStatus 这个值说明已经上传了 传")
  601. // if(this.currentRow.sapStatus == 1){
  602. // } else {
  603. // var send_data = {
  604. // "code":applyCode,
  605. // "pastureid":Cookies.get('pastureid')
  606. // }
  607. // SapTrans(send_data).then(response => {
  608. // console.log('response', response)
  609. // if (response.msg !== 'fail') {
  610. // that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  611. // that.getList()
  612. // } else {
  613. // that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  614. // }
  615. // })
  616. // }
  617. // //如果有这个值说明已经上传了,不用上传
  618. // } else {
  619. // console.log("currentRow sapStatus没有这个值")
  620. // console.log("applyCode",applyCode)
  621. // var send_data = {
  622. // "code":applyCode,
  623. // "pastureid":Cookies.get('pastureid')
  624. // }
  625. // SapTrans(send_data).then(response => {
  626. // console.log('response', response)
  627. // if (response.msg !== 'fail') {
  628. // that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  629. // that.getList()
  630. // } else {
  631. // that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  632. // }
  633. // })
  634. // }
  635. },
  636. tableSort(column) {
  637. sortChange(column, this.listSee)
  638. },
  639. getList() {
  640. this.listLoading = true
  641. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  642. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  643. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  644. } else {
  645. this.getdataListParm.parammaps.startTime = ''
  646. this.getdataListParm.parammaps.stopTime = ''
  647. }
  648. GetDataByName(this.getdataListParm).then(response => {
  649. console.log('table数据', response.data.list)
  650. this.list = response.data.list
  651. this.pageNum = response.data.pageNum
  652. this.pageSize = response.data.pageSize
  653. if (response.data.total) {
  654. this.total = response.data.total
  655. }
  656. // Just to simulate the time of the request
  657. setTimeout(() => {
  658. this.listLoading = false
  659. }, 100)
  660. })
  661. },
  662. statue: function(cellValue) {
  663. // console.log(cellValue.isZeroStock)
  664. if (cellValue.statue == 0) {
  665. return '调拨中'
  666. } else if (cellValue.statue == 1) {
  667. return '调拨完成'
  668. } else if (cellValue.statue == 2) {
  669. return '驳回中'
  670. } else if (cellValue.statue == 3) {
  671. return '退回完成'
  672. } else if (cellValue.statue == 4) {
  673. return '调拨中'
  674. }
  675. },
  676. form_search1() {
  677. console.log('点击了table搜索')
  678. if (this.getdataListParm.parammaps.inputDatetime === null) {
  679. this.getdataListParm.parammaps.inputDatetime = ''
  680. }
  681. this.listLoading = true
  682. this.getdataListParm.offset = 1
  683. this.getList()
  684. },
  685. resetCreateTemp() {
  686. this.createTemp.pastureId = this.$store.state.user.pastureid
  687. this.createTemp.departmentId = this.$store.state.user.departmentid
  688. this.createTemp.employeId = this.$store.state.user.employeid
  689. this.createTemp.empId = this.$store.state.user.employeid
  690. this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
  691. this.createTemp.applyCode = ''
  692. this.createTemp.groupName = ''
  693. this.listAdd = []
  694. },
  695. form_add() {
  696. this.resetCreateTemp()
  697. this.createTemp.applyCode = ''
  698. this.dialogStatus = 'create'
  699. this.dialogFormVisible = true
  700. this.getCreateNumber()
  701. },
  702. getCreateNumber() {
  703. GetDataByName(this.getParmCreateNumber).then(response => {
  704. this.$nextTick(() => {
  705. console.log('新增申购单号', response.data.list[0].orderCode)
  706. this.createTemp.applyCode = response.data.list[0].orderCode
  707. this.$forceUpdate()
  708. })
  709. })
  710. },
  711. changeEmp(val) {
  712. this.createTemp.emp = this.findAllEmploye.find(obj => obj.id == val).name
  713. },
  714. sparePartSearch(queryString, cb) {
  715. console.log('备件模糊查询输入值', queryString)
  716. this.requestSparePart.parammaps['partCode'] = queryString
  717. GetDataByName(this.requestSparePart).then(response => {
  718. console.log('备件模糊查询搜索data', response.data.list)
  719. if (response.data.list == null) {
  720. cb([])
  721. } else {
  722. cb(response.data.list)
  723. }
  724. })
  725. },
  726. handleSelectSparePart(item) {
  727. console.log('备件模糊查询选中值', item)
  728. console.log('备件模糊查询选中值', item.id)
  729. console.log(this.listAdd)
  730. if (this.listAdd.length > 0) {
  731. // eslint-disable-next-line no-redeclare
  732. if (this.listAdd.find(obj => obj.id === item.id)) {
  733. this.$message({
  734. type: 'warning',
  735. message: '此备件已存在,请重新选择备件'
  736. })
  737. } else {
  738. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  739. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  740. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  741. } else {
  742. item.srcpath = ''
  743. item.picpath = ''
  744. }
  745. this.listAdd.unshift(item)
  746. // this.getParmCreateAmount.parammaps.partCode = item.partCode
  747. // GetDataByName(this.getParmCreateAmount).then(response => {
  748. // this.$nextTick(() => {
  749. // console.log('新增根据编号获取备件库存数量', response.data.list[0].reporteryNum)
  750. // item.reportery = response.data.list[0].reporteryNum
  751. // this.listAdd.unshift(item)
  752. // this.$forceUpdate()
  753. // })
  754. // })
  755. }
  756. } else {
  757. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  758. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  759. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  760. } else {
  761. item.srcpath = ''
  762. item.picpath = ''
  763. }
  764. this.listAdd.unshift(item)
  765. // this.getParmCreateAmount.parammaps.partCode = item.partCode
  766. // GetDataByName(this.getParmCreateAmount).then(response => {
  767. // this.$nextTick(() => {
  768. // console.log('新增根据编号获取备件库存数量', response.data.list[0].reporteryNum)
  769. // item.reportery = response.data.list[0].reporteryNum
  770. // this.listAdd.unshift(item)
  771. // this.$forceUpdate()
  772. // })
  773. // })
  774. }
  775. this.$forceUpdate()
  776. },
  777. add_dialog_save() {
  778. this.isokDisable = true
  779. setTimeout(() => {
  780. this.isokDisable = false
  781. }, 1000)
  782. this.$refs['createTemp'].validate(valid => {
  783. if (valid) {
  784. console.log(this.listAdd)
  785. if (this.createTemp.applyCode == '' || this.createTemp.applyCode == null || this.createTemp.applyCode == undefined) {
  786. GetDataByName(this.getParmCreateNumber).then(response => {
  787. this.$nextTick(() => {
  788. console.log('新增申购单号', response.data.list[0].orderCode)
  789. this.createTemp.applyCode = response.data.list[0].orderCode
  790. this.$forceUpdate()
  791. this.add_dialog_saveSave()
  792. })
  793. })
  794. } else {
  795. this.add_dialog_saveSave()
  796. }
  797. }
  798. })
  799. },
  800. add_dialog_saveSave() {
  801. if (this.listAdd.length !== 0) {
  802. for (var j = 0; j < this.listAdd.length; j++) {
  803. console.log(this.listAdd[j].amount)
  804. // eslint-disable-next-line use-isnan
  805. if (this.listAdd[j].amount == null || this.listAdd[j].amount === '') {
  806. this.$message({
  807. type: 'warning',
  808. message: '请检查调拨数量是否未填写',
  809. duration: 2000
  810. })
  811. return false
  812. } else if (parseFloat(this.listAdd[j].amount) > parseFloat(this.listAdd[j].reportery)) {
  813. this.$message({
  814. type: 'error',
  815. message: '调拨数量不可大于现有库存数量',
  816. duration: 2000
  817. })
  818. return false
  819. } else {
  820. var rulesAmount = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  821. if (!rulesAmount.test(parseFloat(this.listAdd[j].amount))) {
  822. this.$message({
  823. type: 'error',
  824. message: '调拨数量请输入正数,且最多保留两位小数',
  825. duration: 2000
  826. })
  827. return false
  828. }
  829. }
  830. }
  831. this.postDataPramas.common = { 'returnmap': '0' }
  832. this.postDataPramas.data = []
  833. this.postDataPramas.data[0] = { 'name': 'insertBigPartTransfer', 'type': 'e', 'parammaps': {
  834. pastureId: this.createTemp.pastureId,
  835. inPastureId: this.createTemp.inPastureId,
  836. applyCode: this.createTemp.applyCode,
  837. empId: this.createTemp.empId,
  838. emp: this.createTemp.emp,
  839. applyDate: this.createTemp.applyDate,
  840. groupName:this.createTemp.groupName
  841. }}
  842. // eslint-disable-next-line no-irregular-whitespace
  843. this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  844. this.postDataPramas.data[1].children = []
  845. this.postDataPramas.data[1].children[0] = { 'name': 'insertParttTransfer', 'type': 'e', 'parammaps': {
  846. bigId: '@insertBigPartTransfer.LastInsertId',
  847. pastureId: '@insertSpotList.pastureId',
  848. partId: '@insertSpotList.partId',
  849. partCode: '@insertSpotList.partCode',
  850. partName: '@insertSpotList.partName',
  851. specification: '@insertSpotList.specification',
  852. price: '@insertSpotList.price',
  853. unit: '@insertSpotList.unit',
  854. brandId: '@insertSpotList.brandId',
  855. brandName: '@insertSpotList.brand',
  856. amount: '@insertSpotList.amount',
  857. providerName: '@insertSpotList.providerName',
  858. providerId: '@insertSpotList.providerId',
  859. note: '@insertSpotList.note',
  860. partRepId: '@insertSpotList.partRepId'
  861. }}
  862. ExecDataByConfig(this.postDataPramas).then(response => {
  863. console.log('新增保存发送参数', this.postDataPramas)
  864. if (response.msg === 'fail') {
  865. this.$notify({
  866. title: '保存失败',
  867. message: response.data,
  868. type: 'warning',
  869. duration: 2000
  870. })
  871. } else {
  872. this.dialogFormVisible = false
  873. this.getdataListParm.parammaps.inputDatetime = ''
  874. this.getList()
  875. this.$notify({
  876. title: '',
  877. message: '保存成功',
  878. type: 'success',
  879. duration: 2000
  880. })
  881. }
  882. })
  883. return true
  884. } else {
  885. this.$message({
  886. title: '',
  887. message: '请选择备件',
  888. type: 'warning',
  889. duration: 2000
  890. })
  891. return false
  892. }
  893. },
  894. partDelete(row) {
  895. console.log(this.listAdd)
  896. MessageBox.confirm('设备名称:' + row.partName, '确认删除?', {
  897. confirmButtonText: '确认',
  898. cancelButtonText: '取消',
  899. type: 'warning'
  900. }).then(() => {
  901. // console.log(this.list2)
  902. for (var i = 0; i < this.listAdd.length; i++) {
  903. console.log(this.listAdd[i])
  904. if (this.listAdd[i].id === row.id) {
  905. var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
  906. }
  907. if (listAddIndex > -1) {
  908. this.listAdd.splice(listAddIndex, 1)
  909. return
  910. }
  911. }
  912. })
  913. },
  914. // 查看
  915. form_see(row) {
  916. this.dialogStatus = 'see'
  917. this.dialogFormVisibleSee = true
  918. row.pastureId = String(row.pastureId)
  919. console.log(row.pastureId)
  920. this.seeTemp = Object.assign({}, row)
  921. console.log('查看上方数据(从table读取)', this.seeTemp)
  922. this.getdataListSee.parammaps.id = this.seeTemp.id
  923. this.getSeeList()
  924. },
  925. getSeeList() {
  926. GetDataByName(this.getdataListSee).then(response => {
  927. console.log('查看下方table数据', response.data.list)
  928. this.listSee = response.data.list
  929. if (response.data.list !== null) {
  930. for (let i = 0; i < response.data.list.length; i++) {
  931. if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
  932. this.listSee[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  933. this.listSee[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  934. } else {
  935. this.listSee[i].srcpath = ''
  936. this.listSee[i].picpath = ''
  937. }
  938. }
  939. }
  940. this.seeTemp.providerName = response.data.list.providerName
  941. this.pageNumSee = response.data.pageNum
  942. this.pageSizeSee = response.data.pageSize
  943. if (response.data.total) {
  944. this.totalSee = response.data.total
  945. }
  946. setTimeout(() => {
  947. this.listLoadingSee = false
  948. }, 100)
  949. })
  950. },
  951. getDownList() {
  952. GetDataByNames(this.requestParams).then(response => {
  953. this.findAllProvider = response.data.findAllProvider.list
  954. this.findAllPasture = response.data.findAllPasture.list
  955. this.findAllPasture2 = response.data.getPastureList.list
  956. this.findAllDepart = response.data.findAllDepart.list
  957. this.findAllEmploye = response.data.findAllEmploye.list
  958. })
  959. },
  960. handleDownload() {
  961. alert('点击了导出')
  962. },
  963. handleReturn(row) {
  964. console.log('点击了确认退回')
  965. this.seeTemp = Object.assign({}, row)
  966. this.getdataListSee.parammaps.id = this.seeTemp.id
  967. this.getSeeList()
  968. MessageBox.confirm('是否确认将调拨单备件退回至库存', {
  969. confirmButtonText: '确认',
  970. cancelButtonText: '取消',
  971. type: 'warning'
  972. }).then(() => {
  973. this.postDataPramas.common = { 'returnmap': '0' }
  974. this.postDataPramas.data = []
  975. this.postDataPramas.data[0] = { 'name': 'updateBigPartTransfer', 'type': 'e', 'parammaps': {
  976. id: row.id,
  977. statue: 3
  978. }}
  979. this.postDataPramas.data[1] = { 'name': ' getPartTransferbybigid', 'type': 'e', 'parammaps': {
  980. id: row.id,
  981. statue: 3
  982. }}
  983. this.postDataPramas.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listSee }}
  984. this.postDataPramas.data[2].children = []
  985. this.postDataPramas.data[2].children[0] = { 'name': 'updatePartRepertoryDB', 'type': 'e', 'parammaps': {
  986. amount: '@insertSpotList.amount',
  987. partRepId: '@insertSpotList.partRepId'
  988. }}
  989. ExecDataByConfig(this.postDataPramas).then(response => {
  990. this.getList()
  991. this.$notify({
  992. title: '成功',
  993. message: '退回成功',
  994. type: 'success',
  995. duration: 2000
  996. })
  997. })
  998. }).catch(() => {
  999. this.$message({
  1000. type: 'info',
  1001. message: '已取消确认退回'
  1002. })
  1003. })
  1004. },
  1005. handleReject(row) {
  1006. console.log('点击了驳回')
  1007. MessageBox.confirm('是否确认将调拨单驳回', {
  1008. confirmButtonText: '确认',
  1009. cancelButtonText: '取消',
  1010. type: 'warning'
  1011. }).then(() => {
  1012. this.requestParam.name = 'updateBigPartTransfer'
  1013. this.requestParam.parammaps = {}
  1014. this.requestParam.parammaps.id = row.id
  1015. this.requestParam.parammaps.statue = 2
  1016. PostDataByName(this.requestParam).then(() => {
  1017. this.getList()
  1018. this.dialogFormVisible = false
  1019. this.$notify({
  1020. title: '成功',
  1021. message: '驳回成功',
  1022. type: 'success',
  1023. duration: 2000
  1024. })
  1025. })
  1026. }).catch(() => {
  1027. this.$message({
  1028. type: 'info',
  1029. message: '已取消驳回'
  1030. })
  1031. })
  1032. }
  1033. }
  1034. }
  1035. </script>
  1036. <style lang="scss" scoped>
  1037. .pagination-container{
  1038. display: block !important;
  1039. }
  1040. </style>
  1041. <style lang="scss">
  1042. .el-step__head.is-success {
  1043. color: #409EFF;
  1044. border-color: #409EFF;
  1045. }
  1046. .el-step__title.is-success{
  1047. color: #409EFF;
  1048. }
  1049. .el-step__head.is-process{
  1050. color: #409EFF;
  1051. border-color: #409EFF;
  1052. .el-step__icon.is-text{
  1053. background: #409EFF;
  1054. color: #fff;
  1055. }
  1056. }
  1057. .step-row{
  1058. color: #000;
  1059. }
  1060. </style>