|
|
@@ -239,9 +239,6 @@
|
|
|
</a-row>
|
|
|
</fieldset>
|
|
|
</a-form>
|
|
|
- <a-modal :visible="previewVisible" :footer="null" @cancel="cancelImg">
|
|
|
- <img alt="预览附件" style="width: 100%" :src="previewImage" />
|
|
|
- </a-modal>
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
@@ -265,163 +262,170 @@ import UploadImg from '@/common/components/uploadImg/index.vue';
|
|
|
import { _closeModal } from '@/common/setup/modal/modal';
|
|
|
|
|
|
export default defineComponent({
|
|
|
- name: 'spot_contract_btn_modify',
|
|
|
- emits: ['cancel', 'update'],
|
|
|
- props: {
|
|
|
- selectedRow: {
|
|
|
- type: Object as PropType<Ermcp3ContractRsp>,
|
|
|
- default: {},
|
|
|
- },
|
|
|
- contractType: {
|
|
|
- type: Number,
|
|
|
- required: true,
|
|
|
- },
|
|
|
+ name: 'spot_contract_btn_modify',
|
|
|
+ emits: ['cancel', 'update'],
|
|
|
+ props: {
|
|
|
+ selectedRow: {
|
|
|
+ type: Object as PropType<Ermcp3ContractRsp>,
|
|
|
+ default: {},
|
|
|
},
|
|
|
- components: { UploadImg },
|
|
|
- setup(props, context) {
|
|
|
- const { visible, cancel } = _closeModal(context);
|
|
|
- const loading = ref<boolean>(false);
|
|
|
- const { sendReq } = addContractReq();
|
|
|
- const { formState, businessType } = handleFromState(props.contractType);
|
|
|
- // 表单
|
|
|
- const formRef = ref();
|
|
|
+ contractType: {
|
|
|
+ type: Number,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ components: { UploadImg },
|
|
|
+ setup(props, context) {
|
|
|
+ const { visible, cancel } = _closeModal(context);
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
+ const { sendReq } = addContractReq();
|
|
|
+ const { formState, businessType } = handleFromState(props.contractType);
|
|
|
+ // 表单
|
|
|
+ const formRef = ref();
|
|
|
|
|
|
- const { rules } = handleFormRule(formState);
|
|
|
- // 合同类型
|
|
|
- const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
|
|
|
+ const { rules } = handleFormRule(formState);
|
|
|
+ // 合同类型
|
|
|
+ const { contractType, isSell, contractChange, customList, queryCustomList } = handleContract(formState);
|
|
|
|
|
|
- // 处理现货商品
|
|
|
- const { deliveryGoodsList, barandList, wrstandardList, goodsList, numberUnit, WrStandardChange, deliveryGoodsChange } = handleDeliveryGoods(formState);
|
|
|
- // 价格信息
|
|
|
- const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
|
|
|
- // 日期
|
|
|
- const { deliveryDate, priceDate, disabledDate } = handleDate();
|
|
|
- // 处理金额
|
|
|
- const { getAmout } = handleAmout(formState);
|
|
|
- // 获取 业务账户
|
|
|
- const { queryTable: queryBusinessManager, getBusinesserOrMerchandiser } = handlerManagerList(loading, 1);
|
|
|
- const { tableList: traderList, queryTable: queryTradeManager } = handlerManagerList(loading, 2, true);
|
|
|
+ // 处理现货商品
|
|
|
+ const { deliveryGoodsList, barandList, wrstandardList, goodsList, numberUnit, WrStandardChange, deliveryGoodsChange } = handleDeliveryGoods(formState);
|
|
|
+ // 价格信息
|
|
|
+ const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
|
|
|
+ // 日期
|
|
|
+ const { deliveryDate, priceDate, disabledDate } = handleDate();
|
|
|
+ // 处理金额
|
|
|
+ const { getAmout } = handleAmout(formState);
|
|
|
+ // 获取 业务账户
|
|
|
+ const { queryTable: queryBusinessManager, getBusinesserOrMerchandiser } = handlerManagerList(loading, 1);
|
|
|
+ const { tableList: traderList, queryTable: queryTradeManager } = handlerManagerList(loading, 2, true);
|
|
|
|
|
|
- // 业务员
|
|
|
- const businesserList = ref<ErmcpLoginUser[]>([]);
|
|
|
- // 跟单员
|
|
|
- const merchandiserList = ref<ErmcpLoginUser[]>([]);
|
|
|
- queryBusinessManager().then(() => {
|
|
|
- businesserList.value = getBusinesserOrMerchandiser('22');
|
|
|
- merchandiserList.value = getBusinesserOrMerchandiser('23');
|
|
|
- });
|
|
|
+ // 业务员
|
|
|
+ const businesserList = ref<ErmcpLoginUser[]>([]);
|
|
|
+ // 跟单员
|
|
|
+ const merchandiserList = ref<ErmcpLoginUser[]>([]);
|
|
|
+ queryBusinessManager().then(() => {
|
|
|
+ businesserList.value = getBusinesserOrMerchandiser('22');
|
|
|
+ merchandiserList.value = getBusinesserOrMerchandiser('23');
|
|
|
+ });
|
|
|
|
|
|
- // 交易主体列表
|
|
|
- const subjectList = ref<Ermcp3SubjectRsp[]>([]);
|
|
|
- QueryPaAreaSubject().then((res) => {
|
|
|
- subjectList.value = res;
|
|
|
- });
|
|
|
+ // 交易主体列表
|
|
|
+ const subjectList = ref<Ermcp3SubjectRsp[]>([]);
|
|
|
+ QueryPaAreaSubject().then((res) => {
|
|
|
+ subjectList.value = res;
|
|
|
+ });
|
|
|
|
|
|
- const { uploadImgAction, uploadImgList, handleImg } = getUploadImg();
|
|
|
- queryCustomList();
|
|
|
- queryTradeManager();
|
|
|
- mergeTwoObj(formState, props.selectedRow);
|
|
|
- isSell.value = formState.ContractType === 1 ? false : true;
|
|
|
+ const { imgs, uploadImgAction, uploadImgList, handleImg } = getUploadImg();
|
|
|
+ queryCustomList();
|
|
|
+ queryTradeManager();
|
|
|
+ mergeTwoObj(formState, props.selectedRow);
|
|
|
+ isSell.value = formState.ContractType === 1 ? false : true;
|
|
|
|
|
|
- const { deliverygoodsid, qty, price, wrstandardid, spotcontractid, spotgoodsbrandid, currencyid, attachment, deliverystartdate, deliveryenddate, startdate, enddate, meruserid, tradeuserid } = props.selectedRow;
|
|
|
- if (deliverygoodsid) {
|
|
|
- deliveryGoodsChange(deliverygoodsid);
|
|
|
- if (wrstandardid) {
|
|
|
- WrStandardChange(wrstandardid);
|
|
|
- formState.WrStandardID = wrstandardid;
|
|
|
- formState.SpotGoodsBrandID = spotgoodsbrandid;
|
|
|
- }
|
|
|
- }
|
|
|
- formState.Qty = qty.toString();
|
|
|
- formState.Price = price.toString();
|
|
|
- formState.CurrencyID = currencyid;
|
|
|
- formState.ContractAttachment = attachment;
|
|
|
- formState.MerUserID = meruserid;
|
|
|
- formState.TradeUserID = tradeuserid;
|
|
|
- formState.SpotContractID = spotcontractid;
|
|
|
- if (deliverystartdate && deliverystartdate !== '--') {
|
|
|
- deliveryDate.value.push(moment(deliverystartdate));
|
|
|
- }
|
|
|
- if (deliveryenddate && deliveryenddate !== '--') {
|
|
|
- deliveryDate.value.push(moment(deliveryenddate));
|
|
|
- }
|
|
|
- if (startdate && startdate !== '--') {
|
|
|
- priceDate.value.push(moment(startdate));
|
|
|
- }
|
|
|
- if (enddate && enddate !== '--') {
|
|
|
- priceDate.value.push(moment(enddate));
|
|
|
- }
|
|
|
- if (attachment) {
|
|
|
- uploadImgList.value = handleImg(attachment);
|
|
|
+ const { deliverygoodsid, qty, price, wrstandardid, spotcontractid, spotgoodsbrandid, currencyid, attachment, deliverystartdate, deliveryenddate, startdate, enddate, meruserid, tradeuserid } = props.selectedRow;
|
|
|
+ if (deliverygoodsid) {
|
|
|
+ deliveryGoodsChange(deliverygoodsid);
|
|
|
+ if (wrstandardid) {
|
|
|
+ WrStandardChange(wrstandardid);
|
|
|
+ formState.WrStandardID = wrstandardid;
|
|
|
+ formState.SpotGoodsBrandID = spotgoodsbrandid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formState.Qty = qty.toString();
|
|
|
+ formState.Price = price.toString();
|
|
|
+ formState.CurrencyID = currencyid;
|
|
|
+ formState.ContractAttachment = attachment;
|
|
|
+ formState.MerUserID = meruserid;
|
|
|
+ formState.TradeUserID = tradeuserid;
|
|
|
+ formState.SpotContractID = spotcontractid;
|
|
|
+ if (deliverystartdate && deliverystartdate !== '--') {
|
|
|
+ deliveryDate.value.push(moment(deliverystartdate));
|
|
|
+ }
|
|
|
+ if (deliveryenddate && deliveryenddate !== '--') {
|
|
|
+ deliveryDate.value.push(moment(deliveryenddate));
|
|
|
+ }
|
|
|
+ if (startdate && startdate !== '--') {
|
|
|
+ priceDate.value.push(moment(startdate));
|
|
|
+ }
|
|
|
+ if (enddate && enddate !== '--') {
|
|
|
+ priceDate.value.push(moment(enddate));
|
|
|
+ }
|
|
|
+ if (attachment) {
|
|
|
+ uploadImgList.value = handleImg(attachment);
|
|
|
+ }
|
|
|
+ function submit() {
|
|
|
+ validateAction<FormState>(formRef, formState).then((param) => {
|
|
|
+ const id = getUserId();
|
|
|
+ isSell.value ? (param.SellUserID = id) : (param.BuyUserID = id);
|
|
|
+ const fn = (value: Moment) => {
|
|
|
+ return formatTime(value, 'd') + ' ' + '00:00:00';
|
|
|
+ };
|
|
|
+ // 交收期
|
|
|
+ const dDate = deliveryDate.value;
|
|
|
+ if (dDate.length) {
|
|
|
+ const DeliveryStartDate = fn(dDate[0]);
|
|
|
+ const DeliveryEndDate = fn(dDate[1]);
|
|
|
+ Object.assign(param, { DeliveryStartDate, DeliveryEndDate });
|
|
|
}
|
|
|
- function submit() {
|
|
|
- validateAction<FormState>(formRef, formState).then((param) => {
|
|
|
- const id = getUserId();
|
|
|
- isSell.value ? (param.SellUserID = id) : (param.BuyUserID = id);
|
|
|
- const fn = (value: Moment) => {
|
|
|
- return formatTime(value, 'd') + ' ' + '00:00:00';
|
|
|
- };
|
|
|
- // 交收期
|
|
|
- const dDate = deliveryDate.value;
|
|
|
- if (dDate.length) {
|
|
|
- const DeliveryStartDate = fn(dDate[0]);
|
|
|
- const DeliveryEndDate = fn(dDate[1]);
|
|
|
- Object.assign(param, { DeliveryStartDate, DeliveryEndDate });
|
|
|
- }
|
|
|
|
|
|
- // 点价期
|
|
|
- const pDate = priceDate.value;
|
|
|
- if (pDate.length && param.PriceType !== 1) {
|
|
|
- // 点价日期[2:点价3:暂定价]
|
|
|
- const StartDate = fn(pDate[0]);
|
|
|
- const EndDate = fn(pDate[1]);
|
|
|
- Object.assign(param, { StartDate, EndDate });
|
|
|
- }
|
|
|
+ // 点价期
|
|
|
+ const pDate = priceDate.value;
|
|
|
+ if (pDate.length && param.PriceType !== 1) {
|
|
|
+ // 点价日期[2:点价3:暂定价]
|
|
|
+ const StartDate = fn(pDate[0]);
|
|
|
+ const EndDate = fn(pDate[1]);
|
|
|
+ Object.assign(param, { StartDate, EndDate });
|
|
|
+ }
|
|
|
|
|
|
- sendReq(param, loading, 2)
|
|
|
- .then((res) => {
|
|
|
- cancel(true);
|
|
|
- })
|
|
|
- .catch((err) => {});
|
|
|
- });
|
|
|
+ // 处理上传图片
|
|
|
+ if (imgs.value.length) {
|
|
|
+ param.ContractAttachment = imgs.value[0].replace('./', '/');
|
|
|
+ } else {
|
|
|
+ param.ContractAttachment = JSON.parse(param.ContractAttachment)
|
|
|
}
|
|
|
- return {
|
|
|
- visible,
|
|
|
- cancel,
|
|
|
- submit,
|
|
|
- formRef,
|
|
|
- loading,
|
|
|
- maskClosableFlag: false,
|
|
|
- formState,
|
|
|
- rules,
|
|
|
- businessType,
|
|
|
- contractType,
|
|
|
- isSell,
|
|
|
- contractChange,
|
|
|
- customList,
|
|
|
- deliveryGoodsList,
|
|
|
- barandList,
|
|
|
- wrstandardList,
|
|
|
- goodsList,
|
|
|
- deliveryGoodsChange,
|
|
|
- WrStandardChange,
|
|
|
- priceType,
|
|
|
- payCurrency,
|
|
|
- payCurrencyUnit,
|
|
|
- parCurrencyChange,
|
|
|
- numberUnit,
|
|
|
- getUserName,
|
|
|
- deliveryDate,
|
|
|
- priceDate,
|
|
|
- disabledDate,
|
|
|
- getAmout,
|
|
|
- traderList,
|
|
|
- businesserList,
|
|
|
- merchandiserList,
|
|
|
- uploadImgAction,
|
|
|
- uploadImgList,
|
|
|
- subjectList,
|
|
|
- };
|
|
|
- },
|
|
|
+
|
|
|
+ sendReq(param, loading, 2)
|
|
|
+ .then((res) => {
|
|
|
+ cancel(true);
|
|
|
+ })
|
|
|
+ .catch((err) => { });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ visible,
|
|
|
+ cancel,
|
|
|
+ submit,
|
|
|
+ formRef,
|
|
|
+ loading,
|
|
|
+ maskClosableFlag: false,
|
|
|
+ formState,
|
|
|
+ rules,
|
|
|
+ businessType,
|
|
|
+ contractType,
|
|
|
+ isSell,
|
|
|
+ contractChange,
|
|
|
+ customList,
|
|
|
+ deliveryGoodsList,
|
|
|
+ barandList,
|
|
|
+ wrstandardList,
|
|
|
+ goodsList,
|
|
|
+ deliveryGoodsChange,
|
|
|
+ WrStandardChange,
|
|
|
+ priceType,
|
|
|
+ payCurrency,
|
|
|
+ payCurrencyUnit,
|
|
|
+ parCurrencyChange,
|
|
|
+ numberUnit,
|
|
|
+ getUserName,
|
|
|
+ deliveryDate,
|
|
|
+ priceDate,
|
|
|
+ disabledDate,
|
|
|
+ getAmout,
|
|
|
+ traderList,
|
|
|
+ businesserList,
|
|
|
+ merchandiserList,
|
|
|
+ uploadImgAction,
|
|
|
+ uploadImgList,
|
|
|
+ subjectList,
|
|
|
+ };
|
|
|
+ },
|
|
|
});
|
|
|
</script>
|