| | |
| | | </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 |
| | |
| | | v-for="item in manufacturerTree" |
| | | :key="item.attributes" |
| | | :label="item.text" |
| | | :value="item.attributes"> |
| | | :value="item.text"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </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 {parseError} from "../../utils/messageDialog"; |
| | |
| | | ...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(){ |
| | |
| | | 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.manufacturer = row.manufacturer; |
| | | this.dataForm.specification = row.specification; |
| | | this.dataForm.explosiveContent = row.explosiveContent; |
| | | this.dataForm.level = row.level; |