excelCom.vue 4.4 KB

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