index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <div class="mainContentBox">
  3. <avue-crud
  4. ref="crudRef"
  5. v-model:search="search"
  6. v-model="form"
  7. :data="data"
  8. :option="option"
  9. v-model:page="page"
  10. @row-save="createRow"
  11. @row-update="updateRow"
  12. @row-del="deleteRow"
  13. @search-change="searchChange"
  14. @search-reset="resetChange"
  15. @size-change="dataList"
  16. @current-change="dataList"
  17. :row-style="rowStyle"
  18. :cell-style="cellStyle"
  19. @selection-change="selectionChange"
  20. >
  21. <template #menu="{ size, row, index }">
  22. <el-button
  23. icon="el-icon-info"
  24. text
  25. @click="openDialog(row.id)"
  26. type="primary"
  27. :size="size"
  28. >
  29. 详情</el-button
  30. >
  31. </template>
  32. </avue-crud>
  33. <el-dialog
  34. v-model="dialog1.visible"
  35. :title="dialog1.title"
  36. width="950px"
  37. @close="dialog1.visible = false"
  38. >
  39. <work-order-page
  40. :opType="0"
  41. :semiFinishedStock="1"
  42. :queryComplete="1"
  43. @order-info="materialInfo1"
  44. />
  45. </el-dialog>
  46. <el-dialog
  47. v-model="dialog2.visible"
  48. :title="dialog2.title"
  49. width="950px"
  50. @close="dialog2.visible = false"
  51. >
  52. <work-order-seqNos-page
  53. :workOrderCode="
  54. form.stockType == '1' ? form.inWorkOrderCode : form.outWorkOrderCode
  55. "
  56. :semiFinishedStock="'1'"
  57. :state="'2'"
  58. @order-info="materialInfo2"
  59. />
  60. </el-dialog>
  61. <el-dialog
  62. v-model="dialog3.visible"
  63. :title="dialog3.title"
  64. width="950px"
  65. @close="dialog3.visible = false;dataList();"
  66. >
  67. <Details
  68. :id="selectId"
  69. @close="
  70. dialog3.visible = false;
  71. "
  72. />
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script setup>
  77. import { ref, getCurrentInstance } from "vue";
  78. import { useCrud } from "@/hooks/userCrud";
  79. import ButtonPermKeys from "@/common/configs/buttonPermission";
  80. import { useCommonStoreHook } from "@/store";
  81. import dictDataUtil from "@/common/configs/dictDataUtil";
  82. import { useDictionaryStore } from "@/store";
  83. import Details from "./components/details.vue";
  84. const { dicts } = useDictionaryStore();
  85. const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  86. // 传入一个url,后面不带/
  87. const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  88. useCrud({
  89. src: "/api/v1/semiFinishedStock",
  90. });
  91. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  92. Methords; //增删改查
  93. const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  94. const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
  95. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  96. const openDialog = (id) => {
  97. selectId.value = id;
  98. dialog3.visible = true;
  99. };
  100. const dialog1 = reactive({
  101. title: "工单号选择",
  102. visible: false,
  103. });
  104. const dialog2 = reactive({
  105. title: "流转卡号选择",
  106. visible: false,
  107. });
  108. const dialog3 = reactive({
  109. title: "详情",
  110. visible: false,
  111. });
  112. const selectId = ref(null);
  113. const materialInfo1 = (value) => {
  114. if (form.value.stockType == "1") {
  115. form.value.inWorkOrderCode = value.workOrderCode;
  116. form.value.outWorkOrderCode = null;
  117. } else if (form.value.stockType == "2") {
  118. form.value.outWorkOrderCode = value.workOrderCode;
  119. }
  120. form.value.workOrderId = value.id;
  121. form.value.workOrderSeqNos = [];
  122. dialog1.visible = false;
  123. };
  124. const materialInfo2 = (value) => {
  125. form.value.workOrderSeqNos = value;
  126. dialog2.visible = false;
  127. };
  128. const seqDisabled = computed(() => {
  129. return !form.value.workOrderId;
  130. });
  131. const displayIn = computed(() => {
  132. return form.value.stockType == "2" || !form.value.stockType;
  133. });
  134. const displayShowIn = computed(() => {
  135. return !(form.value.stockType == "2" || !form.value.stockType);
  136. });
  137. const displayOut = computed(() => {
  138. return form.value.stockType == "1" || !form.value.stockType;
  139. });
  140. const displayShowOut = computed(() => {
  141. return !(form.value.stockType == "1" || !form.value.stockType);
  142. });
  143. // 设置表格列或者其他自定义的option
  144. option.value = Object.assign(option.value, {
  145. searchEnter: true,
  146. delBtn: false,
  147. selection: true,
  148. labelWidth: 100,
  149. editBtn: false,
  150. viewBtn: false,
  151. addBtn: false,
  152. column: [
  153. {
  154. label: "产品编码",
  155. prop: "materialCode",
  156. editDisabled: true,
  157. addDisplay: false,
  158. rules: [
  159. {
  160. required: true,
  161. trigger: "trigger",
  162. },
  163. ],
  164. },
  165. {
  166. label: "工艺路线名称",
  167. prop: "processRouteName",
  168. editDisabled: true,
  169. addDisplay: false,
  170. rules: [
  171. {
  172. required: true,
  173. trigger: "trigger",
  174. },
  175. ],
  176. },
  177. {
  178. label: "工艺路线版本",
  179. prop: "processRouteVersion",
  180. editDisabled: true,
  181. addDisplay: false,
  182. rules: [
  183. {
  184. required: true,
  185. trigger: "trigger",
  186. },
  187. ],
  188. },
  189. {
  190. label: "分组标识",
  191. prop: "opGroup",
  192. editDisabled: true,
  193. addDisplay: false,
  194. rules: [
  195. {
  196. required: true,
  197. trigger: "trigger",
  198. },
  199. ],
  200. },
  201. /*{
  202. label: "库存数量",
  203. prop: "stockNum",
  204. editDisabled: true,
  205. addDisplay: false,
  206. rules: [
  207. {
  208. required: true,
  209. trigger: "trigger",
  210. },
  211. ],
  212. render: ({ row }) => {
  213. return h("p", row.stockType == "2" ? "-" : row.stockNum);
  214. },
  215. },*/
  216. {
  217. label: "入库数量",
  218. prop: "operateNum",
  219. addDisplay: false,
  220. editDisabled: true,
  221. rules: [
  222. {
  223. required: true,
  224. trigger: "trigger",
  225. },
  226. ],
  227. },
  228. {
  229. label: "出库数量",
  230. prop: "outNum",
  231. addDisplay: false,
  232. editDisabled: true,
  233. rules: [
  234. {
  235. required: true,
  236. trigger: "trigger",
  237. },
  238. ],
  239. },
  240. /*{
  241. label: "出入库类型",
  242. prop: "stockType",
  243. editDisabled: true,
  244. disabled: true,
  245. addDisplay: true,
  246. rules: [
  247. {
  248. required: true,
  249. trigger: "trigger",
  250. },
  251. ],
  252. type: "select",
  253. dicData: [
  254. {
  255. label: "入库",
  256. value: "1",
  257. },
  258. {
  259. label: "出库",
  260. value: "2",
  261. },
  262. ],
  263. value: "1",
  264. },*/
  265. /*{
  266. label: "入库工单",
  267. prop: "inWorkOrderCode",
  268. editDisabled: true,
  269. addDisplay: displayShowIn,
  270. disabled: displayIn,
  271. rules: [
  272. {
  273. required: true,
  274. trigger: "trigger",
  275. },
  276. ],
  277. type: "select",
  278. click: ({ value, column }) => {
  279. if (column.boxType) {
  280. dialog1.visible = true;
  281. }
  282. },
  283. change: ({ value, column }) => {
  284. if (value != form.value.materialCode) {
  285. dialog1.visible = true;
  286. form.value.workOrderSeqNos = null;
  287. }
  288. },
  289. },
  290. {
  291. label: "出库工单",
  292. prop: "outWorkOrderCode",
  293. editDisabled: true,
  294. addDisplay: displayShowOut,
  295. disabled: displayOut,
  296. rules: [
  297. {
  298. required: true,
  299. trigger: "trigger",
  300. },
  301. ],
  302. type: "select",
  303. click: ({ value, column }) => {
  304. if (column.boxType) {
  305. dialog1.visible = true;
  306. form.value.workOrderSeqNos = null;
  307. }
  308. },
  309. change: ({ value, column }) => {
  310. if (value != form.value.materialCode) {
  311. dialog1.visible = true;
  312. }
  313. },
  314. render: ({ row }) => {
  315. return h(
  316. "p",
  317. row.stockType == "1"
  318. ? "-"
  319. : row?.outWorkOrderCode
  320. ? row.outWorkOrderCode
  321. : "-"
  322. );
  323. },
  324. },*/
  325. {
  326. label: "流转卡号",
  327. prop: "workOrderSeqNos",
  328. editDisabled: true,
  329. hide: true,
  330. disabled: seqDisabled,
  331. addDisplay: true,
  332. filterable: true,
  333. rules: [
  334. {
  335. required: true,
  336. trigger: "trigger",
  337. },
  338. ],
  339. click: ({ value, column }) => {
  340. if (column.boxType && dialog1.visible == false) {
  341. dialog2.visible = true;
  342. }
  343. },
  344. },
  345. /* {
  346. label: "库位",
  347. prop: "location",
  348. addDisplay: true,
  349. rules: [
  350. {
  351. required: true,
  352. trigger: "trigger",
  353. },
  354. ],
  355. },*/
  356. // {
  357. // label: "物料类型",
  358. // prop: "taskNo",
  359. // type: "select",
  360. // search: true,
  361. // width: 90,
  362. // overHidden: true,
  363. // dicUrl: dictDataUtil.request_url + "stock_material_type",
  364. // props: {
  365. // label: "dictLabel",
  366. // value: "dictValue",
  367. // },
  368. // rules: [
  369. // {
  370. // required: true,
  371. // message: "物料类型不能为空",
  372. // trigger: "trigger",
  373. // },
  374. // ],
  375. // },
  376. // {
  377. // label: "料箱编号",
  378. // prop: "vehicleCode",
  379. // editDisabled: true,
  380. // rules: [
  381. // {
  382. // required: true,
  383. // message: "料箱编号不能为空",
  384. // trigger: "trigger",
  385. // },
  386. // ],
  387. // },
  388. // {
  389. // label: "仓库坐标",
  390. // prop: "locationNo",
  391. // editDisabled: true,
  392. // rules: [
  393. // {
  394. // required: true,
  395. // message: "仓库位置不能为空",
  396. // trigger: "trigger",
  397. // },
  398. // ],
  399. // },
  400. // {
  401. // label: "二维码",
  402. // width: 120,
  403. // overHidden: true,
  404. // prop: "batchCode",
  405. // search: true,
  406. // },
  407. // {
  408. // label: "物料名称",
  409. // prop: "materialName",
  410. // width: 130,
  411. // overHidden: true,
  412. // click: ({ value, column }) => {
  413. // if (column.boxType) {
  414. // dialog1.visible = true;
  415. // }
  416. // },
  417. // },
  418. // {
  419. // label: "数量",
  420. // prop: "num",
  421. // type: "number",
  422. // min: 0,
  423. // max: 99999,
  424. // width: 150,
  425. // overHidden: true,
  426. // formatter: (val, value, label) => {
  427. // if (val.warningMsg) {
  428. // return val.num + "(" + val.warningMsg + ")";
  429. // } else {
  430. // return val.num;
  431. // }
  432. // },
  433. // },
  434. ],
  435. });
  436. const rowStyle = ({ row, column, rowIndex }) => {
  437. if (row.warningMsg) {
  438. return {
  439. backgroundColor: "#f3d2d2",
  440. color: "#6c6a6a",
  441. };
  442. }
  443. };
  444. const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  445. if (columnIndex === 10) {
  446. if (row.warningMsg) {
  447. return {
  448. color: "red",
  449. fontWeight: "bold",
  450. fontSize: "20",
  451. };
  452. } else {
  453. return {
  454. color: "#60fc56",
  455. fontWeight: "bold",
  456. fontSize: "20",
  457. };
  458. }
  459. }
  460. };
  461. onMounted(() => {
  462. dataList();
  463. });
  464. </script>