| | |
| | | class="bodySearchReset" |
| | | :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}" |
| | | > |
| | | <el-button v-waves type="primary" icon="el-icon-search" @click="">查询</el-button> |
| | | <el-button v-waves type="primary" icon="el-icon-search" @click="getTMaterielData($refs.treeLeftRef.getCurrentNode())">查询</el-button> |
| | | <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button> |
| | | </div> |
| | | </el-form> |
| | |
| | | label="序号" |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | prop="partcode" |
| | | label="存货编码" |
| | | sortable="custom" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | prop="partname" |
| | | label="存货名称" |
| | | width="110" |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | prop="partspec" |
| | | label="规格型号" |
| | | width="110" |
| | | sortable="custom" |
| | | /> |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.partspec ? row.partspec : '/' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="code" |
| | | prop="idinventoryclassname" |
| | | label="所属类别" |
| | | sortable="custom" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | label="计量单位" |
| | | width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.isSingleUnit === '0' ? row.idunitgroupname : row.idunitname }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="status" |
| | | label="存货状态" |
| | | width="110" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-tag v-if="row.status==='0'" size="small" type="success">正常</el-tag> |
| | | <el-tag v-if="row.status==='1'" size="small" type="danger">停用</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | label="存货属性" |
| | | sortable="custom" |
| | | min-width="220" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | {{ row.isPurchase === '1' ? '外购' : '' }} |
| | | {{ row.isSale === '1' ? '销售' : '' }} |
| | | {{ row.isMadeSelf === '1' ? '自制' : '' }} |
| | | {{ row.isMaterial === '1' ? '生产消耗' : '' }} |
| | | {{ row.isMadeRequest === '1' ? '委外' : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="数据来源" |
| | | prop="data_sources" |
| | | sortable="custom" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | prop="code" |
| | | label="计量单位" |
| | | label="创建人员" |
| | | prop="lm_user" |
| | | sortable="custom" |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | label="创建时间" |
| | | prop="lm_date" |
| | | sortable="custom" |
| | | width="160" |
| | | /> |
| | | |
| | | <el-table-column |
| | | label="操作" |
| | | width="120" |
| | |
| | | align="right" |
| | | layout="total,prev, pager, next,sizes,jumper" |
| | | popper-class="select_bottom" |
| | | @pagination="getOrganizationSearch" |
| | | @pagination="getTMaterielData($refs.treeLeftRef.getCurrentNode())" |
| | | /> |
| | | |
| | | </div> |
| | |
| | | v-el-drag-dialog |
| | | :title="operation==='add'?'新增':'编辑'" |
| | | :visible.sync="dialogVisible" |
| | | width="800px" |
| | | width="1200px" |
| | | :close-on-click-modal="false" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | |
| | | <el-form ref="dialogForm" class="elForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> |
| | | <el-form ref="dialogForm" class="" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px"> |
| | | <el-divider content-position="left">基本信息</el-divider> |
| | | <el-form-item label="存货编码" prop="usercode"> |
| | | <el-input v-model="dialogForm.usercode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | <el-form-item label="存货编码" prop="partcode"> |
| | | <el-input v-model="dialogForm.partcode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="存货名称" prop="username"> |
| | | <el-input v-model="dialogForm.username" style="width: 200px" /> |
| | | <el-form-item label="存货名称" prop="partname"> |
| | | <el-input v-model="dialogForm.partname" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="规格型号"> |
| | | <el-input v-model="dialogForm.usercode" style="width: 200px" /> |
| | | <el-input v-model="dialogForm.partspec" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="所属类别" prop="username"> |
| | | <el-form-item label="所属类别" prop="inventoryclasscode"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.inventoryclasscode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="所属仓库" prop="idwarehouse"> |
| | | <el-select |
| | | v-model="dialogForm.idwarehouse" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in idwarehouseArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item required label="存货状态"> |
| | | <el-radio-group v-model="dialogForm.status"> |
| | | <el-radio label="0">正常</el-radio> |
| | | <el-radio label="1">停用</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <el-divider content-position="left">计量单位</el-divider> |
| | | <el-form-item label="计量方式" prop="usercode"> |
| | | <el-form-item label="计量方式" required prop="unittypcode"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.unittypcode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="unittypcodeChange" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | v-for="item in unittypcodeArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="计量单位组" prop="username"> |
| | | <el-form-item :label="dialogForm.unittypcode==='1'? '计量单位':'计量单位组'" prop="unitcode"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-if="dialogForm.unittypcode==='1'" |
| | | v-model="dialogForm.unitcode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="val=>unitcodeChange(val,'1')" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in unitcodeSingleArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | <el-select |
| | | v-if="dialogForm.unittypcode!=='1'" |
| | | v-model="dialogForm.unitcode" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :popper-append-to-body="false" |
| | | @change="val=>unitcodeChange(val,'0')" |
| | | > |
| | | <el-option |
| | | v-for="item in unitcodeGroupArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="报表辅助单位" prop="usercode"> |
| | | <el-form-item label="报表辅单位"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.idSubUnitByReport" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogForm.unittypcode==='1'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in idSubUnitByReportArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="库存常用单位" prop="username"> |
| | | <el-form-item label="库存常用单位"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.idUnitByStock" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogForm.unittypcode==='1'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in idUnitBvStockArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="采购常用单位" prop="usercode"> |
| | | <el-form-item label="采购常用单位"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.idUnitByPurchase" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogForm.unittypcode==='1'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in idUnitBvStockArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="销售常用单位" prop="username"> |
| | | <el-form-item label="销售常用单位"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.idUnitBySale" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogForm.unittypcode==='1'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in idUnitBvStockArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="生产常用单位" prop="username"> |
| | | <el-form-item label="生产常用单位"> |
| | | <el-select |
| | | v-model="dialogForm.usercode" |
| | | v-model="dialogForm.idunitbymanufacture" |
| | | style="width:200px" |
| | | placeholder="请选择" |
| | | filterable |
| | | :disabled="dialogForm.unittypcode==='1'" |
| | | :popper-append-to-body="false" |
| | | > |
| | | <el-option |
| | | v-for="item in treeLeftArr" |
| | | :key="item.code" |
| | | :label="item.name" |
| | | :value="item.code" |
| | | v-for="item in idUnitBvStockArr" |
| | | :key="item.unitcode" |
| | | :label="item.unitname" |
| | | :value="item.unitcode" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-divider content-position="left">存货属性</el-divider> |
| | | <el-checkbox v-model="dialogForm.username" style="margin-left: 70px;">外购</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.username">销售</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.username">自制</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.username">生产消耗</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.username">委外</el-checkbox> |
| | | <el-divider content-position="left">存货描述</el-divider> |
| | | <el-form-item label="所属类别"> |
| | | <el-input |
| | | v-model="dialogForm.username" |
| | | type="textarea" |
| | | :autosize="{ minRows: 2, maxRows: 4}" |
| | | |
| | | style="width: 490px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-checkbox v-model="dialogForm.isPurchase" style="margin-left: 70px;">外购</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.isSale">销售</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.isMadeSelf">自制</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.isMaterial">生产消耗</el-checkbox> |
| | | <el-checkbox v-model="dialogForm.isMadeRequest">委外</el-checkbox> |
| | | <!-- <el-divider content-position="left">存货描述</el-divider>--> |
| | | <!-- <el-form-item label="存货描述">--> |
| | | <!-- <el-input--> |
| | | <!-- v-model="dialogForm.username"--> |
| | | <!-- type="textarea"--> |
| | | <!-- :autosize="{ minRows: 2, maxRows: 4}"--> |
| | | <!-- style="width: 490px;"--> |
| | | <!-- />--> |
| | | <!-- </el-form-item>--> |
| | | |
| | | </el-form> |
| | | |
| | |
| | | import { validateCode } from '@/utils/global' |
| | | import elDragDialog from '@/directive/el-drag-dialog' |
| | | import { |
| | | TMaterielAddUpdate, |
| | | TMaterielClassTree, |
| | | TMaterielClassTreeAddUpdate, |
| | | TMaterielClassTreeDelete, |
| | | TMaterielData |
| | | TMaterielData, TMaterielDelete, TUnitGroup |
| | | } from '@/api/ProductModel' |
| | | import arrayToTree from 'array-to-tree' |
| | | import { UnitSerch } from '@/api/GeneralBasicData' |
| | | |
| | | export default { |
| | | name: 'RoleList', |
| | |
| | | |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | usercode: '', // 用户编码 |
| | | username: '' // 用户名称 |
| | | data_sources: 'MES', // 数据来源;ERP/MES |
| | | partcode: '', // 存货编码 |
| | | partname: '', // 存货名称 |
| | | partspec: '', // 规格型号 |
| | | inventoryclasscode: '', // 存货类型编码 |
| | | unittypcode: '1', // 计量方式(0:多计量,1:单计量) |
| | | unitcode: '', // 计量单位编码/计量单位组编码 |
| | | unitsubcode: '', // 计量单位组子项编码(对应的是 主计量单位编码) |
| | | idSubUnitByReport: '', // 报表辅单位编码 |
| | | idUnitByStock: '', // 库存常用单位编码 |
| | | idUnitByPurchase: '', // 采购常用单位编码 |
| | | idUnitBySale: '', // 销售常用单位编码 |
| | | idunitbymanufacture: '', // 生产常用单位 |
| | | isPurchase: false, // 是否外购: 0(否)1(是) |
| | | isSale: false, // 是否销售:0(否)1(是) |
| | | isMadeSelf: false, // 是否自制: 0(否)1(是) |
| | | isMaterial: false, // 是否生产耗用: 0(否)1(是) |
| | | isMadeRequest: false, // 是否委外,0(否)1(是) |
| | | idwarehouse: '', // 仓库编码 |
| | | status: '0', // 使用状态: 正常(0)停用(1) |
| | | OperType: '' // 操作类型 |
| | | }, |
| | | dialogFormRules: { |
| | | usercode: [ |
| | | partcode: [ |
| | | { required: true, validator: validateCode, trigger: ['blur', 'change'] } |
| | | ], |
| | | username: [ |
| | | partname: [ |
| | | { required: true, message: '请输入组织名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | unitcode: [ |
| | | { required: true, message: '请选择计量单位(组)', trigger: ['blur', 'change'] } |
| | | ], |
| | | inventoryclasscode: [ |
| | | { required: true, message: '请选择所属单位', trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | }, |
| | | unittypcodeArr: [ |
| | | { code: '1', name: '单计量' }, |
| | | { code: '0', name: '多计量' } |
| | | ], |
| | | unitcodeSingleArr: [], |
| | | unitcodeGroupArr: [], |
| | | idSubUnitByReportArr: [], |
| | | idUnitBvStockArr: [], |
| | | idwarehouseArr: [] |
| | | |
| | | } |
| | | }, |
| | |
| | | this.getHeight() |
| | | |
| | | this.getTMaterielClassTree() |
| | | this.getSelectApi() |
| | | }, |
| | | methods: { |
| | | async getSelectApi() { |
| | | const { data: res } = await UnitSerch({ tunittype: 'M' }) |
| | | this.unitcodeGroupArr = res |
| | | |
| | | const { data: res2 } = await UnitSerch({ tunittype: 'S' }) |
| | | this.unitcodeSingleArr = res2 |
| | | }, |
| | | async getTMaterielClassTree() { |
| | | const res = await TMaterielClassTree() |
| | | res.data.forEach(i => { |
| | |
| | | this.form.prop = prop |
| | | this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | }, |
| | | getOrganizationSearch() { |
| | | this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | }, |
| | | // 新增按钮 |
| | | add(operation) { |
| | | this.operation = operation |
| | |
| | | this.dialogForm.OperType = 'Update' |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.usercode = row.usercode |
| | | this.dialogForm.data_sources = row.data_sources |
| | | this.dialogForm.partcode = row.partcode |
| | | this.dialogForm.partname = row.partname |
| | | this.dialogForm.partspec = row.partspec |
| | | this.dialogForm.inventoryclasscode = row.idinventoryclasscode |
| | | this.dialogForm.unittypcode = row.isSingleUnit |
| | | // 计量方式(0:多计量,1:单计量) |
| | | if (this.dialogForm.unittypcode === '1') { |
| | | this.dialogForm.unitcode = row.idunitcode |
| | | this.dialogForm.unitsubcode = '' |
| | | this.dialogForm.idSubUnitByReport = '' |
| | | const unitname = this.unitcodeSingleArr.find(i => i.unitcode === this.dialogForm.unitcode).unitname |
| | | |
| | | this.dialogForm.idUnitByStock = unitname |
| | | this.dialogForm.idUnitByPurchase = unitname |
| | | this.dialogForm.idUnitBySale = unitname |
| | | this.dialogForm.idunitbymanufacture = unitname |
| | | } |
| | | |
| | | if (this.dialogForm.unittypcode === '0') { |
| | | this.dialogForm.unitcode = row.idunitgroupcode |
| | | |
| | | const t = this.unitcodeGroupArr.find(i => i.unitcode === this.dialogForm.unitcode).children |
| | | |
| | | this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') |
| | | this.idUnitBvStockArr = t |
| | | |
| | | const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode |
| | | this.dialogForm.unitsubcode = mainUnitCode |
| | | this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode |
| | | |
| | | this.dialogForm.idUnitByStock = mainUnitCode |
| | | this.dialogForm.idUnitByPurchase = mainUnitCode |
| | | this.dialogForm.idUnitBySale = mainUnitCode |
| | | this.dialogForm.idunitbymanufacture = mainUnitCode |
| | | } |
| | | |
| | | this.dialogForm.isPurchase = row.isPurchase === '1' |
| | | this.dialogForm.isSale = row.isSale === '1' |
| | | this.dialogForm.isMadeSelf = row.isMadeSelf === '1' |
| | | this.dialogForm.isMaterial = row.isMaterial === '1' |
| | | this.dialogForm.isMadeRequest = row.isMadeRequest === '1' |
| | | |
| | | this.dialogForm.idwarehouse = row.idwarehousecode |
| | | this.dialogForm.status = row.status |
| | | }) |
| | | }, |
| | | del(row) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | // const result = this.getChildrenCodeMethod(data, []) |
| | | // TMaterielClassTreeDelete({ inventoryclasscode: result.join(',') }).then(res => { |
| | | // if (res.code === '200') { |
| | | // this.$notify.success('删除成功!') |
| | | // this.getTMaterielClassTree() |
| | | // } |
| | | // }) |
| | | TMaterielDelete({ partcode: row.partcode, data_sources: row.data_sources }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success('删除成功!') |
| | | this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$notify.info('已取消删除') |
| | | }) |
| | |
| | | this.form.partcode = '' |
| | | this.form.partname = '' |
| | | this.form.partspec = '' |
| | | this.getTMaterielClassTree() |
| | | this.$refs.treeLeftRef.setCurrentKey('-1') |
| | | this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.usercode = '' |
| | | this.dialogForm.username = '' |
| | | |
| | | this.dialogForm.data_sources = 'MES' |
| | | this.dialogForm.partcode = '' |
| | | this.dialogForm.partname = '' |
| | | this.dialogForm.partspec = '' |
| | | this.dialogForm.inventoryclasscode = '' |
| | | this.dialogForm.unittypcode = '1' |
| | | this.dialogForm.unitcode = '' |
| | | this.dialogForm.unitsubcode = '' |
| | | this.dialogForm.idSubUnitByReport = '' |
| | | this.dialogForm.idUnitByStock = '' |
| | | this.dialogForm.idUnitByPurchase = '' |
| | | this.dialogForm.idUnitBySale = '' |
| | | this.dialogForm.idunitbymanufacture = '' |
| | | this.dialogForm.isPurchase = false |
| | | this.dialogForm.isSale = false |
| | | this.dialogForm.isMadeSelf = false |
| | | this.dialogForm.isMaterial = false |
| | | this.dialogForm.isMadeRequest = false |
| | | this.dialogForm.idwarehouse = '' |
| | | this.dialogForm.status = '0' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | // this.$store.state.app.buttonIsDisabled = true |
| | | // this.dialogForm.group_code = this.dialogForm.group_code.join(',') |
| | | // this.dialogForm.post_code = this.dialogForm.post_code.join(',') |
| | | // this.dialogForm.role_code = this.dialogForm.role_code.join(',') |
| | | // this.dialogForm.storg_code = this.dialogForm.storg_code[this.dialogForm.storg_code.length - 1] |
| | | // AddUpdateUserSave(this.dialogForm).then(res => { |
| | | // if (res.code === '200') { |
| | | // this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | // this.dialogVisible = false |
| | | // this.$store.state.app.buttonIsDisabled = false |
| | | // this.getUserData() |
| | | // } else { |
| | | // this.$store.state.app.buttonIsDisabled = false |
| | | // this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | // } |
| | | // }) |
| | | this.dialogForm.isPurchase = this.dialogForm.isPurchase ? '1' : '0' |
| | | this.dialogForm.isSale = this.dialogForm.isSale ? '1' : '0' |
| | | this.dialogForm.isMadeSelf = this.dialogForm.isMadeSelf ? '1' : '0' |
| | | this.dialogForm.isMaterial = this.dialogForm.isMaterial ? '1' : '0' |
| | | this.dialogForm.isMadeRequest = this.dialogForm.isMadeRequest ? '1' : '0' |
| | | // console.log(JSON.parse(JSON.stringify(this.dialogForm)), 1) |
| | | |
| | | if (this.dialogForm.unittypcode === '1') { |
| | | this.dialogForm.idUnitByStock = this.dialogForm.unitcode |
| | | this.dialogForm.idUnitByPurchase = this.dialogForm.unitcode |
| | | this.dialogForm.idUnitBySale = this.dialogForm.unitcode |
| | | this.dialogForm.idunitbymanufacture = this.dialogForm.unitcode |
| | | } |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | TMaterielAddUpdate(this.dialogForm).then(res => { |
| | | if (res.code === '200') { |
| | | this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.dialogVisible = false |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.getTMaterielData(this.$refs.treeLeftRef.getCurrentNode()) |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!') |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | unittypcodeChange(val) { |
| | | console.log(val) |
| | | |
| | | this.dialogForm.unitcode = '' |
| | | this.dialogForm.unitsubcode = '' |
| | | this.dialogForm.idSubUnitByReport = '' |
| | | this.dialogForm.idUnitByStock = '' |
| | | this.dialogForm.idUnitByPurchase = '' |
| | | this.dialogForm.idUnitBySale = '' |
| | | this.dialogForm.idunitbymanufacture = '' |
| | | // this.$refs.dialogForm.clearValidate() |
| | | // this.$forceUpdate() |
| | | }, |
| | | unitcodeChange(val, type) { |
| | | console.log(val) |
| | | |
| | | if (type === '1') { |
| | | // this.dialogForm.unitcode = val |
| | | this.dialogForm.unitsubcode = '' |
| | | this.dialogForm.idSubUnitByReport = '' |
| | | |
| | | const unitname = this.unitcodeSingleArr.find(i => i.unitcode === val).unitname |
| | | |
| | | this.dialogForm.idUnitByStock = unitname |
| | | this.dialogForm.idUnitByPurchase = unitname |
| | | this.dialogForm.idUnitBySale = unitname |
| | | this.dialogForm.idunitbymanufacture = unitname |
| | | } |
| | | |
| | | if (type === '0') { |
| | | const t = this.unitcodeGroupArr.find(i => i.unitcode === val).children |
| | | |
| | | this.idSubUnitByReportArr = t.filter(i => i.isMainUnit !== '1') |
| | | this.idUnitBvStockArr = t |
| | | |
| | | const mainUnitCode = t.find(i => i.isMainUnit === '1').unitcode |
| | | this.dialogForm.unitsubcode = mainUnitCode |
| | | this.dialogForm.idSubUnitByReport = this.idSubUnitByReportArr[0].unitcode |
| | | |
| | | this.dialogForm.idUnitByStock = mainUnitCode |
| | | this.dialogForm.idUnitByPurchase = mainUnitCode |
| | | this.dialogForm.idUnitBySale = mainUnitCode |
| | | this.dialogForm.idunitbymanufacture = mainUnitCode |
| | | } |
| | | } |
| | | } |
| | | } |