index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. <template>
  2. <div class="user">
  3. <div class="content">
  4. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
  5. :selectConfig="selectConfig" :action-list="[
  6. ]" @get-list="getList">
  7. <template #code="{ item }">
  8. <div style="width: 100%" class="el-click" @click="lookDetails(item)">
  9. {{item.code}}
  10. </div>
  11. </template>
  12. <template #isOverdue="{item}">
  13. <div style="width: 100%">
  14. <span class="red" v-if="item.isOverdue=='1'"> 逾期 </span>
  15. </div>
  16. </template>
  17. <template #prodTag="{ item }">
  18. <div style="width: 100%">
  19. <!-- <el-icon :size="16" style="cursor:pointer;margin-right: 5px;position:relative;top:5px" color="#409EFF" @click="handleEditTag(item)">
  20. <Edit />
  21. </el-icon> -->
  22. <!-- closable @close="prodTagClose(index, item)" -->
  23. <el-tag style="margin-right: 8px" type="success" v-for="(tag, index) in item.prodTags" :key="index">
  24. {{ dictKeyValue(tag, contractTag) }}
  25. </el-tag>
  26. </div>
  27. </template>
  28. <template #list="{ item }">
  29. <div style="width:100%">
  30. <span v-for="(product ,index) in item.produceOrderDetailList" style="margin-right:15px">
  31. <el-popover placement="top-start" :width="400" trigger="hover">
  32. <div>
  33. <div>产品编码:{{product.productCode}}</div>
  34. <div>产品名称:{{product.productName}}</div>
  35. <div>产品尺寸:{{product.productLength}}cm*{{product.productWidth}}cm*{{product.productHeight}}cm</div>
  36. <div>产品数量:{{product.quantity}}</div>
  37. </div>
  38. <template #reference>
  39. <el-progress type="circle" :percentage="(Number(product.finishQuantity) / Number(product.quantity))*100" width="60"
  40. :status="(Number(product.finishQuantity) / Number(product.quantity))*100 == 100 ? 'success' : ''" />
  41. </template>
  42. </el-popover>
  43. </span>
  44. </div>
  45. </template>
  46. </byTable>
  47. </div>
  48. <div class="schedule-right">
  49. <div class="schedule-top">
  50. <el-row>
  51. <!-- <el-col :span="10" style="text-align: left">
  52. <el-select v-model="status" style="width: 110px">
  53. <el-option v-for="item in tableStatus" :key="item.value" :label="item.label" :value="item.value" />
  54. </el-select>
  55. <el-button type="info" style="margin-left: 8px" @click="clickToday()" plain>今日</el-button>
  56. </el-col> -->
  57. <el-col :span="24" style="text-align: center; height: 32px; line-height: 32px">
  58. <div style="display: flex; justify-content: space-between">
  59. <el-button @click="clickToday()" plain>今日</el-button>
  60. <el-button :icon="ArrowLeftBold" @click="prevMonth()" />
  61. <span style="font-weight: 700">{{ month }}</span>
  62. <el-button :icon="ArrowRightBold" @click="nextMonth()" />
  63. </div>
  64. </el-col>
  65. <!-- <el-col :span="10" style="text-align: right">
  66. <el-button type="primary" @click="newSchedule()">新建日程</el-button>
  67. </el-col> -->
  68. </el-row>
  69. </div>
  70. <div class="schedule-bottom">
  71. <el-calendar v-model="today" ref="calendar">
  72. <template #date-cell="{ data }">
  73. <div style="text-align:center;height: 100%;">
  74. <div>
  75. {{ data.day.substr(8, 10) }}
  76. </div>
  77. <el-popover placement="left" :width="400" style="height" trigger="hover" @show="onShow(data.day)">
  78. <template #reference>
  79. <div v-if="isShow(data.day)">
  80. <div style="height:5px;margin-bottom:5px;border-radius:2px" v-for="(item,index) in judgeDay(data.day)" :key="index"
  81. :style="{ background: colorData[item]}">
  82. </div>
  83. </div>
  84. </template>
  85. <div style="height:500px;overflow:auto">
  86. <div v-for="item in showData" :key="item" style="margin-bottom:20px">
  87. <div style="display:flex">
  88. <div>颜色:</div>
  89. <div :style="{ background: colorData[item]}" style="width:20px;height:20px;border-radius:10px"></div>
  90. </div>
  91. <div>
  92. 订单号:<span v-if="rightDataObj[item]">{{rightDataObj[item]['code']}}</span>
  93. </div>
  94. <div>
  95. 产品:<span v-if="rightDataObj[item]">{{rightDataObj[item]['productName']}}</span>
  96. </div>
  97. </div>
  98. </div>
  99. </el-popover>
  100. </div>
  101. </template>
  102. </el-calendar>
  103. </div>
  104. </div>
  105. <el-dialog :title="modalType == 'add' ? '添加店铺' : '编辑店铺'" v-model="dialogVisible" width="500px" destroy-on-close>
  106. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
  107. </byForm>
  108. <template #footer>
  109. <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
  110. <el-button type="primary" @click="submitForm()" size="defualt" :loading="submitLoading">
  111. 确 定
  112. </el-button>
  113. </template>
  114. </el-dialog>
  115. <el-dialog :title="'投产'" v-model="productionDialog" width="500px" destroy-on-close>
  116. <byForm :formConfig="productionFormConfig" :formOption="formOption" v-model="formData.data" :rules="productionRules" ref="productionFormDom"
  117. v-loading="formLoading">
  118. </byForm>
  119. <template #footer>
  120. <el-button @click="productionDialog =false" size="default" v-debounce>取 消</el-button>
  121. <el-button @click="submitProduction" type="primary" size="default" v-debounce>提 交</el-button>
  122. </template>
  123. </el-dialog>
  124. <el-dialog :title="'订单详情'" v-model="dialogVisible" width="90%" destroy-on-close>
  125. <byForm :formConfig="formConfig" :formOption="formOptionOne" v-model="formData.orderData" ref="formDom">
  126. <template #commodity>
  127. <div style="width: 100%">
  128. <el-table :data="formData.orderData.contractProductList" style="width: 100%; ">
  129. <el-table-column type="expand" width="50" align="center">
  130. <template #default="scope">
  131. <div style="padding-left:50px">
  132. <div style="margin-bottom:10px;">
  133. <TitleInfo content='BOM单:'></TitleInfo>
  134. </div>
  135. <el-table :data="scope.row.contractProductBomList" style="width: 100%;" border class="bom-table">
  136. <el-table-column label="图片" width="80">
  137. <template #default="{ row }">
  138. <div v-if="row.fileUrl">
  139. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  140. </div>
  141. <div v-else></div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column prop="productCode" label="物料编码" width="190" />
  145. <el-table-column prop="productName" label="物料名称" min-width="200" />
  146. <el-table-column label="尺寸 (cm)" width="150">
  147. <template #default="{ row, $index }">
  148. <div style="width: 100%">
  149. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  150. </div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column prop="quantity" label="数量" width="110" />
  154. <el-table-column prop="remark" label="备注" width="180" />
  155. </el-table>
  156. </div>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="商品图片" width="80">
  160. <template #default="{ row }">
  161. <div v-if="row.fileUrl">
  162. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  163. </div>
  164. <div v-else></div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column prop="productCnName" label="商品名称" min-width="130" />
  168. <el-table-column prop="productCode" label="商品编码" width="130" />
  169. <el-table-column label="尺寸 cm*cm*cm" width="180">
  170. <template #default="{ row, $index }">
  171. <div style="width: 100%">
  172. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  173. </div>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="设计图稿" width="80">
  177. <template #default="{ row, $index }">
  178. <div style="width: 100%">
  179. <el-upload :action="uploadUrl" accept=".gif, .jpeg, .jpg, .png" :show-file-list="false" :data="uploadData"
  180. :before-upload="(file)=>handleBeforeUpload(file,$index)" :on-success="()=>handleSuccess($index)">
  181. <div v-loading="row.imgLoading">
  182. <img v-if="row.imageUrl" :src="row.imageUrl" class="pic" />
  183. <!-- <el-icon v-else class="avatar-uploader-icon">
  184. <Plus />
  185. </el-icon> -->
  186. </div>
  187. </el-upload>
  188. </div>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="生产源文件" width="140">
  192. <template #default="{ row, $index }">
  193. <div style="width:100%">
  194. <div v-if="row.isShowProductFile &&row.fileListOne && row.fileListOne.length > 0">
  195. <span class="el-click" @click="onPicture(row.fileListOne[0].fileUrl)">{{row.fileListOne[0].fileName}}</span>
  196. </div>
  197. <div v-else>
  198. <div v-if="row.prodFileList && row.prodFileList.length > 0">
  199. <span class="el-click" @click="onPicture(row.prodFileList[0].fileUrl)">{{row.prodFileList[0].fileName}} (定制)</span>
  200. </div>
  201. </div>
  202. </div>
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="数量" width="150" prop="quantity" />
  206. <el-table-column label="备注" min-width="200" prop="remark" />
  207. </el-table>
  208. </div>
  209. </template>
  210. </byForm>
  211. <template #footer>
  212. <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
  213. </template>
  214. </el-dialog>
  215. </div>
  216. </template>
  217. <script setup>
  218. import byTable from "@/components/byTable/index";
  219. import byForm from "@/components/byForm/index";
  220. import moment from "moment";
  221. import * as date from "@/utils/date.js";
  222. import { ArrowLeftBold, ArrowRightBold } from "@element-plus/icons-vue";
  223. const { proxy } = getCurrentInstance();
  224. const contractTag = computed(
  225. () => proxy.useUserStore().allDict["contract_prod_tag"]
  226. );
  227. const companyData = ref([]);
  228. const loading = ref(false);
  229. const submitLoading = ref(false);
  230. const sourceList = ref({
  231. data: [],
  232. pagination: {
  233. total: 3,
  234. pageNum: 1,
  235. pageSize: 10,
  236. keyword: "",
  237. produceStatus: "",
  238. staDeliveryPeriod: "",
  239. endDeliveryPeriod: "",
  240. beginTime: "",
  241. endTime: "",
  242. companyId: "",
  243. isOverdue: "",
  244. },
  245. });
  246. const treeData = ref([]);
  247. const dialogVisible = ref(false);
  248. const modalType = ref("add");
  249. const status = ref("0");
  250. const today = ref(moment().format("yyyy-MM-DD"));
  251. const dateList = ref({});
  252. const month = ref(moment().format("yyyy年MM月"));
  253. const monthOne = ref(moment().format("yyyy-MM"));
  254. const calendar = ref(null);
  255. const statusData = ref([
  256. {
  257. label: "未开始",
  258. value: "0",
  259. },
  260. {
  261. label: "进行中",
  262. value: "1",
  263. },
  264. {
  265. label: "已完成",
  266. value: "2",
  267. },
  268. ]);
  269. const isOverdueData = ref([
  270. {
  271. label: "是",
  272. value: "1",
  273. },
  274. {
  275. label: "否",
  276. value: "0",
  277. },
  278. ]);
  279. const selectConfig = computed(() => [
  280. // {
  281. // label: "生产公司",
  282. // prop: "companyId",
  283. // data: companyData.value,
  284. // fn: () => {
  285. // getRightData();
  286. // },
  287. // },
  288. {
  289. label: "生产状态",
  290. prop: "produceStatus",
  291. data: statusData.value,
  292. },
  293. {
  294. label: "是否逾期",
  295. prop: "isOverdue",
  296. data: isOverdueData.value,
  297. },
  298. {
  299. type: "time",
  300. label: "交期",
  301. placeholder: "开始日期",
  302. prop: "staDeliveryPeriod",
  303. placeholderOne: "结束日期",
  304. propOne: "endDeliveryPeriod",
  305. },
  306. {
  307. type: "time",
  308. label: "下单日期",
  309. placeholder: "开始日期",
  310. prop: "beginTime",
  311. placeholderOne: "结束日期",
  312. propOne: "endTime",
  313. },
  314. ]);
  315. const config = computed(() => {
  316. return [
  317. {
  318. attrs: {
  319. label: "生产公司",
  320. prop: "companyName",
  321. width: 130,
  322. },
  323. },
  324. {
  325. attrs: {
  326. label: "订单号",
  327. slot: "code",
  328. width: 150,
  329. },
  330. },
  331. {
  332. attrs: {
  333. label: "下单时间",
  334. prop: "createTime",
  335. width: 160,
  336. },
  337. },
  338. {
  339. attrs: {
  340. label: "生产状态",
  341. prop: "produceStatus",
  342. width: 120,
  343. },
  344. render(val) {
  345. return proxy.dictValueLabel(val, statusData.value);
  346. },
  347. },
  348. {
  349. attrs: {
  350. label: "交期",
  351. prop: "deliveryPeriod",
  352. width: 160,
  353. },
  354. },
  355. {
  356. attrs: {
  357. label: "投产时间",
  358. prop: "produceTime",
  359. width: 160,
  360. },
  361. },
  362. {
  363. attrs: {
  364. label: "完工时间",
  365. prop: "finishTime",
  366. width: 160,
  367. },
  368. },
  369. {
  370. attrs: {
  371. label: "是否逾期",
  372. slot: "isOverdue",
  373. width: 80,
  374. },
  375. },
  376. {
  377. attrs: {
  378. label: "生产指示",
  379. slot: "prodTag",
  380. "min-width": 220,
  381. },
  382. },
  383. {
  384. attrs: {
  385. slot: "list",
  386. label: "产品生产进度",
  387. // prop: "name",
  388. "min-width": 300,
  389. },
  390. },
  391. {
  392. attrs: {
  393. label: "操作",
  394. width: "100",
  395. align: "center",
  396. fixed: "right",
  397. },
  398. renderHTML(row) {
  399. return [
  400. row.produceTime || !proxy.isCurrentCompanyData(row.companyId)
  401. ? {}
  402. : {
  403. attrs: {
  404. label: "投产",
  405. type: "primary",
  406. text: true,
  407. },
  408. el: "button",
  409. click() {
  410. // proxy
  411. // .msgConfirm()
  412. // .then((res) => {
  413. // proxy
  414. // .post("/produceOrder/putProduction", {
  415. // id: row.id,
  416. // })
  417. // .then((res) => {
  418. // proxy.msgTip("操作成功", 1);
  419. // getList();
  420. // });
  421. // })
  422. // .catch((err) => {});
  423. clickDistributeProduction(row);
  424. },
  425. },
  426. ];
  427. },
  428. },
  429. ];
  430. });
  431. const formData = reactive({
  432. data: {},
  433. orderData: {},
  434. });
  435. const formOption = reactive({
  436. inline: true,
  437. labelWidth: 100,
  438. itemWidth: 100,
  439. });
  440. const formOptionOne = reactive({
  441. inline: true,
  442. labelWidth: 100,
  443. itemWidth: 100,
  444. disabled: true,
  445. });
  446. const formDom = ref(null);
  447. const formConfig = computed(() => {
  448. return [
  449. {
  450. type: "title1",
  451. title: "基本信息",
  452. },
  453. {
  454. type: "text",
  455. prop: "code",
  456. label: "合同号:",
  457. disabled: true,
  458. isShow: formData.orderData.code ? true : false,
  459. },
  460. {
  461. type: "title1",
  462. title: "商品信息",
  463. haveLine: true,
  464. },
  465. {
  466. type: "slot",
  467. slotName: "commodity",
  468. label: "",
  469. },
  470. ];
  471. });
  472. const rules = ref({
  473. deptId: [{ required: true, message: "请选择负责部门", trigger: "change" }],
  474. name: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
  475. code: [{ required: true, message: "请输入店铺编号", trigger: "blur" }],
  476. });
  477. const getList = async (req) => {
  478. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  479. loading.value = true;
  480. proxy.post("/produceOrder/page", sourceList.value.pagination).then((res) => {
  481. res.rows.forEach((x) => {
  482. if (x.prodTag) {
  483. x.prodTags = x.prodTag.split(",");
  484. } else {
  485. x.prodTags = [];
  486. }
  487. });
  488. sourceList.value.data = res.rows;
  489. sourceList.value.pagination.total = res.total;
  490. setTimeout(() => {
  491. loading.value = false;
  492. }, 200);
  493. });
  494. };
  495. const openModal = () => {
  496. dialogVisible.value = true;
  497. modalType.value = "add";
  498. formData.data = {
  499. definition: "2",
  500. fileList: [],
  501. };
  502. if (currencyData.value && currencyData.value.length > 0) {
  503. formData.data.currency = currencyData.value[0].dictKey;
  504. formData.data.costCurrency = currencyData.value[0].dictKey;
  505. }
  506. };
  507. const submitForm = () => {
  508. formDom.value.handleSubmit((valid) => {
  509. submitLoading.value = true;
  510. proxy.post("/shopInfo/" + modalType.value, formData.data).then(
  511. (res) => {
  512. proxy.msgTip("操作成功", 1);
  513. dialogVisible.value = false;
  514. submitLoading.value = false;
  515. getList();
  516. },
  517. (err) => {
  518. submitLoading.value = false;
  519. }
  520. );
  521. });
  522. };
  523. const getDtl = (row) => {
  524. modalType.value = "edit";
  525. proxy.post("/shopInfo/detail", { id: row.id }).then((res) => {
  526. formData.data = res;
  527. dialogVisible.value = true;
  528. });
  529. };
  530. getList();
  531. const productionFormDom = ref(null);
  532. const productionDialog = ref(false);
  533. const formLoading = ref(false);
  534. const productionFormConfig = computed(() => [
  535. {
  536. type: "date",
  537. itemType: "datetime",
  538. label: "投产时间",
  539. prop: "produceTime",
  540. // placeholder: "合同开始时间",
  541. itemWidth: 100,
  542. clearable: true,
  543. disabledFn: (date) => {
  544. return moment(date).isBefore(moment());
  545. },
  546. },
  547. ]);
  548. const productionRules = ref({
  549. produceTime: [
  550. { required: true, message: "请选择投产时间", trigger: "change" },
  551. ],
  552. });
  553. const clickDistributeProduction = (row) => {
  554. formData.data = {
  555. id: row.id,
  556. produceTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  557. };
  558. productionDialog.value = true;
  559. // proxy
  560. // .msgConfirm()
  561. // .then((res) => {
  562. // proxy.post("/produceOrder/putProduction", formData.data).then((res) => {
  563. // proxy.msgTip("操作成功");
  564. // formLoading.value = false;
  565. // productionDialog.value = false;
  566. // getList();
  567. // getRightData();
  568. // });
  569. // })
  570. // .catch((err) => {});
  571. };
  572. const submitProduction = () => {
  573. productionFormDom.value.handleSubmit(() => {
  574. formLoading.value = true;
  575. proxy.post("/produceOrder/putProduction", formData.data).then((res) => {
  576. proxy.msgTip("操作成功");
  577. formLoading.value = false;
  578. productionDialog.value = false;
  579. getList();
  580. getRightData();
  581. });
  582. });
  583. };
  584. const rightData = ref([]);
  585. const rightDataObj = ref({});
  586. const colorData = ref({});
  587. let colorList = [
  588. "#BBFF00",
  589. "#FFFF00",
  590. "#FFBB00",
  591. "#FF3333",
  592. "#D28EFF",
  593. "#CCEEFF",
  594. "#FFC8B4",
  595. "#CCDDFF",
  596. "#007799",
  597. "#550088",
  598. "#AAFFEE",
  599. "#FFB3FF",
  600. "#FFFF33",
  601. ];
  602. const getRightData = () => {
  603. proxy
  604. .post("/produceOrder/schedulingList", {
  605. beginDate: monthOne.value,
  606. companyId: sourceList.value.pagination.companyId,
  607. })
  608. .then(
  609. (res) => {
  610. rightDataObj.value = {};
  611. rightData.value = res.map((x, index) => ({
  612. ...x,
  613. produceTimeOne: x.produceTime,
  614. produceTime: x.produceTime.substr(0, 10),
  615. deliveryPeriod: x.deliveryPeriod.substr(0, 10),
  616. }));
  617. for (let i = 0; i < res.length; i++) {
  618. const ele = res[i];
  619. rightDataObj.value[ele.id] = ele;
  620. if (i <= 12) {
  621. colorData.value[ele.id] = colorList[i];
  622. } else {
  623. let index = Math.floor(i % 12);
  624. colorData.value[ele.id] = colorList[index];
  625. }
  626. }
  627. },
  628. (err) => {
  629. loading.value = false;
  630. }
  631. );
  632. };
  633. getRightData();
  634. const getBackGround = (id) => {
  635. return { background: colorData.value[id] };
  636. };
  637. const prodTagClose = (index, row) => {
  638. row.prodTags.splice(index, 1);
  639. proxy
  640. .post("/contract/updateProductionTag", {
  641. id: row.contractId,
  642. prodTag: row.prodTags.join(","),
  643. })
  644. .then((res) => {
  645. getList();
  646. });
  647. };
  648. const getDict = () => {
  649. proxy
  650. .get("/tenantDept/list", {
  651. pageNum: 1,
  652. pageSize: 9999,
  653. keyword: "",
  654. tenantId: proxy.useUserStore().user.tenantId,
  655. type: 0,
  656. })
  657. .then((res) => {
  658. companyData.value = res.data.map((x) => ({
  659. ...x,
  660. label: x.deptName,
  661. value: x.deptId,
  662. }));
  663. // treeData.value = proxy.handleTree(res.data, "deptId");
  664. });
  665. };
  666. getDict();
  667. const clickToday = () => {
  668. today.value = moment().format("yyyy-MM-DD");
  669. month.value = moment().format("yyyy年MM月");
  670. monthOne.value = moment().format("yyyy-MM");
  671. getRightData();
  672. };
  673. const isShow = (day) => {
  674. let nowDay = new Date(day + " 23:59:59").getTime();
  675. let flag = false;
  676. for (let i = 0; i < rightData.value.length; i++) {
  677. const e = rightData.value[i];
  678. let startDay = new Date(e.produceTime).getTime();
  679. let endDay = new Date(e.deliveryPeriod + " 23:59:59").getTime();
  680. if (nowDay >= startDay && nowDay <= endDay) {
  681. flag = true;
  682. break;
  683. }
  684. }
  685. return flag;
  686. };
  687. const judgeDay = (day) => {
  688. // return dateList.value[day] && dateList.value[day].length > 0;
  689. let nowDay = new Date(day + " 23:59:59").getTime();
  690. let rows = [];
  691. for (let i = 0; i < rightData.value.length; i++) {
  692. const e = rightData.value[i];
  693. let startDay = new Date(e.produceTime).getTime();
  694. let endDay = new Date(e.deliveryPeriod + " 23:59:59").getTime();
  695. if (nowDay >= startDay && nowDay <= endDay) {
  696. rows.push(e.id);
  697. }
  698. }
  699. return rows;
  700. };
  701. const showData = ref([]);
  702. const onShow = (day) => {
  703. let rows = judgeDay(day);
  704. console.log(rows, colorData, "sss");
  705. showData.value = rows;
  706. };
  707. const getData = (id, att) => {
  708. const current = rightData.value.find((x) => x.id == id);
  709. if (current && current[att]) {
  710. return current[att];
  711. }
  712. };
  713. const selectDate = (val) => {
  714. calendar.value.selectDate(val);
  715. };
  716. const prevMonth = () => {
  717. month.value = moment(
  718. moment(month.value, "yyyy年MM月").add(-1, "month").calendar()
  719. ).format("yyyy年MM月");
  720. monthOne.value = moment(moment(month.value, "yyyy年MM月")).format("yyyy-MM");
  721. selectDate("prev-month");
  722. getRightData();
  723. };
  724. const nextMonth = () => {
  725. month.value = moment(
  726. moment(month.value, "yyyy年MM月").add(+1, "month").calendar()
  727. ).format("yyyy年MM月");
  728. monthOne.value = moment(moment(month.value, "yyyy年MM月")).format("yyyy-MM");
  729. selectDate("next-month");
  730. getRightData();
  731. };
  732. watch(
  733. () => today.value,
  734. (newValue) => {
  735. if (month.value !== moment(newValue).format("yyyy年MM月")) {
  736. month.value = moment(newValue).format("yyyy年MM月");
  737. monthOne.value = moment(moment(month.value, "yyyy年MM月")).format(
  738. "yyyy-MM"
  739. );
  740. getRightData();
  741. }
  742. }
  743. );
  744. const getFileData = () => {
  745. let ids = [];
  746. formData.orderData.contractProductList.map((x) => {
  747. // ids.push(x.productId);
  748. x.contractProductBomList.map((y) => {
  749. ids.push(y.materialId);
  750. });
  751. });
  752. ids = Array.from(new Set(ids));
  753. proxy
  754. .post("/fileInfo/getList", {
  755. businessIdList: ids,
  756. })
  757. .then((fileObj) => {
  758. formData.orderData.contractProductList.map((x) => {
  759. // if (fileObj[x.productId] && fileObj[x.productId].length > 0) {
  760. // x.fileUrl = fileObj[x.productId][0].fileUrl;
  761. // }
  762. x.contractProductBomList.map((y) => {
  763. y.fileList = fileObj[y.materialId] || [];
  764. if (y.fileList && y.fileList.length > 0) {
  765. y.fileUrl = y.fileList[0].fileUrl;
  766. }
  767. });
  768. });
  769. });
  770. };
  771. const lookDetails = (item) => {
  772. proxy.post("/contract/detail", { id: item.contractId }).then((res) => {
  773. formData.orderData = res;
  774. dialogVisible.value = true;
  775. if (
  776. formData.orderData.contractProductList &&
  777. formData.orderData.contractProductList.length > 0
  778. ) {
  779. getFileData();
  780. let ids = formData.orderData.contractProductList.map((x) => x.id);
  781. let productIds = formData.orderData.contractProductList.map(
  782. (x) => x.productId
  783. );
  784. proxy.getFileData({
  785. businessIdList: productIds,
  786. data: formData.orderData.contractProductList,
  787. att: "productId",
  788. businessType: "0",
  789. fileAtt: "productFile",
  790. filePathAtt: "fileUrl",
  791. });
  792. proxy
  793. .getFileData({
  794. businessIdList: ids,
  795. getAll: true,
  796. })
  797. .then((fileObj) => {
  798. for (
  799. let i = 0;
  800. i < formData.orderData.contractProductList.length;
  801. i++
  802. ) {
  803. const ele = formData.orderData.contractProductList[i];
  804. for (const key in fileObj) {
  805. if (
  806. ele.id == key &&
  807. fileObj[ele.id] &&
  808. fileObj[ele.id].length > 0
  809. ) {
  810. ele.fileListOne = fileObj[ele.id].filter(
  811. (x) => x.businessType == "0"
  812. );
  813. if (ele.fileListOne && ele.fileListOne.length > 0) {
  814. ele.imageUrl = ele.fileListOne[0].fileUrl;
  815. }
  816. ele.prodFileList = fileObj[ele.id]
  817. .filter((x) => x.businessType == "1")
  818. .map((x) => ({ ...x, name: x.fileName, url: x.fileUrl }));
  819. if (ele.prodFileList && ele.prodFileList.length > 0) {
  820. ele.isShowProductFile = false;
  821. } else {
  822. ele.isShowProductFile = true;
  823. }
  824. }
  825. }
  826. }
  827. });
  828. }
  829. });
  830. };
  831. const handleClickUpload = async (att, flag, index) => {
  832. let res = null;
  833. let path = "";
  834. if (flag) {
  835. proxy.msgTip("请稍后", 2);
  836. res = await proxy.post("/fileService/createTempFolder");
  837. if (res && res.path) {
  838. formData.data.contractProductList[index][att] = res.path;
  839. path = res.path;
  840. }
  841. } else {
  842. path = formData.data.contractProductList[index][att];
  843. }
  844. let a = document.createElement("a");
  845. a.href = "printer://" + "ftp://121.37.194.75/" + path + "/";
  846. a.style.display = "none";
  847. document.body.appendChild(a);
  848. a.click();
  849. document.body.removeChild(a);
  850. };
  851. const onPicture = (path) => {
  852. window.open(path, "_blank");
  853. };
  854. </script>
  855. <style lang="scss" scoped>
  856. ::v-deep(.el-progress__text) {
  857. font-size: 14px !important;
  858. }
  859. .user {
  860. padding: 10px;
  861. display: flex;
  862. justify-content: space-between;
  863. .schedule-right {
  864. width: 400px;
  865. .schedule-top {
  866. width: 100%;
  867. background: #fff;
  868. padding: 20px;
  869. }
  870. .schedule-bottom {
  871. width: 100%;
  872. background: #fff;
  873. height: calc(100vh - 100px - 20px - 83px);
  874. padding: 20px;
  875. margin-top: 10px;
  876. overflow-y: auto;
  877. &::-webkit-scrollbar {
  878. width: 0px;
  879. }
  880. .line-class {
  881. height: 18px;
  882. line-height: 18px;
  883. overflow: hidden;
  884. white-space: nowrap;
  885. text-overflow: ellipsis;
  886. -o-text-overflow: ellipsis;
  887. margin: 1px 0;
  888. }
  889. }
  890. }
  891. .content {
  892. width: calc(100% - 410px);
  893. }
  894. }
  895. ::v-deep(.el-calendar__header) {
  896. display: none;
  897. }
  898. ::v-deep(.el-calendar__body) {
  899. padding: 0;
  900. }
  901. ::v-deep(.el-calendar-table .el-calendar-day) {
  902. // padding: 0;
  903. min-height: 50px;
  904. height: calc((100vh - 100px - 20px - 83px - 95px) / 5);
  905. overflow-y: hidden;
  906. }
  907. .el-icon.avatar-uploader-icon {
  908. font-size: 20px;
  909. color: #8c939d;
  910. width: 50px;
  911. height: 50px;
  912. text-align: center;
  913. border: 1px dashed var(--el-border-color);
  914. }
  915. .red {
  916. background: red;
  917. border-radius: 2px;
  918. padding: 4px;
  919. color: #fff;
  920. }
  921. </style>