index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706
  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. slot: "isSettled",
  634. width: 100,
  635. },
  636. // render(type) {
  637. // return proxy.dictValueLabel(type, isSettled.value);
  638. // },
  639. },
  640. {
  641. attrs: {
  642. label: "预付比例",
  643. slot: "advanceRatio",
  644. width: 100,
  645. align: "right",
  646. },
  647. },
  648. {
  649. attrs: {
  650. label: "已收款金额",
  651. prop: "sumClaimMoney",
  652. width: 100,
  653. align: "right",
  654. },
  655. },
  656. // {
  657. // attrs: {
  658. // label: "汇率",
  659. // prop: "rate",
  660. // width: 80,
  661. // align: "right",
  662. // },
  663. // render(rate) {
  664. // return proxy.moneyFormat(rate, 4);
  665. // },
  666. // },
  667. // {
  668. // attrs: {
  669. // label: "合同金额(CNY)",
  670. // prop: "amountCNY",
  671. // width: 160,
  672. // align: "right",
  673. // },
  674. // render(amountCNY) {
  675. // return proxy.moneyFormat(amountCNY, 2);
  676. // },
  677. // },
  678. // {
  679. // attrs: {
  680. // label: "到账金额(CNY)",
  681. // prop: "sumClaimMoney",
  682. // width: 160,
  683. // align: "right",
  684. // },
  685. // render(sumClaimMoney) {
  686. // return proxy.moneyFormat(sumClaimMoney, 2);
  687. // },
  688. // },
  689. // {
  690. // attrs: {
  691. // label: "到账比例",
  692. // slot: "scale",
  693. // width: 100,
  694. // align: "right",
  695. // },
  696. // },
  697. {
  698. attrs: {
  699. label: "审批状态",
  700. prop: "status",
  701. width: 100,
  702. },
  703. render(type) {
  704. return proxy.dictValueLabel(type, status.value);
  705. },
  706. },
  707. {
  708. attrs: {
  709. label: "操作",
  710. width: 200,
  711. align: "center",
  712. fixed: "right",
  713. },
  714. renderHTML(row) {
  715. return [
  716. row.status == 30 &&
  717. (row.orderDistributeStatus == 0 || row.orderDistributeStatus == 2)
  718. ? {
  719. attrs: {
  720. label: "生产",
  721. type: "danger",
  722. text: true,
  723. },
  724. el: "button",
  725. click() {
  726. clickDistributeProduction(row);
  727. },
  728. }
  729. : {},
  730. route.query.pageType == "1"
  731. ? {
  732. attrs: {
  733. label: "转销售订单",
  734. type: "primary",
  735. text: true,
  736. },
  737. el: "button",
  738. click() {
  739. trunContract(row);
  740. },
  741. }
  742. : {},
  743. // row.status == 30 &&
  744. // row.outboundStatus == 0 &&
  745. // row.produceStatus == 2
  746. // ? {
  747. // attrs: {
  748. // label: "销售出库",
  749. // type: "primary",
  750. // text: true,
  751. // },
  752. // el: "button",
  753. // click() {
  754. // proxy
  755. // .msgConfirm()
  756. // .then((res) => {
  757. // proxy
  758. // .post("/contract/saleOutbound", {
  759. // id: row.id,
  760. // })
  761. // .then((res) => {
  762. // proxy.msgTip("操作成功", 1);
  763. // getList();
  764. // });
  765. // })
  766. // .catch((err) => {});
  767. // },
  768. // }
  769. // : {},
  770. row.status == 30 && row.produceStatus != 10
  771. ? {
  772. attrs: {
  773. label: "变更",
  774. type: "primary",
  775. text: true,
  776. },
  777. el: "button",
  778. click() {
  779. clickAlteration(row);
  780. },
  781. }
  782. : {},
  783. row.status == 30
  784. ? {
  785. attrs: {
  786. label: "打印",
  787. type: "primary",
  788. text: true,
  789. },
  790. el: "button",
  791. click() {
  792. clickPrint(row);
  793. },
  794. }
  795. : {},
  796. // row.orderDistributeStatus == 1
  797. // ? {}
  798. // :
  799. (row.status == 10 ||
  800. (row.status == 30 && Number(row.sumClaimMoney) == 0)) &&
  801. (row.produceStatus == 0 || row.produceStatus == null)
  802. ? {
  803. attrs: {
  804. label: "作废",
  805. type: "danger",
  806. text: true,
  807. },
  808. el: "button",
  809. click() {
  810. proxy
  811. .msgConfirm()
  812. .then((res) => {
  813. proxy
  814. .post("/contract/cancellation", {
  815. id: row.id,
  816. })
  817. .then((res) => {
  818. proxy.msgTip("操作成功", 1);
  819. getList();
  820. });
  821. })
  822. .catch((err) => {});
  823. },
  824. }
  825. : {},
  826. row.status == 30 && row.isSettled == "0"
  827. ? {
  828. attrs: {
  829. label: "结清",
  830. type: "primary",
  831. text: true,
  832. },
  833. el: "button",
  834. click() {
  835. ElMessageBox.confirm("是否确认结清?", "提示", {
  836. confirmButtonText: "确定",
  837. cancelButtonText: "取消",
  838. type: "warning",
  839. }).then(() => {
  840. proxy
  841. .post("/contract/settle", {
  842. id: row.id,
  843. })
  844. .then(() => {
  845. ElMessage({
  846. message: "操作成功",
  847. type: "success",
  848. });
  849. getList();
  850. });
  851. });
  852. },
  853. }
  854. : {},
  855. // {
  856. // attrs: {
  857. // label: "生产指示",
  858. // type: "primary",
  859. // text: true,
  860. // },
  861. // el: "button",
  862. // click() {
  863. // handleEditTag(row);
  864. // },
  865. // },
  866. row.isSettled == "1"
  867. ? {
  868. attrs: {
  869. label: "售后",
  870. type: "primary",
  871. text: true,
  872. },
  873. el: "button",
  874. click() {
  875. openRecords.value = true;
  876. getRecordsData(row);
  877. },
  878. }
  879. : {},
  880. ];
  881. },
  882. },
  883. ];
  884. });
  885. const getDict = () => {
  886. // proxy
  887. // .getDictOne([
  888. // "customer_tag",
  889. // "trade_mode",
  890. // "account_currency",
  891. // "shipping_method",
  892. // ])
  893. // .then((res) => {
  894. // customerTag.value = res["customer_tag"].map((x) => ({
  895. // label: x.dictValue,
  896. // value: x.dictKey,
  897. // }));
  898. // tradeMethods.value = res["trade_mode"].map((x) => ({
  899. // label: x.dictValue,
  900. // value: x.dictKey,
  901. // }));
  902. // accountCurrency.value = res["account_currency"].map((x) => ({
  903. // label: x.dictValue,
  904. // value: x.dictKey,
  905. // }));
  906. // shippingMethod.value = res["shipping_method"].map((x) => ({
  907. // label: x.dictValue,
  908. // value: x.dictKey,
  909. // }));
  910. // });
  911. // proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  912. // corporationList.value = res.rows.map((item) => {
  913. // return {
  914. // ...item,
  915. // label: item.name,
  916. // value: item.id,
  917. // };
  918. // });
  919. // });
  920. proxy
  921. .get("/tenantDept/list", {
  922. pageNum: 1,
  923. pageSize: 9999,
  924. keyword: "",
  925. tenantId: proxy.useUserStore().user.tenantId,
  926. type: 0,
  927. })
  928. .then((res) => {
  929. companyData.value = res.data.map((x) => ({
  930. ...x,
  931. label: x.deptName,
  932. value: x.deptId,
  933. }));
  934. });
  935. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  936. customerList.value = res.rows.map((item) => {
  937. return {
  938. ...item,
  939. label: item.name,
  940. value: item.id,
  941. };
  942. });
  943. });
  944. proxy
  945. .get("/tenantUser/list", {
  946. pageNum: 1,
  947. pageSize: 10000,
  948. tenantId: proxy.useUserStore().user.tenantId,
  949. // companyId: proxy.useUserStore().user.companyId,
  950. })
  951. .then((res) => {
  952. userList.value = res.rows.map((item) => {
  953. return {
  954. label: item.nickName,
  955. value: item.userId,
  956. };
  957. });
  958. });
  959. };
  960. const getList = async (req) => {
  961. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  962. loading.value = true;
  963. proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
  964. res.rows.forEach((x) => {
  965. // x.addTagShow = false;
  966. // if (x.tag) {
  967. // x.tags = x.tag.split(",");
  968. // } else {
  969. // x.tags = [];
  970. // }
  971. if (x.prodTag) {
  972. x.prodTags = x.prodTag.split(",");
  973. } else {
  974. x.prodTags = [];
  975. }
  976. });
  977. sourceList.value.data = res.rows;
  978. sourceList.value.pagination.total = res.total;
  979. setTimeout(() => {
  980. loading.value = false;
  981. }, 200);
  982. });
  983. // proxy
  984. // .post("/contract/getHeadStatistic", sourceList.value.pagination)
  985. // .then((res) => {
  986. // headerData.value = res;
  987. // if (headerData.value) {
  988. // headerData.value.sumClaimMoneyOne = parseFloat(
  989. // Number(headerData.value.sumAmount) -
  990. // Number(headerData.value.sumClaimMoney)
  991. // ).toFixed(2);
  992. // }
  993. // });
  994. };
  995. getDict();
  996. if (route.query.code) {
  997. sourceList.value.pagination.keyword = route.query.code;
  998. }
  999. getList();
  1000. const newContract = () => {
  1001. // let flowKey = route.query.pageType == "1" ? "sample_flow" : "contract_flow" ;
  1002. let flowKey = "contract_flow";
  1003. proxy.$router.replace({
  1004. path: "/platform_manage/process/processApproval",
  1005. query: {
  1006. flowKey: flowKey,
  1007. flowName: "订单流程",
  1008. random: proxy.random(),
  1009. },
  1010. });
  1011. };
  1012. const openPrint = ref(false);
  1013. const rowData = ref({});
  1014. const clickPrint = (row) => {
  1015. rowData.value = {
  1016. id: row.id,
  1017. };
  1018. openPrint.value = true;
  1019. };
  1020. const clickDownload = () => {
  1021. proxy.getPdf("外销合同PDF文件");
  1022. };
  1023. const openHandoverSlip = ref(false);
  1024. const handoverSlipForm = ref({
  1025. id: "",
  1026. code: "",
  1027. buyCorporationName: "",
  1028. fileList: [],
  1029. packageFileList: [],
  1030. });
  1031. const formOption = reactive({
  1032. inline: true,
  1033. labelWidth: 100,
  1034. itemWidth: 100,
  1035. rules: [],
  1036. });
  1037. const formConfig = computed(() => {
  1038. return [
  1039. {
  1040. type: "input",
  1041. prop: "code",
  1042. label: "合同编号",
  1043. itemType: "text",
  1044. disabled: true,
  1045. },
  1046. {
  1047. type: "input",
  1048. prop: "buyCorporationName",
  1049. label: "客户名称",
  1050. itemType: "text",
  1051. disabled: true,
  1052. },
  1053. {
  1054. type: "slot",
  1055. slotName: "file",
  1056. label: "交接单",
  1057. },
  1058. {
  1059. type: "slot",
  1060. slotName: "indication",
  1061. label: "包装指示",
  1062. },
  1063. ];
  1064. });
  1065. const uploadData = ref({});
  1066. const indicationUploadData = ref({});
  1067. const clickHandoverSlip = (item) => {
  1068. handoverSlipForm.value.id = item.id;
  1069. handoverSlipForm.value.code = item.code;
  1070. handoverSlipForm.value.buyCorporationName = item.buyCorporationName;
  1071. if (item.fileInfoVos && item.fileInfoVos.length > 0) {
  1072. handoverSlipForm.value.fileList = item.fileInfoVos.map((item) => {
  1073. return {
  1074. raw: item,
  1075. name: item.fileName,
  1076. url: item.fileUrl,
  1077. };
  1078. });
  1079. } else {
  1080. handoverSlipForm.value.fileList = [];
  1081. }
  1082. if (item.packageFileInfoVOList && item.packageFileInfoVOList.length > 0) {
  1083. handoverSlipForm.value.packageFileList = item.packageFileInfoVOList.map(
  1084. (item) => {
  1085. return {
  1086. raw: item,
  1087. name: item.fileName,
  1088. url: item.fileUrl,
  1089. };
  1090. }
  1091. );
  1092. } else {
  1093. handoverSlipForm.value.packageFileList = [];
  1094. }
  1095. openHandoverSlip.value = true;
  1096. };
  1097. const uploadFile = async (file) => {
  1098. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1099. uploadData.value = res.uploadBody;
  1100. file.id = res.id;
  1101. file.fileName = res.fileName;
  1102. file.fileUrl = res.fileUrl;
  1103. file.uploadState = true;
  1104. return true;
  1105. };
  1106. const indicationUploadFile = async (file) => {
  1107. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  1108. indicationUploadData.value = res.uploadBody;
  1109. file.id = res.id;
  1110. file.fileName = res.fileName;
  1111. file.fileUrl = res.fileUrl;
  1112. file.uploadState = true;
  1113. return true;
  1114. };
  1115. const handleSuccess = (any, UploadFile) => {
  1116. UploadFile.raw.uploadState = false;
  1117. };
  1118. const onPreviewFile = (file) => {
  1119. window.open(file.raw.fileUrl, "_blank");
  1120. };
  1121. const submitHandoverSlip = () => {
  1122. if (
  1123. handoverSlipForm.value.fileList &&
  1124. handoverSlipForm.value.fileList.length > 0
  1125. ) {
  1126. for (let i = 0; i < handoverSlipForm.value.fileList.length; i++) {
  1127. if (handoverSlipForm.value.fileList[i].raw.uploadState) {
  1128. return ElMessage("文件上传中,请稍后提交");
  1129. }
  1130. }
  1131. }
  1132. if (
  1133. handoverSlipForm.value.packageFileList &&
  1134. handoverSlipForm.value.packageFileList.length > 0
  1135. ) {
  1136. for (let i = 0; i < handoverSlipForm.value.packageFileList.length; i++) {
  1137. if (handoverSlipForm.value.packageFileList[i].raw.uploadState) {
  1138. return ElMessage("文件上传中,请稍后提交");
  1139. }
  1140. }
  1141. }
  1142. let data = proxy.deepClone(handoverSlipForm.value);
  1143. if (data.fileList && data.fileList.length > 0) {
  1144. data.fileList = data.fileList.map((item) => {
  1145. return {
  1146. id: item.raw.id,
  1147. fileName: item.raw.fileName,
  1148. fileUrl: item.raw.fileUrl,
  1149. };
  1150. });
  1151. } else {
  1152. data.fileList = [];
  1153. }
  1154. if (data.packageFileList && data.packageFileList.length > 0) {
  1155. data.packageFileList = data.packageFileList.map((item) => {
  1156. return {
  1157. id: item.raw.id,
  1158. fileName: item.raw.fileName,
  1159. fileUrl: item.raw.fileUrl,
  1160. };
  1161. });
  1162. } else {
  1163. data.packageFileList = [];
  1164. }
  1165. proxy.post("/contract/contractHandover", data).then(() => {
  1166. ElMessage({
  1167. message: "操作成功!",
  1168. type: "success",
  1169. });
  1170. openHandoverSlip.value = false;
  1171. getList();
  1172. });
  1173. };
  1174. const addTag = ref("");
  1175. const judgeTagSelect = (data, val) => {
  1176. if (data && data.length > 0) {
  1177. if (data.includes(val)) {
  1178. return true;
  1179. }
  1180. }
  1181. return false;
  1182. };
  1183. const changeTag = (val, item) => {
  1184. let data = {
  1185. id: item.buyCorporationId,
  1186. tag: proxy.deepClone(item.tags),
  1187. };
  1188. data.tag.push(val);
  1189. data.tag = data.tag.join(",");
  1190. proxy.post("/customer/editTag", data).then(() => {
  1191. ElMessage({
  1192. message: "添加成功",
  1193. type: "success",
  1194. });
  1195. item.addTagShow = false;
  1196. addTag.value = "";
  1197. getList();
  1198. });
  1199. };
  1200. const tagClose = (val, item) => {
  1201. let data = {
  1202. id: item.buyCorporationId,
  1203. tag: proxy.deepClone(item.tags),
  1204. };
  1205. data.tag = data.tag.filter((row) => row !== val);
  1206. if (data.tag && data.tag.length > 0) {
  1207. data.tag = data.tag.join(",");
  1208. } else {
  1209. data.tag = "";
  1210. }
  1211. proxy.post("/customer/editTag", data).then(() => {
  1212. ElMessage({
  1213. message: "删除成功",
  1214. type: "success",
  1215. });
  1216. item.addTagShow = false;
  1217. addTag.value = "";
  1218. getList();
  1219. });
  1220. };
  1221. const showSelect = (item) => {
  1222. item.addTagShow = true;
  1223. };
  1224. const currentContractId = ref("");
  1225. const openDetails = (row) => {
  1226. // currentContractId.value = row.id;
  1227. // openDetailsDialog.value = true;
  1228. // 新页面打开方式
  1229. // const page = proxy.$router.resolve({
  1230. // name: "contractDetails",
  1231. // query: {
  1232. // currentContractId: row.id,
  1233. // },
  1234. // });
  1235. // window.open(page.href, "_blank");
  1236. proxy.$router.push({
  1237. name: "contractDetails",
  1238. query: {
  1239. currentContractId: row.id,
  1240. },
  1241. });
  1242. };
  1243. const computeScale = (item) => {
  1244. let text = 0;
  1245. if (
  1246. item.sumClaimMoney &&
  1247. Number(item.sumClaimMoney) > 0 &&
  1248. item.amountCNY &&
  1249. Number(item.amountCNY) > 0
  1250. ) {
  1251. text = parseFloat(
  1252. (Number(item.sumClaimMoney) / Number(item.amountCNY)) * 100
  1253. ).toFixed(2);
  1254. }
  1255. return text + "%";
  1256. };
  1257. const clickCorporationName = (row) => {
  1258. proxy.$router.push({
  1259. name: "Portrait",
  1260. query: {
  1261. id: row.buyCorporationId,
  1262. },
  1263. });
  1264. };
  1265. const printObj = ref({
  1266. id: "pdfDom",
  1267. popTitle: "",
  1268. extraCss:
  1269. "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",
  1270. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  1271. });
  1272. const clickAlteration = (row) => {
  1273. // let flowKey =
  1274. // route.query.pageType == "1" ? "sample_update_flow" : "contract_update_flow";
  1275. let flowKey = "contract_update_flow";
  1276. proxy.$router.push({
  1277. path: "/platform_manage/process/processApproval",
  1278. query: {
  1279. flowKey: flowKey,
  1280. flowName: "订单变更流程",
  1281. random: proxy.random(),
  1282. businessId: row.id,
  1283. },
  1284. });
  1285. };
  1286. const PdfDom = ref(null);
  1287. const exportExcel = () => {
  1288. PdfDom.value.exportExcel();
  1289. };
  1290. const formData = reactive({
  1291. recordsFormData: {},
  1292. data: {},
  1293. tagData: {},
  1294. });
  1295. const formLoading = ref(false);
  1296. const openRecords = ref(false);
  1297. const openAddRecords = ref(false);
  1298. const recordsLoading = ref(false);
  1299. const recordsData = ref([]);
  1300. const recordsForm = ref(null);
  1301. const rowContractData = ref({});
  1302. const recordsFormConfig = computed(() => [
  1303. {
  1304. type: "date",
  1305. itemType: "datetime",
  1306. prop: "documentaryTime",
  1307. label: "售后时间",
  1308. disabled: false,
  1309. },
  1310. {
  1311. type: "input",
  1312. prop: "documentaryRemark",
  1313. label: "售后记录",
  1314. itemType: "textarea",
  1315. disabled: false,
  1316. },
  1317. {
  1318. type: "slot",
  1319. slotName: "file",
  1320. label: "上传附件",
  1321. },
  1322. ]);
  1323. const recordsRules = ref({
  1324. documentaryTime: [
  1325. { required: true, message: "请选择售后时间", trigger: "change" },
  1326. ],
  1327. documentaryRemark: [
  1328. { required: true, message: "请输入售后记录", trigger: "blur" },
  1329. ],
  1330. });
  1331. const getRecordsData = (row) => {
  1332. if (row && row.id) {
  1333. rowContractData.value = row;
  1334. }
  1335. proxy
  1336. .post("/contractDocumentary/page", {
  1337. businessId: rowContractData.value.id,
  1338. documentaryType: "-2",
  1339. })
  1340. .then((res) => {
  1341. recordsData.value = res.rows;
  1342. const idList = recordsData.value.map((x) => x.id);
  1343. // 请求文件数据并回显
  1344. if (idList.length > 0) {
  1345. proxy
  1346. .post("/fileInfo/getList", {
  1347. businessIdList: idList,
  1348. })
  1349. .then((fileObj) => {
  1350. if (fileObj) {
  1351. for (let i = 0; i < recordsData.value.length; i++) {
  1352. const e = recordsData.value[i];
  1353. for (const key in fileObj) {
  1354. if (e.id === key) {
  1355. e.fileList = fileObj[key];
  1356. }
  1357. }
  1358. }
  1359. }
  1360. });
  1361. }
  1362. });
  1363. };
  1364. const handleClickAddRecord = () => {
  1365. formData.recordsFormData = {
  1366. businessId: rowContractData.value.id,
  1367. businessType: "0",
  1368. documentaryType: "-2",
  1369. documentaryTime: proxy.parseTime(new Date()),
  1370. documentaryRemark: "",
  1371. fileList: [],
  1372. };
  1373. openAddRecords.value = true;
  1374. };
  1375. const submitRecords = () => {
  1376. recordsForm.value.handleSubmit(() => {
  1377. formLoading.value = true;
  1378. formData.recordsFormData.fileList = formData.recordsFormData.fileList.map(
  1379. (item) => {
  1380. return {
  1381. id: item.raw.id,
  1382. fileName: item.raw.fileName,
  1383. fileUrl: item.raw.fileUrl,
  1384. uploadState: item.raw.uploadState,
  1385. };
  1386. }
  1387. );
  1388. proxy
  1389. .post("/contractDocumentary/add", formData.recordsFormData)
  1390. .then((res) => {
  1391. ElMessage({
  1392. message: "操作成功",
  1393. type: "success",
  1394. });
  1395. formLoading.value = false;
  1396. openAddRecords.value = false;
  1397. getRecordsData();
  1398. });
  1399. });
  1400. };
  1401. const openFile = (item) => {
  1402. window.open(item.fileUrl, "_blank");
  1403. };
  1404. const formSearchConfig = computed(() => {
  1405. return [
  1406. {
  1407. type: "select",
  1408. label: "审批状态",
  1409. prop: "status",
  1410. itemWidth: 50,
  1411. data: status.value,
  1412. clearable: true,
  1413. },
  1414. {
  1415. type: "select",
  1416. label: "工厂",
  1417. prop: "companyId",
  1418. itemWidth: 50,
  1419. data: companyData.value,
  1420. clearable: true,
  1421. },
  1422. {
  1423. type: "select",
  1424. label: "业务员",
  1425. prop: "userId",
  1426. data: userList.value,
  1427. clearable: true,
  1428. },
  1429. {
  1430. type: "date",
  1431. itemType: "datetime",
  1432. label: "合同时间",
  1433. prop: "beginTime",
  1434. placeholder: "合同开始时间",
  1435. itemWidth: 50,
  1436. clearable: true,
  1437. },
  1438. {
  1439. type: "date",
  1440. itemType: "datetime",
  1441. label: " ",
  1442. prop: "endTime",
  1443. placeholder: "合同结束时间",
  1444. itemWidth: 50,
  1445. clearable: true,
  1446. },
  1447. ];
  1448. });
  1449. const moreSearchDialog = ref(false);
  1450. const clickMoreSearch = () => {
  1451. moreSearchDialog.value = true;
  1452. };
  1453. const moreSearchQuery = () => {
  1454. moreSearchDialog.value = false;
  1455. getList();
  1456. };
  1457. const moreSearchReset = () => {
  1458. sourceList.value.pagination = {
  1459. total: 0,
  1460. pageNum: sourceList.value.pagination.pageNum,
  1461. pageSize: sourceList.value.pagination.pageSize,
  1462. keyword: "",
  1463. status: "",
  1464. sellCorporationId: "",
  1465. beginTime: "",
  1466. endTime: "",
  1467. };
  1468. moreSearchQuery();
  1469. };
  1470. const productionFormDom = ref(null);
  1471. const productionDialog = ref(false);
  1472. const productionFormConfig = computed(() => [
  1473. {
  1474. type: "treeSelect",
  1475. prop: "produceCompanyId",
  1476. label: "工厂",
  1477. data: companyData.value,
  1478. propsTreeLabel: "deptName",
  1479. propsTreeValue: "deptId",
  1480. itemWidth: 100,
  1481. disabled: true,
  1482. },
  1483. {
  1484. type: "input",
  1485. itemType: "textarea",
  1486. label: "驳回原因",
  1487. prop: "rejectRemark",
  1488. itemWidth: 100,
  1489. isShow: formData.data.rejectRemark ? true : false,
  1490. disabled: true,
  1491. },
  1492. {
  1493. type: "date",
  1494. itemType: "datet",
  1495. label: "交期",
  1496. prop: "deliveryPeriod",
  1497. // placeholder: "合同开始时间",
  1498. itemWidth: 100,
  1499. disabledFn: (date) => {
  1500. return moment(date).isBefore(moment());
  1501. },
  1502. clearable: true,
  1503. },
  1504. ]);
  1505. const productionRules = ref({
  1506. produceCompanyId: [
  1507. { required: true, message: "请选择生产公司", trigger: "change" },
  1508. ],
  1509. deliveryPeriod: [
  1510. { required: true, message: "请选择交期", trigger: "change" },
  1511. ],
  1512. });
  1513. const clickDistributeProduction = (row) => {
  1514. formData.data = {
  1515. contractId: row.id,
  1516. deliveryPeriod: "",
  1517. produceCompanyId: row.companyId,
  1518. rejectRemark: row.rejectRemark,
  1519. orderDistributeStatus: row.orderDistributeStatus,
  1520. };
  1521. productionDialog.value = true;
  1522. };
  1523. const submitProduction = () => {
  1524. productionFormDom.value.handleSubmit(() => {
  1525. let url =
  1526. formData.data.orderDistributeStatus == 1
  1527. ? "/produceOrder/editDeliveryPeriod"
  1528. : "/produceOrder/createOrder";
  1529. formLoading.value = true;
  1530. proxy.post(url, formData.data).then((res) => {
  1531. proxy.msgTip("操作成功");
  1532. formLoading.value = false;
  1533. productionDialog.value = false;
  1534. getList();
  1535. });
  1536. });
  1537. };
  1538. const handleEditTag = (row) => {
  1539. formData.tagData = {
  1540. id: row.id,
  1541. prodTag: row.prodTags,
  1542. };
  1543. tagDialog.value = true;
  1544. };
  1545. const tagFormDom = ref(null);
  1546. const tagDialog = ref(false);
  1547. const tagFormConfig = computed(() => [
  1548. {
  1549. type: "select",
  1550. prop: "prodTag",
  1551. label: "生产指示",
  1552. multiple: true,
  1553. data: contractTag.value,
  1554. itemWidth: 100,
  1555. },
  1556. {
  1557. type: "input",
  1558. prop: "prodRemark",
  1559. itemType: "textarea",
  1560. label: "备注",
  1561. itemWidth: 100,
  1562. },
  1563. ]);
  1564. const tagRules = ref({
  1565. prodTag: [{ required: true, message: "请选择生产指示", trigger: "change" }],
  1566. });
  1567. const submitTag = () => {
  1568. tagFormDom.value.handleSubmit(() => {
  1569. const data = {
  1570. id: formData.tagData.id,
  1571. prodTag: formData.tagData.prodTag.join(","),
  1572. prodRemark: formData.tagData.prodRemark,
  1573. };
  1574. formLoading.value = true;
  1575. proxy.post("/contract/updateProductionTag", data).then((res) => {
  1576. proxy.msgTip("操作成功");
  1577. formLoading.value = false;
  1578. tagDialog.value = false;
  1579. getList();
  1580. });
  1581. });
  1582. };
  1583. const prodTagClose = (index, row) => {
  1584. row.prodTags.splice(index, 1);
  1585. proxy
  1586. .post("/contract/updateProductionTag", {
  1587. id: row.id,
  1588. prodTag: row.prodTags.join(","),
  1589. })
  1590. .then((res) => {});
  1591. };
  1592. const handleClickFile = (fileUrl) => {
  1593. window.open(fileUrl, "_blank");
  1594. };
  1595. const productData = ref([]);
  1596. const onShowProductData = (item) => {
  1597. productData.value = item.contractProductList;
  1598. };
  1599. onMounted(() => {
  1600. $bus.on("refreshTableData", () => {
  1601. getList();
  1602. });
  1603. });
  1604. onBeforeUnmount(() => {
  1605. // 取消订阅特定事件
  1606. $bus.off("refreshTableData");
  1607. });
  1608. const trunContract = (row) => {
  1609. proxy.$router.replace({
  1610. path: "/platform_manage/process/processApproval",
  1611. query: {
  1612. flowKey: "contract_flow",
  1613. flowName: "转销售订单",
  1614. random: proxy.random(),
  1615. businessId: row.id,
  1616. },
  1617. });
  1618. };
  1619. </script>
  1620. <style lang="scss" scoped>
  1621. .tenant {
  1622. padding: 20px;
  1623. }
  1624. ::v-deep(.el-input-number .el-input__inner) {
  1625. text-align: left;
  1626. }
  1627. .baseRow {
  1628. min-height: 24px;
  1629. border-top: 1px solid black;
  1630. border-left: 1px solid black;
  1631. }
  1632. .contentRow {
  1633. border-right: 1px solid black;
  1634. line-height: 24px;
  1635. padding-left: 4px;
  1636. }
  1637. .active {
  1638. background: #a6dd82;
  1639. color: #fff;
  1640. border-radius: 4px;
  1641. }
  1642. .more {
  1643. position: absolute;
  1644. left: -60px;
  1645. background: rgba(0, 0, 0, 0.8);
  1646. color: #fff;
  1647. opacity: 0.5;
  1648. height: 65px;
  1649. padding-top: 8px;
  1650. width: 50px;
  1651. border-radius: 3px;
  1652. text-align: center;
  1653. cursor: pointer;
  1654. pointer-events: none;
  1655. }
  1656. </style>