disposeDialog.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <div>
  3. <ele-modal
  4. :title="`处理工单`"
  5. append-to-body
  6. :visible.sync="visibleDialog"
  7. destroy-on-close
  8. @close="closeWindows"
  9. width="80vw"
  10. :maxable="true"
  11. :resizable="true"
  12. >
  13. <div class="flex_info">
  14. <div class="flex_right">
  15. <div class="search_box">
  16. <el-input
  17. placeholder="请输入关键词"
  18. v-model="keyWord"
  19. class="input-with-select"
  20. >
  21. <el-button slot="append" icon="el-icon-search" @click="search">搜索</el-button>
  22. </el-input>
  23. <el-button type="primary" @click="control">处理</el-button>
  24. </div>
  25. <el-table
  26. ref="multipleTable"
  27. :data="tableData"
  28. border
  29. height="500px"
  30. tooltip-effect="dark"
  31. @selection-change="handleSelectionChange"
  32. >
  33. <el-table-column
  34. type="selection"
  35. :selectable="checkSelectable"
  36. width="55"
  37. align="center"
  38. >
  39. </el-table-column>
  40. <el-table-column label="序号" type="index" width="50">
  41. </el-table-column>
  42. <el-table-column
  43. label="物品名称"
  44. prop="categoryName"
  45. :show-overflow-tooltip="true"
  46. ></el-table-column>
  47. <el-table-column
  48. label="物品编码"
  49. prop="info.categoryCode"
  50. :show-overflow-tooltip="true"
  51. ></el-table-column>
  52. <!-- <el-table-column
  53. width="150"
  54. prop="categoryLevelPath"
  55. label="产品分类"
  56. :show-overflow-tooltip="true"
  57. ></el-table-column> -->
  58. <el-table-column
  59. label="批次号"
  60. prop="batchNo"
  61. :show-overflow-tooltip="true"
  62. ></el-table-column>
  63. <!-- <el-table-column
  64. label="包装编码"
  65. prop="packageNo"
  66. :show-overflow-tooltip="true"
  67. ></el-table-column> -->
  68. <!-- <el-table-column
  69. label="包装数量"
  70. prop="info.packingCountBase"
  71. :show-overflow-tooltip="true"
  72. ></el-table-column> -->
  73. <!-- <el-table-column
  74. label="包装单位"
  75. prop="info.packingUnit"
  76. :show-overflow-tooltip="true"
  77. ></el-table-column> -->
  78. <!-- <el-table-column
  79. label="牌号"
  80. prop="brandNum"
  81. :show-overflow-tooltip="true"
  82. ></el-table-column>
  83. <el-table-column
  84. label="型号"
  85. prop="categoryModel"
  86. :show-overflow-tooltip="true"
  87. ></el-table-column>
  88. <el-table-column
  89. label="型号"
  90. prop="categoryModel"
  91. :show-overflow-tooltip="true"
  92. ></el-table-column>
  93. <el-table-column
  94. label="规格"
  95. prop="specification"
  96. :show-overflow-tooltip="true"
  97. ></el-table-column> -->
  98. <el-table-column
  99. label="计量数量"
  100. prop="info.measureQuantity"
  101. :show-overflow-tooltip="true"
  102. ></el-table-column>
  103. <el-table-column
  104. label="计量单位"
  105. prop="info.measureUnit"
  106. :show-overflow-tooltip="true"
  107. ></el-table-column>
  108. <el-table-column
  109. label="重量"
  110. prop="info.weight"
  111. :show-overflow-tooltip="true"
  112. >
  113. </el-table-column>
  114. <el-table-column
  115. label="重量单位"
  116. prop="info.weightUnit"
  117. :show-overflow-tooltip="true"
  118. >
  119. </el-table-column>
  120. <el-table-column
  121. label="仓库"
  122. prop="info.warehouseName"
  123. :show-overflow-tooltip="true"
  124. ></el-table-column>
  125. </el-table>
  126. <el-pagination
  127. background
  128. layout="total, sizes, prev, pager, next, jumper"
  129. :total="total"
  130. :page-sizes="[10, 20, 50, 100]"
  131. :page-size.sync="pages.size"
  132. :current-page.sync="pages.pageNum"
  133. @current-change="_getInformation"
  134. @size-change="_getInformation"
  135. >
  136. </el-pagination>
  137. </div>
  138. <div class="flex_right" style="margin-left: 10px">
  139. <el-table
  140. ref="table"
  141. :data="controlTableData"
  142. border
  143. height="600px"
  144. tooltip-effect="dark"
  145. >
  146. <el-table-column
  147. label="盘点状态"
  148. width="100"
  149. prop="controlStatus"
  150. :show-overflow-tooltip="true"
  151. >
  152. <template slot-scope="{ row }">
  153. <el-select v-model="row.controlStatus" placeholder="请选择">
  154. <el-option
  155. v-for="item in statusOption"
  156. :label="item.label"
  157. :value="item.value"
  158. :key="item.value"
  159. >
  160. </el-option>
  161. </el-select>
  162. </template>
  163. </el-table-column>
  164. <el-table-column
  165. label="数量"
  166. prop="count"
  167. :show-overflow-tooltip="true"
  168. >
  169. <template slot-scope="{ row }">
  170. <el-input
  171. v-model="row.count"
  172. placeholder="请输入内容"
  173. ></el-input> </template
  174. ></el-table-column>
  175. <el-table-column label="序号" type="index" width="50">
  176. </el-table-column>
  177. <el-table-column
  178. label="物品名称"
  179. prop="categoryName"
  180. :show-overflow-tooltip="true"
  181. ></el-table-column>
  182. <el-table-column
  183. label="物品编码"
  184. prop="info.categoryCode"
  185. :show-overflow-tooltip="true"
  186. ></el-table-column>
  187. <el-table-column
  188. label="批次号"
  189. prop="batchNo"
  190. :show-overflow-tooltip="true"
  191. ></el-table-column>
  192. <!-- <el-table-column
  193. label="包装编码"
  194. prop="packageNo"
  195. :show-overflow-tooltip="true"
  196. ></el-table-column>
  197. <el-table-column
  198. label="包装数量"
  199. prop="info.packingCountBase"
  200. :show-overflow-tooltip="true"
  201. ></el-table-column>
  202. <el-table-column
  203. label="包装单位"
  204. prop="info.packingUnit"
  205. :show-overflow-tooltip="true"
  206. ></el-table-column> -->
  207. <el-table-column
  208. label="计量数量"
  209. prop="info.measureQuantity"
  210. :show-overflow-tooltip="true"
  211. ></el-table-column>
  212. <el-table-column
  213. label="计量单位"
  214. prop="info.measureUnit"
  215. :show-overflow-tooltip="true"
  216. ></el-table-column>
  217. <el-table-column
  218. label="重量"
  219. prop="info.weight"
  220. :show-overflow-tooltip="true"
  221. >
  222. </el-table-column>
  223. <el-table-column
  224. label="重量单位"
  225. prop="info.weightUnit"
  226. :show-overflow-tooltip="true"
  227. >
  228. </el-table-column>
  229. <el-table-column
  230. label="仓库"
  231. prop="info.warehouseName"
  232. :show-overflow-tooltip="true"
  233. ></el-table-column>
  234. <el-table-column label="操作" width="100" fixed="right">
  235. <template slot-scope="{ row, $index }">
  236. <el-button
  237. @click="deleted(row, $index)"
  238. type="text"
  239. size="small"
  240. >删除</el-button
  241. >
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. </div>
  246. </div>
  247. <div class="select-btn">
  248. <el-button type="primary" @click="onConfirm">确定</el-button>
  249. <el-button @click="closeWindows">关闭</el-button>
  250. </div>
  251. </ele-modal>
  252. </div>
  253. </template>
  254. <script>
  255. import { getPlanDetailList } from '@/api/inventory';
  256. import deptSelect from '@/components/CommomSelect/new-dept-select.vue';
  257. import { getUserPage } from '@/api/system/organization';
  258. import { reportWork } from '@/api/inventory';
  259. import { fieldModel } from '@/api/codeManagement';
  260. export default {
  261. watch: {
  262. tableData() {
  263. this.doLayout();
  264. },
  265. visibleDialog(val) {
  266. if (val) {
  267. this._getInformation();
  268. }
  269. }
  270. },
  271. components: { deptSelect },
  272. data() {
  273. return {
  274. statusOption: [
  275. {
  276. label: '盘盈',
  277. value: '2'
  278. },
  279. {
  280. label: '丢失',
  281. value: '3'
  282. },
  283. {
  284. label: '破损',
  285. value: '4'
  286. }
  287. ],
  288. visibleDialog: false,
  289. planOrderId: '',
  290. keyWord: '',
  291. formData: {},
  292. tableData: [],
  293. controlTableData: [],
  294. executorList: [],
  295. factoryList: [],
  296. factoryId: '',
  297. value: '',
  298. treeType: '',
  299. treeList: [],
  300. selection: [],
  301. selectionIds: [],
  302. pages: {
  303. pageNum: 1,
  304. size: 10,
  305. keyWord: ''
  306. },
  307. total: 0,
  308. curType: '',
  309. classificationId: '',
  310. memoSelection: [],
  311. newColumns: [] // 动态表头
  312. };
  313. },
  314. created() {
  315. this.getFieldModel();
  316. },
  317. methods: {
  318. // 搜索
  319. search() {
  320. this.pages.keyWord = this.keyWord;
  321. this.pages.pageNum = 1;
  322. this._getInformation();
  323. },
  324. control() {
  325. if (this.selection.length > 0) {
  326. console.log(this.selection);
  327. console.log(this.selectionIds);
  328. let boolen = this.selection.every((item) =>
  329. this.selectionIds.includes(item.id)
  330. );
  331. if (this.selection.length > 0 && !boolen) {
  332. this.selection = this.selection.filter(
  333. (item) => !this.selectionIds.includes(item.id)
  334. );
  335. this.selectionIds = this.selectionIds.concat(
  336. this.selection.map((item) => item.id)
  337. );
  338. console.log('this.selection---------', this.selection);
  339. console.log('this.selectionIds---', this.selectionIds);
  340. this.controlTableData = this.controlTableData.concat(
  341. this.selection.map((item) => {
  342. return {
  343. ...item
  344. };
  345. })
  346. );
  347. console.log('this.tableData---------', this.controlTableData);
  348. } else {
  349. this.$message.error('请选择正确的行');
  350. }
  351. } else {
  352. this.$message.error('请选择调出物品信息');
  353. }
  354. },
  355. checkSelectable(row) {
  356. return !this.selectionIds.includes(row.id);
  357. },
  358. executorChange(val) {
  359. this.formData.executorName = this.executorList.filter(
  360. (item) => item.id == val
  361. )[0].name;
  362. },
  363. //选择部门(搜索)
  364. searchDeptNodeClick(info, row) {
  365. this.formData.executorId = '';
  366. if (info) {
  367. const params = { groupId: info };
  368. this.getUserList(params);
  369. this.formData.executeGroupName = row.name;
  370. } else {
  371. this.formData.executeGroupId = null;
  372. }
  373. },
  374. // 获取审核人列表、巡点检人员
  375. async getUserList(params) {
  376. try {
  377. let data = { pageNum: 1, size: -1 };
  378. if (params) {
  379. data = Object.assign(data, params);
  380. }
  381. const res = await getUserPage(data);
  382. this.executorList = res.list;
  383. } catch (error) {}
  384. },
  385. doLayout() {
  386. let that = this;
  387. this.$nextTick(() => {
  388. that.$refs.multipleTable.doLayout();
  389. });
  390. },
  391. // 获取动态表头
  392. getFieldModel() {
  393. fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  394. let newRes = res.map((m) => {
  395. return {
  396. prop: 'extField.' + m.prop,
  397. label: m.label,
  398. align: 'center',
  399. showOverflowTooltip: true
  400. };
  401. });
  402. this.newColumns = [...newRes];
  403. });
  404. },
  405. deleted(row, index) {
  406. this.controlTableData.splice(index, 1);
  407. this.selectionIds = this.selectionIds.filter((item) => item !== row.id);
  408. },
  409. onConfirm() {
  410. let arr = []
  411. if (this.controlTableData.length > 0) {
  412. let isBoolen = this.controlTableData.every(
  413. (item) => item.controlStatus > 0 && item.count > 0
  414. );
  415. if (!isBoolen) {
  416. return this.$message.error('请选择盘点状态和数量!');
  417. }
  418. arr = this.controlTableData.map((item) => {
  419. let key = null;
  420. switch (item.controlStatus) {
  421. case '2':
  422. key = 'surplusQuantity';
  423. break;
  424. case '3':
  425. key = 'loseQuantity';
  426. break;
  427. case '4':
  428. key = 'wornQuantity';
  429. break;
  430. }
  431. return {
  432. id: item.id,
  433. status: item.controlStatus,
  434. planOrderId: this.planOrderId,
  435. [key]: item.count
  436. };
  437. });
  438. } else {
  439. arr = []
  440. }
  441. console.log(arr);
  442. reportWork(arr, { planOrderId: this.planOrderId }).then(() => {
  443. this.$message.success('报工成功!');
  444. this.$emit('flushed');
  445. this.closeWindows();
  446. });
  447. // } else {
  448. // this.$message.error('请选择物品!');
  449. // }
  450. },
  451. open(id) {
  452. this.planOrderId = id;
  453. this.visibleDialog = true;
  454. },
  455. handleSelectionChange(val) {
  456. this.selection = val;
  457. },
  458. closeWindows() {
  459. this.keyWord = '';
  460. this.pages.keyWord = '';
  461. this.selection = [];
  462. this.controlTableData = [];
  463. this.visibleDialog = false;
  464. },
  465. async _getInformation() {
  466. getPlanDetailList({
  467. ...this.pages,
  468. planOrderId: this.planOrderId
  469. }).then((data) => {
  470. this.tableData = data.list;
  471. this.total = data.count;
  472. });
  473. }
  474. }
  475. };
  476. </script>
  477. <style lang="scss" scoped>
  478. :deep(.el-checkbox__input.is-disabled .el-checkbox__inner) {
  479. background-color: #eee !important;
  480. }
  481. .flex_info {
  482. display: flex;
  483. margin-top: 20px;
  484. margin-bottom: 20px;
  485. .flex_right {
  486. flex: 1;
  487. overflow: hidden;
  488. .search_box {
  489. display: flex;
  490. margin-bottom: 10px;
  491. > div {
  492. flex: 1;
  493. }
  494. > button {
  495. margin-left: 10px;
  496. }
  497. }
  498. }
  499. }
  500. .search_box {
  501. overflow: hidden;
  502. }
  503. .select-btn {
  504. text-align: right;
  505. }
  506. .right {
  507. text-align: right;
  508. }
  509. .mt10 {
  510. margin-top: 10px;
  511. }
  512. </style>