材料分类界面修改 及报销单模块处理
This commit is contained in:
parent
25e6a92261
commit
c1fa3f236d
@ -8,10 +8,12 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="父级分类" prop="pid">
|
||||
<el-select class="w-[280px]" v-model="formData.pid" clearable placeholder="请选择父级分类">
|
||||
<!-- <el-select class="w-[280px]" v-model="formData.pid" clearable placeholder="请选择父级分类">
|
||||
<el-option label="全部" :value="0"></el-option>
|
||||
|
||||
<el-option v-for="(item, index) in imaterialList" :key="index" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
<el-cascader :props="props" clearable v-model="formData.pid" :show-all-levels="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@ -37,7 +39,7 @@
|
||||
<script lang="ts" setup name="projectEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apimaterialLists, apimaterialAdd, apimaterialEdit, apimaterialDetail } from '@/api/material_classify'
|
||||
import { apimaterialLists, apimaterialAdd, apimaterialEdit, apimaterialDetail, apimaterialDatas } from '@/api/material_classify'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import { isEmail, isIdCard, isPhone } from '@/utils/validate'
|
||||
import type { PropType } from 'vue'
|
||||
@ -45,7 +47,6 @@ import configs from "@/config"
|
||||
import useUserStore from "@/stores/modules/user";
|
||||
const base_url = configs.baseUrl + configs.urlPrefix
|
||||
const userStore = useUserStore();
|
||||
const imaterialList = ref([])
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
@ -69,31 +70,68 @@ const formData = reactive({
|
||||
name: ''
|
||||
})
|
||||
|
||||
//层级
|
||||
|
||||
const props = {
|
||||
|
||||
lazy: true,
|
||||
checkStrictly: true,
|
||||
async lazyLoad(node: any, resolve: any) {
|
||||
if (node.level == 0) {
|
||||
apimaterialLists({ page_no: 1, page_size: 9999 }).then((res) => {
|
||||
// console.log(res)
|
||||
let nodes = res.lists.map((item: any) => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
}))
|
||||
resolve(nodes)
|
||||
})
|
||||
} else {
|
||||
apimaterialDatas({ 'pid': node.value })
|
||||
.then((res) => {
|
||||
|
||||
// 节点数组
|
||||
let nodes = res.map((item: any) => ({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
}));
|
||||
// resolve 节点返回
|
||||
resolve(nodes);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
|
||||
})
|
||||
|
||||
//获取分类列表
|
||||
const imateriallist = () => {
|
||||
apimaterialLists({ page_no: 1, page_size: 9999 }).then((res) => {
|
||||
console.log(res)
|
||||
imaterialList.value = res.lists
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (data.all_pid && data.all_pid.length > 0) {
|
||||
const data1 = data.all_pid.reverse()
|
||||
data1.push(data.id)
|
||||
console.log(data1, '11111')
|
||||
formData.pid = data1
|
||||
} else {
|
||||
const data1 = data.all_pid
|
||||
data1.push(data.id)
|
||||
formData.pid = data1
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -109,12 +147,11 @@ const getDetail = async (row: Record<string, any>) => {
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
|
||||
|
||||
|
||||
if (formData.pid.length > 0) {
|
||||
formData.pid = formData.pid[formData.pid.length - 1]
|
||||
}
|
||||
console.log(formData)
|
||||
await formRef.value?.validate()
|
||||
|
||||
|
||||
const data = { ...formData }
|
||||
mode.value == 'edit'
|
||||
? await apimaterialEdit(data)
|
||||
@ -125,7 +162,6 @@ const handleSubmit = async () => {
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
imateriallist()
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules" inline>
|
||||
<el-form ref="formRef" :model="formData" label-width="auto" :rules="formRules" inline>
|
||||
<div style="display: flex; flex-direction: row-reverse; justify-content: flex-start;margin-bottom: 30px;">
|
||||
|
||||
<el-select class="w-[180px]" v-model="formData.dept_id" clearable placeholder="请选择部门">
|
||||
@ -13,23 +13,23 @@
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户" prop="customer_id" :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
||||
<el-form-item label="客户" prop="custom_id" :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
||||
<el-input v-model="customer_name" clearable placeholder="请输入客户" readonly @click="showDialog = true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="报价日期" prop="quotation_date">
|
||||
<el-date-picker class="flex-1 !flex" v-model="formData.quotation_date" clearable type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="选择报价日期">
|
||||
<el-date-picker class="flex-1 !flex" v-model="formData.quotation_date" clearable type="date" value-format="YYYY-MM-DD" placeholder="选择报价日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系人" prop="contacts">
|
||||
<el-input v-model="formData.contacts" clearable placeholder="请输入联系人" />
|
||||
<el-form-item label="联系人" prop="custom_master_name">
|
||||
<el-input v-model="formData.custom_master_name" clearable placeholder="请输入联系人" />
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系电话" prop="contacts_phone" :rules="[{ required: true, message: '请输入手机号码', trigger: 'blur' }, { validator: isMobileNumber, trigger: 'blur' }]">
|
||||
<el-input v-model="formData.contacts_phone" clearable placeholder="请输入联系电话" :regex="/^ 1[3 - 9]\d{ 9}$ /" />
|
||||
<el-form-item label="联系电话" prop="custom_master_phone" :rules="[{ validator: isMobileNumber, trigger: 'blur' }]">
|
||||
<el-input v-model="formData.custom_master_phone" clearable placeholder="请输入联系电话" :regex="/^ 1[3 - 9]\d{ 9}$ /" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@ -46,19 +46,32 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col> <el-col :span="8">
|
||||
<el-form-item label="含税金额" prop="amount_including_tax">
|
||||
<el-input v-model="formData.amount_including_tax" clearable placeholder="请输入含税金额" />
|
||||
</el-form-item></el-col><el-col :span="8">
|
||||
<el-form-item label="运费" prop="freight">
|
||||
<el-form-item label="含税金额" prop="amount_including_tax" :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
||||
<el-input v-model="formData.amount_including_tax" clearable placeholder="请输入含税金额" @input="amountinput" />
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="含税金额大写" prop="amount_including_tax" :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
||||
<el-input v-model="amount_including_daxie" disabled clearable placeholder="请输入含税金额大写" />
|
||||
</el-form-item></el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="运费" prop="freight" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
||||
<el-input v-model="formData.freight" clearable placeholder="请输入运费" />
|
||||
</el-form-item></el-col><el-col :span="8">
|
||||
<el-form-item label="其他费用" prop="other_fee">
|
||||
<el-form-item label="其他费用" prop="other_fee" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
||||
<el-input v-model="formData.other_fee" clearable placeholder="请输入其他费用" />
|
||||
</el-form-item></el-col><el-col :span="8">
|
||||
</el-form-item></el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合计金额" prop="total_amount">
|
||||
<el-input v-model="formData.total_amount" clearable placeholder="请输入合计金额" />
|
||||
</el-form-item></el-col><el-col :span="8">
|
||||
<el-form-item label="客户需求" prop="customer_require">
|
||||
<el-input v-model="formData.total_amount" clearable placeholder="请输入合计金额" @input="amountinput1" />
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合计金额大写" prop="total_amount">
|
||||
<el-input v-model="total_amount_daxie" clearable disabled placeholder="请输入合计金额大写" />
|
||||
</el-form-item></el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户需求" prop="customer_require" :rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
||||
<el-input v-model="formData.customer_require" clearable placeholder="请输入客户需求" />
|
||||
</el-form-item></el-col><el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
@ -176,6 +189,7 @@ import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiQuotationAdd, apiQuotationEdit, apiQuotationDetail } from '@/api/quotation'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import { toChinesNum } from "@/utils/util";
|
||||
import customDialog1 from '@/components/product/index.vue'
|
||||
import reviewprocess from '@/components/reviewprocess/index.vue'
|
||||
const list1 = reactive([])
|
||||
@ -196,6 +210,8 @@ const mode = ref('add')
|
||||
const showDialog = ref(false)
|
||||
const showDialog1 = ref(false)
|
||||
const customer_name = ref('')
|
||||
const amount_including_daxie = ref('')
|
||||
const total_amount_daxie = ref('')
|
||||
const tableData = ref([])
|
||||
const formDataannex = reactive([])
|
||||
import feedback from '@/utils/feedback'
|
||||
@ -241,6 +257,20 @@ const getlist = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
//监听金额大写输入
|
||||
const amountinput = (e) => {
|
||||
// console.log(e)
|
||||
if (e && e > 0) {
|
||||
amount_including_daxie.value = toChinesNum(e)
|
||||
}
|
||||
}
|
||||
const amountinput1 = (e) => {
|
||||
// console.log(e)
|
||||
if (e && e > 0) {
|
||||
total_amount_daxie.value = toChinesNum(e)
|
||||
}
|
||||
}
|
||||
|
||||
//获取部门
|
||||
const deptrmt = (e: any) => {
|
||||
formData.dept_id = ''
|
||||
@ -259,10 +289,10 @@ const formData = reactive({
|
||||
dept_id: '',
|
||||
org_id: '',
|
||||
approve_id: 1,
|
||||
customer_id: '',
|
||||
custom_id: '',
|
||||
quotation_date: '',
|
||||
contacts: '',
|
||||
contacts_phone: '',
|
||||
custom_master_name: '',
|
||||
custom_master_phone: '',
|
||||
create_user: '',
|
||||
invoice_type: '',
|
||||
amount_including_tax: '',
|
||||
@ -278,7 +308,7 @@ const formData = reactive({
|
||||
})
|
||||
|
||||
const customEvent = (e: any) => {
|
||||
formData.customer_id = e.id;
|
||||
formData.custom_id = e.id;
|
||||
customer_name.value = e.name;
|
||||
showDialog.value = false;
|
||||
};
|
||||
@ -334,7 +364,13 @@ const setFormData = async (data: Record<any, any>) => {
|
||||
if (data.dept_id) {
|
||||
getlist1(data.org_id)
|
||||
}
|
||||
customer_name.value = data.custom.name
|
||||
if (data.total_amount && data.total_amount > 0) {
|
||||
amountinput1(data.total_amount)
|
||||
}
|
||||
if (data.amount_including_tax && data.amount_including_tax > 0) {
|
||||
amountinput(data.amount_including_tax)
|
||||
}
|
||||
customer_name.value = data.custom_name
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
@ -357,21 +393,11 @@ const getDetail = async (row: Record<string, any>) => {
|
||||
setFormData(data)
|
||||
}
|
||||
const isMobileNumber = (rule: any, value: string | number | any[], callback: (arg0: Error | undefined) => void) => {
|
||||
if (value) {
|
||||
// return new Error("请输入电话号码");
|
||||
const reg = /^1[3|4|5|7|8][0-9]\d{8}$/;
|
||||
const isPhone = reg.test(value);
|
||||
value = Number(value); //转换为数字
|
||||
if (typeof value === "number" && !isNaN(value)) {//判断是否为数字
|
||||
value = value.toString(); //转换成字符串
|
||||
if (value.length < 0 || value.length > 12 || !isPhone) { //判断是否为11位手机号
|
||||
callback(new Error("手机号码格式如:138xxxx8754"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback(new Error("请输入电话号码"));
|
||||
}
|
||||
|
||||
if (value && !/^1[3|4|5|7|8][0-9]{9}$/.test(value)) {
|
||||
callback(new Error('请输入正确的手机号码'));
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -51,11 +51,11 @@
|
||||
<el-table-column label="运费" prop="freight" show-overflow-tooltip />
|
||||
<el-table-column label="其他费用" prop="other_fee" show-overflow-tooltip />
|
||||
<el-table-column label="合计金额" prop="total_amount" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="160" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['quotation.quotation/edit']" type="primary" link @click="handleEdit(row)">
|
||||
<!-- <el-button v-perms="['quotation.quotation/edit']" type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
<el-button v-perms="['quotation.quotation/delete']" type="danger" link @click="handleDelete(row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user