烟花爆竹实名登记前端
祖安之光
2026-02-04 0b3900a7822edbf2dbf453a2045c3861d4533876
src/views/usermng/product.vue
@@ -37,7 +37,7 @@
          </el-option>
        </el-select>
        <el-button v-if="getBtnPermission('add')" class="filter-item" style="margin-left: 10px;" type="primary"
                   icon="el-icon-plus" @click="showCreateHandle">旧系统信息录入
                   icon="el-icon-plus" @click="showCreateHandle">万能码信息录入
        </el-button>
        <el-upload v-if="userType === 1"
            class="filter-item"
@@ -51,7 +51,7 @@
            :on-success="onSuccessHandler"
            :on-error="onErrorHandler"
            :auto-upload="true">
            <el-dropdown  @command="handleCommand" split-button trigger="hover" type="primary" style="margin-left: 10px;" icon="el-icon-plus" :disabled="uploadBtnControl">旧系统信息导入
            <el-dropdown  @command="handleCommand" split-button trigger="hover" type="primary" style="margin-left: 10px;" icon="el-icon-plus" :disabled="uploadBtnControl">万能码信息导入
                <el-button type="primary" slot="trigger" :disabled="uploadBtnControl"></el-button>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item icon="el-icon-plus"  command="download"  >下载模板</el-dropdown-item>
@@ -104,7 +104,7 @@
            <span>{{ scope.row.specification }}</span>
          </template>
        </el-table-column>
        <el-table-column label="单挂(个)含药量" prop="explosiveContent" align="center" sortable="custom">
        <el-table-column label="单个产品含药量" prop="explosiveContent" align="center" sortable="custom">
          <template slot-scope="scope">
            <span>{{ scope.row.explosiveContent }}</span>
          </template>
@@ -136,7 +136,8 @@
        </el-table-column>
        <el-table-column label="操作" align="center" width="240" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle(scope.row)">查看</el-button>
              <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle('update',scope.row)">修改</el-button>
            <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle('editor',scope.row)">查看</el-button>
            <el-button v-if="getBtnPermission('delete')" type="text" style="color:red;"
                       @click="deleteHandle(scope.row)">删除
            </el-button>
@@ -157,7 +158,7 @@
        @current-change="handleCurrentChange"
      />
    </div>
    <el-dialog :title="dialogStatus==='create'|| dialogStatus === 'createNew'?'新增':'查看'" :visible.sync="dialogFormVisible"
    <el-dialog :title="dialogStatus==='create'|| dialogStatus === 'createNew'?'新增':dialogStatus === 'update'?'修改':'查看'" :visible.sync="dialogFormVisible"
               :modal-append-to-body="false" :close-on-click-modal="false" width="700px">
      <el-form ref="dataForm" :rules="dataFormRules" :model="dataForm" label-position="right" label-width="140px"
               style="margin-left:50px;width:500px;" element-loading-text="保存中...">
@@ -178,7 +179,7 @@
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="产品小类:" prop="type">
        <el-form-item label="产品小类:" prop="secondaryType">
          <el-select v-model="dataForm.secondaryType" clearable placeholder="请选择" :disabled="dialogStatus==='editor'"
                     @change="selectChange">
            <el-option
@@ -204,7 +205,7 @@
              v-for="item in manufacturerTree"
              :key="item.attributes"
              :label="item.text"
              :value="item.attributes">
              :value="item.text">
            </el-option>
          </el-select>
        </el-form-item>
@@ -215,11 +216,11 @@
            <br>
          <span v-show="dialogStatus !== 'create'" style="font-size: 12px;color: red">(如单挂鞭炮2000发,则填2000)</span>
        </el-form-item>
        <el-form-item :label="dialogStatus === 'createNew' ? '最小单位含药量:':'含药量:'" prop="explosiveContent">
        <el-form-item :label="dialogStatus === 'createNew' ? '最小单位含药量:':'单个产品含药量:'" prop="explosiveContent">
          <el-input-number v-model.number="dataForm.explosiveContent" :controls="false" :disabled="dialogStatus==='editor'"/>
            <span>&nbsp;g</span>
            <br>
            <span v-show="dialogStatus !== 'create'" style="font-size: 12px;color: red">(箱含药量 = 最小单位含药量×规格×箱含量,如单发鞭炮含药量为0.5g,则填写0.5)</span>
            <span v-show="dialogStatus !== 'create'" style="font-size: 12px;color: red">(单个产品含药量 = 最小单位含药量×规格,如 最小单位含药量为0.5g,规格为100,则单个产品含药量为0.5*100=50g)</span>
        </el-form-item>
        <el-form-item label="箱含量:" prop="boxNumber">
          <el-input-number v-model.number="dataForm.boxNumber" :controls="false" :disabled="dialogStatus==='editor'"/>
