index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <!-- 采购订单修订—— 查看 -->
  2. <script>
  3. import {
  4. initColumns,
  5. initDicts,
  6. initRules,
  7. initParams,
  8. } from "@/utils/init";
  9. import { Columns, TabColumns } from "../add/column";
  10. const NewColumns = initColumns(Columns, { disabled: true, readonly: true });
  11. const NewTabColumns = TabColumns.map((element) => ({
  12. ...element,
  13. tableColumns: initColumns(element.tableColumns),
  14. }));
  15. export default {
  16. name: "SeePurchaseContractDrawer",
  17. dicts: initDicts(NewColumns),
  18. data() {
  19. // const arr2Obj = function (data, keyName, valueName) {
  20. // return Object.fromEntries(
  21. // data.map((item) => [item[keyName], item[valueName]])
  22. // );
  23. // };
  24. // const columns = [
  25. // // { key: "id", title: "主键" },
  26. // { key: "puOrg", title: "采购组织" },
  27. // { key: "puOrgName", title: "采购组织名称" },
  28. // { key: "billType", title: "订单类型" },
  29. // { key: "billTypeName", title: "订单类型名称" },
  30. // { key: "oaDemandNo", title: "OA需求单号" },
  31. // { key: "code", title: "订单编号" },
  32. // { key: "billDate", title: "订单日期" },
  33. // { key: "supplier", title: "供应商" },
  34. // { key: "supplierName", title: "供应商名称" },
  35. // { key: "paymentAgreement", title: "付款协议" },
  36. // { key: "finalType", title: "结算方式" },
  37. // { key: "currency", title: "币种" },
  38. // { key: "currencyName", title: "币种名称" },
  39. // { key: "buyer", title: "采购员" },
  40. // { key: "buyerName", title: "采购员名称" },
  41. // { key: "puDept", title: "采购部门" },
  42. // { key: "puDeptName", title: "采购部门名称" },
  43. // { key: "customer", title: "收货客户" },
  44. // { key: "customerName", title: "收货客户名称" },
  45. // { key: "qty", title: "总数量" },
  46. // { key: "originalQty", title: "原始总数量" },
  47. // { key: "money", title: "价税合计" },
  48. // { key: "originalMoney", title: "原始总金额" },
  49. // { key: "notaxMoney", title: "无税金额" },
  50. // { key: "status", title: "单据状态" },
  51. // { key: "freezeCause", title: "冻结原因" },
  52. // { key: "isBack", title: "退货" },
  53. // { key: "isMarketing", title: "已协同生成销售订单" },
  54. // { key: "isMarketingSource", title: "由销售订单协同生成" },
  55. // { key: "warehouse", title: "WMS入库仓库" },
  56. // { key: "warehouseName", title: "WMS入库仓库名称" },
  57. // { key: "goodsAllocation", title: "货位" },
  58. // { key: "goodsAllocationName", title: "货位名称" },
  59. // { key: "isSendSrm", title: "是否同步SRM" },
  60. // { key: "isInvoice", title: "发票标识" },
  61. // { key: "supplierOrderNo", title: "供应商订单号" },
  62. // { key: "rebateMoney", title: "订单使用返利金额" },
  63. // { key: "deductionMoney", title: "订单抵扣余款金额" },
  64. // { key: "address", title: "收货地址" },
  65. // { key: "contacts", title: "收货联系人" },
  66. // { key: "customerDept", title: "客户部门" },
  67. // { key: "customerDeptName", title: "客户部门名称" },
  68. // { key: "supplierContacts", title: "供应商业务联系人" },
  69. // { key: "supplierContactsName", title: "供应商业务联系人名称" },
  70. // { key: "isUrgency", title: "紧急程度" },
  71. // { key: "isSendWms", title: "已同步WMS" },
  72. // { key: "agent", title: "代理人" },
  73. // { key: "agentName", title: "代理人名称" },
  74. // { key: "isClose", title: "最终关闭" },
  75. // { key: "closeTime", title: "最终关闭日期" },
  76. // { key: "applyPaymentMoney", title: "累计付款申请金额" },
  77. // { key: "paymentMoney", title: "累计付款金额" },
  78. // { key: "invoiceMoney", title: "发票金额" },
  79. // { key: "supplierPersonal", title: "供应商业务员" },
  80. // { key: "supplierPersonalName", title: "供应商业务员名称" },
  81. // { key: "isDeliver", title: "是否发货" },
  82. // { key: "retReason", title: "退换原因" },
  83. // { key: "processType", title: "处理方式" },
  84. // { key: "isEnd", title: "整单关闭标识" },
  85. // { key: "projectNow", title: "在建工程项目" },
  86. // { key: "operatingItems", title: "经营性项目" },
  87. // { key: "isArrivalReson", title: "到货超期原因" },
  88. // { key: "midOrderNo", title: "中台采购订单号" },
  89. // { key: "marketingCode", title: "销售订单号" },
  90. // { key: "isArrival", title: "到货超期" },
  91. // // { key: "tenantId", title: "租户号" },
  92. // // { key: "revision", title: "乐观锁" },
  93. // { key: "createByName", title: "创建人名称" },
  94. // { key: "updateByName", title: "更新人名称" },
  95. // // { key: "delFlag", title: "删除标记" },
  96. // { key: "flowId", title: "OA流程ID" },
  97. // { key: "approver", title: "审批人" },
  98. // { key: "approverFinishTime", title: "审批时间" },
  99. // { key: "approveTime", title: "提交时间" },
  100. // ];
  101. // const initColumns = () =>
  102. // columns.map((column) => {
  103. // const clearable = column.clearable || true;
  104. // if (column.type === "InputNumber") {
  105. // return {
  106. // ...column,
  107. // clearable,
  108. // config: { controlsPosition: "right" },
  109. // };
  110. // }
  111. // if (column.type === "DatePicker") {
  112. // return {
  113. // ...column,
  114. // clearable,
  115. // config: { type: "date" },
  116. // };
  117. // }
  118. // return {
  119. // ...column,
  120. // clearable,
  121. // };
  122. // });
  123. // const initParams = () => arr2Obj(initColumns(), "key", "value");
  124. // const tabColumns = [
  125. // {
  126. // title: '物料信息',
  127. // key: 'first',
  128. // tableColumns: [
  129. // // { key: "id", title: "主键" },
  130. // { key: "rowNo", title: "行号" },
  131. // { key: "orderId", title: "采购订单ID" },
  132. // { key: "material", title: "物料" },
  133. // { key: "materialName", title: "物料名称" },
  134. // { key: "materialCode", title: "物料编码" },
  135. // { key: "materialClassify", title: "物料分类" },
  136. // { key: "materialManufacturersCode", title: "厂家物料编码" },
  137. // { key: "specification", title: "规格" },
  138. // { key: "model", title: "型号" },
  139. // { key: "isMedcine", title: "医药物料" },
  140. // { key: "manufacturer", title: "生产厂家代理人" },
  141. // { key: "isDrug", title: "物料药品属性" },
  142. // { key: "unit", title: "单位" },
  143. // { key: "qty", title: "数量" },
  144. // { key: "taxPrice", title: "含税单价" },
  145. // { key: "money", title: "价税合计" },
  146. // { key: "tax", title: "税率" },
  147. // { key: "taxDeductMoneya", title: "折扣金额" },
  148. // { key: "arrivalQty", title: "已到货数量" },
  149. // { key: "unarrivedQty", title: "未到货数量" },
  150. // { key: "notaxMoney", title: "无税金额" },
  151. // { key: "priceSource", title: "价格目录ID" },
  152. // { key: "isStorage", title: "入库关闭" },
  153. // { key: "isInvoice", title: "开票关闭" },
  154. // { key: "isArrival", title: "到货关闭" },
  155. // { key: "isPayment", title: "付款关闭" },
  156. // { key: "isGift", title: "赠品" },
  157. // { key: "warehouse", title: "收货仓库" },
  158. // { key: "place", title: "收货地点" },
  159. // { key: "address", title: "收货地址" },
  160. // { key: "productBatch", title: "产品批号" },
  161. // { key: "manufactureDate", title: "生产日期" },
  162. // { key: "efficacyLoseDate", title: "有效期至/失效日期" },
  163. // { key: "approvalNumber", title: "批准文号" },
  164. // { key: "registration", title: "注册证号" },
  165. // { key: "storageCondition", title: "存储条件" },
  166. // { key: "carriageCondition", title: "运输条件" },
  167. // { key: "isBatchLock", title: "批号锁定标识" },
  168. // { key: "isReplenishment", title: "补单标识" },
  169. // { key: "isUrgency", title: "紧急标识" },
  170. // { key: "originalQty", title: "原始数量" },
  171. // { key: "originalMoney", title: "原始金额" },
  172. // { key: "directProductBatch", title: "直运产品批号" },
  173. // { key: "discountRule", title: "折扣规则编码" },
  174. // { key: "reservedQty", title: "预留数量" },
  175. // { key: "reservedPeriod", title: "预留周期" },
  176. // { key: "taxDeductClassify", title: "扣税类别" },
  177. // { key: "exchangeRate", title: "折本汇率" },
  178. // { key: "source", title: "上游单据号" },
  179. // { key: "sourceId", title: "上游单据ID" },
  180. // { key: "demandCode", title: "采购需求单号" },
  181. // { key: "arrivalDatePlan", title: "计划到货日期" },
  182. // { key: "priceType", title: "价格类型" },
  183. // { key: "isDistributionPrice", title: "配送价" },
  184. // // { key: "tenantId", title: "租户号" },
  185. // // { key: "revision", title: "乐观锁" },
  186. // { key: "createByName", title: "创建人名称" },
  187. // { key: "updateByName", title: "更新人名称" },
  188. // // { key: "delFlag", title: "删除标记" },
  189. // // { key: "materialClassifyOne", title: "物料一级分类" },
  190. // { key: "materialClassifyOneName", title: "物料一级分类名称" },
  191. // // { key: "materialClassifyTwo", title: "物料二级分类" },
  192. // { key: "materialClassifyTwoName", title: "物料二级分类名称" },
  193. // // { key: "materialClassifyThree", title: "物料三级分类" },
  194. // { key: "materialClassifyThreeName", title: "物料三级分类名称" },
  195. // // { key: "materialClassifyFour", title: "物料四级分类" },
  196. // { key: "materialClassifyFourName", title: "物料四级分类名称" },
  197. // { key: "price", title: "无税单价" }
  198. // ]
  199. // },
  200. // {
  201. // title: '执行结果',
  202. // key: 'second',
  203. // tableColumns: [
  204. // // { key: "id", title: "主键" },
  205. // { key: "orderId", title: "采购订单ID" },
  206. // { key: "rowno", title: "行号" },
  207. // { key: "material", title: "物料" },
  208. // { key: "materialName", title: "物料名称" },
  209. // { key: "specification", title: "规格" },
  210. // { key: "qty", title: "数量" },
  211. // { key: "stroageQty", title: "累计到货主数量" },
  212. // { key: "stockQty", title: "累计入库主数量" },
  213. // { key: "invoiceQty", title: "累计开票主数量" },
  214. // { key: "rollbackQty", title: "累计退货主数量" },
  215. // { key: "backStockQty", title: "累计退库主数量" },
  216. // { key: "floatQty", title: "未到货数量" },
  217. // // { key: "tenantId", title: "租户号" },
  218. // // { key: "revision", title: "乐观锁" },
  219. // { key: "createByName", title: "创建人名称" },
  220. // { key: "updateByName", title: "更新人名称" },
  221. // // { key: "delFlag", title: "删除标记" }
  222. // ]
  223. // },
  224. // ];
  225. // const initTabColumns = () => tabColumns;
  226. return {
  227. visible: false,
  228. columns: NewColumns,
  229. rules: initRules(NewColumns),
  230. params: {
  231. ...initParams(NewColumns),
  232. puOrderItemList: [],
  233. puOrderExecuteList: [],
  234. },
  235. tabColumns: NewTabColumns,
  236. tabName: "puOrderItemList",
  237. // tabTableDatas: {
  238. // first: [],
  239. // second: [],
  240. // // third: [],
  241. // // fourth: [],
  242. // // fifth: [],
  243. // },
  244. };
  245. },
  246. computed: {},
  247. watch: {},
  248. methods: {
  249. setVisible(prop) {
  250. this.visible = prop;
  251. },
  252. //
  253. async fetchItem(prop) {
  254. try {
  255. this.loading = true;
  256. const { code, msg, data } = await item(prop);
  257. if (code === 200) {
  258. this.params = data;
  259. this.$notify.success({ title: msg });
  260. } else {
  261. this.$notify.warning({ title: msg });
  262. }
  263. } catch (err) {
  264. this.$notify.error({ title: "error", message: err });
  265. } finally {
  266. this.loading = false;
  267. }
  268. },
  269. // 取 消
  270. handleCancel() {
  271. this.setVisible(false);
  272. this.params = initParams(Columns);
  273. },
  274. },
  275. created() { },
  276. mounted() { },
  277. destroyed() { },
  278. };
  279. </script>
  280. <template>
  281. <el-drawer direction="btt" size="100%" :with-header="false" :visible.sync="visible" @open="beforeOpen"
  282. @close="$emit('close')">
  283. <el-form size="mini" label-position="right" label-width="135px" :model="params" :rules="rules">
  284. <el-card :body-style="{
  285. padding: '20px',
  286. display: 'flex',
  287. 'flex-wrap': 'wrap',
  288. }" style="margin: 10px">
  289. <div slot="header" style="
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. ">
  294. <h3>查看</h3>
  295. <div style="text-align: right">
  296. <el-button size="mini" @click="handleCancel">取 消</el-button>
  297. </div>
  298. </div>
  299. <el-row>
  300. <el-col v-for="(column, index) in columns" :key="index" :span="column.span || 6">
  301. <el-form-item :prop="column.key" :label="column.title">
  302. <el-input v-if="column.type === 'Textarea'" v-model="params[column.key]" type="textarea"
  303. :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
  304. :readonly="column.readonly" style="width: 100%"></el-input>
  305. <el-input-number v-else-if="column.type === 'InputNumber'" v-model="params[column.key]"
  306. :controls-position="column.config.controlsPosition" :placeholder="column.placeholder"
  307. :clearable="column.clearable" :disabled="column.disabled" :readonly="column.readonly"
  308. style="width: 100%"></el-input-number>
  309. <el-select v-else-if="column.type === 'Select'" v-model="params[column.key]"
  310. :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
  311. :readonly="column.readonly" style="width: 100%">
  312. <el-option v-for="item in dict.type[column.config.optionsName]" :key="item.value" :label="item.label"
  313. :value="item.value">
  314. </el-option>
  315. </el-select>
  316. <el-date-picker v-else-if="column.type === 'DatePicker'" v-model="params[column.key]"
  317. :type="column.config.type" :placeholder="column.placeholder" :clearable="column.clearable"
  318. :disabled="column.disabled" :readonly="column.readonly" :picker-options="column.pickerOptions"
  319. style="width: 100%">
  320. </el-date-picker>
  321. <el-upload v-else-if="column.type === 'Upload'" :file-list="params[column.key]" :disabled="column.disabled"
  322. :readonly="column.readonly" drag action="https://jsonplaceholder.typicode.com/posts/" multiple>
  323. <i class="el-icon-upload"></i>
  324. <div class="el-upload__text">
  325. 将文件拖到此处,或<em>点击上传</em>
  326. </div>
  327. <div class="el-upload__tip" slot="tip">
  328. 只能上传jpg/png文件,且不超过500kb
  329. </div>
  330. </el-upload>
  331. <el-input v-else v-model="params[column.key]" :placeholder="column.placeholder"
  332. :clearable="column.clearable" :disabled="column.disabled" :readonly="column.readonly"
  333. style="width: 100%"></el-input>
  334. </el-form-item>
  335. </el-col>
  336. </el-row>
  337. </el-card>
  338. <el-card :body-style="{
  339. padding: '20px',
  340. display: 'flex',
  341. 'flex-wrap': 'wrap',
  342. position: 'relative',
  343. }" style="margin: 10px">
  344. <el-tabs v-model="tabName" style="width: 100%">
  345. <el-tab-pane v-for="(column, index) in tabColumns" :key="index" :label="column.title" :name="column.key">
  346. <el-table :data="params[column.key]" style="width: 100%">
  347. <el-table-column v-for="(cColumn, cIndex) in column.tableColumns" :key="cIndex" :prop="cColumn.key"
  348. :label="cColumn.title" :width="cColumn.width">
  349. <template slot-scope="scope">
  350. <el-tag v-if="cColumn.key === 'index'">
  351. {{ scope.$index + 1 }}
  352. </el-tag>
  353. <el-input v-if="cColumn.type === 'Input'" v-model="scope.row[cColumn.key]"
  354. :placeholder="cColumn.placeholder" :clearable="cColumn.clearable" :disabled="cColumn.disabled"
  355. size="mini" style="width: 100%"></el-input>
  356. <el-input-number v-if="cColumn.type === 'InputNumber'" v-model="scope.row[cColumn.key]"
  357. :controls-position="cColumn.config.controlsPosition" :placeholder="cColumn.placeholder"
  358. :clearable="cColumn.clearable" :disabled="cColumn.disabled" size="mini"
  359. style="width: 100%"></el-input-number>
  360. <el-input v-if="column.type === 'InputDialog'" v-model="params[column.key]"
  361. :placeholder="column.placeholder" :clearable="column.clearable" :disabled="column.disabled"
  362. :readonly="column.readonly" style="width: 100%; cursor: pointer"
  363. @click.native.stop="openAsyncInputDialog(column, params)">
  364. <template #suffix>
  365. <el-icon class="el-icon-thumb"></el-icon>
  366. </template>
  367. </el-input>
  368. </template>
  369. </el-table-column>
  370. <el-table-column fixed="right" label="操作" width="120">
  371. <template slot-scope="scope">
  372. <el-button @click.native.prevent="
  373. delTableRow(params[tabName], scope.$index)
  374. " type="text" size="small">
  375. 删行
  376. </el-button>
  377. </template>
  378. </el-table-column>
  379. </el-table>
  380. </el-tab-pane>
  381. </el-tabs>
  382. <el-row style="position: absolute; top: 20px; right: 20px">
  383. <el-button size="mini" @click="addTableRow(params[tabName])">增行</el-button>
  384. </el-row>
  385. </el-card>
  386. </el-form>
  387. </el-drawer>
  388. </template>