index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div class="h-full flex">
  3. <div class="p-5 w-80 pr-0">
  4. <div class="bg-white w-full h-full shadow-md rounded-md flex flex-col">
  5. <div class="flex-1 p-3 overflow-y-auto">
  6. <el-form :model="businessOpportunityForm" label-width="70px" style="max-width: 600px">
  7. <el-form-item label="商机名称">
  8. <el-input v-model="businessOpportunityForm.name" clearable placeholder="请输入"></el-input>
  9. </el-form-item>
  10. <el-form-item label="商机阶段">
  11. <el-select v-model="businessOpportunityForm.stageId" placeholder="请选择" clearable>
  12. <el-option v-for="item in fixedData.BusinessStage" :key="item.id" :label="item.name" :value="item.id" />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="客户名称">
  16. <el-input v-model="businessOpportunityForm.customerName" clearable placeholder="请输入"></el-input>
  17. </el-form-item>
  18. <el-form-item label="联系人">
  19. <el-input v-model="businessOpportunityForm.contactsName" clearable placeholder="请输入"></el-input>
  20. </el-form-item>
  21. <el-form-item label="产品">
  22. <el-select v-model="businessOpportunityForm.product" placeholder="请选择" clearable>
  23. <el-option v-for="item in fixedData.ProductArr" :key="item.value" :label="item.label"
  24. :value="item.value" />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="负责人">
  28. <el-select v-model="businessOpportunityForm.inchargerId" placeholder="请选择" clearable>
  29. <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="创建时间">
  33. <el-date-picker v-model="businessOpportunityForm.startTime" type="date" placeholder="请选择"
  34. :clearable="false" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  35. </el-form-item>
  36. <el-form-item label="">
  37. <el-date-picker v-model="businessOpportunityForm.endTime" type="date" placeholder="请选择" :clearable="false"
  38. format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
  39. </el-form-item>
  40. </el-form>
  41. </div>
  42. <div class="w-full flex p-3 shadow-[0_-3px_5px_0px_rgba(0,0,0,0.2)]">
  43. <El-button class="w-full" @click="resetForm()">重置</El-Button>
  44. <El-button type="primary" class="w-full" @click="getBusinessTableList()">搜索</El-Button>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="flex-1 p-5 overflow-auto">
  49. <div class="bg-white w-full h-full p-3 shadow-md rounded-md flex flex-col">
  50. <div class="flex justify-end pb-3">
  51. <el-button v-permission="['businessAddAnEdit']" type="primary"
  52. @click="editNewBusiness(false)">新建商机</el-button>
  53. <el-button type="primary" @click="showVisible('batchTransferVisible')"
  54. :disabled="batchTableData.length <= 0">批量转移</el-button>
  55. <el-button type="primary" v-permission="['businessDelete']" @click="batchDeteleItem()"
  56. :disabled="batchTableData.length <= 0">批量删除</el-button>
  57. <el-button type="primary" @click="showVisible('stageSetVisible')">阶段设置</el-button>
  58. <el-button type="primary" v-permission="['businessRecycle']"
  59. @click="showVisible('deteleBusinessVisible')">回收站</el-button>
  60. <el-button v-permission="['businessImport']" type="primary"
  61. @click="showVisible('importVisible')">导入</el-button>
  62. <el-button v-permission="['businessExport']" type="primary" @click="exportBusinessTableList()"
  63. :loading="allLoading.exoprtLoading">导出</el-button>
  64. </div>
  65. <div class="flex-1 w-full overflow-hidden">
  66. <el-table ref="businessTableRef" :data="businessTable" border v-loading="allLoading.businessTableLading"
  67. :show-overflow-tooltip="tableShowOverflowTooltip" @selection-change="changeBatch"
  68. style="width: 100%;height: 100%;">
  69. <el-table-column type="selection" width="55" />
  70. <el-table-column v-for="(item, index) in tableColumn" :prop="item.prop" :label="item.label" :key="index"
  71. :width="item.width">
  72. <template #default="scope">
  73. <div class="table-text-textnowrap" v-if="item.eventName"
  74. @click="dealWithTableColumn(scope.row, item.eventName)">{{ scope.row[item.prop] }}</div>
  75. <template v-else>{{ scope.row[item.prop] }}</template>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="操作" fixed="right" width="200"
  79. v-permission="['businessAddAnEdit', 'tasksAdd', 'businessDelete']">
  80. <template #default="scope">
  81. <el-button link type="primary" size="large" @click="editNewBusiness(scope.row)"
  82. v-permission="['businessAddAnEdit']">编辑</el-button>
  83. <el-button link type="primary" size="large" @click="newTask(scope.row)"
  84. v-permission="['tasksAdd']">新建任务</el-button>
  85. <el-button link type="danger" size="large" @click="businessDeteleItem(scope.row.id, scope.row.name)"
  86. v-permission="['businessDelete']">删除</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. </div>
  91. <div class="flex justify-end pt-3">
  92. <el-pagination layout="total, prev, pager, next, sizes" :page-size="businessOpportunityForm.pageFrom"
  93. @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="businessTotalTable"
  94. :hide-on-single-page="true" />
  95. </div>
  96. </div>
  97. </div>
  98. <!-- 弹窗 -->
  99. <el-dialog v-model="allVisible.newBusinessisible" width="1000" :show-close="false" top="10vh"
  100. :before-close="handleClose">
  101. <template #header="{ close, titleId, titleClass }">
  102. <div class="flex justify-between items-center border-b pb-3 dialog-header">
  103. <h4 :id="titleId">{{ allText.newBusinessisibleText }}</h4>
  104. <div>
  105. <el-button type="primary" :loading="allLoading.newBusinessSaveLading"
  106. :disabled="allLoading.businessSaveLading" @click="editBusiness(true)"
  107. v-if="!businessTemplateValue.id">保存并新建</el-button>
  108. <el-button type="primary" @click="editBusiness(false)" :loading="allLoading.businessSaveLading"
  109. :disabled="allLoading.newBusinessSaveLading">保存</el-button>
  110. <el-button @click="closeVisible('newBusinessisible')">取消</el-button>
  111. </div>
  112. </div>
  113. </template>
  114. <div class="h-[60vh] overflow-y-auto scroll-bar pt-3" v-loading="allLoading.generateFormLading">
  115. <GenerateForm ref="businessTemplateRef" :data="businessTemplate" :value="businessTemplateValue"
  116. :key="businessTemplateKey" />
  117. <div>相关产品</div>
  118. <RelatedProducts ref="relatedProductsRef" :productTableList="productTableList"
  119. :productTableListValue="productTableListValue" />
  120. </div>
  121. </el-dialog>
  122. <!-- 批量转移 -->
  123. <el-dialog v-model="allVisible.batchTransferVisible" width="600" :show-close="false" top="10vh">
  124. <template #header="{ close, titleId, titleClass }">
  125. <div class="flex justify-between items-center border-b pb-3 dialog-header">
  126. <h4 :id="titleId">{{ allText.transferText }}</h4>
  127. <div>
  128. <el-button type="primary" v-loading="allLoading.transferLoading" @click="transferBusiness()">转移</el-button>
  129. <el-button @click="allVisible.batchTransferVisible = false">取消</el-button>
  130. </div>
  131. </div>
  132. </template>
  133. <div class="scroll-bar m-6">
  134. <div class="flex mb-4">
  135. <div class="w-20 flex items-center justify-end pr-4">转移至:</div>
  136. <el-select v-model="transferPersonnel" placeholder="请选择" class="flex1">
  137. <el-option v-for="item in fixedData.Personnel" :key="item.id" :label="item.name" :value="item.id" />
  138. </el-select>
  139. </div>
  140. <div class="pl-3 text-[#e94a4a]">转移后,将看不到此商机</div>
  141. </div>
  142. </el-dialog>
  143. <!-- 导入 -->
  144. <el-dialog v-model="allVisible.importVisible" width="680" :show-close="false" top="10vh">
  145. <template #header="{ close, titleId, titleClass }">
  146. <div class="flex justify-between items-center border-b pb-3 dialog-header">
  147. <h4 :id="titleId">导入产品</h4>
  148. <div class="flex">
  149. <el-upload class="upload-demo mr-3" :limit="1" :show-file-list="false" accept=".xlsx"
  150. :http-request="importBusiness">
  151. <el-button type="primary" :loading="allLoading.importLoading">导入</el-button>
  152. </el-upload>
  153. <el-button @click="allVisible.importVisible = false">取消</el-button>
  154. </div>
  155. </div>
  156. </template>
  157. <div class="p-8">
  158. <div class="ml-4 mr-4">
  159. <div class="flex items-center">1、点击下载 <el-link type="primary"
  160. @click="downloadTemplate(MODURL, '商机导入模板.xlsx')">商机导入模板.xlsx</el-link></div>
  161. <div class="mt-4">2、填写excel文件、商机名称、商机金额、商机阶段必填</div>
  162. </div>
  163. </div>
  164. </el-dialog>
  165. <!-- 新建任务 -->
  166. <TaskModal :visible="allVisible.taskModalVisible" :edit-form="taskModalForm" :save-loading="taskLoading"
  167. @close="closeVisible('taskModalVisible')" @submit="submitForm" :title="'新建任务'"
  168. :disabled-list="['taskType', 'businessOpportunityId']" />
  169. <!-- 回收站 -->
  170. <DeteleBusiness :visibles="allVisible.deteleBusinessVisible" @closeVisible="closeVisible" />
  171. <!-- 阶段设置 -->
  172. <StageSetting :visibles="allVisible.stageSetVisible" @closeVisible="closeVisible" />
  173. </div>
  174. </template>
  175. <script lang="ts" setup>
  176. import { ref, reactive, onMounted, inject } from "vue";
  177. import type { ElTable, FormInstance, FormRules, UploadRequestOptions } from 'element-plus'
  178. import { useRouter, useRoute } from "vue-router";
  179. import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDATEINSET, BUSINESSDETELE, BATCHTRANSFER, MODURL, tableColumn, BUSIESS_GETSATE, URL_IMPOERBUSINESS, BUSIESS_INFO, URL_EXPORTBUSINESS } from './api'
  180. import { GETTABLELIST } from '@/pages/product/api'
  181. import { post, get, uploadFile } from "@/utils/request";
  182. import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, createTaskFromType, formatDate, confirmAction, downloadTemplate, downloadFile, judgmentaAmounteEqual } from '@/utils/tools'
  183. import { createTask } from '@/components/TaskModal/taskFunction'
  184. import { formatDateTime } from '@/utils/times'
  185. import { GenerateForm } from '@zmjs/form-design';
  186. import { tableShowOverflowTooltip } from '@/utils/globalVariables'
  187. import RelatedProducts from '@/components/relatedProducts/relatedProducts.vue'
  188. import TaskModal from '@/components/TaskModal/index.vue'
  189. import DeteleBusiness from './component/deteleTables.vue'
  190. import StageSetting from './component/stageSetting.vue'
  191. import { GETTABLELISTPRODUCT } from "../order/api";
  192. const route = useRoute()
  193. const router = useRouter()
  194. const globalPopup = inject<GlobalPopup>('globalPopup')
  195. const businessTableRef = ref<InstanceType<typeof ElTable>>() // 商机table dom
  196. const businessTotalTable = ref(0)
  197. const businessTemplateRef = ref<typeof GenerateForm>() // 自定义表单dom
  198. const relatedProductsRef = ref<typeof RelatedProducts>()
  199. const businessTemplateValue = ref<any>({})
  200. const businessTemplateKey = ref(1)
  201. const businessTemplate = ref({
  202. config: {},
  203. list: []
  204. }) // 自定义表单数据
  205. const businessTable = ref([])
  206. const allLoading = reactive({
  207. businessTableLading: false,
  208. businessSaveLading: false,
  209. newBusinessSaveLading: false,
  210. transferLoading: false,
  211. importLoading: false,
  212. exoprtLoading: false,
  213. generateFormLading: false
  214. })
  215. const allVisible = reactive({
  216. newBusinessisible: false,
  217. recycleVisible: false,
  218. taskModalVisible: false,
  219. batchTransferVisible: false,
  220. deteleBusinessVisible: false,
  221. stageSetVisible: false,
  222. importVisible: false
  223. })
  224. const allText = reactive({
  225. newBusinessisibleText: '新建商机',
  226. transferText: '转移商机'
  227. }) // 所有文本
  228. const taskModalForm = ref({}) // 任务弹窗表单
  229. const taskLoading = ref<saveLoadingType>("1");
  230. const batchTableData = ref([]) // 批量数据
  231. const transferPersonnel = ref('') // 转移人
  232. const businessOpportunityForm = reactive<businessOpportunityFormType>({
  233. name: '',
  234. stageId: '',
  235. customerName: '',
  236. contactsName: '',
  237. product: '',
  238. inchargerId: '',
  239. startTime: getFirstDayOfMonth(new Date()),
  240. endTime: formatDate(new Date()),
  241. pageIndex: 1,
  242. pageFrom: 10
  243. })
  244. const fixedData = reactive({
  245. BusinessStage: [] as fixedDataInterface[],
  246. Personnel: [] as personnelInterface[],
  247. ProductArr: [] as productInterface[]
  248. })
  249. const productTableList = ref([])
  250. const productTableListValue = ref([])
  251. function editBusiness(visibles: boolean) {
  252. businessTemplateRef.value?.getData().then((res: any) => {
  253. let productTableListData = relatedProductsRef?.value?.returnData()
  254. console.log(!productTableListData, judgmentaAmounteEqual({ ...businessTemplateValue.value, ...res }, productTableListData))
  255. if (!productTableListData || judgmentaAmounteEqual({ ...businessTemplateValue.value, ...res }, productTableListData)) {
  256. return
  257. }
  258. productTableListData.forEach((item: any) => {
  259. delete item.id
  260. })
  261. let newForm = {
  262. ...res,
  263. expectedTransactionDate: res.expectedTransactionDate ? formatDateTime(new Date(res.expectedTransactionDate)) : '',
  264. businessItemProductList: productTableListData ? JSON.stringify(productTableListData) : []
  265. }
  266. allLoading.businessSaveLading = true
  267. setTimeout(() => {
  268. post(UPDATEINSET, { ...businessTemplateValue.value, ...newForm }).then((_res) => {
  269. allVisible.newBusinessisible = visibles
  270. globalPopup?.showSuccess('保存成功')
  271. getBusinessTableList()
  272. }).finally(() => {
  273. allLoading.businessSaveLading = false
  274. })
  275. }, 1500)
  276. }).catch((_err: any) => {
  277. console.log(_err)
  278. globalPopup?.showError('请填写完整')
  279. })
  280. }
  281. function editNewBusiness(item: any) {
  282. console.log(item, '选择数据')
  283. showVisible('newBusinessisible')
  284. allLoading.generateFormLading = true
  285. if (item) {
  286. editProduct(item)
  287. businessTemplateValue.value = editBusinessData(item)
  288. allText.newBusinessisibleText = '编辑商机'
  289. }
  290. if (!item) {
  291. businessTemplateValue.value = {}
  292. productTableListValue.value = []
  293. allText.newBusinessisibleText = '新建商机'
  294. }
  295. setTimeout(() => {
  296. businessTemplateRef.value && businessTemplateRef.value.reset()
  297. businessTemplateKey.value++
  298. allLoading.generateFormLading = false
  299. }, 500)
  300. }
  301. function newTask(item: any) {
  302. const { id } = item
  303. taskModalForm.value = { ...createTaskFromType(1), businessOpportunityId: id, }
  304. showVisible('taskModalVisible')
  305. }
  306. function submitForm(submitData: any, isClose: boolean) { // 任务提交
  307. taskLoading.value = '2'
  308. createTask(submitData, isClose).then((res) => {
  309. const { saveLoading, isClose } = res
  310. taskLoading.value = saveLoading
  311. allVisible.taskModalVisible = isClose
  312. globalPopup?.showSuccess('新增成功')
  313. }).catch((err) => {
  314. const { saveLoading, isClose, message } = err
  315. taskLoading.value = saveLoading
  316. allVisible.taskModalVisible = isClose
  317. globalPopup?.showError(message)
  318. })
  319. }
  320. function transferBusiness() {
  321. const ids = batchTableData.value.map((item: any) => item.id).join(',')
  322. allLoading.transferLoading = true
  323. post(BATCHTRANSFER, { ids, inchargerId: transferPersonnel.value }).then(() => {
  324. transferPersonnel.value = ''
  325. globalPopup?.showSuccess('转移成功')
  326. closeVisible('batchTransferVisible')
  327. getBusinessTableList()
  328. }).finally(() => {
  329. allLoading.transferLoading = false
  330. })
  331. }
  332. function batchDeteleItem() {
  333. const value = batchTableData.value.map((item: any) => item.id).join(',')
  334. const label = batchTableData.value.map((item: any) => item.name).join(',')
  335. businessDeteleItem(value, label, true)
  336. }
  337. function businessDeteleItem(value: string | number, label: string, batch: boolean = false) {
  338. confirmAction(`确定${batch ? '批量' : ''}删除【${label}】商机吗?`).then(() => {
  339. post(BUSINESSDETELE, { ids: value }).then(res => {
  340. if (res.code != 'ok') {
  341. globalPopup?.showError(res.msg)
  342. return
  343. }
  344. globalPopup?.showSuccess('删除成功')
  345. changeBatch(false)
  346. getBusinessTableList()
  347. }).catch((err) => {
  348. globalPopup?.showError(err.msg)
  349. })
  350. })
  351. }
  352. async function importBusiness(param: UploadRequestOptions) {
  353. allLoading.importLoading = true
  354. const formData = new FormData();
  355. formData.append('multipartFile', param.file)
  356. const res = await uploadFile(URL_IMPOERBUSINESS, formData).finally(() => {
  357. allLoading.importLoading = false
  358. })
  359. if (res.code == 'ok') {
  360. globalPopup?.showSuccess('导入成功' || '')
  361. getBusinessTableList()
  362. return
  363. }
  364. globalPopup?.showError(res.msg || '')
  365. }
  366. function exportBusinessTableList() {
  367. allLoading.exoprtLoading = true
  368. let valueForm = getFromValue(businessOpportunityForm)
  369. post(URL_EXPORTBUSINESS, { ...valueForm }).then((res) => {
  370. downloadFile(res.data, '商机表导出.xlsx')
  371. }).finally(() => {
  372. allLoading.exoprtLoading = false
  373. })
  374. }
  375. function changeBatch(flag: boolean = true) {
  376. if (flag) {
  377. batchTableData.value = businessTableRef.value && businessTableRef.value.getSelectionRows()
  378. } else {
  379. batchTableData.value = []
  380. businessTableRef.value && businessTableRef.value.clearSelection()
  381. }
  382. }
  383. function editProduct(row: any) {
  384. post(BUSIESS_INFO, { id: row.id }).then(({ data }) => {
  385. const list = (data.businessItemProducts || []).map((item: any) => {
  386. const { id, productName, productId, productCode, unit, unitName, typeName, productType, type, price, inventory, orderProductDetail, num, discount, sellingPrice, sealPrice, totalPrice, quantity } = item
  387. return {
  388. id, productId: productId, productName, productCode, unitName: unit, typeName: productType, type, price, inventory,
  389. num, discount, sealPrice, totalPrice, quantity, sellingPrice
  390. }
  391. })
  392. productTableListValue.value = list
  393. })
  394. }
  395. function editBusinessData(item: any) {
  396. const { name, expectedTransactionDate, amountOfMoney = 0, customerId, contactsId, creatorId, stageId, id, inchargerId, remark } = item
  397. return { name, expectedTransactionDate, amountOfMoney, customerId, contactsId, creatorId, stageId, id, inchargerId, remark }
  398. }
  399. function handleSizeChange(val: number) {
  400. businessOpportunityForm.pageIndex = 1
  401. businessOpportunityForm.pageFrom = val
  402. getBusinessTableList()
  403. }
  404. function handleCurrentChange(val: number) {
  405. businessOpportunityForm.pageIndex = val
  406. getBusinessTableList()
  407. }
  408. function showVisible(type: keyof typeof allVisible) { // 显示弹窗
  409. allVisible[type] = true
  410. }
  411. function closeVisible(type: keyof typeof allVisible) {
  412. allVisible[type] = false
  413. }
  414. function handleClose(done: () => void) {
  415. done()
  416. }
  417. function getBusinessTableList() {
  418. const formValue = getFromValue(businessOpportunityForm)
  419. allLoading.businessTableLading = true
  420. post(GETBUSINESSLIST, { ...formValue }).then((res) => {
  421. const { data, total } = res.data
  422. businessTable.value = data.map((item: any) => {
  423. return {
  424. ...item,
  425. expectedTransactionDate: formatDate(new Date(item.expectedTransactionDate))
  426. }
  427. })
  428. businessTotalTable.value = total
  429. }).finally(() => {
  430. allLoading.businessTableLading = false
  431. })
  432. }
  433. function resetForm() {
  434. let reset = {
  435. startTime: getFirstDayOfMonth(new Date()),
  436. endTime: formatDate(new Date()),
  437. pageIndex: 1,
  438. pageFrom: 10
  439. }
  440. let newBusinessOpportunityForm = resetFromValue(businessOpportunityForm, { ...reset })
  441. Object.assign(businessOpportunityForm, newBusinessOpportunityForm)
  442. getBusinessTableList()
  443. }
  444. async function getSystemField() {
  445. // const systemField = getAllListByCode(['商机阶段'])
  446. // for (let i in systemField) {
  447. // const { data } = await get(`${GETSYSFILED}?code=${systemField[i]}`)
  448. // for (let key of Object.keys(fixedData)) {
  449. // if (systemField[i] == key) {
  450. // Object.assign(fixedData, { [key]: data })
  451. // }
  452. // }
  453. // }
  454. const row = await post(BUSIESS_GETSATE, {})
  455. fixedData.BusinessStage = (row.data || []).map((item: any) => {
  456. const { name, id, seq } = item
  457. return { name, id, seq }
  458. }).sort(function (a: any, b: any) { return a.seq - b.seq; });
  459. const { data } = await post(GETPERSONNEL, {})
  460. fixedData.Personnel = data.map((item: any) => {
  461. const { id, name, phone, jobNumber } = item
  462. return {
  463. id, name, phone, jobNumber
  464. }
  465. })
  466. post(GETTABLELISTPRODUCT, { pageIndex: -1, pageSize: -1 }).then(({ data }) => {
  467. fixedData.ProductArr = (data.record || []).map((item: any) => {
  468. const { id, productName } = item
  469. return {
  470. value: id, label: productName
  471. }
  472. })
  473. })
  474. const res = await get(GETGENERATEFOEM)
  475. businessTemplate.value = JSON.parse(res.data[0].config)
  476. }
  477. function toBusinessTableDetail(row: any) {
  478. router.push({
  479. path: `${MOD}/detail`,
  480. query: { id: row.id }
  481. })
  482. }
  483. function dealWithTableColumn(row: any, eventName: string) {
  484. if (eventName == 'toClueTableDetail') {
  485. toBusinessTableDetail(row)
  486. }
  487. }
  488. function getProductTableList() {
  489. post(GETTABLELIST, { pageIndex: -1, pageSize: -1 }).then((res) => {
  490. if (res.code == 'ok') {
  491. const { record, total } = res.data
  492. productTableList.value = record.map((item: any) => {
  493. const { id, productName, productCode, unit, unitName, typeName, type, price, inventory } = item
  494. return {
  495. id,
  496. productId: id,
  497. productName,
  498. productCode,
  499. unit,
  500. unitName,
  501. price,
  502. type,
  503. typeName,
  504. inventory,
  505. quantity: '',
  506. discount: '',
  507. totalPrice: ''
  508. }
  509. })
  510. }
  511. })
  512. }
  513. onMounted(() => {
  514. getSystemField()
  515. getProductTableList()
  516. getBusinessTableList()
  517. })
  518. </script>
  519. <style lang="scss" scoped>
  520. .dialog-header {
  521. h4 {
  522. font-size: 18px;
  523. line-height: 24px;
  524. }
  525. }
  526. </style>