| | |
| | | <template> |
| | | <win-sm :title="setting.title" @close="close" :width="'800px'"> |
| | | <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px"> |
| | | <el-form-item label="盘点单名" prop="code"> |
| | | <el-input disabled v-model="formData.code" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <win-sm :title="`${setting.title}盘点`" @close="close" :width="'800px'"> |
| | | <el-form v-loading="loading" ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px"> |
| | | <el-form-item label="盘点单名" prop="businessFormName"> |
| | | <el-input |
| | | v-model="formData.businessFormName" |
| | | clearable |
| | | maxlength="20" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="盘点仓库" prop="name"> |
| | | <el-input v-model="formData.name" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-form-item label="盘点仓库" prop="warehouseId"> |
| | | <el-select v-model="formData.warehouseId" placeholder="请选择" style="width: 100%"> |
| | | <el-option v-for="item in warehouseOptions" :key="item.id" :label="item.warehouseName" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="盘点人"> |
| | | <el-input v-model="formData.adss" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-form-item label="盘点人" prop="operatorUserId"> |
| | | <el-select v-model="formData.operatorUserId" placeholder="请选择" style="width: 100%"> |
| | | <el-option v-for="item in operatorOptions" :key="item.id" :label="item.managerName" :value="item.managerId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="监盘人"> |
| | | <el-input v-model="formData.adss" clearable maxlength="20" show-word-limit style="width: 100%" /> |
| | | <el-form-item label="监盘人" prop="monitorUserId"> |
| | | <el-select v-model="formData.monitorUserId" placeholder="请选择" style="width: 100%"> |
| | | <el-option v-for="item in operatorOptions2" :key="item.id" :label="item.userName" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="status"> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input |
| | | type="textarea" |
| | | placeholder="请输入内容" |
| | | v-model="formData.adss" |
| | | v-model="formData.remark" |
| | | resize="none" |
| | | maxlength="100" |
| | | show-word-limit |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {selectTenantWarehouse, tenantUserQueryUser} from '@/api/baseSetting/finsystenant'; |
| | | import {inventoryAdd, inventoryEdit} from '@/api/stock/inventory'; |
| | | import {warehouseManagerList} from '@/api/foudation/store'; |
| | | import winSm from '@/components/win/win-sm'; |
| | | import myButton from '@/components/myButton/myButton'; |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant'; |
| | | import {formatDate} from '@/utils/DateFormatter'; |
| | | import {mapGetters} from 'vuex'; |
| | | |
| | | export default { |
| | | components: { winSm, myButton }, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | count: 0, |
| | | loading: true, |
| | | checkAll: false, |
| | | checkedList: [], |
| | | warehouseOptions: [], // 仓库列表 |
| | | operatorOptions: [], |
| | | operatorOptions2: [], |
| | | formData: { |
| | | code: '', |
| | | name: '', |
| | | status: true, |
| | | summary: '', |
| | | businessFormName: '', |
| | | warehouseId: '', |
| | | operatorUserId: '', |
| | | monitorUserId: '', |
| | | remark: '', |
| | | }, |
| | | rules: { |
| | | code: [{ required: true, message: '请输入机构编号', trigger: 'blur' }], |
| | | name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }], |
| | | status: [{ required: true, message: '请选择状态', trigger: 'blur' }], |
| | | businessFormName: [{ required: true, message: '请输入', trigger: 'blur' }], |
| | | warehouseId: [{ required: true, message: '请选择', trigger: 'blur' }], |
| | | operatorUserId: [{ required: true, message: '请选择', trigger: 'blur' }], |
| | | monitorUserId: [{ required: true, message: '请选择', trigger: 'blur' }], |
| | | }, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo']), |
| | | }, |
| | | created() { |
| | | if (this.setting.info) { |
| | | if (this.setting.id) { |
| | | this.formData = Object.assign({}, JSON.parse(this.setting.info)); |
| | | this.$set(this.formData,'operatorUserId',this.formData.operatorId) |
| | | this.$set(this.formData,'monitorUserId',this.formData.operatorId2) |
| | | this.$set(this.formData,'remark',this.formData.beiz1) |
| | | } else { |
| | | this.formData.businessFormName = formatDate(new Date(), 'yyyy年MM月份盘点'); |
| | | } |
| | | this.handleSelectTenantWarehouse(); |
| | | this.getPdr(); |
| | | this.getJpr(); |
| | | }, |
| | | methods: { |
| | | // 获取仓库列表 |
| | | handleSelectTenantWarehouse() { |
| | | selectTenantWarehouse({ agencyId: this.userInfo.tenantId }).then((res) => { |
| | | this.count++ |
| | | this.warehouseOptions = res; |
| | | if(this.count>1){ |
| | | this.loading = false |
| | | } |
| | | }); |
| | | }, |
| | | // 获取盘点人 |
| | | getPdr() { |
| | | warehouseManagerList({ tenantId: this.userInfo.tenantId }).then((res) => { |
| | | this.count++ |
| | | this.operatorOptions = res; |
| | | if(this.count>1){ |
| | | this.loading = false |
| | | } |
| | | }); |
| | | }, |
| | | // 获取监盘人 |
| | | getJpr() { |
| | | tenantUserQueryUser({ tenantId: this.userInfo.tenantId }).then((res) => { |
| | | this.count++ |
| | | this.operatorOptions2 = res; |
| | | if(this.count>1){ |
| | | this.loading = false |
| | | } |
| | | }); |
| | | }, |
| | | getEditInfo(id) {}, |
| | | close() { |
| | | this.$emit('close'); |
| | |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.formData); |
| | | this.loading = true |
| | | if (this.setting.id) { |
| | | // 编辑接口 |
| | | finsystenant.edit(params).then((res) => { |
| | | if (res) { |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | } else { |
| | | this.$message.error('保存失败'); |
| | | } |
| | | inventoryEdit(params).then((res) => { |
| | | this.loading = false |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }).catch(()=>{ |
| | | this.loading = false |
| | | }); |
| | | } else { |
| | | params.orgId = this.setting.orgId; |
| | | finsystenant.add(params).then((res) => { |
| | | if (res) { |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | } else { |
| | | this.$message.error('保存失败'); |
| | | } |
| | | inventoryAdd(params).then((res) => { |
| | | this.loading = false |
| | | this.$message.success('保存成功!'); |
| | | this.close(); |
| | | this.$emit('search'); |
| | | }).catch(()=>{ |
| | | this.loading = false |
| | | }); |
| | | } |
| | | } else { |