|
@@ -9,6 +9,7 @@ import { GlobalStore } from '@/stores/index'
|
|
import TableBase from '@/components/TableBase/index.vue'
|
|
import TableBase from '@/components/TableBase/index.vue'
|
|
import Upload from '@/components/Upload/index.vue'
|
|
import Upload from '@/components/Upload/index.vue'
|
|
import {
|
|
import {
|
|
|
|
+ Storehouse_Contract_Add,
|
|
Storehouse_Product_List,
|
|
Storehouse_Product_List,
|
|
Storehouse_IotCard_Edit,
|
|
Storehouse_IotCard_Edit,
|
|
Storehouse_ProductClass_List,
|
|
Storehouse_ProductClass_List,
|
|
@@ -27,12 +28,10 @@ const ruleFormRef = ref<FormInstance>()
|
|
const drawerRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
const drawerRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
const dialogRef = ref<InstanceType<typeof Dialog> | null>(null)
|
|
const dialogRef = ref<InstanceType<typeof Dialog> | null>(null)
|
|
const uploadRef = ref<InstanceType<typeof Upload> | null>(null)
|
|
const uploadRef = ref<InstanceType<typeof Upload> | null>(null)
|
|
-const TableProductRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
|
|
|
+const selectTable = ref()
|
|
const drawerProductRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
const drawerProductRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
|
|
|
const validate_T_product = (rule: any, value: any, callback: any) => {
|
|
const validate_T_product = (rule: any, value: any, callback: any) => {
|
|
- console.log(value)
|
|
|
|
-
|
|
|
|
if (form.T_type === 1 && value === '') {
|
|
if (form.T_type === 1 && value === '') {
|
|
callback(new Error('请选择产品明细'))
|
|
callback(new Error('请选择产品明细'))
|
|
} else if (value.includes(undefined)) {
|
|
} else if (value.includes(undefined)) {
|
|
@@ -62,6 +61,9 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
formEl.resetFields()
|
|
formEl.resetFields()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 父级方法
|
|
|
|
+const emit = defineEmits<{ (event: 'onTableList'): void }>()
|
|
|
|
+
|
|
// 添加仓库名称
|
|
// 添加仓库名称
|
|
interface FormType {
|
|
interface FormType {
|
|
T_id: string
|
|
T_id: string
|
|
@@ -100,19 +102,36 @@ const openDrawer = (type: string, row?: any) => {
|
|
drawerRef.value?.openDrawer()
|
|
drawerRef.value?.openDrawer()
|
|
}
|
|
}
|
|
|
|
|
|
-const AddContract = (formEl: FormInstance | undefined) => {
|
|
|
|
- if (!formEl) return
|
|
|
|
|
|
+const blurHandle = () => {
|
|
form.T_product = tableData.value.map(item => {
|
|
form.T_product = tableData.value.map(item => {
|
|
if (!item.count) return undefined
|
|
if (!item.count) return undefined
|
|
return `${item.Id},${item.count}`
|
|
return `${item.Id},${item.count}`
|
|
})
|
|
})
|
|
|
|
+}
|
|
|
|
+const deleteProduct = (id: number) => {
|
|
|
|
+ tableData.value = tableData.value.filter(item => item.Id !== id)
|
|
|
|
+ console.log(id)
|
|
|
|
+
|
|
|
|
+ selectTable.value?.toggleRowSelection([tableData.value[1]])
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const AddContract = (formEl: FormInstance | undefined) => {
|
|
|
|
+ if (!formEl) return
|
|
|
|
+ // form.T_product = tableData.value.map(item => {
|
|
|
|
+ // if (!item.count) return undefined
|
|
|
|
+ // return `${item.Id},${item.count}`
|
|
|
|
+ // })
|
|
|
|
|
|
formEl.validate(async valid => {
|
|
formEl.validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
let res: any = {}
|
|
let res: any = {}
|
|
if (isNew.value) {
|
|
if (isNew.value) {
|
|
console.log(form)
|
|
console.log(form)
|
|
- // res = await Storehouse_IotCard_Add({ User_tokey: globalStore.GET_User_tokey, ...form })
|
|
|
|
|
|
+ res = await Storehouse_Contract_Add({
|
|
|
|
+ ...form,
|
|
|
|
+ User_tokey: globalStore.GET_User_tokey,
|
|
|
|
+ T_product: form.T_product.toString()
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
res = await Storehouse_IotCard_Edit({
|
|
res = await Storehouse_IotCard_Edit({
|
|
User_tokey: globalStore.GET_User_tokey,
|
|
User_tokey: globalStore.GET_User_tokey,
|
|
@@ -120,10 +139,10 @@ const AddContract = (formEl: FormInstance | undefined) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if (res.Code === 200) {
|
|
if (res.Code === 200) {
|
|
- ElMessage.success(`${isNew.value ? '添加' : '修改'}物联网卡成功!!`)
|
|
|
|
|
|
+ ElMessage.success(`${isNew.value ? '添加' : '修改'}合同成功!!`)
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
drawerRef.value?.closeDrawer()
|
|
drawerRef.value?.closeDrawer()
|
|
- // TableRef.value?.getTableList()
|
|
|
|
|
|
+ emit('onTableList')
|
|
resetForm(ruleFormRef.value)
|
|
resetForm(ruleFormRef.value)
|
|
isNew.value = true
|
|
isNew.value = true
|
|
})
|
|
})
|
|
@@ -154,7 +173,6 @@ const getProductClassList = async () => {
|
|
// 获取产品型号
|
|
// 获取产品型号
|
|
const getProductModelList = async () => {
|
|
const getProductModelList = async () => {
|
|
const res: any = await Storehouse_Product_Model_List({ T_name: autoSelect.value })
|
|
const res: any = await Storehouse_Product_Model_List({ T_name: autoSelect.value })
|
|
- console.log(res)
|
|
|
|
modelOptions.value = res.Data.map((item: any, index: number) => {
|
|
modelOptions.value = res.Data.map((item: any, index: number) => {
|
|
return {
|
|
return {
|
|
value: item,
|
|
value: item,
|
|
@@ -167,22 +185,13 @@ const AddProductionDetailed = () => {
|
|
!classOptions.value.length && getProductClassList()
|
|
!classOptions.value.length && getProductClassList()
|
|
drawerProductRef.value?.openDrawer()
|
|
drawerProductRef.value?.openDrawer()
|
|
}
|
|
}
|
|
-// 搜索名称
|
|
|
|
-const searchNameHandle = async () => {
|
|
|
|
- console.log(initParam)
|
|
|
|
- const res = await Storehouse_Product_Name_List({ T_name: initParam.T_name, T_class: initParam.T_class })
|
|
|
|
- console.log(res)
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
// 搜索模型
|
|
// 搜索模型
|
|
const searchModelHandle = () => {
|
|
const searchModelHandle = () => {
|
|
total = 0
|
|
total = 0
|
|
initParam.page = 1
|
|
initParam.page = 1
|
|
tableProductData.value = []
|
|
tableProductData.value = []
|
|
getProductList()
|
|
getProductList()
|
|
- // console.log(initParam)
|
|
|
|
-}
|
|
|
|
-const searchHandle = () => {
|
|
|
|
- //
|
|
|
|
}
|
|
}
|
|
// 保存选中的数据id,row-key就是要指定一个key标识这一行的数据
|
|
// 保存选中的数据id,row-key就是要指定一个key标识这一行的数据
|
|
const getRowKey = (row: any) => {
|
|
const getRowKey = (row: any) => {
|
|
@@ -205,7 +214,7 @@ const load = () => {
|
|
let total = 0
|
|
let total = 0
|
|
const tableProductData = ref<any[]>([])
|
|
const tableProductData = ref<any[]>([])
|
|
const getProductList = async () => {
|
|
const getProductList = async () => {
|
|
- const res: any = await Storehouse_Product_List({ ...initParam,T_name: autoSelect.value})
|
|
|
|
|
|
+ const res: any = await Storehouse_Product_List({ ...initParam, T_name: autoSelect.value })
|
|
console.log(res)
|
|
console.log(res)
|
|
tableProductData.value.push(...res.Data.Data)
|
|
tableProductData.value.push(...res.Data.Data)
|
|
total = res.Data.Num
|
|
total = res.Data.Num
|
|
@@ -314,7 +323,13 @@ defineExpose({
|
|
<span style="color: red">*数量</span>
|
|
<span style="color: red">*数量</span>
|
|
</template>
|
|
</template>
|
|
<template #default="{ row }" v-if="item.prop === item.name">
|
|
<template #default="{ row }" v-if="item.prop === item.name">
|
|
- <el-input v-if="item.prop === 'count'" v-model.number="row.count" type="text" autocomplete="off" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-if="item.prop === 'count'"
|
|
|
|
+ v-model.number="row.count"
|
|
|
|
+ type="text"
|
|
|
|
+ autocomplete="off"
|
|
|
|
+ @blur="blurHandle"
|
|
|
|
+ />
|
|
<span v-if="item.prop === 'T_relation_sn'">
|
|
<span v-if="item.prop === 'T_relation_sn'">
|
|
<el-tag v-if="row.T_relation_sn === 1" effect="dark">是</el-tag>
|
|
<el-tag v-if="row.T_relation_sn === 1" effect="dark">是</el-tag>
|
|
<el-tag v-else type="success" effect="dark">否</el-tag>
|
|
<el-tag v-else type="success" effect="dark">否</el-tag>
|
|
@@ -323,7 +338,11 @@ defineExpose({
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column v-bind="item" v-if="item.fixed === 'right'">
|
|
<el-table-column v-bind="item" v-if="item.fixed === 'right'">
|
|
- <el-button link type="danger" size="small" :icon="Delete">删除</el-button>
|
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
+ <el-button link type="danger" size="small" :icon="Delete" @click="deleteProduct(row.Id)"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
|
|
+ </template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</template>
|
|
</template>
|
|
<template #append>
|
|
<template #append>
|
|
@@ -358,11 +377,12 @@ defineExpose({
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="上传附件:" :label-width="formLabelWidth" prop="T_pdf">
|
|
<el-form-item label="上传附件:" :label-width="formLabelWidth" prop="T_pdf">
|
|
<Upload
|
|
<Upload
|
|
|
|
+ v-model="form.T_pdf"
|
|
class="w-50"
|
|
class="w-50"
|
|
ref="uploadRef"
|
|
ref="uploadRef"
|
|
- :isImg="true"
|
|
|
|
:limit="1"
|
|
:limit="1"
|
|
- v-model="form.T_pdf"
|
|
|
|
|
|
+ successText="文件上传成功!!"
|
|
|
|
+ errorText="文件上传失败"
|
|
accept=".pdf"
|
|
accept=".pdf"
|
|
listType="text"
|
|
listType="text"
|
|
>
|
|
>
|
|
@@ -420,6 +440,7 @@ defineExpose({
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<el-table
|
|
<el-table
|
|
|
|
+ ref="selectTable"
|
|
border
|
|
border
|
|
:row-key="getRowKey"
|
|
:row-key="getRowKey"
|
|
:data="tableProductData"
|
|
:data="tableProductData"
|