index.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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. return 1
  562. },
  563. //监听 - 表格 - 勾选
  564. change_table_selection(val) {
  565. this.selectList = val
  566. console.log('勾选数据selectList', this.selectList)
  567. },
  568. sapUpload(){
  569. const that = this
  570. console.log("currentRow ProofCode",this.currentRow.ProofCode)
  571. var send_data = this.selectList
  572. if(send_data.length == 0){
  573. that.$notify({ title: '失败', message: '请勾选数据!' , type: 'error', duration: 2000 })
  574. return false
  575. }
  576. console.log(that.isSap)
  577. if(that.isSap == 1){
  578. that.isSap = 0
  579. SapTrans(send_data).then(response => {
  580. console.log('response', response)
  581. if (response.msg !== 'fail') {
  582. that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  583. that.selectList = []
  584. that.getList()
  585. } else {
  586. that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  587. }
  588. })
  589. } else {
  590. that.$notify({ title: '失败', message: '正在请求中,请稍等几秒钟后再点击' , type: 'error', duration: 2000 })
  591. }
  592. setTimeout(() => {
  593. that.isSap = 1
  594. }, 3000)
  595. // if(true){
  596. //sapStatus 0 或没有 未同步,1 同步成功,2同步失败
  597. // if(this.currentRow.sapStatus){
  598. // console.log("currentRow sapStatus 这个值说明已经上传了 传")
  599. // if(this.currentRow.sapStatus == 1){
  600. // } else {
  601. // var send_data = {
  602. // "code":applyCode,
  603. // "pastureid":Cookies.get('pastureid')
  604. // }
  605. // SapTrans(send_data).then(response => {
  606. // console.log('response', response)
  607. // if (response.msg !== 'fail') {
  608. // that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  609. // that.getList()
  610. // } else {
  611. // that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  612. // }
  613. // })
  614. // }
  615. // //如果有这个值说明已经上传了,不用上传
  616. // } else {
  617. // console.log("currentRow sapStatus没有这个值")
  618. // console.log("applyCode",applyCode)
  619. // var send_data = {
  620. // "code":applyCode,
  621. // "pastureid":Cookies.get('pastureid')
  622. // }
  623. // SapTrans(send_data).then(response => {
  624. // console.log('response', response)
  625. // if (response.msg !== 'fail') {
  626. // that.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  627. // that.getList()
  628. // } else {
  629. // that.$notify({ title: '失败', message: '上传失败' , type: 'error', duration: 2000 })
  630. // }
  631. // })
  632. // }
  633. },
  634. tableSort(column) {
  635. sortChange(column, this.listSee)
  636. },
  637. getList() {
  638. this.listLoading = true
  639. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  640. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  641. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  642. } else {
  643. this.getdataListParm.parammaps.startTime = ''
  644. this.getdataListParm.parammaps.stopTime = ''
  645. }
  646. GetDataByName(this.getdataListParm).then(response => {
  647. console.log('table数据', response.data.list)
  648. this.list = response.data.list
  649. this.pageNum = response.data.pageNum
  650. this.pageSize = response.data.pageSize
  651. if (response.data.total) {
  652. this.total = response.data.total
  653. }
  654. // Just to simulate the time of the request
  655. setTimeout(() => {
  656. this.listLoading = false
  657. }, 100)
  658. })
  659. },
  660. statue: function(cellValue) {
  661. // console.log(cellValue.isZeroStock)
  662. if (cellValue.statue == 0) {
  663. return '调拨中'
  664. } else if (cellValue.statue == 1) {
  665. return '调拨完成'
  666. } else if (cellValue.statue == 2) {
  667. return '驳回中'
  668. } else if (cellValue.statue == 3) {
  669. return '退回完成'
  670. } else if (cellValue.statue == 4) {
  671. return '调拨中'
  672. }
  673. },
  674. form_search1() {
  675. console.log('点击了table搜索')
  676. if (this.getdataListParm.parammaps.inputDatetime === null) {
  677. this.getdataListParm.parammaps.inputDatetime = ''
  678. }
  679. this.listLoading = true
  680. this.getdataListParm.offset = 1
  681. this.getList()
  682. },
  683. resetCreateTemp() {
  684. this.createTemp.pastureId = this.$store.state.user.pastureid
  685. this.createTemp.departmentId = this.$store.state.user.departmentid
  686. this.createTemp.employeId = this.$store.state.user.employeid
  687. this.createTemp.empId = this.$store.state.user.employeid
  688. this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
  689. this.createTemp.applyCode = ''
  690. this.createTemp.groupName = ''
  691. this.listAdd = []
  692. },
  693. form_add() {
  694. this.resetCreateTemp()
  695. this.createTemp.applyCode = ''
  696. this.dialogStatus = 'create'
  697. this.dialogFormVisible = true
  698. this.getCreateNumber()
  699. },
  700. getCreateNumber() {
  701. GetDataByName(this.getParmCreateNumber).then(response => {
  702. this.$nextTick(() => {
  703. console.log('新增申购单号', response.data.list[0].orderCode)
  704. this.createTemp.applyCode = response.data.list[0].orderCode
  705. this.$forceUpdate()
  706. })
  707. })
  708. },
  709. changeEmp(val) {
  710. this.createTemp.emp = this.findAllEmploye.find(obj => obj.id == val).name
  711. },
  712. sparePartSearch(queryString, cb) {
  713. console.log('备件模糊查询输入值', queryString)
  714. this.requestSparePart.parammaps['partCode'] = queryString
  715. GetDataByName(this.requestSparePart).then(response => {
  716. console.log('备件模糊查询搜索data', response.data.list)
  717. if (response.data.list == null) {
  718. cb([])
  719. } else {
  720. cb(response.data.list)
  721. }
  722. })
  723. },
  724. handleSelectSparePart(item) {
  725. console.log('备件模糊查询选中值', item)
  726. console.log('备件模糊查询选中值', item.id)
  727. console.log(this.listAdd)
  728. if (this.listAdd.length > 0) {
  729. // eslint-disable-next-line no-redeclare
  730. if (this.listAdd.find(obj => obj.id === item.id)) {
  731. this.$message({
  732. type: 'warning',
  733. message: '此备件已存在,请重新选择备件'
  734. })
  735. } else {
  736. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  737. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  738. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  739. } else {
  740. item.srcpath = ''
  741. item.picpath = ''
  742. }
  743. this.listAdd.unshift(item)
  744. // this.getParmCreateAmount.parammaps.partCode = item.partCode
  745. // GetDataByName(this.getParmCreateAmount).then(response => {
  746. // this.$nextTick(() => {
  747. // console.log('新增根据编号获取备件库存数量', response.data.list[0].reporteryNum)
  748. // item.reportery = response.data.list[0].reporteryNum
  749. // this.listAdd.unshift(item)
  750. // this.$forceUpdate()
  751. // })
  752. // })
  753. }
  754. } else {
  755. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  756. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  757. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  758. } else {
  759. item.srcpath = ''
  760. item.picpath = ''
  761. }
  762. this.listAdd.unshift(item)
  763. // this.getParmCreateAmount.parammaps.partCode = item.partCode
  764. // GetDataByName(this.getParmCreateAmount).then(response => {
  765. // this.$nextTick(() => {
  766. // console.log('新增根据编号获取备件库存数量', response.data.list[0].reporteryNum)
  767. // item.reportery = response.data.list[0].reporteryNum
  768. // this.listAdd.unshift(item)
  769. // this.$forceUpdate()
  770. // })
  771. // })
  772. }
  773. this.$forceUpdate()
  774. },
  775. add_dialog_save() {
  776. this.isokDisable = true
  777. setTimeout(() => {
  778. this.isokDisable = false
  779. }, 1000)
  780. this.$refs['createTemp'].validate(valid => {
  781. if (valid) {
  782. console.log(this.listAdd)
  783. if (this.createTemp.applyCode == '' || this.createTemp.applyCode == null || this.createTemp.applyCode == undefined) {
  784. GetDataByName(this.getParmCreateNumber).then(response => {
  785. this.$nextTick(() => {
  786. console.log('新增申购单号', response.data.list[0].orderCode)
  787. this.createTemp.applyCode = response.data.list[0].orderCode
  788. this.$forceUpdate()
  789. this.add_dialog_saveSave()
  790. })
  791. })
  792. } else {
  793. this.add_dialog_saveSave()
  794. }
  795. }
  796. })
  797. },
  798. add_dialog_saveSave() {
  799. if (this.listAdd.length !== 0) {
  800. for (var j = 0; j < this.listAdd.length; j++) {
  801. console.log(this.listAdd[j].amount)
  802. // eslint-disable-next-line use-isnan
  803. if (this.listAdd[j].amount == null || this.listAdd[j].amount === '') {
  804. this.$message({
  805. type: 'warning',
  806. message: '请检查调拨数量是否未填写',
  807. duration: 2000
  808. })
  809. return false
  810. } else if (parseFloat(this.listAdd[j].amount) > parseFloat(this.listAdd[j].reportery)) {
  811. this.$message({
  812. type: 'error',
  813. message: '调拨数量不可大于现有库存数量',
  814. duration: 2000
  815. })
  816. return false
  817. } else {
  818. var rulesAmount = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  819. if (!rulesAmount.test(parseFloat(this.listAdd[j].amount))) {
  820. this.$message({
  821. type: 'error',
  822. message: '调拨数量请输入正数,且最多保留两位小数',
  823. duration: 2000
  824. })
  825. return false
  826. }
  827. }
  828. }
  829. this.postDataPramas.common = { 'returnmap': '0' }
  830. this.postDataPramas.data = []
  831. this.postDataPramas.data[0] = { 'name': 'insertBigPartTransfer', 'type': 'e', 'parammaps': {
  832. pastureId: this.createTemp.pastureId,
  833. inPastureId: this.createTemp.inPastureId,
  834. applyCode: this.createTemp.applyCode,
  835. empId: this.createTemp.empId,
  836. emp: this.createTemp.emp,
  837. applyDate: this.createTemp.applyDate,
  838. groupName:this.createTemp.groupName
  839. }}
  840. // eslint-disable-next-line no-irregular-whitespace
  841. this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  842. this.postDataPramas.data[1].children = []
  843. this.postDataPramas.data[1].children[0] = { 'name': 'insertParttTransfer', 'type': 'e', 'parammaps': {
  844. bigId: '@insertBigPartTransfer.LastInsertId',
  845. pastureId: '@insertSpotList.pastureId',
  846. partId: '@insertSpotList.partId',
  847. partCode: '@insertSpotList.partCode',
  848. partName: '@insertSpotList.partName',
  849. specification: '@insertSpotList.specification',
  850. price: '@insertSpotList.price',
  851. unit: '@insertSpotList.unit',
  852. brandId: '@insertSpotList.brandId',
  853. brandName: '@insertSpotList.brand',
  854. amount: '@insertSpotList.amount',
  855. providerName: '@insertSpotList.providerName',
  856. providerId: '@insertSpotList.providerId',
  857. note: '@insertSpotList.note',
  858. partRepId: '@insertSpotList.partRepId'
  859. }}
  860. ExecDataByConfig(this.postDataPramas).then(response => {
  861. console.log('新增保存发送参数', this.postDataPramas)
  862. if (response.msg === 'fail') {
  863. this.$notify({
  864. title: '保存失败',
  865. message: response.data,
  866. type: 'warning',
  867. duration: 2000
  868. })
  869. } else {
  870. this.dialogFormVisible = false
  871. this.getdataListParm.parammaps.inputDatetime = ''
  872. this.getList()
  873. this.$notify({
  874. title: '',
  875. message: '保存成功',
  876. type: 'success',
  877. duration: 2000
  878. })
  879. }
  880. })
  881. return true
  882. } else {
  883. this.$message({
  884. title: '',
  885. message: '请选择备件',
  886. type: 'warning',
  887. duration: 2000
  888. })
  889. return false
  890. }
  891. },
  892. partDelete(row) {
  893. console.log(this.listAdd)
  894. MessageBox.confirm('设备名称:' + row.partName, '确认删除?', {
  895. confirmButtonText: '确认',
  896. cancelButtonText: '取消',
  897. type: 'warning'
  898. }).then(() => {
  899. // console.log(this.list2)
  900. for (var i = 0; i < this.listAdd.length; i++) {
  901. console.log(this.listAdd[i])
  902. if (this.listAdd[i].id === row.id) {
  903. var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
  904. }
  905. if (listAddIndex > -1) {
  906. this.listAdd.splice(listAddIndex, 1)
  907. return
  908. }
  909. }
  910. })
  911. },
  912. // 查看
  913. form_see(row) {
  914. this.dialogStatus = 'see'
  915. this.dialogFormVisibleSee = true
  916. row.pastureId = String(row.pastureId)
  917. console.log(row.pastureId)
  918. this.seeTemp = Object.assign({}, row)
  919. console.log('查看上方数据(从table读取)', this.seeTemp)
  920. this.getdataListSee.parammaps.id = this.seeTemp.id
  921. this.getSeeList()
  922. },
  923. getSeeList() {
  924. GetDataByName(this.getdataListSee).then(response => {
  925. console.log('查看下方table数据', response.data.list)
  926. this.listSee = response.data.list
  927. if (response.data.list !== null) {
  928. for (let i = 0; i < response.data.list.length; i++) {
  929. 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) {
  930. this.listSee[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  931. this.listSee[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  932. } else {
  933. this.listSee[i].srcpath = ''
  934. this.listSee[i].picpath = ''
  935. }
  936. }
  937. }
  938. this.seeTemp.providerName = response.data.list.providerName
  939. this.pageNumSee = response.data.pageNum
  940. this.pageSizeSee = response.data.pageSize
  941. if (response.data.total) {
  942. this.totalSee = response.data.total
  943. }
  944. setTimeout(() => {
  945. this.listLoadingSee = false
  946. }, 100)
  947. })
  948. },
  949. getDownList() {
  950. GetDataByNames(this.requestParams).then(response => {
  951. this.findAllProvider = response.data.findAllProvider.list
  952. this.findAllPasture = response.data.findAllPasture.list
  953. this.findAllPasture2 = response.data.getPastureList.list
  954. this.findAllDepart = response.data.findAllDepart.list
  955. this.findAllEmploye = response.data.findAllEmploye.list
  956. })
  957. },
  958. handleDownload() {
  959. alert('点击了导出')
  960. },
  961. handleReturn(row) {
  962. console.log('点击了确认退回')
  963. this.seeTemp = Object.assign({}, row)
  964. this.getdataListSee.parammaps.id = this.seeTemp.id
  965. this.getSeeList()
  966. MessageBox.confirm('是否确认将调拨单备件退回至库存', {
  967. confirmButtonText: '确认',
  968. cancelButtonText: '取消',
  969. type: 'warning'
  970. }).then(() => {
  971. this.postDataPramas.common = { 'returnmap': '0' }
  972. this.postDataPramas.data = []
  973. this.postDataPramas.data[0] = { 'name': 'updateBigPartTransfer', 'type': 'e', 'parammaps': {
  974. id: row.id,
  975. statue: 3
  976. }}
  977. this.postDataPramas.data[1] = { 'name': ' getPartTransferbybigid', 'type': 'e', 'parammaps': {
  978. id: row.id,
  979. statue: 3
  980. }}
  981. this.postDataPramas.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listSee }}
  982. this.postDataPramas.data[2].children = []
  983. this.postDataPramas.data[2].children[0] = { 'name': 'updatePartRepertoryDB', 'type': 'e', 'parammaps': {
  984. amount: '@insertSpotList.amount',
  985. partRepId: '@insertSpotList.partRepId'
  986. }}
  987. ExecDataByConfig(this.postDataPramas).then(response => {
  988. this.getList()
  989. this.$notify({
  990. title: '成功',
  991. message: '退回成功',
  992. type: 'success',
  993. duration: 2000
  994. })
  995. })
  996. }).catch(() => {
  997. this.$message({
  998. type: 'info',
  999. message: '已取消确认退回'
  1000. })
  1001. })
  1002. },
  1003. handleReject(row) {
  1004. console.log('点击了驳回')
  1005. MessageBox.confirm('是否确认将调拨单驳回', {
  1006. confirmButtonText: '确认',
  1007. cancelButtonText: '取消',
  1008. type: 'warning'
  1009. }).then(() => {
  1010. this.requestParam.name = 'updateBigPartTransfer'
  1011. this.requestParam.parammaps = {}
  1012. this.requestParam.parammaps.id = row.id
  1013. this.requestParam.parammaps.statue = 2
  1014. PostDataByName(this.requestParam).then(() => {
  1015. this.getList()
  1016. this.dialogFormVisible = false
  1017. this.$notify({
  1018. title: '成功',
  1019. message: '驳回成功',
  1020. type: 'success',
  1021. duration: 2000
  1022. })
  1023. })
  1024. }).catch(() => {
  1025. this.$message({
  1026. type: 'info',
  1027. message: '已取消驳回'
  1028. })
  1029. })
  1030. }
  1031. }
  1032. }
  1033. </script>
  1034. <style lang="scss" scoped>
  1035. .pagination-container{
  1036. display: block !important;
  1037. }
  1038. </style>
  1039. <style lang="scss">
  1040. .el-step__head.is-success {
  1041. color: #409EFF;
  1042. border-color: #409EFF;
  1043. }
  1044. .el-step__title.is-success{
  1045. color: #409EFF;
  1046. }
  1047. .el-step__head.is-process{
  1048. color: #409EFF;
  1049. border-color: #409EFF;
  1050. .el-step__icon.is-text{
  1051. background: #409EFF;
  1052. color: #fff;
  1053. }
  1054. }
  1055. .step-row{
  1056. color: #000;
  1057. }
  1058. </style>