quality.data.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Form';
  3. import dayjs from 'dayjs';
  4. import { h } from 'vue';
  5. import { DatePicker } from 'ant-design-vue';
  6. import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
  7. // 表格字段
  8. export const getTableColumns = ({ onTimeChange, onClickRemark, onBrandNumChange }): BasicColumn[] => [
  9. {
  10. title: '序号',
  11. dataIndex: 'serialNumber',
  12. key: 'serialNumber',
  13. width: 40,
  14. align: 'center',
  15. },
  16. {
  17. title: '炉号',
  18. dataIndex: 'heatNo',
  19. key: 'heatNo',
  20. width: 60,
  21. align: 'center',
  22. },
  23. {
  24. title: '送样时间',
  25. dataIndex: 'deliveryTime',
  26. key: 'deliveryTime',
  27. width: 104,
  28. align: 'center',
  29. customRender({ text, record }) {
  30. if (!record.heatNo) return '';
  31. return h(DatePicker, {
  32. bordered: false,
  33. showTime: true,
  34. size: 'small',
  35. allowClear: false,
  36. suffixIcon: '',
  37. defaultValue: dayjs(text),
  38. onChange(date) {
  39. onTimeChange && onTimeChange(date, record);
  40. },
  41. });
  42. },
  43. },
  44. {
  45. title: '牌号',
  46. dataIndex: 'brandNum',
  47. key: 'brandNum',
  48. width: 57,
  49. align: 'center',
  50. customRender(opt) {
  51. if (!opt.record.heatNo) return '';
  52. return h(JSearchSelect, {
  53. value: opt.text,
  54. dict: 'billet_spec',
  55. size: 'small',
  56. bordered: false,
  57. dropdownStyle: {},
  58. allowClear: false,
  59. onChange(value) {
  60. onBrandNumChange && onBrandNumChange(value, opt.record);
  61. },
  62. });
  63. },
  64. },
  65. {
  66. title: '班产 / 170 / 定尺',
  67. dataIndex: 'size',
  68. key: 'size',
  69. width: 100,
  70. align: 'center',
  71. },
  72. {
  73. title: '班产',
  74. dataIndex: 'workLength',
  75. key: 'workLength',
  76. width: 150,
  77. align: 'left',
  78. customRender({ text }) {
  79. if (!text) return '';
  80. return h('div', {}, [
  81. h('span', { style: { display: 'inline', width: '50px', color: '#f50' } }, text.size),
  82. h('span', {}, ' / '),
  83. h('span', { style: { display: 'inline', width: '50px', color: '#108ee9' } }, text.num ? text.num + ' 支' : ''),
  84. h('span', {}, ' / '),
  85. h('span', { style: { display: 'inline', color: '#87d068' } }, text.weight ? text.weight + ' 吨' : ''),
  86. ]);
  87. },
  88. },
  89. {
  90. title: '日产',
  91. dataIndex: 'dayLength',
  92. key: 'dayLength',
  93. width: 150,
  94. align: 'left',
  95. customRender({ text }) {
  96. if (!text) return '';
  97. return h('div', {}, [
  98. h('span', { style: { display: 'inline', width: '50px', color: '#f50' } }, text.size),
  99. h('span', {}, ' / '),
  100. h('span', { style: { display: 'inline', width: '50px', color: '#108ee9' } }, text.num ? text.num + ' 支' : ''),
  101. h('span', {}, ' / '),
  102. h('span', { style: { display: 'inline', color: '#87d068' } }, text.weight ? text.weight + ' 吨' : ''),
  103. ]);
  104. },
  105. },
  106. {
  107. title: '备注',
  108. dataIndex: 'notes',
  109. key: 'notes',
  110. width: 95,
  111. align: 'center',
  112. customRender(opt) {
  113. if (!opt.record.heatNo) return '';
  114. return h(
  115. 'div',
  116. {
  117. style: {
  118. cursor: 'pointer',
  119. width: '100%',
  120. height: '32px',
  121. },
  122. onClick: () => {
  123. onClickRemark && onClickRemark(opt.record, opt.text);
  124. },
  125. },
  126. opt.text
  127. );
  128. },
  129. },
  130. ];
  131. // 自定义表单字段
  132. export const getFormSchemas = ({ onDateChange }) => {
  133. return [
  134. {
  135. field: 'ccmNo',
  136. label: '铸机',
  137. component: 'Input',
  138. defaultValue: '5',
  139. componentProps: {
  140. dictCode: 'lg_zj',
  141. },
  142. colProps: { span: 6 },
  143. slot: 'ccmNo',
  144. },
  145. {
  146. label: '',
  147. field: 'zhanwei',
  148. component: 'Input',
  149. slot: 'zhanwei',
  150. colProps: { span: 18 },
  151. },
  152. {
  153. label: '班次日期',
  154. field: 'queryDate',
  155. component: 'DatePicker',
  156. defaultValue: dayjs(),
  157. componentProps: {
  158. valueFormat: 'YYYY-MM-DD',
  159. onChange: (v) => {
  160. onDateChange && onDateChange(v);
  161. },
  162. },
  163. },
  164. {
  165. label: '',
  166. field: 'shiftObj',
  167. component: 'Input',
  168. slot: 'shiftObj',
  169. colProps: { span: 14 },
  170. },
  171. ] as FormSchema[];
  172. };