modelFile.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div id="modelFile">
  3. <span class="modelFile" style="margin-right: 12px;">模型文件</span>
  4. <el-cascader :options="options" :props="props" :show-all-levels="false" @change="handleChange" style="width:160px;"
  5. clearable placeholder="请选择模型文件" v-model="casVal"></el-cascader>
  6. </div>
  7. </template>
  8. <script>
  9. import tools from "@/utils/scan/tools"
  10. import { queryModelFile } from "@/api/data_admin/buildTaskApi"
  11. import { mapGetters, mapActions } from "vuex"
  12. export default {
  13. computed: {
  14. ...mapGetters("layout", [ "projectId", "secret", "userId" ])
  15. },
  16. data() {
  17. return {
  18. casVal: [],
  19. options: [],
  20. modelIdToFloorId: {},
  21. props: {
  22. value: "FileId",
  23. label: "FileName",
  24. children: "FileList"
  25. },
  26. };
  27. },
  28. created() {
  29. this.init()
  30. },
  31. watch: {
  32. projectId() {
  33. this.casVal =[]
  34. this.options = []
  35. this.init()
  36. }
  37. },
  38. methods: {
  39. //设置默认选项
  40. setValue(val) {
  41. if (val && val.length) {
  42. this.casVal = val
  43. }
  44. },
  45. //获取数据
  46. init() {
  47. this.getDirectory()
  48. },
  49. // 获取文件夹
  50. getDirectory() {
  51. queryModelFile("", res => {
  52. this.options = res.Content.map(item => {
  53. item.FileId = item.FolderId
  54. item.FileName = item.FolderName
  55. return item
  56. })
  57. });
  58. },
  59. //改变item
  60. handleChange(value) {
  61. this.$emit("change", value)
  62. }
  63. }
  64. };
  65. </script>
  66. <style lang="less">
  67. .el-cascader .el-input .el-input__inner {
  68. vertical-align: bottom;
  69. }
  70. </style>
  71. <style lang="less" scoped>
  72. #modelFile {
  73. margin-left: 10px;
  74. float: left;
  75. .modelFile {
  76. color: #999999;
  77. font-size: 14px;
  78. }
  79. }
  80. </style>