index.vue 6.5KB

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