|
@@ -76,7 +76,19 @@
|
|
|
</div> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
+
|
|
|
+ <!-- <template #materials>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <van-button round block type="primary" size="small" style="width: 100%; border: none" :plain="false">
|
|
|
+ 添加物料/半成品
|
|
|
+ </van-button>
|
|
|
+ </div>
|
|
|
+ </template> -->
|
|
|
</testForm>
|
|
|
+ <div style="padding-top:10px;background:#fff">
|
|
|
+ <testForm v-model="formData.data" :formOption="formOptionOne" :formConfig="[]" :rules="rules" @onSubmit="onSubmit" ref="formDom1">
|
|
|
+ </testForm>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -110,6 +122,18 @@ const rules = {
|
|
|
message: "请输入售后金额",
|
|
|
},
|
|
|
],
|
|
|
+ productId: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择物料",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ quantity: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入物料数量",
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
const formOption = reactive({
|
|
|
readonly: false, //用于控制整个表单是否只读
|
|
@@ -117,8 +141,74 @@ const formOption = reactive({
|
|
|
labelAlign: "top",
|
|
|
scroll: true,
|
|
|
labelWidth: "62pk",
|
|
|
+ hiddenSubmitBtn: true,
|
|
|
+});
|
|
|
+
|
|
|
+const formOptionOne = reactive({
|
|
|
+ readonly: false, //用于控制整个表单是否只读
|
|
|
+ disabled: false,
|
|
|
+ labelAlign: "top",
|
|
|
+ scroll: true,
|
|
|
+ labelWidth: "62pk",
|
|
|
hiddenSubmitBtn: false,
|
|
|
+ otherBtn: false,
|
|
|
+ otherBtnText: "暂存",
|
|
|
+ btnConfig: {
|
|
|
+ isNeed: true,
|
|
|
+ prop: "afterSalesMaterialsList",
|
|
|
+ plain: true,
|
|
|
+ listTitle: proxy.t("salesContract.contractDetails"),
|
|
|
+ listConfig: [
|
|
|
+ {
|
|
|
+ type: "picker",
|
|
|
+ label: proxy.t("salesContract.productName"),
|
|
|
+ prop: "productId",
|
|
|
+ itemType: "onePicker",
|
|
|
+ showPicker: false,
|
|
|
+ readonly: false,
|
|
|
+ fieldNames: {
|
|
|
+ text: "label",
|
|
|
+ value: "value",
|
|
|
+ },
|
|
|
+ data: [],
|
|
|
+ isNeedSearch: true, //是否需要关键字过滤数据
|
|
|
+ searchKeyword: "",
|
|
|
+ onSearchData: (keyword) => {
|
|
|
+ getProductData(keyword);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ itemType: "digit",
|
|
|
+ label: proxy.t("salesContract.quantity"),
|
|
|
+ prop: "quantity",
|
|
|
+ clearable: true,
|
|
|
+ // changeFn: (index, val) => {
|
|
|
+ // changeAmount(index);
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ clickFn: () => {
|
|
|
+ if (
|
|
|
+ formData.data.afterSalesMaterialsList &&
|
|
|
+ formData.data.afterSalesMaterialsList.length > 0
|
|
|
+ ) {
|
|
|
+ formData.data.afterSalesMaterialsList.push({
|
|
|
+ productId: "",
|
|
|
+ quantity: "",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.afterSalesMaterialsList = [
|
|
|
+ {
|
|
|
+ productId: "",
|
|
|
+ quantity: "",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
});
|
|
|
+
|
|
|
const formConfig = reactive([
|
|
|
{
|
|
|
type: "slot",
|
|
@@ -180,6 +270,10 @@ const formConfig = reactive([
|
|
|
type: "slot",
|
|
|
slotName: "file",
|
|
|
},
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "申请物料",
|
|
|
+ },
|
|
|
]);
|
|
|
|
|
|
const topConfig = ref([
|
|
@@ -348,44 +442,51 @@ onMounted(() => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-const onSubmit = () => {
|
|
|
- let arr = Object.values(submitData.value);
|
|
|
- for (let i = 0; i < arr.length; i++) {
|
|
|
- const e = arr[i];
|
|
|
- if (e.quantity || e.remark.trim() || e.fileList.length > 0) {
|
|
|
- if (!e.quantity) {
|
|
|
- return showFailToast(`请填写${e.productName}配件的售后数量`);
|
|
|
- }
|
|
|
- if (!e.remark.trim()) {
|
|
|
- return showFailToast(`请填写${e.productName}配件的售后说明`);
|
|
|
- }
|
|
|
- if (e.fileList.length == 0) {
|
|
|
- return showFailToast(`请上传${e.productName}配件的现场照片`);
|
|
|
+const onSubmit = async () => {
|
|
|
+ formDom.value.validateForm().then((status) => {
|
|
|
+ if (status) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ let arr = Object.values(submitData.value);
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const e = arr[i];
|
|
|
+ if (e.quantity || e.remark.trim() || e.fileList.length > 0) {
|
|
|
+ if (!e.quantity) {
|
|
|
+ return showFailToast(`请填写${e.productName}配件的售后数量`);
|
|
|
+ }
|
|
|
+ if (!e.remark.trim()) {
|
|
|
+ return showFailToast(`请填写${e.productName}配件的售后说明`);
|
|
|
+ }
|
|
|
+ if (e.fileList.length == 0) {
|
|
|
+ return showFailToast(`请上传${e.productName}配件的现场照片`);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if (!(Number(formData.data.amount) > 0)) {
|
|
|
- return showFailToast(`售后金额需大于0`);
|
|
|
- }
|
|
|
- proxy
|
|
|
- .post("/afterSalesRecord/afterSales", {
|
|
|
- id: formData.data.id,
|
|
|
- afterSalesRemark: formData.data.afterSalesRemark,
|
|
|
- amount: formData.data.amount,
|
|
|
- afterSalesRecordDetailList: arr,
|
|
|
- })
|
|
|
- .then(
|
|
|
- () => {
|
|
|
- showSuccessToast(proxy.t("afterSales.operationSuccessful"));
|
|
|
- setTimeout(() => {
|
|
|
- onClickLeft();
|
|
|
- }, 500);
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- return showFailToast(err.message);
|
|
|
+ if (!(Number(formData.data.amount) > 0)) {
|
|
|
+ return showFailToast(`售后金额需大于0`);
|
|
|
}
|
|
|
- );
|
|
|
+ proxy
|
|
|
+ .post("/afterSalesRecord/afterSales", {
|
|
|
+ id: formData.data.id,
|
|
|
+ afterSalesRemark: formData.data.afterSalesRemark,
|
|
|
+ amount: formData.data.amount,
|
|
|
+ afterSalesRecordDetailList: arr,
|
|
|
+ afterSalesMaterialsList: formData.data.afterSalesMaterialsList,
|
|
|
+ })
|
|
|
+ .then(
|
|
|
+ () => {
|
|
|
+ showSuccessToast(proxy.t("afterSales.operationSuccessful"));
|
|
|
+ setTimeout(() => {
|
|
|
+ onClickLeft();
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ return showFailToast(err.message);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const handleClickItem = (item) => {
|
|
@@ -409,6 +510,30 @@ const handleClickItem = (item) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const productData = ref([]);
|
|
|
+const getProductData = (keyword) => {
|
|
|
+ proxy.post("/productInfo/page", { keyword, definition: "2" }).then((res) => {
|
|
|
+ productData.value = res.data.rows.map((x) => ({
|
|
|
+ label: x.name + ` (${x.spec})`,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ formOptionOne.btnConfig.listConfig[0].data = productData.value;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const getDict = () => {
|
|
|
+ proxy
|
|
|
+ .post("/productInfo/page", { pageNum: 1, pageSize: 9999, definition: "2" })
|
|
|
+ .then((res) => {
|
|
|
+ productData.value = res.data.rows.map((x) => ({
|
|
|
+ label: x.name + ` (${x.spec})`,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ formOptionOne.btnConfig.listConfig[0].data = productData.value;
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+
|
|
|
const afterRead = (file) => {
|
|
|
if (file && file.length > 0) {
|
|
|
for (let i = 0; i < file.length; i++) {
|
|
@@ -476,6 +601,7 @@ const afterRead = (file) => {
|
|
|
);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
// 文件上传
|
|
|
const onOversize = () => {
|
|
|
showToast("文件大小不能超过 5MB");
|