index.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720
  1. <template>
  2. <div class="pageIndexClass">
  3. <div class="content">
  4. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
  5. :statConfig="statConfig" :onMoreSearch="false" @moreSearch="clickMoreSearch" highlight-current-row :action-list="[
  6. {
  7. text: '新建',
  8. action: () => newContract(),
  9. },
  10. ]" @get-list="getList">
  11. <template #code="{ item }">
  12. <div style="width: 100%">
  13. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(item)">{{ item.code }}</a>
  14. </div>
  15. </template>
  16. <template #isSettled="{ item }">
  17. <div>
  18. <span style="padding: 4px" :class="[item.isSettled == 1 ? 'active' : '']">
  19. {{
  20. proxy.dictValueLabel(item.isSettled, isSettled)
  21. }}</span>
  22. </div>
  23. </template>
  24. <template #contractType="{ item }">
  25. <div style="width: 100%">
  26. <span>
  27. {{ dictKeyValue(item.contractType, contractType) }}
  28. </span>
  29. </div>
  30. </template>
  31. <template #produceStatus="{ item }">
  32. <div style="width: 100%">
  33. <span v-if="item.produceStatus==0 || item.produceStatus" :class="item.produceStatus==10?'tag-active':'tag-active-1'">
  34. {{ dictValueLabel(item.produceStatus, produceStatusData) }}</span>
  35. </div>
  36. </template>
  37. <template #amount="{ item }">
  38. <div>
  39. <span style="padding-right: 4px">{{ item.currency }}</span>
  40. <span>{{ moneyFormat(item.amount, 2) }}</span>
  41. </div>
  42. </template>
  43. <template #buyCorporationName="{ item }">
  44. <div style="width: 100%">
  45. <a style="color: #409eff; cursor: pointer" @click="clickCorporationName(item)">{{ item.buyCorporationName }}</a>
  46. </div>
  47. </template>
  48. <template #product="{item}">
  49. <div style="width: 100%">
  50. <el-popover placement="top-start" :width="400" trigger="hover" @show="onShowProductData(item)">
  51. <div style="display:flex;margin-bottom:20px;align-items:center" v-for="i in productData" :key="i.id">
  52. <div style="width:60px">
  53. <img :src="i.productImgUrl" alt="" class="pic" @click="handleClickFile(i.productImgUrl)">
  54. </div>
  55. <div style="width:calc(100% - 60px)">
  56. <div>产品编码:{{i.productCode}}</div>
  57. <div>产品名称:{{i.productName}}</div>
  58. <div>产品尺寸:{{i.productLength}}cm*{{i.productWidth}}cm*{{i.productHeight}}cm</div>
  59. <div>产品颜色:{{i.productColor}}</div>
  60. <div>产品数量:{{i.quantity}}</div>
  61. </div>
  62. </div>
  63. <template #reference>
  64. <div style="display:flex;height:65px;position:relative;top:15px">
  65. <div v-for="(product,index) in item.contractProductList" :key="product.id" style="margin-right:10px;position:relative;">
  66. <el-badge :value="product.quantity" :min="0" :max="999999" v-if="index<3">
  67. <img :src="product.productImgUrl" class="pic" @click="handleClickFile(product.productImgUrl)">
  68. </el-badge>
  69. <div v-if="index==3" class="more">
  70. 共{{item.contractProductList.length}}款
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. </el-popover>
  76. </div>
  77. </template>
  78. <template #deliveryTime="{ item }">
  79. <div style="width: 100%;display:flex;align-items:center">
  80. <el-icon v-if="item.orderDistributeStatus==1 && item.deliveryTime" :size="16" style="cursor:pointer;margin-right: 8px;" color="#409EFF"
  81. @click="clickDistributeProduction(item)">
  82. <Edit />
  83. </el-icon>
  84. <div v-if="item.deliveryTime">
  85. {{item.deliveryTime.slice(0,10)}}
  86. </div>
  87. </div>
  88. </template>
  89. <template #prodTag="{ item }">
  90. <div style="width: 100%;display:flex;align-items:center">
  91. <el-icon :size="16" style="cursor:pointer;margin-right: 8px;" color="#409EFF" @click="handleEditTag(item)">
  92. <Edit />
  93. </el-icon>
  94. <el-popover placement="top-start" :width="300" trigger="hover">
  95. <div>
  96. 备注:{{item.prodRemark}}
  97. </div>
  98. <template #reference>
  99. <div style="width:100%;display:inline-block">
  100. <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.prodTags" closable :key="index"
  101. @close="prodTagClose(index, item)">
  102. {{ dictKeyValue(tag, contractTag) }}
  103. </el-tag>
  104. </div>
  105. </template>
  106. </el-popover>
  107. </div>
  108. </template>
  109. <template #tags="{ item }">
  110. <div style="width: 100%">
  111. <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.tags" closable :key="index" @close="tagClose(tag, item)">
  112. {{ dictValueLabel(tag, customerTag) }}
  113. </el-tag>
  114. <template v-if="item.tags.length !== customerTag.length">
  115. <el-select v-if="item.addTagShow" v-model="addTag" style="width: 100%" @change="
  116. (val) => {
  117. return changeTag(val, item);
  118. }
  119. ">
  120. <el-option v-for="tag in customerTag" :key="tag.value" :label="tag.label" :value="tag.value"
  121. :disabled="judgeTagSelect(item.tags, tag.value)" />
  122. </el-select>
  123. <el-tag style="cursor: pointer" type="success" @click="showSelect(item)" v-else>
  124. +
  125. </el-tag>
  126. </template>
  127. </div>
  128. </template>
  129. <template #advanceRatio="{ item }">
  130. <div>
  131. <span>{{ moneyFormat(item.advanceRatio, 2) }}%</span>
  132. </div>
  133. </template>
  134. <template #scale="{ item }">
  135. <div>
  136. {{ computeScale(item) }}
  137. </div>
  138. </template>
  139. </byTable>
  140. </div>
  141. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="920">
  142. <ContractPDFOne :rowData="rowData"></ContractPDFOne>
  143. <!-- <ContractPDFOneNew :rowData="rowData" ref="PdfDom"></ContractPDFOneNew> -->
  144. <!-- <template #footer>
  145. <el-button @click="openPrint = false" size="default">取消</el-button>
  146. <el-button type="primary" v-print="printObj" size="default">打印</el-button>
  147. <el-button type="primary" @click="clickDownload()" size="default">下载PDF</el-button>
  148. <el-button type="primary" @click="exportExcel()" size="default">导出Excel</el-button>
  149. </template> -->
  150. </el-dialog>
  151. <el-dialog title="交接单" v-if="openHandoverSlip" v-model="openHandoverSlip" width="600">
  152. <byForm :formConfig="formConfig" :formOption="formOption" v-model="handoverSlipForm">
  153. <template #file>
  154. <div style="width: 100%">
  155. <el-upload v-model:fileList="handoverSlipForm.fileList" :action="uploadUrl" :data="uploadData" multiple :before-upload="uploadFile"
  156. :on-success="handleSuccess" :on-preview="onPreviewFile">
  157. <el-button type="primary" plain>选择</el-button>
  158. </el-upload>
  159. </div>
  160. </template>
  161. <template #indication>
  162. <div style="width: 100%">
  163. <el-upload v-model:fileList="handoverSlipForm.packageFileList" :action="uploadUrl" :data="indicationUploadData" multiple
  164. :before-upload="indicationUploadFile" :on-success="handleSuccess" :on-preview="onPreviewFile">
  165. <el-button type="primary" plain>选择</el-button>
  166. </el-upload>
  167. </div>
  168. </template>
  169. </byForm>
  170. <template #footer>
  171. <el-button @click="openHandoverSlip = false" size="default">关 闭</el-button>
  172. <el-button type="primary" @click="submitHandoverSlip()" size="default">确 定</el-button>
  173. </template>
  174. </el-dialog>
  175. <el-dialog title="合同详情" v-if="openDetailsDialog" v-model="openDetailsDialog" width="1100">
  176. <ContractDetails :contractId="currentContractId"></ContractDetails>
  177. </el-dialog>
  178. <el-dialog :title="`售后记录`" v-if="openRecords" v-model="openRecords" width="600">
  179. <div style="padding-left: 50px; margin-bottom: 20px">
  180. <el-button type="primary" plain @click="handleClickAddRecord()">添加记录</el-button>
  181. </div>
  182. <el-timeline>
  183. <el-timeline-item v-for="(activity, index) in recordsData" :key="index">
  184. <div style="
  185. width: 100%;
  186. display: flex;
  187. justify-content: space-between;
  188. color: #bfb9b9;
  189. ">
  190. <div>售后时间:{{ activity.documentaryTime }}</div>
  191. <div>{{ activity.userName }}</div>
  192. </div>
  193. <div style="width: 100%; margin-top: 8px">
  194. 售后记录:{{ activity.documentaryRemark }}
  195. </div>
  196. <div style="width: 100%; margin-top: 8px" v-if="activity.fileList && activity.fileList.length > 0">
  197. <div v-for="(item, index) in activity.fileList" :key="index">
  198. <div style="cursor: pointer; color: #409eff" @click="openFile(item)">
  199. {{ item.fileName }}
  200. </div>
  201. </div>
  202. </div>
  203. </el-timeline-item>
  204. </el-timeline>
  205. <template #footer>
  206. <el-button @click="openRecords = false" size="default">关 闭</el-button>
  207. </template>
  208. </el-dialog>
  209. <el-dialog :title="`添加售后记录`" v-if="openAddRecords" v-model="openAddRecords" width="600">
  210. <byForm :formConfig="recordsFormConfig" :formOption="formOption" v-model="formData.recordsFormData" :rules="recordsRules" ref="recordsForm"
  211. v-loading="formLoading">
  212. <template #file>
  213. <div style="width: 100%">
  214. <el-upload v-model:fileList="formData.recordsFormData.fileList" :action="uploadUrl" :data="uploadData" multiple
  215. :before-upload="uploadFile" :on-success="handleSuccess" :on-preview="onPreviewFile">
  216. <el-button type="primary" plain>选择</el-button>
  217. </el-upload>
  218. </div>
  219. </template>
  220. </byForm>
  221. <template #footer>
  222. <el-button @click="openAddRecords = false" size="default">关 闭</el-button>
  223. <el-button type="primary" @click="submitRecords()" size="default">确 定</el-button>
  224. </template>
  225. </el-dialog>
  226. <el-dialog :title="'高级检索'" v-model="moreSearchDialog" width="500px" destroy-on-close>
  227. <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
  228. </byForm>
  229. <template #footer>
  230. <el-button @click="moreSearchReset" size="default">重置</el-button>
  231. <el-button @click="moreSearchQuery" type="primary" size="default" v-debounce>搜索</el-button>
  232. </template>
  233. </el-dialog>
  234. <el-dialog :title="'生产'" v-model="productionDialog" width="700px" destroy-on-close>
  235. <byForm :formConfig="productionFormConfig" :formOption="formOption" v-model="formData.data" :rules="productionRules" ref="productionFormDom"
  236. v-loading="formLoading">
  237. </byForm>
  238. <template #footer>
  239. <el-button @click="productionDialog =false" size="default">取 消</el-button>
  240. <el-button @click="submitProduction" type="primary" size="default" v-debounce>下 发</el-button>
  241. </template>
  242. </el-dialog>
  243. <el-dialog :title="'生产指示'" v-model="tagDialog" width="700px" destroy-on-close>
  244. <byForm :formConfig="tagFormConfig" :formOption="formOption" v-model="formData.tagData" :rules="tagRules" ref="tagFormDom"
  245. v-loading="formLoading">
  246. </byForm>
  247. <template #footer>
  248. <el-button @click="tagDialog =false" size="default" v-debounce>取 消</el-button>
  249. <el-button @click="submitTag" type="primary" size="default" v-debounce>提 交</el-button>
  250. </template>
  251. </el-dialog>
  252. </div>
  253. </template>
  254. <script setup>
  255. import { computed, ref, watch } from "vue";
  256. import byTable from "@/components/byTable/index";
  257. import byForm from "@/components/byForm/index";
  258. import useUserStore from "@/store/modules/user";
  259. import { ElMessage, ElMessageBox } from "element-plus";
  260. import ContractDetails from "@/components/contractCom/contractDetails.vue";
  261. import ContractPDFOne from "@/components/PDF/contractPDFOne.vue";
  262. import ContractPDFOneNew from "@/components/PDF/contractPDFOneNew.vue";
  263. import $bus from "@/bus/index.js";
  264. import moment from "moment";
  265. const route = useRoute();
  266. const contractTag = computed(
  267. () => proxy.useUserStore().allDict["contract_prod_tag"]
  268. );
  269. const { proxy } = getCurrentInstance();
  270. const accountCurrency = ref([]);
  271. const tradeMethods = ref([]);
  272. const corporationList = ref([]);
  273. const customerList = ref([]);
  274. const userList = ref([]);
  275. const companyData = ref([]);
  276. const isSettled = ref([
  277. {
  278. label: "已结清",
  279. value: "1",
  280. },
  281. {
  282. label: "未结清",
  283. value: "0",
  284. },
  285. ]);
  286. const shippingMethod = ref([]);
  287. const customerTag = ref([]);
  288. const openDetailsDialog = ref(false);
  289. const produceStatusData = ref([
  290. {
  291. label: "未开始",
  292. value: "0",
  293. },
  294. {
  295. label: "生产中",
  296. value: "1",
  297. },
  298. {
  299. label: "生产完成",
  300. value: "2",
  301. },
  302. {
  303. label: "出库中",
  304. value: "5",
  305. },
  306. {
  307. label: "已出库",
  308. value: "10",
  309. },
  310. {
  311. label: "作废",
  312. value: "99",
  313. },
  314. ]);
  315. const status = ref([
  316. {
  317. label: "草稿",
  318. value: 0,
  319. },
  320. {
  321. label: "审批中",
  322. value: 10,
  323. },
  324. {
  325. label: "驳回",
  326. value: 20,
  327. },
  328. {
  329. label: "审批通过",
  330. value: 30,
  331. },
  332. {
  333. label: "变更中",
  334. value: 60,
  335. },
  336. {
  337. label: "已变更",
  338. value: 70,
  339. },
  340. {
  341. label: "作废",
  342. value: 88,
  343. },
  344. {
  345. label: "终止",
  346. value: 99,
  347. },
  348. ]);
  349. const contractType = ref([
  350. {
  351. dictKey: "3",
  352. dictValue: "打样订单",
  353. },
  354. {
  355. dictKey: "2",
  356. dictValue: "内销订单",
  357. },
  358. {
  359. dictKey: "1",
  360. dictValue: "外贸订单(退税)",
  361. },
  362. {
  363. dictKey: "4",
  364. dictValue: "外贸订单(不退税)",
  365. },
  366. ]);
  367. const belongTypeData = ref([
  368. {
  369. dictKey: "1",
  370. dictValue: "归属工厂",
  371. },
  372. {
  373. dictKey: "2",
  374. dictValue: "归属业务",
  375. },
  376. ]);
  377. const sourceList = ref({
  378. data: [],
  379. pagination: {
  380. total: 0,
  381. pageNum: 1,
  382. pageSize: 10,
  383. keyword: "",
  384. status: "",
  385. companyId: "",
  386. userId: "",
  387. isSettled: "",
  388. beginTime: "",
  389. endTime: "",
  390. deliveryTimeSta: "",
  391. deliveryTimeEnd: "",
  392. type: "",
  393. produceStatus: "",
  394. },
  395. });
  396. const loading = ref(false);
  397. const selectConfig = computed(() => {
  398. return [
  399. {
  400. label: "业务公司",
  401. prop: "ofCompanyId",
  402. data: proxy.useUserStore().allDict["list_company_data"],
  403. },
  404. {
  405. label: "订单类型",
  406. prop: "contractType",
  407. data: contractType.value,
  408. },
  409. {
  410. label: "审批状态",
  411. prop: "status",
  412. data: status.value,
  413. },
  414. {
  415. label: "工厂",
  416. prop: "companyId",
  417. data: companyData.value,
  418. },
  419. // {
  420. // label: "生产状态",
  421. // prop: "produceStatus",
  422. // data: produceStatusData.value,
  423. // },
  424. {
  425. label: "业务员",
  426. prop: "userId",
  427. data: userList.value,
  428. },
  429. {
  430. label: "是否已结清",
  431. prop: "isSettled",
  432. data: isSettled.value,
  433. },
  434. {
  435. type: "time",
  436. label: "创建时间",
  437. placeholder: "开始日期",
  438. prop: "beginTime",
  439. placeholderOne: "结束日期",
  440. propOne: "endTime",
  441. },
  442. {
  443. type: "time",
  444. label: "交期",
  445. placeholder: "开始日期",
  446. prop: "deliveryTimeSta",
  447. placeholderOne: "结束日期",
  448. propOne: "deliveryTimeEnd",
  449. },
  450. ];
  451. });
  452. const headerData = ref({});
  453. const statConfig = computed(() => [
  454. // {
  455. // label: "统计",
  456. // data: [
  457. // //一个卡牌多数据配置
  458. // {
  459. // label: "订单统计(CNY)",
  460. // type: 2,
  461. // data: [
  462. // {
  463. // label: "订单数",
  464. // num: headerData.value.count,
  465. // color: "#C280FF",
  466. // },
  467. // {
  468. // label: "客户数",
  469. // num: headerData.value.customerCount,
  470. // color: "#C280FF",
  471. // },
  472. // {
  473. // label: "订单金额",
  474. // num: proxy.moneyFormat(headerData.value.sumAmount, 2),
  475. // color: "#C280FF",
  476. // },
  477. // ],
  478. // },
  479. // {
  480. // label: "款项统计(CNY)",
  481. // type: 3,
  482. // data: [
  483. // {
  484. // label: "已收款",
  485. // num: proxy.moneyFormat(headerData.value.sumClaimMoney, 2),
  486. // color: "#FF9315",
  487. // },
  488. // {
  489. // label: "待收款",
  490. // num: proxy.moneyFormat(headerData.value.sumClaimMoneyOne, 2),
  491. // color: "#FF9315",
  492. // },
  493. // ],
  494. // },
  495. // ],
  496. // },
  497. ]);
  498. const config = computed(() => {
  499. return [
  500. {
  501. attrs: {
  502. label: "业务公司",
  503. prop: "ofCompanyName",
  504. width: 110,
  505. },
  506. },
  507. {
  508. attrs: {
  509. label: "业务部门",
  510. prop: "deptName",
  511. width: 110,
  512. },
  513. },
  514. {
  515. attrs: {
  516. label: "订单类型",
  517. slot: "contractType",
  518. width: 110,
  519. },
  520. },
  521. {
  522. attrs: {
  523. label: "合同号",
  524. slot: "code",
  525. width: 140,
  526. },
  527. },
  528. {
  529. attrs: {
  530. label: "工厂",
  531. prop: "companyName",
  532. width: 120,
  533. },
  534. },
  535. {
  536. attrs: {
  537. label: "订单归属",
  538. prop: "belongType",
  539. width: 80,
  540. },
  541. render(val) {
  542. return proxy.dictKeyValue(val, belongTypeData.value);
  543. },
  544. },
  545. {
  546. attrs: {
  547. label: "生产状态",
  548. // prop: "produceStatus",
  549. slot: "produceStatus",
  550. width: 100,
  551. },
  552. // render(val) {
  553. // return proxy.dictValueLabel(val, produceStatusData.value);
  554. // },
  555. },
  556. // {
  557. // attrs: {
  558. // label: "销售部门",
  559. // prop: "deptName",
  560. // width: 120,
  561. // },
  562. // },
  563. {
  564. attrs: {
  565. label: "业务员",
  566. prop: "salesmanName",
  567. width: 100,
  568. },
  569. // render(type) {
  570. // return proxy.dictValueLabel(type, userList.value);
  571. // },
  572. },
  573. {
  574. attrs: {
  575. label: "下单时间",
  576. prop: "createTime",
  577. width: 160,
  578. },
  579. },
  580. {
  581. attrs: {
  582. label: "交期",
  583. slot: "deliveryTime",
  584. width: 130,
  585. },
  586. },
  587. {
  588. attrs: {
  589. label: "下发生产时间",
  590. prop: "orderDistributeTime",
  591. width: 160,
  592. },
  593. },
  594. {
  595. attrs: {
  596. label: "合同金额",
  597. slot: "amount",
  598. width: 140,
  599. align: "right",
  600. },
  601. },
  602. {
  603. attrs: {
  604. label: "生产指示",
  605. slot: "prodTag",
  606. "min-width": 240,
  607. },
  608. },
  609. {
  610. attrs: {
  611. label: "客户名称",
  612. slot: "buyCorporationName",
  613. "min-width": 180,
  614. },
  615. },
  616. {
  617. attrs: {
  618. label: "商品数据",
  619. slot: "product",
  620. "min-width": 240,
  621. },
  622. },
  623. // {
  624. // attrs: {
  625. // label: "客户标签",
  626. // slot: "tags",
  627. // width: 180,
  628. // },
  629. // },
  630. {
  631. attrs: {
  632. label: "已出库数量",
  633. prop: "aa",
  634. width: 100,
  635. },
  636. },
  637. {
  638. attrs: {
  639. label: "待出库数量",
  640. prop: "bb",
  641. width: 100,
  642. },
  643. },
  644. {
  645. attrs: {
  646. label: "是否已结清",
  647. slot: "isSettled",
  648. width: 100,
  649. },
  650. // render(type) {
  651. // return proxy.dictValueLabel(type, isSettled.value);
  652. // },
  653. },
  654. {
  655. attrs: {
  656. label: "预付比例",
  657. slot: "advanceRatio",
  658. width: 100,
  659. align: "right",
  660. },
  661. },
  662. {
  663. attrs: {
  664. label: "已收款金额",
  665. prop: "sumClaimMoney",
  666. width: 100,
  667. align: "right",
  668. },
  669. },
  670. // {
  671. // attrs: {
  672. // label: "汇率",
  673. // prop: "rate",
  674. // width: 80,
  675. // align: "right",
  676. // },
  677. // render(rate) {
  678. // return proxy.moneyFormat(rate, 4);
  679. // },
  680. // },
  681. // {
  682. // attrs: {
  683. // label: "合同金额(CNY)",
  684. // prop: "amountCNY",
  685. // width: 160,
  686. // align: "right",
  687. // },
  688. // render(amountCNY) {
  689. // return proxy.moneyFormat(amountCNY, 2);
  690. // },
  691. // },
  692. // {
  693. // attrs: {
  694. // label: "到账金额(CNY)",
  695. // prop: "sumClaimMoney",
  696. // width: 160,
  697. // align: "right",
  698. // },
  699. // render(sumClaimMoney) {
  700. // return proxy.moneyFormat(sumClaimMoney, 2);
  701. // },
  702. // },
  703. // {
  704. // attrs: {
  705. // label: "到账比例",
  706. // slot: "scale",
  707. // width: 100,
  708. // align: "right",
  709. // },
  710. // },
  711. {
  712. attrs: {
  713. label: "审批状态",
  714. prop: "status",
  715. width: 100,
  716. },
  717. render(type) {
  718. return proxy.dictValueLabel(type, status.value);
  719. },
  720. },
  721. {
  722. attrs: {
  723. label: "操作",
  724. width: 200,
  725. align: "center",
  726. fixed: "right",
  727. },
  728. renderHTML(row) {
  729. return [
  730. row.status == 30 &&
  731. (row.orderDistributeStatus == 0 || row.orderDistributeStatus == 2)
  732. ? {
  733. attrs: {
  734. label: "生产",
  735. type: "danger",
  736. text: true,
  737. },
  738. el: "button",
  739. click() {
  740. clickDistributeProduction(row);
  741. },
  742. }
  743. : {},
  744. route.query.pageType == "1"
  745. ? {
  746. attrs: {
  747. label: "转销售订单",
  748. type: "primary",
  749. text: true,
  750. },
  751. el: "button",
  752. click() {
  753. trunContract(row);
  754. },
  755. }
  756. : {},
  757. // row.status == 30 &&
  758. // row.outboundStatus == 0 &&
  759. // row.produceStatus == 2
  760. // ? {
  761. // attrs: {
  762. // label: "销售出库",
  763. // type: "primary",
  764. // text: true,
  765. // },
  766. // el: "button",
  767. // click() {
  768. // proxy
  769. // .msgConfirm()
  770. // .then((res) => {
  771. // proxy
  772. // .post("/contract/saleOutbound", {
  773. // id: row.id,
  774. // })
  775. // .then((res) => {
  776. // proxy.msgTip("操作成功", 1);
  777. // getList();
  778. // });
  779. // })
  780. // .catch((err) => {});
  781. // },
  782. // }
  783. // : {},
  784. row.status == 30 && row.produceStatus != 10
  785. ? {
  786. attrs: {
  787. label: "变更",
  788. type: "primary",
  789. text: true,
  790. },
  791. el: "button",
  792. click() {
  793. clickAlteration(row);
  794. },
  795. }
  796. : {},
  797. row.status == 30
  798. ? {
  799. attrs: {
  800. label: "打印",
  801. type: "primary",
  802. text: true,
  803. },
  804. el: "button",
  805. click() {
  806. clickPrint(row);
  807. },
  808. }
  809. : {},
  810. // row.orderDistributeStatus == 1
  811. // ? {}
  812. // :
  813. (row.status == 10 ||
  814. (row.status == 30 && Number(row.sumClaimMoney) == 0)) &&
  815. (row.produceStatus == 0 || row.produceStatus == null)
  816. ? {
  817. attrs: {
  818. label: "作废",
  819. type: "danger",
  820. text: true,
  821. },
  822. el: "button",
  823. click() {
  824. proxy
  825. .msgConfirm()
  826. .then((res) => {
  827. proxy
  828. .post("/contract/cancellation", {
  829. id: row.id,
  830. })
  831. .then((res) => {
  832. proxy.msgTip("操作成功", 1);
  833. getList();
  834. });
  835. })
  836. .catch((err) => {});
  837. },
  838. }
  839. : {},
  840. row.status == 30 && row.isSettled == "0"
  841. ? {
  842. attrs: {
  843. label: "结清",
  844. type: "primary",
  845. text: true,
  846. },
  847. el: "button",
  848. click() {
  849. ElMessageBox.confirm("是否确认结清?", "提示", {
  850. confirmButtonText: "确定",
  851. cancelButtonText: "取消",
  852. type: "warning",
  853. }).then(() => {
  854. proxy
  855. .post("/contract/settle", {
  856. id: row.id,
  857. })
  858. .then(() => {
  859. ElMessage({
  860. message: "操作成功",
  861. type: "success",
  862. });
  863. getList();
  864. });
  865. });
  866. },
  867. }
  868. : {},
  869. // {
  870. // attrs: {
  871. // label: "生产指示",
  872. // type: "primary",
  873. // text: true,
  874. // },
  875. // el: "button",
  876. // click() {
  877. // handleEditTag(row);
  878. // },
  879. // },
  880. row.isSettled == "1"
  881. ? {
  882. attrs: {
  883. label: "售后",
  884. type: "primary",
  885. text: true,
  886. },
  887. el: "button",
  888. click() {
  889. openRecords.value = true;
  890. getRecordsData(row);
  891. },
  892. }
  893. : {},
  894. ];
  895. },
  896. },
  897. ];
  898. });
  899. const getDict = () => {
  900. // proxy
  901. // .getDictOne([
  902. // "customer_tag",
  903. // "trade_mode",
  904. // "account_currency",
  905. // "shipping_method",
  906. // ])
  907. // .then((res) => {
  908. // customerTag.value = res["customer_tag"].map((x) => ({
  909. // label: x.dictValue,
  910. // value: x.dictKey,
  911. // }));
  912. // tradeMethods.value = res["trade_mode"].map((x) => ({
  913. // label: x.dictValue,
  914. // value: x.dictKey,
  915. // }));
  916. // accountCurrency.value = res["account_currency"].map((x) => ({
  917. // label: x.dictValue,
  918. // value: x.dictKey,
  919. // }));
  920. // shippingMethod.value = res["shipping_method"].map((x) => ({
  921. // label: x.dictValue,
  922. // value: x.dictKey,
  923. // }));
  924. // });
  925. // proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  926. // corporationList.value = res.rows.map((item) => {
  927. // return {
  928. // ...item,
  929. // label: item.name,
  930. // value: item.id,
  931. // };
  932. // });
  933. // });
  934. proxy
  935. .get("/tenantDept/list", {
  936. pageNum: 1,
  937. pageSize: 9999,
  938. keyword: "",
  939. tenantId: proxy.useUserStore().user.tenantId,
  940. type: 0,
  941. })
  942. .then((res) => {
  943. companyData.value = res.data.map((x) => ({
  944. ...x,
  945. label: x.deptName,
  946. value: x.deptId,
  947. }));
  948. });
  949. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  950. customerList.value = res.rows.map((item) => {
  951. return {
  952. ...item,
  953. label: item.name,
  954. value: item.id,
  955. };
  956. });
  957. });
  958. proxy
  959. .get("/tenantUser/list", {
  960. pageNum: 1,
  961. pageSize: 10000,
  962. tenantId: proxy.useUserStore().user.tenantId,
  963. // companyId: proxy.useUserStore().user.companyId,
  964. })
  965. .then((res) => {
  966. userList.value = res.rows.map((item) => {
  967. return {
  968. label: item.nickName,
  969. value: item.userId,
  970. };
  971. });
  972. });
  973. };
  974. const getList = async (req) => {
  975. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  976. loading.value = true;
  977. proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
  978. res.rows.forEach((x) => {
  979. // x.addTagShow = false;
  980. // if (x.tag) {
  981. // x.tags = x.tag.split(",");
  982. // } else {
  983. // x.tags = [];
  984. // }
  985. if (x.prodTag) {
  986. x.prodTags = x.prodTag.split(",");
  987. } else {
  988. x.prodTags = [];
  989. }
  990. });
  991. sourceList.value.data = res.rows;
  992. sourceList.value.pagination.total = res.total;
  993. setTimeout(() => {
  994. loading.value = false;
  995. }, 200);
  996. });
  997. // proxy
  998. // .post("/contract/getHeadStatistic", sourceList.value.pagination)
  999. // .then((res) => {
  1000. // headerData.value = res;
  1001. // if (headerData.value) {
  1002. // headerData.value.sumClaimMoneyOne = parseFloat(
  1003. // Number(headerData.value.sumAmount) -
  1004. // Number(headerData.value.sumClaimMoney)
  1005. // ).toFixed(2);
  1006. // }
  1007. // });
  1008. };
  1009. getDict();
  1010. if (route.query.code) {
  1011. sourceList.value.pagination.keyword = route.query.code;
  1012. }
  1013. getList();
  1014. const newContract = () => {
  1015. // let flowKey = route.query.pageType == "1" ? "sample_flow" : "contract_flow" ;
  1016. let flowKey = "contract_flow";
  1017. proxy.$router.replace({
  1018. path: "/platform_manage/process/processApproval",
  1019. query: {
  1020. flowKey: flowKey,
  1021. flowName: "订单流程",
  1022. random: proxy.random(),
  1023. },
  1024. });
  1025. };
  1026. const openPrint = ref(false);
  1027. const rowData = ref({});
  1028. const clickPrint = (row) => {
  1029. rowData.value = {
  1030. id: row.id,
  1031. };
  1032. openPrint.value = true;
  1033. };
  1034. const clickDownload = () => {
  1035. proxy.getPdf("外销合同PDF文件");
  1036. };
  1037. const openHandoverSlip = ref(false);
  1038. const handoverSlipForm = ref({
  1039. id: "",
  1040. code: "",
  1041. buyCorporationName: "",
  1042. fileList: [],
  1043. packageFileList: [],
  1044. });
  1045. const formOption = reactive({
  1046. inline: true,
  1047. labelWidth: 100,
  1048. itemWidth: 100,
  1049. rules: [],
  1050. });
  1051. const formConfig = computed(() => {
  1052. return [
  1053. {
  1054. type: "input",
  1055. prop: "code",
  1056. label: "合同编号",
  1057. itemType: "text",
  1058. disabled: true,
  1059. },
  1060. {
  1061. type: "input",
  1062. prop: "buyCorporationName",
  1063. label: "客户名称",
  1064. itemType: "text",
  1065. disabled: true,
  1066. },
  1067. {
  1068. type: "slot",
  1069. slotName: "file",
  1070. label: "交接单",
  1071. },
  1072. {
  1073. type: "slot",
  1074. slotName: "indication",
  1075. label: "包装指示",
  1076. },
  1077. ];
  1078. });
  1079. const uploadData = ref({});
  1080. const indicationUploadData = ref({});
  1081. const clickHandoverSlip = (item) => {
  1082. handoverSlipForm.value.id = item.id;
  1083. handoverSlipForm.value.code = item.code;
  1084. handoverSlipForm.value.buyCorporationName = item.buyCorporationName;
  1085. if (item.fileInfoVos && item.fileInfoVos.length > 0) {
  1086. handoverSlipForm.value.fileList = item.fileInfoVos.map((item) => {
  1087. return {
  1088. raw: item,
  1089. name: item.fileName,
  1090. url: item.fileUrl,
  1091. };
  1092. });
  1093. } else {
  1094. handoverSlipForm.value.fileList = [];
  1095. }
  1096. if (item.packageFileInfoVOList && item.packageFileInfoVOList.length > 0) {
  1097. handoverSlipForm.value.packageFileList = item.packageFileInfoVOList.map(
  1098. (item) => {
  1099. return {
  1100. raw: item,
  1101. name: item.fileName,
  1102. url: item.fileUrl,
  1103. };
  1104. }
  1105. );
  1106. } else {
  1107. handoverSlipForm.value.packageFileList = [];
  1108. }
  1109. openHandoverSlip.value = true;
  1110. };
  1111. const uploadFile = async (file) => {
  1112. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1113. uploadData.value = res.uploadBody;
  1114. file.id = res.id;
  1115. file.fileName = res.fileName;
  1116. file.fileUrl = res.fileUrl;
  1117. file.uploadState = true;
  1118. return true;
  1119. };
  1120. const indicationUploadFile = async (file) => {
  1121. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1122. indicationUploadData.value = res.uploadBody;
  1123. file.id = res.id;
  1124. file.fileName = res.fileName;
  1125. file.fileUrl = res.fileUrl;
  1126. file.uploadState = true;
  1127. return true;
  1128. };
  1129. const handleSuccess = (any, UploadFile) => {
  1130. UploadFile.raw.uploadState = false;
  1131. };
  1132. const onPreviewFile = (file) => {
  1133. window.open(file.raw.fileUrl, "_blank");
  1134. };
  1135. const submitHandoverSlip = () => {
  1136. if (
  1137. handoverSlipForm.value.fileList &&
  1138. handoverSlipForm.value.fileList.length > 0
  1139. ) {
  1140. for (let i = 0; i < handoverSlipForm.value.fileList.length; i++) {
  1141. if (handoverSlipForm.value.fileList[i].raw.uploadState) {
  1142. return ElMessage("文件上传中,请稍后提交");
  1143. }
  1144. }
  1145. }
  1146. if (
  1147. handoverSlipForm.value.packageFileList &&
  1148. handoverSlipForm.value.packageFileList.length > 0
  1149. ) {
  1150. for (let i = 0; i < handoverSlipForm.value.packageFileList.length; i++) {
  1151. if (handoverSlipForm.value.packageFileList[i].raw.uploadState) {
  1152. return ElMessage("文件上传中,请稍后提交");
  1153. }
  1154. }
  1155. }
  1156. let data = proxy.deepClone(handoverSlipForm.value);
  1157. if (data.fileList && data.fileList.length > 0) {
  1158. data.fileList = data.fileList.map((item) => {
  1159. return {
  1160. id: item.raw.id,
  1161. fileName: item.raw.fileName,
  1162. fileUrl: item.raw.fileUrl,
  1163. };
  1164. });
  1165. } else {
  1166. data.fileList = [];
  1167. }
  1168. if (data.packageFileList && data.packageFileList.length > 0) {
  1169. data.packageFileList = data.packageFileList.map((item) => {
  1170. return {
  1171. id: item.raw.id,
  1172. fileName: item.raw.fileName,
  1173. fileUrl: item.raw.fileUrl,
  1174. };
  1175. });
  1176. } else {
  1177. data.packageFileList = [];
  1178. }
  1179. proxy.post("/contract/contractHandover", data).then(() => {
  1180. ElMessage({
  1181. message: "操作成功!",
  1182. type: "success",
  1183. });
  1184. openHandoverSlip.value = false;
  1185. getList();
  1186. });
  1187. };
  1188. const addTag = ref("");
  1189. const judgeTagSelect = (data, val) => {
  1190. if (data && data.length > 0) {
  1191. if (data.includes(val)) {
  1192. return true;
  1193. }
  1194. }
  1195. return false;
  1196. };
  1197. const changeTag = (val, item) => {
  1198. let data = {
  1199. id: item.buyCorporationId,
  1200. tag: proxy.deepClone(item.tags),
  1201. };
  1202. data.tag.push(val);
  1203. data.tag = data.tag.join(",");
  1204. proxy.post("/customer/editTag", data).then(() => {
  1205. ElMessage({
  1206. message: "添加成功",
  1207. type: "success",
  1208. });
  1209. item.addTagShow = false;
  1210. addTag.value = "";
  1211. getList();
  1212. });
  1213. };
  1214. const tagClose = (val, item) => {
  1215. let data = {
  1216. id: item.buyCorporationId,
  1217. tag: proxy.deepClone(item.tags),
  1218. };
  1219. data.tag = data.tag.filter((row) => row !== val);
  1220. if (data.tag && data.tag.length > 0) {
  1221. data.tag = data.tag.join(",");
  1222. } else {
  1223. data.tag = "";
  1224. }
  1225. proxy.post("/customer/editTag", data).then(() => {
  1226. ElMessage({
  1227. message: "删除成功",
  1228. type: "success",
  1229. });
  1230. item.addTagShow = false;
  1231. addTag.value = "";
  1232. getList();
  1233. });
  1234. };
  1235. const showSelect = (item) => {
  1236. item.addTagShow = true;
  1237. };
  1238. const currentContractId = ref("");
  1239. const openDetails = (row) => {
  1240. // currentContractId.value = row.id;
  1241. // openDetailsDialog.value = true;
  1242. // 新页面打开方式
  1243. // const page = proxy.$router.resolve({
  1244. // name: "contractDetails",
  1245. // query: {
  1246. // currentContractId: row.id,
  1247. // },
  1248. // });
  1249. // window.open(page.href, "_blank");
  1250. proxy.$router.push({
  1251. name: "contractDetails",
  1252. query: {
  1253. currentContractId: row.id,
  1254. },
  1255. });
  1256. };
  1257. const computeScale = (item) => {
  1258. let text = 0;
  1259. if (
  1260. item.sumClaimMoney &&
  1261. Number(item.sumClaimMoney) > 0 &&
  1262. item.amountCNY &&
  1263. Number(item.amountCNY) > 0
  1264. ) {
  1265. text = parseFloat(
  1266. (Number(item.sumClaimMoney) / Number(item.amountCNY)) * 100
  1267. ).toFixed(2);
  1268. }
  1269. return text + "%";
  1270. };
  1271. const clickCorporationName = (row) => {
  1272. proxy.$router.push({
  1273. name: "Portrait",
  1274. query: {
  1275. id: row.buyCorporationId,
  1276. },
  1277. });
  1278. };
  1279. const printObj = ref({
  1280. id: "pdfDom",
  1281. popTitle: "",
  1282. extraCss:
  1283. "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
  1284. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  1285. });
  1286. const clickAlteration = (row) => {
  1287. // let flowKey =
  1288. // route.query.pageType == "1" ? "sample_update_flow" : "contract_update_flow";
  1289. let flowKey = "contract_update_flow";
  1290. proxy.$router.push({
  1291. path: "/platform_manage/process/processApproval",
  1292. query: {
  1293. flowKey: flowKey,
  1294. flowName: "订单变更流程",
  1295. random: proxy.random(),
  1296. businessId: row.id,
  1297. },
  1298. });
  1299. };
  1300. const PdfDom = ref(null);
  1301. const exportExcel = () => {
  1302. PdfDom.value.exportExcel();
  1303. };
  1304. const formData = reactive({
  1305. recordsFormData: {},
  1306. data: {},
  1307. tagData: {},
  1308. });
  1309. const formLoading = ref(false);
  1310. const openRecords = ref(false);
  1311. const openAddRecords = ref(false);
  1312. const recordsLoading = ref(false);
  1313. const recordsData = ref([]);
  1314. const recordsForm = ref(null);
  1315. const rowContractData = ref({});
  1316. const recordsFormConfig = computed(() => [
  1317. {
  1318. type: "date",
  1319. itemType: "datetime",
  1320. prop: "documentaryTime",
  1321. label: "售后时间",
  1322. disabled: false,
  1323. },
  1324. {
  1325. type: "input",
  1326. prop: "documentaryRemark",
  1327. label: "售后记录",
  1328. itemType: "textarea",
  1329. disabled: false,
  1330. },
  1331. {
  1332. type: "slot",
  1333. slotName: "file",
  1334. label: "上传附件",
  1335. },
  1336. ]);
  1337. const recordsRules = ref({
  1338. documentaryTime: [
  1339. { required: true, message: "请选择售后时间", trigger: "change" },
  1340. ],
  1341. documentaryRemark: [
  1342. { required: true, message: "请输入售后记录", trigger: "blur" },
  1343. ],
  1344. });
  1345. const getRecordsData = (row) => {
  1346. if (row && row.id) {
  1347. rowContractData.value = row;
  1348. }
  1349. proxy
  1350. .post("/contractDocumentary/page", {
  1351. businessId: rowContractData.value.id,
  1352. documentaryType: "-2",
  1353. })
  1354. .then((res) => {
  1355. recordsData.value = res.rows;
  1356. const idList = recordsData.value.map((x) => x.id);
  1357. // 请求文件数据并回显
  1358. if (idList.length > 0) {
  1359. proxy
  1360. .post("/fileInfo/getList", {
  1361. businessIdList: idList,
  1362. })
  1363. .then((fileObj) => {
  1364. if (fileObj) {
  1365. for (let i = 0; i < recordsData.value.length; i++) {
  1366. const e = recordsData.value[i];
  1367. for (const key in fileObj) {
  1368. if (e.id === key) {
  1369. e.fileList = fileObj[key];
  1370. }
  1371. }
  1372. }
  1373. }
  1374. });
  1375. }
  1376. });
  1377. };
  1378. const handleClickAddRecord = () => {
  1379. formData.recordsFormData = {
  1380. businessId: rowContractData.value.id,
  1381. businessType: "0",
  1382. documentaryType: "-2",
  1383. documentaryTime: proxy.parseTime(new Date()),
  1384. documentaryRemark: "",
  1385. fileList: [],
  1386. };
  1387. openAddRecords.value = true;
  1388. };
  1389. const submitRecords = () => {
  1390. recordsForm.value.handleSubmit(() => {
  1391. formLoading.value = true;
  1392. formData.recordsFormData.fileList = formData.recordsFormData.fileList.map(
  1393. (item) => {
  1394. return {
  1395. id: item.raw.id,
  1396. fileName: item.raw.fileName,
  1397. fileUrl: item.raw.fileUrl,
  1398. uploadState: item.raw.uploadState,
  1399. };
  1400. }
  1401. );
  1402. proxy
  1403. .post("/contractDocumentary/add", formData.recordsFormData)
  1404. .then((res) => {
  1405. ElMessage({
  1406. message: "操作成功",
  1407. type: "success",
  1408. });
  1409. formLoading.value = false;
  1410. openAddRecords.value = false;
  1411. getRecordsData();
  1412. });
  1413. });
  1414. };
  1415. const openFile = (item) => {
  1416. window.open(item.fileUrl, "_blank");
  1417. };
  1418. const formSearchConfig = computed(() => {
  1419. return [
  1420. {
  1421. type: "select",
  1422. label: "审批状态",
  1423. prop: "status",
  1424. itemWidth: 50,
  1425. data: status.value,
  1426. clearable: true,
  1427. },
  1428. {
  1429. type: "select",
  1430. label: "工厂",
  1431. prop: "companyId",
  1432. itemWidth: 50,
  1433. data: companyData.value,
  1434. clearable: true,
  1435. },
  1436. {
  1437. type: "select",
  1438. label: "业务员",
  1439. prop: "userId",
  1440. data: userList.value,
  1441. clearable: true,
  1442. },
  1443. {
  1444. type: "date",
  1445. itemType: "datetime",
  1446. label: "合同时间",
  1447. prop: "beginTime",
  1448. placeholder: "合同开始时间",
  1449. itemWidth: 50,
  1450. clearable: true,
  1451. },
  1452. {
  1453. type: "date",
  1454. itemType: "datetime",
  1455. label: " ",
  1456. prop: "endTime",
  1457. placeholder: "合同结束时间",
  1458. itemWidth: 50,
  1459. clearable: true,
  1460. },
  1461. ];
  1462. });
  1463. const moreSearchDialog = ref(false);
  1464. const clickMoreSearch = () => {
  1465. moreSearchDialog.value = true;
  1466. };
  1467. const moreSearchQuery = () => {
  1468. moreSearchDialog.value = false;
  1469. getList();
  1470. };
  1471. const moreSearchReset = () => {
  1472. sourceList.value.pagination = {
  1473. total: 0,
  1474. pageNum: sourceList.value.pagination.pageNum,
  1475. pageSize: sourceList.value.pagination.pageSize,
  1476. keyword: "",
  1477. status: "",
  1478. sellCorporationId: "",
  1479. beginTime: "",
  1480. endTime: "",
  1481. };
  1482. moreSearchQuery();
  1483. };
  1484. const productionFormDom = ref(null);
  1485. const productionDialog = ref(false);
  1486. const productionFormConfig = computed(() => [
  1487. {
  1488. type: "treeSelect",
  1489. prop: "produceCompanyId",
  1490. label: "工厂",
  1491. data: companyData.value,
  1492. propsTreeLabel: "deptName",
  1493. propsTreeValue: "deptId",
  1494. itemWidth: 100,
  1495. disabled: true,
  1496. },
  1497. {
  1498. type: "input",
  1499. itemType: "textarea",
  1500. label: "驳回原因",
  1501. prop: "rejectRemark",
  1502. itemWidth: 100,
  1503. isShow: formData.data.rejectRemark ? true : false,
  1504. disabled: true,
  1505. },
  1506. {
  1507. type: "date",
  1508. itemType: "datet",
  1509. label: "交期",
  1510. prop: "deliveryPeriod",
  1511. // placeholder: "合同开始时间",
  1512. itemWidth: 100,
  1513. disabledFn: (date) => {
  1514. return moment(date).isBefore(moment());
  1515. },
  1516. clearable: true,
  1517. },
  1518. ]);
  1519. const productionRules = ref({
  1520. produceCompanyId: [
  1521. { required: true, message: "请选择生产公司", trigger: "change" },
  1522. ],
  1523. deliveryPeriod: [
  1524. { required: true, message: "请选择交期", trigger: "change" },
  1525. ],
  1526. });
  1527. const clickDistributeProduction = (row) => {
  1528. formData.data = {
  1529. contractId: row.id,
  1530. deliveryPeriod: "",
  1531. produceCompanyId: row.companyId,
  1532. rejectRemark: row.rejectRemark,
  1533. orderDistributeStatus: row.orderDistributeStatus,
  1534. };
  1535. productionDialog.value = true;
  1536. };
  1537. const submitProduction = () => {
  1538. productionFormDom.value.handleSubmit(() => {
  1539. let url =
  1540. formData.data.orderDistributeStatus == 1
  1541. ? "/produceOrder/editDeliveryPeriod"
  1542. : "/produceOrder/createOrder";
  1543. formLoading.value = true;
  1544. proxy.post(url, formData.data).then((res) => {
  1545. proxy.msgTip("操作成功");
  1546. formLoading.value = false;
  1547. productionDialog.value = false;
  1548. getList();
  1549. });
  1550. });
  1551. };
  1552. const handleEditTag = (row) => {
  1553. formData.tagData = {
  1554. id: row.id,
  1555. prodTag: row.prodTags,
  1556. };
  1557. tagDialog.value = true;
  1558. };
  1559. const tagFormDom = ref(null);
  1560. const tagDialog = ref(false);
  1561. const tagFormConfig = computed(() => [
  1562. {
  1563. type: "select",
  1564. prop: "prodTag",
  1565. label: "生产指示",
  1566. multiple: true,
  1567. data: contractTag.value,
  1568. itemWidth: 100,
  1569. },
  1570. {
  1571. type: "input",
  1572. prop: "prodRemark",
  1573. itemType: "textarea",
  1574. label: "备注",
  1575. itemWidth: 100,
  1576. },
  1577. ]);
  1578. const tagRules = ref({
  1579. prodTag: [{ required: true, message: "请选择生产指示", trigger: "change" }],
  1580. });
  1581. const submitTag = () => {
  1582. tagFormDom.value.handleSubmit(() => {
  1583. const data = {
  1584. id: formData.tagData.id,
  1585. prodTag: formData.tagData.prodTag.join(","),
  1586. prodRemark: formData.tagData.prodRemark,
  1587. };
  1588. formLoading.value = true;
  1589. proxy.post("/contract/updateProductionTag", data).then((res) => {
  1590. proxy.msgTip("操作成功");
  1591. formLoading.value = false;
  1592. tagDialog.value = false;
  1593. getList();
  1594. });
  1595. });
  1596. };
  1597. const prodTagClose = (index, row) => {
  1598. row.prodTags.splice(index, 1);
  1599. proxy
  1600. .post("/contract/updateProductionTag", {
  1601. id: row.id,
  1602. prodTag: row.prodTags.join(","),
  1603. })
  1604. .then((res) => {});
  1605. };
  1606. const handleClickFile = (fileUrl) => {
  1607. window.open(fileUrl, "_blank");
  1608. };
  1609. const productData = ref([]);
  1610. const onShowProductData = (item) => {
  1611. productData.value = item.contractProductList;
  1612. };
  1613. onMounted(() => {
  1614. $bus.on("refreshTableData", () => {
  1615. getList();
  1616. });
  1617. });
  1618. onBeforeUnmount(() => {
  1619. // 取消订阅特定事件
  1620. $bus.off("refreshTableData");
  1621. });
  1622. const trunContract = (row) => {
  1623. proxy.$router.replace({
  1624. path: "/platform_manage/process/processApproval",
  1625. query: {
  1626. flowKey: "contract_flow",
  1627. flowName: "转销售订单",
  1628. random: proxy.random(),
  1629. businessId: row.id,
  1630. },
  1631. });
  1632. };
  1633. </script>
  1634. <style lang="scss" scoped>
  1635. .tenant {
  1636. padding: 20px;
  1637. }
  1638. ::v-deep(.el-input-number .el-input__inner) {
  1639. text-align: left;
  1640. }
  1641. .baseRow {
  1642. min-height: 24px;
  1643. border-top: 1px solid black;
  1644. border-left: 1px solid black;
  1645. }
  1646. .contentRow {
  1647. border-right: 1px solid black;
  1648. line-height: 24px;
  1649. padding-left: 4px;
  1650. }
  1651. .active {
  1652. background: #a6dd82;
  1653. color: #fff;
  1654. border-radius: 4px;
  1655. }
  1656. .more {
  1657. position: absolute;
  1658. left: -60px;
  1659. background: rgba(0, 0, 0, 0.8);
  1660. color: #fff;
  1661. opacity: 0.5;
  1662. height: 65px;
  1663. padding-top: 8px;
  1664. width: 50px;
  1665. border-radius: 3px;
  1666. text-align: center;
  1667. cursor: pointer;
  1668. pointer-events: none;
  1669. }
  1670. </style>