update 解决初步获取detail时code被watcher强制替换的问题
This commit is contained in:
		@@ -43,7 +43,7 @@
 | 
			
		||||
          <!-- 表单标签页 -->
 | 
			
		||||
          <div v-if="tab.key === 'info'">
 | 
			
		||||
            <!-- form  -->
 | 
			
		||||
            <el-form ref="dataForm" :model="dataForm" v-loading="formLoading || optionsLoading">
 | 
			
		||||
            <el-form ref="dataForm" :model="dataForm" v-loading="formLoading || optionsLoading || tableLoading">
 | 
			
		||||
              <el-row v-for="(row, rowIndex) in configs.form.rows" :key="'row_' + rowIndex" :gutter="20">
 | 
			
		||||
                <el-col v-for="(col, colIndex) in row" :key="colIndex" :span="24 / row.length">
 | 
			
		||||
                  <el-form-item
 | 
			
		||||
@@ -331,12 +331,13 @@ export default {
 | 
			
		||||
      this.$watch(
 | 
			
		||||
        () => this.dataForm[targetProp],
 | 
			
		||||
        (val) => {
 | 
			
		||||
          console.log("[DWM watch]");
 | 
			
		||||
          if (val && targetProp in dataSource) {
 | 
			
		||||
            this.dataForm[followerProp] = dataSource[targetProp]?.find((item) => item.id === val)?.[followerProp];
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          immediate: true,
 | 
			
		||||
          immediate: false,
 | 
			
		||||
        }
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
@@ -372,11 +373,11 @@ export default {
 | 
			
		||||
      console.log("[DWM doRequests] requestList", this.requestList);
 | 
			
		||||
      if (this.requestList.length) {
 | 
			
		||||
        const promiseList = [];
 | 
			
		||||
        this.optionsLoading = true;
 | 
			
		||||
        try {
 | 
			
		||||
          this.requestList.forEach((opt) => {
 | 
			
		||||
            console.log("[DWM doRequests]", opt.fetchData);
 | 
			
		||||
            promiseList.push(async function () {
 | 
			
		||||
            promiseList.push(async () => {
 | 
			
		||||
              this.optionsLoading = true;
 | 
			
		||||
              // const { data: res } = await opt.fetchData(this.dataForm.id ? this.dataForm.id : -1);
 | 
			
		||||
              const { data: res } = await opt.fetchData();
 | 
			
		||||
              if (opt.cacheFetchedData) this.cached[opt.prop] = "list" in res.data ? res.data.list : res.data || [];
 | 
			
		||||
@@ -412,12 +413,10 @@ export default {
 | 
			
		||||
                // res.code != 0
 | 
			
		||||
                this.$set(opt, "options", []);
 | 
			
		||||
              }
 | 
			
		||||
              this.optionsLoading = false;
 | 
			
		||||
            });
 | 
			
		||||
          });
 | 
			
		||||
          const v = await Promise.all(promiseList.map(fn => fn.call(this)));
 | 
			
		||||
          console.log("v", v);
 | 
			
		||||
 | 
			
		||||
          this.optionsLoading = false;
 | 
			
		||||
          const v = await Promise.all(promiseList.map((fn) => fn.call(this)));
 | 
			
		||||
          return true;
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
          this.$message.err("刷新选项失败");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user