|
|
@@ -303,21 +303,22 @@
|
|
|
:rules="rules.wrsconvertdetails.middlegoodsid">
|
|
|
<a-select class="inlineFormSelect"
|
|
|
style="width: 200px"
|
|
|
+ @change="middleChange(domain.middlegoodsid, domain)"
|
|
|
v-model:value="domain.middlegoodsid"
|
|
|
- placeholder="请选择品类">
|
|
|
- <a-select-option v-for="item in unitList"
|
|
|
- :value="item.enumitemname"
|
|
|
- :key="item.autoid">
|
|
|
- {{item.enumdicname}}
|
|
|
+ placeholder="请选择套保品种">
|
|
|
+ <a-select-option v-for="item in goodsGroup"
|
|
|
+ :value="item.groupcategroyid"
|
|
|
+ :key="item.groupcategroyid">
|
|
|
+ {{item.goodsgroupname}}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
- <a-form-item :name="['wrsconvertdetails', index, 'unitid']">
|
|
|
+ <a-form-item :name="['wrsconvertdetails', index, 'unitidName']">
|
|
|
<a-input class="dialogInput"
|
|
|
readonly
|
|
|
- v-model:value="domain.unitid"
|
|
|
+ v-model:value="domain.unitidName"
|
|
|
placeholder="选择套保品种后自动填入"></a-input>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
@@ -405,28 +406,26 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
|
|
|
+import { defineComponent, ref, toRaw } from 'vue';
|
|
|
import { closeModal } from '@/common/setup/modal/index';
|
|
|
import { initData } from '@/common/methods/index';
|
|
|
import { PlusOutlined, MinusOutlined } from '@ant-design/icons-vue';
|
|
|
-import { handleAdd, handleFromState } from './setup';
|
|
|
-import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
|
|
|
+import { handleAdd, handleFromState, handleGoodsGroup, getGoodsUnit } from './setup';
|
|
|
import { getGoodsUnitList } from '../../setup';
|
|
|
import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
|
|
|
-import { FormState } from './interface';
|
|
|
-
|
|
|
-const validateCommon = (value: any, errInfo: string) => {
|
|
|
- if (value) {
|
|
|
- return Promise.resolve();
|
|
|
- } else {
|
|
|
- return Promise.reject(errInfo);
|
|
|
- }
|
|
|
-};
|
|
|
+import { FormState, WRSConvertDetailEx } from './interface';
|
|
|
+import { validateCommon } from '@/common/setup/validate';
|
|
|
|
|
|
+/**
|
|
|
+ * 检验单位
|
|
|
+ */
|
|
|
const validateUnit = async (rule: RuleObject, value: number) => {
|
|
|
return validateCommon(value, '请选择单位');
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
const valideteWR = async (rule: RuleObject, value: number) => {
|
|
|
return validateCommon(value, '请选择品类');
|
|
|
};
|
|
|
@@ -533,11 +532,6 @@ export default defineComponent({
|
|
|
.catch((error: ValidateErrorEntity<FormState>) => {
|
|
|
console.log('error', error);
|
|
|
});
|
|
|
- // loading.value = true;
|
|
|
- // setTimeout(() => {
|
|
|
- // loading.value = false;
|
|
|
- // cancel();
|
|
|
- // }, 2000);
|
|
|
}
|
|
|
|
|
|
// 表单
|
|
|
@@ -559,11 +553,21 @@ export default defineComponent({
|
|
|
middlegoodsid: { required: true, validator: valideteWR, trigger: 'change' },
|
|
|
convertratio: { required: true, message: '请输入套保系数', trigger: 'blur' },
|
|
|
},
|
|
|
- // nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
|
|
|
- // cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
|
|
|
};
|
|
|
-
|
|
|
- initData(() => {});
|
|
|
+ const { goodsGroup, getGoodsGroup } = handleGoodsGroup();
|
|
|
+ /**
|
|
|
+ * 切换套保品种时候,获取对应的单位
|
|
|
+ */
|
|
|
+ function middleChange(id: number, value: WRSConvertDetailEx) {
|
|
|
+ const obj = goodsGroup.value.find((e) => e.groupcategroyid === id);
|
|
|
+ if (obj) {
|
|
|
+ value.unitidName = getGoodsUnit(obj.agreeunit);
|
|
|
+ value.unitid = obj.agreeunit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ initData(() => {
|
|
|
+ getGoodsGroup();
|
|
|
+ });
|
|
|
return {
|
|
|
visible,
|
|
|
cancel,
|
|
|
@@ -573,7 +577,8 @@ export default defineComponent({
|
|
|
deleteOne,
|
|
|
rules,
|
|
|
unitList,
|
|
|
-
|
|
|
+ goodsGroup,
|
|
|
+ middleChange,
|
|
|
submit,
|
|
|
loading,
|
|
|
dataSource,
|