homogeneityInspectDialog.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div>
  3. <ele-modal
  4. width="90vw"
  5. :visible.sync="visible"
  6. :close-on-click-modal="false"
  7. row-key="code"
  8. custom-class="ele-dialog-form"
  9. :title="'齐套性检查'"
  10. :maxable="true"
  11. >
  12. <div class="form-wrapper">
  13. <div v-if="leftShow" :style="{ width: leftWidth }">
  14. <el-tree
  15. :expand-on-click-node="false"
  16. :data="cardList"
  17. :props="treeProps"
  18. highlight-current
  19. @node-click="handleNodeClick"
  20. ></el-tree>
  21. </div>
  22. <div :style="{ width: rightWidth }">
  23. <div v-if="!leftShow" class="planInfo">
  24. <el-row style="width: 100%">
  25. <el-col
  26. :span="planInfo.salesCode ? 6 : planInfo.salesCode.length * 6"
  27. >
  28. <div style="color: blue; display: flex">
  29. <div>销售单号:</div
  30. ><div v-if="planInfo.salesCode"
  31. ><span v-for="item in planInfo.salesCode"
  32. > {{ item }}</span
  33. ></div
  34. >
  35. </div>
  36. </el-col>
  37. <el-col :span="6"> 计划编号:{{ planInfo.code }} </el-col>
  38. <el-col :span="6"> 批次号:{{ planInfo.batchNo }} </el-col>
  39. <el-col :span="6"> 名称:{{ planInfo.productName }} </el-col>
  40. <el-col :span="6"> 规格:{{ planInfo.specification }} </el-col>
  41. <el-col :span="6"> 型号:{{ planInfo.model }} </el-col>
  42. <el-col :span="6"> 计划数量:{{ planInfo.productNum }} </el-col>
  43. </el-row>
  44. <el-row>
  45. <el-form
  46. :inline="true"
  47. :model="formInline"
  48. class="demo-form-inline"
  49. >
  50. <el-form-item label="审批人">
  51. <el-select
  52. size="mini"
  53. v-model="formInline.region"
  54. placeholder="BOM类型"
  55. >
  56. <el-option label="区域一" value="shanghai"></el-option>
  57. <el-option label="区域二" value="beijing"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="活动区域">
  61. <el-select
  62. size="mini"
  63. v-model="formInline.region"
  64. placeholder="BOM版本"
  65. >
  66. <el-option label="区域一" value="shanghai"></el-option>
  67. <el-option label="区域二" value="beijing"></el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-form>
  71. </el-row>
  72. </div>
  73. <div>
  74. <ele-pro-table
  75. ref="table"
  76. :needPage="false"
  77. :columns="columns"
  78. key="checkTable"
  79. :init-load="false"
  80. :datasource="datasourceList"
  81. >
  82. <template v-slot:stockCount="{ row }">
  83. <el-link
  84. type="primary"
  85. :underline="false"
  86. @click="stockDetail(row)"
  87. >
  88. {{ row.stockCount }}
  89. </el-link>
  90. </template>
  91. <template v-slot:currentCount="{ row }">
  92. <el-link
  93. type="primary"
  94. :underline="false"
  95. @click="currentDetail(row)"
  96. >
  97. {{ row.currentCount }}
  98. </el-link>
  99. </template>
  100. <template v-slot:stockColor="{ row }">
  101. <div :class="{ statusRed: row.stockStatus == '缺料' }">
  102. {{ row.stockStatus }}
  103. </div>
  104. </template>
  105. <template v-slot:currentColor="{ row }">
  106. <div :class="{ statusRed: row.currentStatus == '缺料' }">
  107. {{ row.currentStatus }}
  108. </div>
  109. </template>
  110. <template v-slot:finishColor="{ row }">
  111. <div :class="{ statusRed: row.finishStatus == '缺料' }">
  112. {{ row.finishStatus }}
  113. </div>
  114. </template>
  115. <template v-slot:finishCount="{ row }">
  116. <div>
  117. <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
  118. <div v-else>-</div>
  119. </div>
  120. </template>
  121. </ele-pro-table>
  122. </div>
  123. </div>
  124. </div>
  125. <div slot="footer">
  126. <el-button plain @click="cancel">取消</el-button>
  127. <el-button type="primary" @click="confirm">确定</el-button>
  128. </div>
  129. </ele-modal>
  130. <stockDetailDialog ref="stockDetailDialog" />
  131. <currentDetailDialog ref="currentDetailDialog" />
  132. </div>
  133. </template>
  134. <script>
  135. import {
  136. homogeneityInspect,
  137. homogeneityInspectMerge,
  138. findMaterialInfoByPlanId,
  139. findBomCategoryByCategoryId
  140. } from '@/api/productionPlan/index.js';
  141. import stockDetailDialog from './stockDetailDialog.vue';
  142. import currentDetailDialog from './currentDetailDialog.vue';
  143. export default {
  144. components: {
  145. stockDetailDialog,
  146. currentDetailDialog
  147. },
  148. data() {
  149. return {
  150. visible: false,
  151. formData: {},
  152. requestData: {
  153. deviceCode: '',
  154. deviceName: '',
  155. deviceId: ''
  156. },
  157. requiredFormingNum: 0,
  158. formInline: {},
  159. // form: {
  160. // homogeneityInspect: []
  161. // },
  162. rules: {},
  163. columns: [
  164. {
  165. columnKey: 'index',
  166. label: '序号',
  167. type: 'index',
  168. width: 55,
  169. align: 'center',
  170. showOverflowTooltip: true
  171. },
  172. // {
  173. // prop: 'productCode',
  174. // label: '计划编号',
  175. // align: 'center',
  176. // minWidth: 100,
  177. // showOverflowTooltip: true
  178. // },
  179. // {
  180. // prop: 'opCode',
  181. // label: '工序编码',
  182. // align: 'center',
  183. // minWidth: 100,
  184. // showOverflowTooltip: true
  185. // },
  186. // {
  187. // prop: 'opName',
  188. // label: '工序名称',
  189. // align: 'center',
  190. // minWidth: 100
  191. // },
  192. // {
  193. // prop: 'bomCode',
  194. // label: '物料编码',
  195. // align: 'center',
  196. // minWidth: 100,
  197. // showOverflowTooltip: true
  198. // },
  199. // {
  200. // prop: 'bomName',
  201. // label: '物料名称',
  202. // align: 'center',
  203. // minWidth: 100
  204. // },
  205. {
  206. prop: 'demandQuantity',
  207. label: '定额数量',
  208. align: 'center',
  209. minWidth: 80
  210. },
  211. // {
  212. // slot: 'stockCount',
  213. // prop: 'stockCount',
  214. // label: '库存数量',
  215. // align: 'center',
  216. // minWidth: 80
  217. // },
  218. {
  219. slot: 'stockColor',
  220. prop: 'stockStatus',
  221. label: '库存状态',
  222. align: 'center',
  223. minWidth: 80
  224. },
  225. {
  226. slot: 'inTransitNum',
  227. prop: 'inTransitNum',
  228. label: '在途数量',
  229. align: 'center',
  230. minWidth: 80
  231. },
  232. // {
  233. // slot: 'currentColor',
  234. // prop: 'currentStatus',
  235. // label: '在途状态',
  236. // align: 'center',
  237. // minWidth: 80
  238. // },
  239. {
  240. label: '最终缺料数量',
  241. align: 'center',
  242. minWidth: 80,
  243. formatter: (row) => {
  244. let total =
  245. row.demandQuantity - row.inTransitNum - row.inventoryQuantity;
  246. if (total < 0) {
  247. return 0;
  248. }
  249. return total;
  250. }
  251. },
  252. {
  253. slot: 'finishColor',
  254. prop: 'finishStatus',
  255. label: '最终状态',
  256. align: 'center',
  257. minWidth: 80
  258. }
  259. ],
  260. ids: [],
  261. leftShow: false,
  262. leftWidth: '0%',
  263. rightWidth: '100%',
  264. cardList: [],
  265. treeProps: {
  266. label: 'code',
  267. children: 'children'
  268. },
  269. planInfo: {
  270. salesCode: ''
  271. },
  272. datasourceList: []
  273. };
  274. },
  275. watch: {
  276. leftShow(newVal, oldVal) {
  277. if (newVal) {
  278. this.leftWidth = '15%';
  279. this.rightWidth = '85%';
  280. } else {
  281. this.leftWidth = '0%';
  282. this.rightWidth = '100%';
  283. }
  284. }
  285. },
  286. mounted() {},
  287. methods: {
  288. handleNodeClick(data) {
  289. this.reload({ planIds: [data.id] });
  290. },
  291. reload(where) {
  292. this.$nextTick(() => {
  293. this.$refs.table.reload({ page: 1, where });
  294. });
  295. },
  296. /* 表格数据源 */
  297. // datasource({ page, limit, where }) {
  298. // return homogeneityInspect({
  299. // pageNum: page,
  300. // size: limit,
  301. // ...where
  302. // });
  303. // },
  304. stockDetail(row) {
  305. this.$refs.stockDetailDialog.open(row);
  306. },
  307. currentDetail(row) {
  308. this.$refs.currentDetailDialog.open(row);
  309. },
  310. async open(dataList) {
  311. this.visible = true;
  312. try {
  313. let data = dataList[0];
  314. const res = await findBomCategoryByCategoryId(data.categoryId);
  315. let obj = {};
  316. res.map((el) => {
  317. let OBMINFO = {
  318. bomId: el.bomId,
  319. bomType: el.type,
  320. versions: `V${el.versions}.0`
  321. };
  322. if (obj[el.bomType]) {
  323. obj[el.bomType].bomList.push(OBMINFO);
  324. } else {
  325. obj[el.bomType] = { ...el, bomList: [OBMINFO] };
  326. }
  327. });
  328. console.log(obj,'obj ++++++++++')
  329. console.log(res, '版本 类型');
  330. let params = {
  331. planId: data.id
  332. };
  333. const result = await findMaterialInfoByPlanId(params);
  334. console.log(result, 'result +++++');
  335. this.datasourceList = result;
  336. } catch (err) {
  337. this.$message.error(err.message);
  338. }
  339. return;
  340. this.cardList = dataList || [];
  341. for (let item of this.cardList) {
  342. let children = [];
  343. if (item.salesCode) {
  344. for (let ele of item.salesCode) {
  345. children.push({ code: ele, id: item.id });
  346. }
  347. }
  348. item.children = children;
  349. }
  350. this.planInfo = dataList.length > 0 ? dataList[0] : null;
  351. console.log(this.planInfo);
  352. if (dataList.length > 1) {
  353. this.leftShow = true;
  354. } else {
  355. this.leftShow = false;
  356. }
  357. if (this.planInfo) {
  358. this.reload({ planIds: [this.planInfo.id] });
  359. }
  360. },
  361. cancel() {
  362. this.formData = {};
  363. this.visible = false;
  364. },
  365. confirm() {
  366. this.visible = false;
  367. },
  368. async merge() {
  369. this.reload({ planIds: this.ids, productType: 1, merge: 2 });
  370. },
  371. tabClick() {
  372. this.reload({ planIds: this.ids, productType: 1 });
  373. }
  374. }
  375. };
  376. </script>
  377. <style lang="scss" scoped>
  378. .mt20 {
  379. margin-top: 20px;
  380. }
  381. .el-form-item {
  382. margin-bottom: 0 !important;
  383. }
  384. .optionButton {
  385. display: flex;
  386. justify-content: flex-end;
  387. padding-bottom: 3px;
  388. }
  389. .statusRed {
  390. color: red;
  391. }
  392. .planInfo {
  393. }
  394. .form-wrapper {
  395. display: flex;
  396. }
  397. .planInfo {
  398. // display: flex;
  399. font-size: 16px;
  400. }
  401. </style>