烟花爆竹实名登记前端
祖安之光
2026-03-12 8f6a8545c3cf50ff0feac85f7b3c57db8fc3a0b4
src/views/usermng/product.vue
@@ -94,7 +94,7 @@
            <span>{{ scope.row.directionCode }}</span>
          </template>
        </el-table-column>
        <el-table-column label="生产厂家" prop="manufacturer" align="center" sortable="custom">
        <el-table-column label="批发厂家" prop="manufacturer" align="center" sortable="custom">
          <template slot-scope="scope">
            <span>{{ scope.row.manufacturer }}</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
@@ -198,13 +199,13 @@
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="生产厂家:" prop="manufacturer">
        <el-form-item label="批发厂家:" prop="manufacturer">
          <el-select v-model="dataForm.manufacturer" filterable placeholder="请选择" :disabled="dialogStatus==='editor'">
            <el-option
              v-for="item in manufacturerTree"
              :key="item.attributes"
              :label="item.text"
              :value="item.attributes">
              :key="item.enterprisenumber"
              :label="item.enterprisename"
              :value="item.enterprisenumber">
            </el-option>
          </el-select>
        </el-form-item>
@@ -256,9 +257,10 @@
      deleteProduct,
      getMajorCategoryTree,
      getManufacturerTree, getPermitLevelTree, getSecondaryCategoryTree,
      productList,
      productList, updateOldProduct,
      updateProduct
  } from "../../api/product";
  import {  getSuperiorDepartmentList } from '@/api/enterprise'
  import {parseError} from "../../utils/messageDialog";
  import {computePageCount} from "../../utils";
  import {mapGetters} from "vuex";
@@ -309,7 +311,7 @@
        dataFormRules: {
          name: [{required: true, message: '产品名不能为空', trigger: 'blur'}],
          type: [{required: true, message: '产品类型不能为空', trigger: 'blur'}],
          manufacturer: [{required: true, message: '生产厂家不能为空', trigger: 'blur'}],
          manufacturer: [{required: true, message: '批发厂家不能为空', trigger: 'blur'}],
          specification: [{required: true, message: '规格不能为空', trigger: 'blur'}],
          explosiveContent: [{required: true, message: '含药量不能为空', trigger: 'blur'}],
          level: [{required: true, message: '产品级别不能为空', trigger: 'blur'}],
@@ -329,9 +331,10 @@
      this.getProductMajorCategory();
    },
    mounted() {
      getManufacturerTree().then(res => {
        this.manufacturerTree = (res.data);
      })
      // getManufacturerTree().then(res => {
      //   this.manufacturerTree = (res.data);
      // })
        this.getSuperiorDepartmentListData()
    },
    computed: {
      ...mapGetters([
@@ -339,14 +342,23 @@
        'username'
      ]),
        debouncedSubmit() {
            return this.debounce(this.submitHandle, 1000);
            return this.debounce(this.submitHandle, 800);
        }
    },
    methods: {
      async selectChange(){
        async getSuperiorDepartmentListData(){
            let res = await getSuperiorDepartmentList({filter: {enterprisename:"",safetysupervision:"烟花爆竹批发经营",province:"",city:"",district:"",street:""},
                pageIndex: 1,
                pageSize:9999})
            if(res.data.code === "200"){
                this.manufacturerTree = res.data.result.records
            }
        },
      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(){
@@ -430,8 +442,7 @@
          }else if (this.dialogStatus === 'createNew') {
              this.createNewHandle();
          }else {
              // this.updateHandle();
              this.dialogFormVisible = false;
              this.updateHandle();
          }
      },
      createHandle: function () {
@@ -536,6 +547,7 @@
          id: '',
          name: '',
          type: '',
        secondaryType: '',
          directionCode: '',
          manufacturer: '',
          specification: '',
@@ -569,7 +581,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
@@ -587,10 +599,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()
@@ -600,6 +619,7 @@
        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.specification = row.specification;