index.vue 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <script lang="tsx">
  2. //表格
  3. import { defineComponent, ref } from "vue";
  4. import { ElMessage } from "element-plus";
  5. import { transformPageResponse } from "@/utils/qomo";
  6. import { useRouter } from "vue-router";
  7. export default defineComponent({
  8. setup() {
  9. const router = useRouter();
  10. const tableRef = ref();
  11. const forecastDialogRef = ref();
  12. const selectionRows = ref([]);
  13. const btnTitle = ref("工时差异");
  14. // const uploadUrl = ref("/c7525cost/importExcel");
  15. //列
  16. const columnsCheck = ref([
  17. { prop: "type", label: "对比项", hideInSearchForm: true },
  18. {
  19. label: "实际",
  20. prop: "costCenterCode",
  21. hideInSearchForm: true
  22. },
  23. { label: "标准", prop: "factory", hideInSearchForm: true },
  24. { label: "差值", prop: "factory", hideInSearchForm: true },
  25. {
  26. type: "operation",
  27. label: "挖掘分析",
  28. minWidth: 120,
  29. render: ({ row }) => (
  30. <base-table-operation
  31. btnList={[
  32. {
  33. key: "check",
  34. label:"查看明细",
  35. onclick: () => timeVariance(row)
  36. }
  37. ]}
  38. />
  39. )
  40. }
  41. ]);
  42. const columns = ref([
  43. { type: "selection" },
  44. { prop: "year", label: "工厂号" },
  45. { label: "物料号", prop: "costCenterCode" },
  46. { label: "成本阶段", prop: "factory" },
  47. { prop: "laborHourRate", label: "版本号", hideInSearchForm: true },
  48. { prop: "equipHourRate", label: "工单年月",hideInAddOrEditForm: true},
  49. {
  50. prop: "fuelHourRate",
  51. label: "实际总成本",
  52. hideInSearchForm: true,
  53. hideInAddOrEditForm: true
  54. },
  55. {
  56. prop: "auxiliaryHourRate",
  57. label: "标准总成本",
  58. hideInSearchForm: true,
  59. hideInAddOrEditForm: true
  60. },
  61. { prop: "otherHourRate", label: "总差额", hideInSearchForm: true,hideInAddOrEditForm: true },
  62. { prop: "effectiveDate", label: "差额比", hideInSearchForm: true,hideInAddOrEditForm: true },
  63. {
  64. valueType: "date",
  65. prop: "expirationDate",
  66. label: "创建时间",
  67. hideInSearchForm: true,
  68. hideInAddOrEditForm: true
  69. },
  70. {
  71. type: "operation",
  72. label: "报告状态",
  73. minWidth: 120,
  74. render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => (
  75. <base-table-operation
  76. btnList={[
  77. {
  78. key: "check",
  79. label: "查看报告",
  80. onclick: () => checkReport(row)
  81. }
  82. ]}
  83. />
  84. )
  85. }
  86. ]);
  87. const render = () => {
  88. return (
  89. <div>
  90. <BaseTable
  91. columns={columns.value}
  92. ref={tableRef}
  93. selectionRows={selectionRows.value}
  94. toolbar={{
  95. layout: "search-dnamic,reload,column-setting,fullscreen"
  96. }}
  97. request={async ({
  98. pageSize = 10,
  99. current = 1,
  100. ...otherSearchParams
  101. }) => {
  102. await new Promise(resolve =>
  103. setTimeout(resolve, Math.random() * 1111)
  104. );
  105. return {
  106. data: Array(pageSize)
  107. .fill(0)
  108. .map((item, index) => ({
  109. id: Math.random(),
  110. name: "Tom" + current,
  111. date123: "date123" + current,
  112. createTime: new Date().getTime(),
  113. districtName: "区划" + index,
  114. districtName1: "区划1" + index
  115. })),
  116. current,
  117. // pages: 500 / pageSize,
  118. total: 500
  119. };
  120. }}
  121. curdConfig={{
  122. /**
  123. * 接受自动表单的数据
  124. * @param data
  125. */
  126. async onAddOrEdit(data) {},
  127. unitColSpan: 24
  128. }}
  129. v-slots={{
  130. toolbar: ({ doAddOrEdit, doDeleteRows }) => (
  131. <el-space>
  132. <el-button type="primary" onClick={doAddOrEdit}>
  133. 新增挖掘任务
  134. </el-button>
  135. </el-space>
  136. )
  137. }}
  138. />
  139. <BaseDialog
  140. title="报告详情"
  141. width="80%"
  142. ref={forecastDialogRef}
  143. confirmButtonProps={false}
  144. >
  145. <BaseTable
  146. columns={columnsCheck.value}
  147. ref={tableRef}
  148. selectionRows={selectionRows.value}
  149. request={async ({ pageSize = 10, current = 1 }) => {
  150. await new Promise(resolve =>
  151. setTimeout(resolve, Math.random() * 1111)
  152. );
  153. return {
  154. data: Array(pageSize)
  155. .fill(0)
  156. .map((item, index) => ({
  157. id: Math.random(),
  158. name: "Tom" + current,
  159. date123: "date123" + current,
  160. createTime: new Date().getTime(),
  161. districtName: "区划" + index,
  162. districtName1: "区划1" + index,
  163. type: index % 3
  164. })),
  165. current,
  166. total: 500
  167. };
  168. }}
  169. curdConfig={{
  170. /**
  171. * 接受自动表单的数据
  172. * @param data
  173. */
  174. async onAddOrEdit(data) {},
  175. unitColSpan: 24
  176. }}
  177. />
  178. </BaseDialog>
  179. </div>
  180. );
  181. };
  182. const checkReport = () => {
  183. forecastDialogRef.value.open();
  184. };
  185. const timeVariance = row => {
  186. if (row.type == 0) {
  187. // 工时
  188. router.push({
  189. path: "/standardComparison/manHour",
  190. });
  191. } else if (row.type == 1) {
  192. // 人工
  193. router.push({
  194. path: "/standardComparison/artificial",
  195. });
  196. } else if (row.type == 2) {
  197. // 材料
  198. router.push({
  199. path: "/standardComparison/materials",
  200. });
  201. }
  202. };
  203. return render;
  204. }
  205. });
  206. </script>
  207. <style lang="scss" scoped></style>