|
@@ -8,23 +8,27 @@ import Upload from '@/components/Upload/index.vue'
|
|
|
import {
|
|
|
Storehouse_Contract_Add,
|
|
|
Storehouse_Contract_Edit,
|
|
|
- Storehouse_Contract_Product_List
|
|
|
+ Storehouse_Contract_Product_List,
|
|
|
+ Storehouse_Contract_Gen_Number
|
|
|
} from '@/api/storehouse/index'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import ImageCom from '@/components/Image/index.vue'
|
|
|
import InStorageProduct from '@/views/storehouse/inventory/InStorageProduct.vue'
|
|
|
+import ContractUser from '@/views/storehouse/outStock/receiveUser.vue'
|
|
|
|
|
|
const isProduct = ref(false)
|
|
|
let selectProductData: any[] = []
|
|
|
const isNew = ref(true)
|
|
|
const globalStore = GlobalStore()
|
|
|
+const User_tokey = globalStore.GET_User_tokey
|
|
|
const formLabelWidth = ref('120px')
|
|
|
const ruleFormRef = ref<FormInstance>()
|
|
|
const drawerRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
const uploadRef = ref<InstanceType<typeof Upload> | null>(null)
|
|
|
+const receiveUserdialog = ref<InstanceType<typeof ContractUser> | null>(null)
|
|
|
|
|
|
const validate_T_product = (rule: any, value: any, callback: any) => {
|
|
|
- if (form.T_type === 1 && value === '') {
|
|
|
+ if (value === '') {
|
|
|
callback(new Error('请选择产品明细'))
|
|
|
} else if (value.includes(undefined)) {
|
|
|
callback(new Error('请填写产品数量'))
|
|
@@ -60,8 +64,8 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
// 父级方法
|
|
|
const emit = defineEmits<{ (event: 'onTableList'): void }>()
|
|
|
|
|
|
-// 添加仓库名称
|
|
|
interface FormType {
|
|
|
+ T_uuid: string
|
|
|
T_number: string
|
|
|
T_customer: string
|
|
|
T_type: any
|
|
@@ -70,9 +74,11 @@ interface FormType {
|
|
|
T_date: string
|
|
|
T_remark: string
|
|
|
T_pdf: string
|
|
|
+ T_submit: string
|
|
|
}
|
|
|
-// type Fn = () => void
|
|
|
+
|
|
|
const form = reactive<FormType>({
|
|
|
+ T_uuid: '',
|
|
|
T_number: '',
|
|
|
T_customer: '',
|
|
|
T_type: '',
|
|
@@ -80,7 +86,8 @@ const form = reactive<FormType>({
|
|
|
T_money: '',
|
|
|
T_date: '',
|
|
|
T_remark: '',
|
|
|
- T_pdf: ''
|
|
|
+ T_pdf: '',
|
|
|
+ T_submit: ''
|
|
|
})
|
|
|
|
|
|
const openDrawer = (type: string, row?: any) => {
|
|
@@ -103,7 +110,7 @@ const editDataEcho = async (row: any) => {
|
|
|
form.T_customer = row.T_customer
|
|
|
|
|
|
const res: any = await Storehouse_Contract_Product_List({
|
|
|
- User_tokey: globalStore.GET_User_tokey,
|
|
|
+ User_tokey,
|
|
|
T_number: row.T_number
|
|
|
})
|
|
|
if (res.Code === 200) {
|
|
@@ -146,18 +153,16 @@ const AddContract = (formEl: FormInstance | undefined) => {
|
|
|
tableData.value.forEach(item => {
|
|
|
product += `${item.Id},${item.count}|`
|
|
|
})
|
|
|
+ const params = {
|
|
|
+ ...form,
|
|
|
+ User_tokey,
|
|
|
+ T_submit: form.T_uuid,
|
|
|
+ T_product: product
|
|
|
+ }
|
|
|
if (isNew.value) {
|
|
|
- res = await Storehouse_Contract_Add({
|
|
|
- ...form,
|
|
|
- User_tokey: globalStore.GET_User_tokey,
|
|
|
- T_product: product
|
|
|
- })
|
|
|
+ res = await Storehouse_Contract_Add(params)
|
|
|
} else {
|
|
|
- res = await Storehouse_Contract_Edit({
|
|
|
- ...form,
|
|
|
- T_product: product,
|
|
|
- User_tokey: globalStore.GET_User_tokey
|
|
|
- })
|
|
|
+ res = await Storehouse_Contract_Edit(params)
|
|
|
}
|
|
|
if (res.Code === 200) {
|
|
|
ElMessage.success(`${isNew.value ? '添加' : '修改'}合同成功!!`)
|
|
@@ -193,7 +198,6 @@ const drawerProductRef = ref<InstanceType<typeof InStorageProduct> | null>(null)
|
|
|
*/
|
|
|
const AddProductionDetailed = () => {
|
|
|
isProduct.value = true
|
|
|
- console.log(selectProductData)
|
|
|
nextTick(() => {
|
|
|
drawerProductRef.value?.openDrawer()
|
|
|
})
|
|
@@ -213,8 +217,18 @@ const ProductselectionChange = (row: any) => {
|
|
|
/**
|
|
|
* 全选
|
|
|
*/
|
|
|
-const ProductSelectionAllChange = (selection: any[]) => {
|
|
|
- tableData.value = selection
|
|
|
+const ProductSelectionAllChange = (selection: any[]) => (tableData.value = selection)
|
|
|
+const getContractNumber = async () => {
|
|
|
+ const res: any = await Storehouse_Contract_Gen_Number({ User_tokey })
|
|
|
+ if (res.Code === 200) form.T_number = res.Data
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 合同负责人
|
|
|
+ */
|
|
|
+const selectApprover = () => receiveUserdialog.value?.openDrawer()
|
|
|
+const getReceiveInfo = ({ T_uuid, T_name }: { T_uuid: string; T_name: string }) => {
|
|
|
+ form.T_submit = T_name
|
|
|
+ form.T_uuid = T_uuid
|
|
|
}
|
|
|
defineExpose({
|
|
|
openDrawer
|
|
@@ -230,36 +244,20 @@ defineExpose({
|
|
|
<el-form ref="ruleFormRef" :model="form" :rules="rules">
|
|
|
<el-divider border-style="dashed" />
|
|
|
<el-form-item label="合同编号:" :label-width="formLabelWidth" prop="T_number">
|
|
|
- <el-input
|
|
|
- v-model="form.T_number"
|
|
|
- type="text"
|
|
|
- :disabled="!isNew"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入合同编号"
|
|
|
- class="w-50"
|
|
|
- />
|
|
|
+ <div>
|
|
|
+ <el-input v-model="form.T_number" :disabled="!isNew" placeholder="请输入合同编号" class="w-50" />
|
|
|
+ <el-button type="primary" @click="getContractNumber">生成合同编号</el-button>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="客户名称:" :label-width="formLabelWidth" prop="T_customer">
|
|
|
- <el-input
|
|
|
- v-model="form.T_customer"
|
|
|
- type="text"
|
|
|
- autocomplete="off"
|
|
|
- placeholder="请输入客户名称"
|
|
|
- class="w-50"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="合同类型:" :label-width="formLabelWidth" prop="T_type">
|
|
|
- <el-select v-model="form.T_type" class="w-50" clearable :disabled="!isNew" placeholder="请选择合同类型~">
|
|
|
- <el-option label="销售合同" :value="1" />
|
|
|
- <el-option label="验证合同" :value="2" />
|
|
|
- </el-select>
|
|
|
+ <el-input v-model="form.T_customer" placeholder="请输入客户名称" class="w-50" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="产品明细:" :label-width="formLabelWidth" prop="T_product">
|
|
|
<el-table
|
|
|
- :data="tableData"
|
|
|
- style="width: 100%"
|
|
|
border
|
|
|
stripe
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%"
|
|
|
:header-cell-style="{ background: '#dedfe0', height: '50px' }"
|
|
|
>
|
|
|
<template v-for="item in columns" :key="item.prop">
|
|
@@ -295,13 +293,13 @@ defineExpose({
|
|
|
</template>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="业务日期:" :label-width="formLabelWidth" prop="T_date">
|
|
|
+ <el-form-item label="签订时间:" :label-width="formLabelWidth" prop="T_date">
|
|
|
<el-date-picker
|
|
|
class="my-date-picker"
|
|
|
style="width: 21.5rem"
|
|
|
v-model="form.T_date"
|
|
|
type="date"
|
|
|
- placeholder="选择日期"
|
|
|
+ placeholder="签订时间"
|
|
|
format="YYYY-MM-DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
|
/>
|
|
@@ -309,6 +307,9 @@ defineExpose({
|
|
|
<el-form-item label="合同金额:" :label-width="formLabelWidth" prop="T_money">
|
|
|
<el-input v-model="form.T_money" type="text" autocomplete="off" placeholder="请输入合同金额" class="w-50" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="合同负责人:" :label-width="formLabelWidth" prop="T_submit">
|
|
|
+ <el-input v-model="form.T_submit" placeholder="请选择合同负责人" class="w-50" @focus="selectApprover" />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="合同备注:" :label-width="formLabelWidth" prop="T_remark">
|
|
|
<el-input
|
|
|
class="w-50"
|
|
@@ -343,6 +344,7 @@ defineExpose({
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</Drawer>
|
|
|
+ <ContractUser ref="receiveUserdialog" @onUserInfo="getReceiveInfo" title="合同负责人" />
|
|
|
<InStorageProduct
|
|
|
v-if="isProduct"
|
|
|
ref="drawerProductRef"
|
|
@@ -354,10 +356,6 @@ defineExpose({
|
|
|
</template>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-.tooltip-content {
|
|
|
- max-width: 500px;
|
|
|
- overflow-y: auto;
|
|
|
-}
|
|
|
.contract-form {
|
|
|
:deep(.el-table--border .el-table__cell) {
|
|
|
border-right: 0;
|