index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="pageIndexClass">
  3. <div>
  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 #aa="{ item }">
  8. <div style="width:100%">
  9. <el-progress type="circle" :percentage="Number(item.completionRate)" width="60"
  10. :status="Number(item.completionRate) == 100 ? 'success' : ''" />
  11. </div>
  12. </template>
  13. <template v-for="(slotItem, index) in processesData" v-slot:[slotItem.id]="{ item }" :key="slotItem.id">
  14. <div style="width:100%">
  15. aaa
  16. </div>
  17. </template>
  18. </byTable>
  19. </div>
  20. <el-dialog :title="'打印二维码'" v-model="dialogVisible" width="350px" destroy-on-close>
  21. <div>
  22. <div id="pdfDom" style="width:100%">
  23. <div style="font-size:20px;text-align:center">
  24. {{printData.name}}
  25. </div>
  26. <div style="border-top: 1px solid #000;border-bottom: 1px solid #000; padding: 10px 0; margin:10px auto;text-align:center">
  27. <div :ref="printData.id" style="width:200px;margin-left:55px">
  28. {{printData.scanValue}}
  29. </div>
  30. <div style="font-size:20px;text-align:center;font-weight:700;margin-top:10px">
  31. {{printData.createTime}}
  32. </div>
  33. <!-- 换页 -->
  34. <!-- <div style="page-break-after: always"></div> -->
  35. </div>
  36. <div style="margin-left:10px;display:flex;flex-direction:column;justify-content:space-around">
  37. <div style="font-size:14px;margin-top:8px"> 产品编码:{{printData.productName}}</div>
  38. <div style="font-size:14px;margin-top:8px">
  39. 产品名称:{{printData.productSpec}}
  40. </div>
  41. <div style="font-size:14px;margin-top:8px">
  42. 原材料编码:{{printData.productSpec}}
  43. </div>
  44. <div style="font-size:14px;margin-top:8px">
  45. 原材料名称:{{printData.productSpec}}
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <template #footer>
  51. <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
  52. <el-button type="primary" v-print="printObj" size="defualt">打 印</el-button>
  53. </template>
  54. </el-dialog>
  55. </div>
  56. </template>
  57. <script setup>
  58. import byTable from "@/components/byTable/index";
  59. import byForm from "@/components/byForm/index";
  60. import QRCode from "qrcodejs2-fix";
  61. const { proxy } = getCurrentInstance();
  62. const loading = ref(false);
  63. const submitLoading = ref(false);
  64. const sourceList = ref({
  65. data: [],
  66. pagination: {
  67. total: 3,
  68. pageNum: 1,
  69. pageSize: 10,
  70. keyword: "",
  71. produceStatus: "",
  72. staDeliveryPeriod: "",
  73. endDeliveryPeriod: "",
  74. beginTime: "",
  75. endTime: "",
  76. },
  77. });
  78. const treeData = ref([]);
  79. const dialogVisible = ref(false);
  80. const modalType = ref("add");
  81. const statusData = ref([
  82. {
  83. label: "未开始",
  84. value: "0",
  85. },
  86. {
  87. label: "生产中",
  88. value: "1",
  89. },
  90. {
  91. label: "生产完成",
  92. value: "2",
  93. },
  94. {
  95. label: "出库中",
  96. value: "5",
  97. },
  98. {
  99. label: "已出库",
  100. value: "10",
  101. },
  102. {
  103. label: "作废",
  104. value: "99",
  105. },
  106. ]);
  107. const selectConfig = computed(() => [
  108. {
  109. label: "生产状态",
  110. prop: "produceStatus",
  111. data: statusData.value,
  112. },
  113. {
  114. type: "time",
  115. label: "交期",
  116. placeholder: "开始日期",
  117. prop: "staDeliveryPeriod",
  118. placeholderOne: "结束日期",
  119. propOne: "endDeliveryPeriod",
  120. },
  121. {
  122. type: "time",
  123. label: "下单日期",
  124. placeholder: "开始日期",
  125. prop: "beginTime",
  126. placeholderOne: "结束日期",
  127. propOne: "endTime",
  128. },
  129. ]);
  130. const config = ref([
  131. {
  132. attrs: {
  133. label: "订单号",
  134. prop: "code",
  135. },
  136. },
  137. // {
  138. // attrs: {
  139. // label: "设计图",
  140. // prop: "code",
  141. // },
  142. // },
  143. {
  144. attrs: {
  145. label: "产品图片",
  146. prop: "code",
  147. },
  148. },
  149. {
  150. attrs: {
  151. label: "产品编码",
  152. prop: "name",
  153. },
  154. },
  155. {
  156. attrs: {
  157. label: "产品名称",
  158. prop: "name",
  159. },
  160. },
  161. {
  162. attrs: {
  163. label: "生产状态",
  164. prop: "deptName",
  165. },
  166. render(val) {
  167. return proxy.dictValueLabel(val, statusData.value);
  168. },
  169. },
  170. {
  171. attrs: {
  172. label: "下单时间",
  173. prop: "deptName",
  174. },
  175. },
  176. {
  177. attrs: {
  178. label: "交期",
  179. prop: "deptName",
  180. },
  181. },
  182. {
  183. attrs: {
  184. label: "投产时间",
  185. prop: "deptName",
  186. },
  187. },
  188. {
  189. attrs: {
  190. label: "完成时间",
  191. prop: "deptName",
  192. },
  193. },
  194. {
  195. attrs: {
  196. label: "生产用时",
  197. prop: "deptName",
  198. },
  199. },
  200. ]);
  201. const formData = reactive({
  202. data: {},
  203. });
  204. const formOption = reactive({
  205. inline: true,
  206. labelWidth: 100,
  207. itemWidth: 100,
  208. });
  209. const formDom = ref(null);
  210. const formConfig = computed(() => {
  211. return [
  212. {
  213. type: "input",
  214. prop: "code",
  215. label: "店铺编号",
  216. itemWidth: 100,
  217. disabled: false,
  218. },
  219. {
  220. type: "input",
  221. prop: "name",
  222. label: "店铺名称",
  223. itemWidth: 100,
  224. disabled: false,
  225. },
  226. {
  227. type: "treeSelect",
  228. prop: "deptId",
  229. label: "负责部门",
  230. data: treeData.value,
  231. propsTreeLabel: "deptName",
  232. propsTreeValue: "deptId",
  233. itemWidth: 100,
  234. disabled: false,
  235. },
  236. ];
  237. });
  238. const rules = ref({
  239. deptId: [{ required: true, message: "请选择负责部门", trigger: "change" }],
  240. name: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
  241. code: [{ required: true, message: "请输入店铺编号", trigger: "blur" }],
  242. });
  243. const getList = async (req) => {
  244. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  245. loading.value = true;
  246. proxy.post("/shopInfo/page", sourceList.value.pagination).then((res) => {
  247. sourceList.value.data = res.rows;
  248. sourceList.value.pagination.total = res.total;
  249. setTimeout(() => {
  250. loading.value = false;
  251. }, 200);
  252. });
  253. };
  254. const openModal = () => {
  255. dialogVisible.value = true;
  256. modalType.value = "add";
  257. formData.data = {
  258. definition: "2",
  259. fileList: [],
  260. };
  261. if (currencyData.value && currencyData.value.length > 0) {
  262. formData.data.currency = currencyData.value[0].dictKey;
  263. formData.data.costCurrency = currencyData.value[0].dictKey;
  264. }
  265. };
  266. const submitForm = () => {
  267. formDom.value.handleSubmit((valid) => {
  268. submitLoading.value = true;
  269. proxy.post("/shopInfo/" + modalType.value, formData.data).then(
  270. (res) => {
  271. proxy.msgTip("操作成功", 1);
  272. dialogVisible.value = false;
  273. submitLoading.value = false;
  274. getList();
  275. },
  276. (err) => {
  277. submitLoading.value = false;
  278. }
  279. );
  280. });
  281. };
  282. const getDtl = (row) => {
  283. modalType.value = "edit";
  284. proxy.post("/shopInfo/detail", { id: row.id }).then((res) => {
  285. formData.data = res;
  286. dialogVisible.value = true;
  287. });
  288. };
  289. const processesData = ref([]);
  290. const getProcesses = () => {
  291. proxy
  292. .post("/productionProcesses/page", { pageNum: 1, pageSize: 9999 })
  293. .then((res) => {
  294. for (let i = 0; i < res.rows.length; i++) {
  295. const ele = res.rows[i];
  296. let attrs = {
  297. label: `[ ${ele.name} ]`,
  298. slot: ele.id,
  299. isNeedHeaderSlot: false,
  300. width: 90,
  301. fixed: "right",
  302. };
  303. config.value.push({
  304. attrs,
  305. });
  306. }
  307. processesData.value = res.rows;
  308. });
  309. };
  310. getProcesses();
  311. getList();
  312. const printData = ref({});
  313. const printQrCode = (row) => {
  314. printData.value = row;
  315. dialogVisible.value = true;
  316. nextTick(() => {
  317. proxy.$refs[row.id].innerHTML = ""; //清除二维码方法一
  318. new QRCode(proxy.$refs[row.id], {
  319. text: row.id,
  320. width: 200,
  321. height: 200,
  322. colorDark: "#000000",
  323. colorLight: "#ffffff",
  324. correctLevel: QRCode.CorrectLevel.H,
  325. });
  326. });
  327. };
  328. const printObj = ref({
  329. id: "pdfDom",
  330. popTitle: "",
  331. extraCss:
  332. "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",
  333. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  334. });
  335. </script>
  336. <style lang="scss" scoped>
  337. ::v-deep(.el-progress__text) {
  338. font-size: 14px !important;
  339. }
  340. .content {
  341. padding: 20px;
  342. }
  343. </style>