excelCom.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!-- 表格数据 -->
  2. <template>
  3. <div class="mainContentBox">
  4. <avue-crud
  5. ref="crudRef2"
  6. v-model:search="search"
  7. v-model="form"
  8. @row-update="createRow"
  9. :data="data"
  10. :option="option"
  11. v-model:page="page"
  12. >
  13. <template #menu="{ size, row, index }">
  14. <el-button
  15. v-if="row.excelData != '' && row.excelData != null"
  16. link
  17. size="small"
  18. type="primary"
  19. @click="opView(row)"
  20. style="margin: 0"
  21. ><i-ep-view />查看
  22. </el-button>
  23. <el-button
  24. v-if="row.excelData != '' && row.excelData != null"
  25. type="warning"
  26. link
  27. size="small"
  28. @click="opUpdate(row)"
  29. style="margin: 0"
  30. ><i-ep-edit />修改表格数据
  31. </el-button>
  32. </template>
  33. </avue-crud>
  34. <el-dialog
  35. v-model="updataShow"
  36. :title="updateTitle"
  37. @close="updataShow = false"
  38. width="1600"
  39. >
  40. <updateExcel
  41. @refresh="refreshDatalist"
  42. :data="ExData"
  43. @close="closeShow"
  44. />
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <script setup>
  49. import { ref, getCurrentInstance } from "vue";
  50. import { useCrud } from "@/hooks/userCrud";
  51. import dictDataUtil from "@/common/configs/dictDataUtil";
  52. import ButtonPermKeys from "@/common/configs/buttonPermission";
  53. import {
  54. useCommonStoreHook,
  55. useDictionaryStore,
  56. useUserStoreHook,
  57. } from "@/store";
  58. import updateExcel from "./updateExcel.vue";
  59. // 数据字典相关
  60. const { dicts } = useDictionaryStore();
  61. const updataShow = ref(false);
  62. const updateTitle = ref("修改表格数据");
  63. const crudRef2 = ref({});
  64. const lookStatus = ref(false);
  65. const opUpdate = (row) => {
  66. ExData.value = row;
  67. ExData.value.lookStatus = false;
  68. if (row.writeData == "" || row.writeData == null) {
  69. ElMessage.error("数据有误请联系管理员");
  70. return;
  71. }
  72. updataShow.value = true;
  73. };
  74. const opView = (row) => {
  75. ExData.value = row;
  76. ExData.value.lookStatus = true;
  77. if (row.writeData == "" || row.writeData == null) {
  78. ElMessage.error("数据有误请联系管理员");
  79. return;
  80. }
  81. updataShow.value = true;
  82. };
  83. const closeShow = () => {
  84. updataShow.value = false;
  85. };
  86. const ExData = ref("");
  87. // 传入一个url,后面不带/
  88. const {
  89. form,
  90. data,
  91. option,
  92. search,
  93. page,
  94. toDeleteIds,
  95. Methords,
  96. Utils,
  97. commonConfig,
  98. } = useCrud({
  99. src: "/api/v1/ProcessFormData",
  100. });
  101. const ctableRef = ref(null);
  102. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  103. Methords; //增删改查
  104. const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  105. const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
  106. const userStore = useUserStoreHook();
  107. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  108. const doEdit = (row, index) => {
  109. crudRef2.value && crudRef2.value.rowEdit(row, index);
  110. };
  111. const refreshTra = (row) => {
  112. commonConfig.value.params = { seqNo: row.seqNo };
  113. dataList();
  114. };
  115. const refreshDatalist = () => {
  116. dataList();
  117. };
  118. defineExpose({ refreshTra });
  119. onMounted(() => {
  120. if (userStore.user.userId === 10000) {
  121. option.value.menu = true;
  122. }
  123. });
  124. option.value = Object.assign(option.value, {
  125. selection: false,
  126. border: true,
  127. index: false,
  128. expandLevel: 3,
  129. headerAlign: "center",
  130. align: "center",
  131. labelWidth: 100,
  132. addBtn: false,
  133. delBtn: false,
  134. viewBtn: false,
  135. menu: false,
  136. header: false,
  137. editBtn: false,
  138. rowKey: "operationId",
  139. column: [
  140. {
  141. label: "工序Id",
  142. prop: "operationId",
  143. display: false,
  144. hide: true,
  145. },
  146. {
  147. label: "工序名称",
  148. prop: "operationName",
  149. disabled: true,
  150. search: false,
  151. display: false,
  152. },
  153. {
  154. label: "表格名称",
  155. disabled: true,
  156. prop: "formName",
  157. search: false,
  158. },
  159. {
  160. label: "表格类型",
  161. prop: "formType",
  162. type: "select",
  163. disabled: true,
  164. search: false,
  165. dicData: dicts.excel_type,
  166. props: {
  167. label: "dictLabel",
  168. value: "dictValue",
  169. },
  170. },
  171. ],
  172. });
  173. </script>