@@ -240,7 +241,7 @@
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="submitHandle">确认</el-button>
        <el-button type="primary" @click="debouncedSubmit">确认</el-button>
      </div>
    </el-dialog>
    <div style="clear: both;"></div>
@@ -256,7 +257,7 @@
      deleteProduct,
      getMajorCategoryTree,
      getManufacturerTree, getPermitLevelTree, getSecondaryCategoryTree,
      productList,
      productList, updateOldProduct,
      updateProduct
  } from "../../api/product";
  import {parseError} from "../../utils/messageDialog";
@@ -337,13 +338,16 @@
      ...mapGetters([
        'userType',
        'username'
      ])
      ]),
        debouncedSubmit() {
            return this.debounce(this.submitHandle, 800);
        }
    },
    methods: {
      async selectChange(){
      async selectChange(second){
        this.$forceUpdate();
        this.dataForm.level = '';
        let res = await getPermitLevelTree(this.dataForm.secondaryType);
        let res = await getPermitLevelTree(second || this.dataForm.secondaryType);
        this.permitLevelOptions = res.data;
      },
      getProductMajorCategory(){
@@ -412,14 +416,22 @@
          parseError({error: error, vm: _this})
        })
      },
        debounce(func, wait) {
            let timeout;
            return (...args) => {
                clearTimeout(timeout);
                timeout = setTimeout(() => {
                    func.apply(this, args);
                }, wait);
            };
        },
      submitHandle:function(){
          if (this.dialogStatus === 'create') {
              this.createHandle();
          }else if (this.dialogStatus === 'createNew') {
              this.createNewHandle();
          }else {
              // this.updateHandle();
              this.dialogFormVisible = false;
              this.updateHandle();
          }
      },
      createHandle: function () {
@@ -524,6 +536,7 @@
          id: '',
          name: '',
          type: '',
        secondaryType: '',
          directionCode: '',
          manufacturer: '',
          specification: '',
@@ -557,7 +570,7 @@
            const userName = Cookies.get('userName');
            const name = Cookies.get('name');
            _this.dataForm['modifiedBy'] = name + '(' + userName + ')';
            updateProduct(_this.dataForm).then(response => {
              updateOldProduct(_this.dataForm).then(response => {
              const res = response.data
              if (res.code == 200) {
                _this.dialogFormVisible = false
@@ -575,10 +588,17 @@
          }
        })
      },
      showEditHandle: function (row) {
      showEditHandle: async function (type,row) {
        this.resetDataForm();
        this.dialogStatus = 'editor';
        this.dataFormSetValue(row);
          if(type == 'editor'){
              this.dialogStatus = 'editor';
          }else{
              this.dialogStatus = 'update';
          }
          await this.getProductSecondaryCategory(row.type)
          await this.selectChange(row.secondaryType)
          await this.dataFormSetValue(row);
        this.dialogFormVisible = true;
        this.$nextTick(() => {
          this.$refs['dataForm'].clearValidate()
@@ -588,8 +608,9 @@
        this.dataForm.id = row.id;
        this.dataForm.name = row.name;
        this.dataForm.type = row.type;
          this.dataForm.secondaryType = row.secondaryType;
        this.dataForm.directionCode = row.directionCode;
        this.dataForm.manufacturer = row.companyNumber;
        this.dataForm.manufacturer = row.manufacturer;
        this.dataForm.specification = row.specification;
        this.dataForm.explosiveContent = row.explosiveContent;
        this.dataForm.level = row.level;