Bläddra i källkod

物料变更单-详情增加序号

002390 1 år sedan
förälder
incheckning
e69a04d977
2 ändrade filer med 141 tillägg och 152 borttagningar
  1. 1 0
      src/views/material/changeApply/add/index.vue
  2. 140 152
      src/views/material/changeApply/see/index.vue

+ 1 - 0
src/views/material/changeApply/add/index.vue

@@ -378,6 +378,7 @@ export default {
           >
             <div style="height: 420px;display:flex">
               <el-super-table
+                index
                 v-model="materialInfo[item.key]"
                 :dict="dict"
                 :ref="tabName"

+ 140 - 152
src/views/material/changeApply/see/index.vue

@@ -1,8 +1,12 @@
 <!-- 批量新增 -->
 <script>
 import useColumns from "../add/column";
-import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic';
-
+import {
+  addChangeList,
+  getMaterialDetails,
+  getChangeDetails,
+  editChangeList,
+} from "@/api/changeApply/basic";
 
 export default {
   name: "SeeChangeOrders",
@@ -21,7 +25,6 @@ export default {
   },
 
   data() {
-
     const {
       TabColumns,
       TableColumns,
@@ -35,28 +38,26 @@ export default {
     const rules = this.$init.rules([...TabColumns, ...TableColumns]);
     const params = this.$init.params([...TabColumns, ...TableColumns]);
     let tabColumns = _.cloneDeep(TabColumns);
-    tabColumns =  tabColumns.map(item =>( 
-
-      {...item,
-        TableColumns: [...item.TableColumns.map(column =>({
-          item:{...column.item,disabled:true},
-          attr:{
+    tabColumns = tabColumns.map((item) => ({
+      ...item,
+      TableColumns: [
+        ...item.TableColumns.map((column) => ({
+          item: { ...column.item, disabled: true },
+          attr: {
             ...column.attr,
-            disabled:true
-          }
-        }))]
-      }
-      )
+            disabled: true,
+          },
+        })),
+      ],
+    }));
 
-    )
+    console.log(tabColumns, "tabColumns");
 
-    console.log(tabColumns,'tabColumns');
-    
     return {
       width: "100%",
       visible: false,
-      loading:false,
-      title:'查看',
+      loading: false,
+      title: "查看",
       rules,
       params,
       tabName: tabName,
@@ -65,9 +66,8 @@ export default {
     };
   },
   computed: {
-   
-    materialInfo:{
-      get(){
+    materialInfo: {
+      get() {
         const { materialBasic } = this.params;
         this.params.materialBasic = materialBasic.map((item, index) => ({
           ...item,
@@ -78,21 +78,17 @@ export default {
           materialBasic: this.params.materialBasic.filter(
             ({ delFlag }) => delFlag !== "2"
           ),
-        }
+        };
       },
-      set(){},
-    }
-  
-  },
-  watch: {
-    
+      set() {},
+    },
   },
+  watch: {},
   methods: {
-    setVisible(prop){
+    setVisible(prop) {
       this.visible = prop;
     },
-    beforeOpen(){
-    },
+    beforeOpen() {},
     //
     async fetchItem(prop) {
       try {
@@ -101,10 +97,9 @@ export default {
 
         let { code, data } = await getChangeDetails(prop.id);
 
-        if(code == 200){
+        if (code == 200) {
           this.params = data;
         }
-        
       } catch (err) {
         // catch
         console.error(err);
@@ -113,7 +108,7 @@ export default {
         this.loading = false;
       }
     },
-    
+
     //
     async hide() {
       const {
@@ -127,40 +122,36 @@ export default {
       } = useColumns();
       this.visible = false;
       this.tabName = tabName;
-      this.$emit('success');
+      this.$emit("success");
       this.params = this.$init.params([...TabColumns, ...TableColumns]);
     },
-   
-    async handleSubmit(){
-      this.params = {...this.params,status:'1'};
-      console.log(this.params,'this.params');
+
+    async handleSubmit() {
+      this.params = { ...this.params, status: "1" };
+      console.log(this.params, "this.params");
       try {
-          this.loading = true;
-          
-          const {code,msg} = await addChangeList(this.params);
+        this.loading = true;
 
-          if(code == 200){
+        const { code, msg } = await addChangeList(this.params);
 
-            this.hide();
-            this.$notify.success({
-              message: msg,
-            });
-          }
-          
-        } catch (error) {}
-        finally{
-          this.loading = false;
+        if (code == 200) {
+          this.hide();
+          this.$notify.success({
+            message: msg,
+          });
         }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
     },
-    handleSubmitValidate(prop,cb){
-
+    handleSubmitValidate(prop, cb) {
       this.$refs[prop].$refs[prop].validate(async (valid) => {
         if (valid) {
           try {
             this.loading = true;
 
             await cb();
-            
           } catch (err) {
             // catch
             console.error(err);
@@ -174,113 +165,112 @@ export default {
       });
     },
   },
-  created() {
-  },
+  created() {},
   mounted() {},
   destroyed() {},
 };
 </script>
 
 <template>
-    <el-drawer
-      v-bind="$attrs"
-      v-on="$listeners"
-      :size="width"
-      :visible.sync="visible"
-      destroy-on-close
-      :show-close="false"
-      @close="hide"
-      @open="beforeOpen"
-      v-loading="loading"
+  <el-drawer
+    v-bind="$attrs"
+    v-on="$listeners"
+    :size="width"
+    :visible.sync="visible"
+    destroy-on-close
+    :show-close="false"
+    @close="hide"
+    @open="beforeOpen"
+    v-loading="loading"
+  >
+    <div
+      slot="title"
+      style="display: flex; justify-content: space-between; align-items: center"
     >
-      <div 
-        slot="title" 
-        style="display: flex;
-            justify-content: space-between;
-            align-items: center;"
-      >
-        <h3>{{title}}</h3>
-        <div>
-          <el-button 
-            v-if="params.status === '0' || params.status === '3'"
-            type="primary"
-            :size="$attrs.size" 
-            :loading="loading" 
-            @click="handleSubmit"
-          >
-            提 交
-          </el-button>
-          <el-button :size="$attrs.size" :loading="loading" @click="hide"
-            >取 消</el-button>
-        </div>
+      <h3>{{ title }}</h3>
+      <div>
+        <el-button
+          v-if="params.status === '0' || params.status === '3'"
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="handleSubmit"
+        >
+          提 交
+        </el-button>
+        <el-button :size="$attrs.size" :loading="loading" @click="hide"
+          >取 消</el-button
+        >
       </div>
-      <el-super-form
-        v-model="params"
-        :dict="dict"
-        :rules="rules"
-        :size="$attrs.size"
-        :columns="TableColumns"
-        ref="superForm"
-        label-width="auto"
-        label-position="right"
-        style="padding: 20px"
+    </div>
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="$attrs.size"
+      :columns="TableColumns"
+      ref="superForm"
+      label-width="auto"
+      label-position="right"
+      style="padding: 20px"
+    >
+      <template slot="puOrgName" slot-scope="scope">
+        <component
+          v-bind="scope.attr"
+          v-model="scope.row[scope.item.key]"
+          :size="$attrs.size"
+          :source.sync="scope.row"
+          @change="changePuOrgName({ ...scope, select: $event })"
+        >
+        </component
+      ></template>
+    </el-super-form>
+
+    <el-tabs v-model="tabName" style="padding: 0 20px 20px">
+      <el-tab-pane
+        v-for="({ item, TableColumns: columns }, index) in TabColumns"
+        :key="index"
+        :label="item.title"
+        :name="item.key"
+        lazy
       >
-        <template slot="puOrgName" slot-scope="scope">
-          <component
-            v-bind="scope.attr"
-            v-model="scope.row[scope.item.key]"
+        <div style="height: 420px; display: flex">
+          <el-super-table
+            v-model="materialInfo[item.key]"
+            :dict="dict"
+            index
+            :ref="tabName"
+            :columns="columns"
             :size="$attrs.size"
-            :source.sync="scope.row"
-            @change="changePuOrgName({ ...scope, select: $event })"
-          >
-          </component
-        ></template>
-      </el-super-form>
-      
-    
-        <el-tabs v-model="tabName" style="padding: 0 20px 20px">
-          <el-tab-pane
-            v-for="({ item, TableColumns: columns }, index) in TabColumns"
-            :key="index"
-            :label="item.title"
-            :name="item.key"
-            lazy
           >
-          <div style="height: 420px;display:flex">
-            <el-super-table
-              v-model="materialInfo[item.key]"
-              :dict="dict"
-              :ref="tabName"
-              :columns="columns"
-              :size="$attrs.size"
+            <template slot="materialName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                @change="changeMaterialName(scope)"
+              >
+              </component>
+            </template>
+            <el-table-column
+              fixed="right"
+              label="操作"
+              width="120"
+              align="center"
             >
-              <template slot="materialName" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  @change="changeMaterialName(scope)"
-                >
-                </component>
+              <template slot-scope="scope">
+                <AmendantRecord
+                  v-if="tabName === 'materialBasic'"
+                  v-model="scope.row"
+                ></AmendantRecord>
               </template>
-              <el-table-column fixed="right" label="操作" width="120" align="center">
-                
-                <template slot-scope="scope">
-                  <AmendantRecord
-                    v-if=" tabName ==='materialBasic' "
-                    v-model="scope.row"
-                  ></AmendantRecord>
-                  
-                </template>
-              </el-table-column>
-            </el-super-table>
-          </div>
-           
-          </el-tab-pane>
-        </el-tabs>
-     
-    </el-drawer>
+            </el-table-column>
+          </el-super-table>
+        </div>
+      </el-tab-pane>
+    </el-tabs>
+  </el-drawer>
 </template>
 
 <style scoped>
@@ -288,5 +278,3 @@ export default {
   display: none;
 }
 </style>
-
-