disposeDialog.vue 14 KB

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