index.vue 23 KB

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