setVersion.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {
  2. ref,
  3. verification,
  4. requestSearch,
  5. requestAdd,
  6. requestDelete,
  7. requestEdit
  8. } from "@/utils/importUsed";
  9. import { useApiInfo } from "../hook";
  10. const { onSearch } = useApiInfo();
  11. export default function setVersion() {
  12. // 设置版本号
  13. const setVersionVisible = ref(false);
  14. const setVersionColumns = ref({});
  15. function handleSetVersion(row) {
  16. setVersionVisible.value = true;
  17. // 表格数据赋值
  18. setVersionColumns.value = row;
  19. }
  20. const closeFn = () => (setVersionVisible.value = false);
  21. /// 提交函数
  22. const setVersionFormsubmit = async data => {
  23. requestAdd(
  24. {
  25. module: "kxsConfigServer",
  26. method: "apiInfosetVersion",
  27. params: data
  28. },
  29. () => {
  30. closeFn();
  31. onSearch();
  32. }
  33. );
  34. };
  35. // 获取表单项数据函数
  36. const setVersionOpenFunction = async () => {
  37. //通过表格数据获取参数
  38. for (const key in setVersionFormData.value) {
  39. if (Object.prototype.hasOwnProperty.call(setVersionFormData.value, key)) {
  40. setVersionFormData.value[key].value = setVersionColumns[key] || "";
  41. }
  42. }
  43. };
  44. // 表单数据
  45. const setVersionFormData = ref({
  46. version: {
  47. label: "版本号",
  48. value: "",
  49. type: "number",
  50. disposition: {},
  51. options: [],
  52. rules: [{ required: true, message: "请输入接口名称", trigger: "blur" }]
  53. }
  54. });
  55. return {
  56. setVersionFormData,
  57. setVersionFormsubmit,
  58. setVersionVisible,
  59. handleSetVersion,
  60. setVersionOpenFunction
  61. };
  62. }