Selaa lähdekoodia

物料变更单-修改序列号和批号字段,提示是否生成新版本

002390 1 vuosi sitten
vanhempi
commit
ce60d55004
1 muutettua tiedostoa jossa 198 lisäystä ja 178 poistoa
  1. 198 178
      src/views/material/changeApply/add/index.vue

+ 198 - 178
src/views/material/changeApply/add/index.vue

@@ -204,11 +204,16 @@ export default {
     },
     //
     async useSubmit(prop) {
-      console.log(this.params, "this.params");
+      let params = _.cloneDeep(this.params);
+      params.materialBasic = params.materialBasic.map((item) => {
+        delete item.isNewVersion;
+        return item;
+      });
+
       this.handleSubmitValidate(prop, async () => {
         try {
           this.loading = true;
-          const { code, msg } = await addChangeList(this.params);
+          const { code, msg } = await addChangeList(params);
 
           if (code == 200) {
             this.hide();
@@ -283,6 +288,21 @@ export default {
       }
       this.changeExpiryDateManagerment(row);
     },
+    visibleChange(val, source) {
+      val &&
+        !source.isNewVersion &&
+        this.$confirm("是否生成新版本?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            source.isNewVersion = true;
+          })
+          .catch(() => {
+            source.isNewVersion = false;
+          });
+    },
     changeExpiryDateManagerment(row) {
       if (row.expiryDateManagerment === "2") {
         row.usefulLife = "";
@@ -302,7 +322,7 @@ export default {
 <template>
   <el-drawer
     v-bind="$attrs"
-    v-on="$listeners" 
+    v-on="$listeners"
     :size="width"
     :visible.sync="visible"
     destroy-on-close
@@ -360,90 +380,89 @@ export default {
           :name="item.key"
           lazy
         >
-         
-            <el-super-ux-table
-              index
-              v-model="materialInfo[item.key]"
-              :dict="dict"
-              :ref="tabName"
-              :columns="columns"
-              :size="$attrs.size"
-              :height="420"
-            >
-              <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"
-                >
-                </component>
-              </template>
-              <!-- 判断是否禁用 -->
-              <template slot="drug" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial === '0')"
-                >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
-              </template>
-
-              <template slot="registrationNo" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial === '0')"
+          <el-super-ux-table
+            index
+            v-model="materialInfo[item.key]"
+            :dict="dict"
+            :ref="tabName"
+            :columns="columns"
+            :size="$attrs.size"
+            :height="420"
+          >
+            <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"
+              >
+              </component>
+            </template>
+            <!-- 判断是否禁用 -->
+            <template slot="drug" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial === '0')"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
                 >
-                </component>
-              </template>
-
-              <template slot="medicalDevices" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial === '0')"
+                </el-option>
+              </component>
+            </template>
+
+            <template slot="registrationNo" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial === '0')"
+              >
+              </component>
+            </template>
+
+            <template slot="medicalDevices" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial === '0')"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
                 >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
-              </template>
-              <template slot="maintenanceType" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="!(scope.row.medicineMaterial === '0')"
+                </el-option>
+              </component>
+            </template>
+            <template slot="maintenanceType" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial === '0')"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
                 >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
-              </template>
-              <!-- <template slot="dosageFromName" slot-scope="scope">
+                </el-option>
+              </component>
+            </template>
+            <!-- <template slot="dosageFromName" slot-scope="scope">
                   <component
                     v-bind="scope.attr"
                     v-model="scope.row[scope.item.key]"
@@ -453,108 +472,109 @@ export default {
                   >
                   </component>
                 </template> -->
-              <!-- 批号及库存状态管理 -->
-              <template slot="isInventoryStatus" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  @change="changeIsInventoryStatus(scope.row)"
+            <!-- 批号及库存状态管理 -->
+            <template slot="isInventoryStatus" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                @visible-change="(val) => visibleChange(val, scope.row)"
+                @change="changeIsInventoryStatus(scope.row)"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
                 >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
-              </template>
-              <!-- 效期管理 -->
-              <template slot="expiryDateManagerment" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
-                  :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="scope.row.isInventoryStatus !== '0'"
-                  @change="changeExpiryDateManagerment(scope.row)"
+                </el-option>
+              </component>
+            </template>
+            <!-- 效期管理 -->
+            <template slot="expiryDateManagerment" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="scope.row.isInventoryStatus !== '0'"
+                @change="changeExpiryDateManagerment(scope.row)"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
                 >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
-              </template>
-              <!-- 是否序列号管理 -->
-              <template slot="serialNoManager" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
+                </el-option>
+              </component>
+            </template>
+            <!-- 是否序列号管理 -->
+            <template slot="serialNoManager" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="scope.row.isInventoryStatus !== '0'"
+                @visible-change="(val) => visibleChange(val, scope.row)"
+              >
+                <el-option
+                  v-for="item in dict.type[scope.attr.dictName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </component>
+            </template>
+            <!-- 有效期 -->
+            <template slot="usefulLife" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="scope.row.expiryDateManagerment !== '0'"
+              >
+              </component>
+            </template>
+
+            <ux-table-column
+              fixed="right"
+              title="操作"
+              width="120"
+              align="center"
+            >
+              <template slot="header" slot-scope="scope">
+                <el-button
+                  type="text"
                   :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="scope.row.isInventoryStatus !== '0'"
+                  @click="useRowAdd(tabName)"
                 >
-                  <el-option
-                    v-for="item in dict.type[scope.attr.dictName]"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </component>
+                  增行
+                </el-button>
               </template>
-              <!-- 有效期 -->
-              <template slot="usefulLife" slot-scope="scope">
-                <component
-                  v-bind="scope.attr"
-                  v-model="scope.row[scope.item.key]"
+              <template slot-scope="scope">
+                <el-button
+                  type="text"
                   :size="$attrs.size"
-                  :source.sync="scope.row"
-                  :disabled="scope.row.expiryDateManagerment !== '0'"
+                  @click.native.prevent="useRowRemove(tabName, scope)"
                 >
-                </component>
+                  删除
+                </el-button>
+                <AmendantRecord
+                  v-if="
+                    tabName === 'materialBasic' &&
+                    addType === 'edit' &&
+                    scope.row.id
+                  "
+                  v-model="scope.row"
+                ></AmendantRecord>
               </template>
-
-              <ux-table-column
-                fixed="right"
-                title="操作"
-                width="120"
-                align="center"
-              >
-                <template slot="header" slot-scope="scope">
-                  <el-button
-                    type="text"
-                    :size="$attrs.size"
-                    @click="useRowAdd(tabName)"
-                  >
-                    增行
-                  </el-button>
-                </template>
-                <template slot-scope="scope">
-                  <el-button
-                    type="text"
-                    :size="$attrs.size"
-                    @click.native.prevent="useRowRemove(tabName, scope)"
-                  >
-                    删除
-                  </el-button>
-                  <AmendantRecord
-                    v-if="
-                      tabName === 'materialBasic' &&
-                      addType === 'edit' &&
-                      scope.row.id
-                    "
-                    v-model="scope.row"
-                  ></AmendantRecord>
-                </template>
-              </ux-table-column>
-            </el-super-ux-table>
-          
+            </ux-table-column>
+          </el-super-ux-table>
         </el-tab-pane>
       </el-tabs>
       <el-row style="position: absolute; top: 0px; right: 20px">