| | |
| | | </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" |
| | |
| | | :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> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <span>{{ scope.row.level }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="单个产品含量" prop="boxNumber" align="center" sortable="custom"> |
| | | <el-table-column label="箱含量" prop="boxNumber" align="center" sortable="custom"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.boxNumber }}</span> |
| | | </template> |
| | |
| | | </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> |
| | |
| | | @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="保存中..."> |
| | |
| | | </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 |
| | |
| | | </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> |
| | |
| | | <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> 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-form-item label="箱含量:" prop="boxNumber"> |
| | | <el-input-number v-model.number="dataForm.boxNumber" :controls="false" :disabled="dialogStatus==='editor'"/> |
| | | </el-form-item> |
| | | <el-form-item label="包装方式:" prop="packing"> |
| | |
| | | </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> |
| | |
| | | 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"; |
| | |
| | | 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'}], |
| | |
| | | this.getProductMajorCategory(); |
| | | }, |
| | | mounted() { |
| | | getManufacturerTree().then(res => { |
| | | this.manufacturerTree = (res.data); |
| | | }) |
| | | // getManufacturerTree().then(res => { |
| | | // this.manufacturerTree = (res.data); |
| | | // }) |
| | | this.getSuperiorDepartmentListData() |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | | 'userType', |
| | | 'username' |
| | | ]) |
| | | ]), |
| | | debouncedSubmit() { |
| | | 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(){ |
| | |
| | | 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 () { |
| | |
| | | id: '', |
| | | name: '', |
| | | type: '', |
| | | secondaryType: '', |
| | | directionCode: '', |
| | | manufacturer: '', |
| | | specification: '', |
| | |
| | | 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 |
| | |
| | | } |
| | | }) |
| | | }, |
| | | 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() |
| | |
| | | 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; |