see-purchase-task.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <script>
  2. export default {
  3. name: "SeePurchaseTaskDrawer",
  4. data() {
  5. const arr2Obj = function (data, keyName, valueName) {
  6. return Object.fromEntries(
  7. data.map((item) => [item[keyName], item[valueName]])
  8. );
  9. };
  10. const columns = [
  11. {
  12. title: "采购组织",
  13. key: "puOrg",
  14. type: "TagSelect",
  15. value: [],
  16. required: true,
  17. },
  18. { title: "需求来源", key: "source", type: "Input", value: "采购创建" },
  19. { title: "采购员", key: "buyer", value: [], type: "TagSelect" },
  20. { title: "交易类型", key: "billYpe", value: [], type: "TagSelect" },
  21. { title: "物料编码", key: "material", type: "Input", required: true },
  22. {
  23. title: "物料名称",
  24. key: "materialName",
  25. type: "TagSelect",
  26. value: [],
  27. required: true,
  28. },
  29. {
  30. title: "物料/物料描述",
  31. key: "materialDesc",
  32. type: "TagSelect",
  33. value: [],
  34. required: true,
  35. },
  36. { title: "生产厂家", key: "manufacturer", type: "Input" },
  37. { title: "收货客户", key: "customer", type: "TagSelect", value: [] },
  38. {
  39. title: "采购单位",
  40. key: "puUnit",
  41. type: "TagSelect",
  42. value: [],
  43. required: true,
  44. },
  45. {
  46. title: "采购数量",
  47. key: "puQty",
  48. type: "InputNumber",
  49. required: true,
  50. },
  51. {
  52. title: "需求时间",
  53. key: "demandDate",
  54. type: "DatePicker",
  55. config: { type: "date" },
  56. },
  57. { title: "项目名称", key: "projectName", type: "TagSelect", value: [] },
  58. { title: "需求人", key: "demandPersonal", type: "TagSelect", value: [] },
  59. {
  60. title: "需求组织",
  61. key: "demandOrg",
  62. type: "TagSelect",
  63. value: [],
  64. require: true,
  65. },
  66. { title: "需求部门", key: "demandDept", type: "TagSelect", value: [] },
  67. { title: "建议供应商", key: "supplier", type: "TagSelect", value: [] },
  68. { title: "收货人", key: "a", type: "TagSelect", value: [] },
  69. { title: "收货组织", key: "b", type: "TagSelect", value: [] },
  70. { title: "收货人联系方式", key: "c", type: "Input" },
  71. { title: "收货地址", key: "d", type: "Input" },
  72. { title: "收货仓库", key: "e", type: "TagSelect", value: [] },
  73. {
  74. title: "指定供应商",
  75. key: "assignSupplier",
  76. type: "TagSelect",
  77. value: [],
  78. },
  79. { title: "单位", key: "unit", type: "TagSelect", value: [] },
  80. { title: "收货地址", key: "f", type: "TagSelect", value: [] },
  81. ];
  82. const initColumns = () => columns;
  83. const initParams = () => arr2Obj(initColumns(), "key", "value");
  84. return {
  85. visible: false,
  86. loading: false,
  87. columns: initColumns(),
  88. params: initParams(),
  89. };
  90. },
  91. computed: {},
  92. watch: {},
  93. methods: {
  94. setVisible(prop) {
  95. this.visible = prop;
  96. },
  97. async fetchTaskItem() {
  98. this.loading = true;
  99. try {
  100. // do something
  101. } catch (err) {
  102. this.$notify.error({ title: "error", message: err });
  103. } finally {
  104. this.loading = false;
  105. }
  106. },
  107. },
  108. created() {
  109. console.log(this.params);
  110. },
  111. mounted() {},
  112. destroyed() {},
  113. };
  114. </script>
  115. <template>
  116. <el-drawer
  117. title="我是标题"
  118. direction="btt"
  119. size="100%"
  120. :with-header="false"
  121. :visible.sync="visible"
  122. :before-close="handleClose"
  123. >
  124. <el-card
  125. :body-style="{
  126. padding: '20px',
  127. display: 'flex',
  128. 'flex-wrap': 'wrap',
  129. }"
  130. style="margin: 10px"
  131. >
  132. <el-descriptions title="采购任务详情" direction="vertical" :column="3">
  133. <el-descriptions-item
  134. v-for="(column, index) in columns"
  135. :key="index"
  136. :label="column.title"
  137. >
  138. {{ params[column.key] }}
  139. </el-descriptions-item>
  140. </el-descriptions>
  141. </el-card>
  142. <el-card
  143. :body-style="{
  144. 'text-align': 'right',
  145. padding: '10px 20px',
  146. }"
  147. style="
  148. position: fixed;
  149. left: 0;
  150. bottom: 0;
  151. margin: 10px;
  152. width: calc(100% - 20px);
  153. "
  154. >
  155. <el-button size="mini" @click="setVisible(false)">返回</el-button>
  156. </el-card>
  157. </el-drawer>
  158. </template>