You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

384 lines
16 KiB

  1. <template>
  2. <div class="customer-css">
  3. <el-form :inline="true" label-position="top" :model="searchData">
  4. <el-form-item label="物料编码">
  5. <el-input v-model="searchData.partNo" clearable style="width: 150px"></el-input>
  6. </el-form-item>
  7. <el-form-item label="物料名称">
  8. <el-input v-model="searchData.partDesc" clearable style="width: 150px"></el-input>
  9. </el-form-item>
  10. <el-form-item label="状态">
  11. <el-input v-model="searchData.remark1" clearable style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item label=" ">
  14. <el-button type="primary" @click="searchTable()">查询</el-button>
  15. <el-button type="primary" @click="addModal()">新增</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table
  19. :data="dataList"
  20. :height="searchData.height"
  21. border
  22. v-loading="dataListLoading"
  23. style="width: 100%;">
  24. <el-table-column
  25. v-for="(item, index) in columnList"
  26. :key="index"
  27. :sortable="item.columnSortable"
  28. :prop="item.columnProp"
  29. :header-align="item.headerAlign"
  30. :show-overflow-tooltip="item.showOverflowTooltip"
  31. :align="item.align"
  32. :fixed="item.fixed == '' ? false : item.fixed"
  33. :min-width="item.columnWidth"
  34. :label="item.columnLabel">
  35. <template slot-scope="scope">
  36. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column
  40. header-align="center"
  41. align="center"
  42. width="180"
  43. fixed="right"
  44. label="Actions">
  45. <template slot-scope="scope">
  46. <a type="text" size="small" @click="editModel(scope.row)">Edit |</a>
  47. <a type="text" size="small" @click="deleteData(scope.row)"> Delete</a>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <!-- 新增/编辑弹窗 -->
  52. <el-dialog :title="dialogTitle" :close-on-click-modal="false" v-drag :visible.sync="dialogVisible" width="900px">
  53. <div class="dialog-content">
  54. <el-form label-position="top" :model="formData" :rules="formRules" ref="formRef">
  55. <el-row :gutter="20">
  56. <el-col :span="8">
  57. <el-form-item label="物料编码" prop="partNo">
  58. <el-input v-model="formData.partNo" placeholder="请输入物料编码"></el-input>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="8">
  62. <el-form-item label="物料名称" prop="partDesc">
  63. <el-input v-model="formData.partDesc" placeholder="请输入物料名称"></el-input>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="8">
  67. <el-form-item label="计量单位" prop="umid">
  68. <el-input v-model="formData.umid" placeholder="请输入计量单位"></el-input>
  69. </el-form-item>
  70. </el-col>
  71. </el-row>
  72. <el-row :gutter="20">
  73. <el-col :span="8">
  74. <el-form-item label="询价数量" prop="qty">
  75. <el-input v-model="formData.qty" type="number" placeholder="请输入询价数量"></el-input>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="8">
  79. <el-form-item label="状态" prop="remark1">
  80. <el-select v-model="formData.remark1" placeholder="请选择状态" clearable style="width: 100%">
  81. <el-option label="询价中" value="询价中"></el-option>
  82. <el-option label="报价中" value="报价中"></el-option>
  83. <el-option label="已完成" value="已完成"></el-option>
  84. <el-option label="已取消" value="已取消"></el-option>
  85. </el-select>
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="8">
  89. <el-form-item label="材料费用" prop="materialCost">
  90. <el-input v-model="formData.materialCost" type="number" placeholder="请输入材料费用"></el-input>
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row :gutter="20">
  95. <el-col :span="8">
  96. <el-form-item label="加工费" prop="produceFee">
  97. <el-input v-model="formData.produceFee" type="number" placeholder="请输入加工费"></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="8">
  101. <el-form-item label="表面处理费" prop="surfaceFee">
  102. <el-input v-model="formData.surfaceFee" type="number" placeholder="请输入表面处理费"></el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="8">
  106. <el-form-item label="利润" prop="profit">
  107. <el-input v-model="formData.profit" type="number" placeholder="请输入利润"></el-input>
  108. </el-form-item>
  109. </el-col>
  110. </el-row>
  111. <el-row :gutter="20">
  112. <el-col :span="8">
  113. <el-form-item label="未税单价" prop="price">
  114. <el-input v-model="formData.price" type="number" placeholder="请输入未税单价"></el-input>
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="8">
  118. <el-form-item label="税率(%)" prop="taxRate">
  119. <el-input v-model="formData.taxRate" type="number" placeholder="请输入税率"></el-input>
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="8">
  123. <el-form-item label="含税单价" prop="tax">
  124. <el-input v-model="formData.tax" type="number" placeholder="请输入含税单价"></el-input>
  125. </el-form-item>
  126. </el-col>
  127. </el-row>
  128. <el-row :gutter="20">
  129. <el-col :span="8">
  130. <el-form-item label="关税" prop="duty">
  131. <el-input v-model="formData.duty" type="number" placeholder="请输入关税"></el-input>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="8">
  135. <el-form-item label="采购周期(天)" prop="purchaseCycle">
  136. <el-input v-model="formData.purchaseCycle" type="number" placeholder="请输入采购周期"></el-input>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="模具费" prop="mouldFee">
  141. <el-input v-model="formData.mouldFee" type="number" placeholder="请输入模具费"></el-input>
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row :gutter="20">
  146. <el-col :span="8">
  147. <el-form-item label="附加费用" prop="additionalCost">
  148. <el-input v-model="formData.additionalCost" type="number" placeholder="请输入附加费用"></el-input>
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="8">
  152. <el-form-item label="运费" prop="freight">
  153. <el-input v-model="formData.freight" type="number" placeholder="请输入运费"></el-input>
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span="8">
  157. <el-form-item label="报价日期" prop="createdDate">
  158. <el-date-picker v-model="formData.createdDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"></el-date-picker>
  159. </el-form-item>
  160. </el-col>
  161. </el-row>
  162. <el-row :gutter="20">
  163. <el-col :span="24">
  164. <el-form-item label="备注" prop="remark">
  165. <el-input type="textarea" :rows="3" v-model="formData.remark" placeholder="请输入备注"></el-input>
  166. </el-form-item>
  167. </el-col>
  168. </el-row>
  169. </el-form>
  170. </div>
  171. <div slot="footer" class="dialog-footer" style="margin-top: 20px">
  172. <el-button type="primary" @click="submitData()">保存</el-button>
  173. <el-button @click="dialogVisible = false">取消</el-button>
  174. </div>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script>
  179. // 请根据实际API路径调整导入
  180. // import {
  181. // searchQuotationList,
  182. // createQuotation,
  183. // updateQuotation,
  184. // deleteQuotation
  185. // } from '@/api/quote/quotation'
  186. export default {
  187. name: 'QuotationRecord',
  188. data() {
  189. return {
  190. dataList: [],
  191. dataListLoading: false,
  192. searchData: {
  193. partNo: '',
  194. partDesc: '',
  195. remark1: '',
  196. height: '200',
  197. page: 1,
  198. limit: 1000
  199. },
  200. dialogVisible: false,
  201. dialogTitle: '新增报价记录',
  202. formData: {
  203. id: '',
  204. partNo: '',
  205. partDesc: '',
  206. umid: '',
  207. qty: '',
  208. remark1: '',
  209. materialCost: '',
  210. produceFee: '',
  211. surfaceFee: '',
  212. profit: '',
  213. price: '',
  214. taxRate: '',
  215. tax: '',
  216. duty: '',
  217. purchaseCycle: '',
  218. mouldFee: '',
  219. additionalCost: '',
  220. freight: '',
  221. createdDate: '',
  222. remark: '',
  223. createdBy: ''
  224. },
  225. formRules: {
  226. partNo: [{ required: true, message: '请输入物料编码', trigger: 'blur' }]
  227. },
  228. columnList: [
  229. { columnProp: 'partNo', headerAlign: 'center', align: 'left', columnLabel: '物料编码', columnWidth: 130, fixed: '', columnHidden: false, columnSortable: false },
  230. { columnProp: 'partDesc', headerAlign: 'center', align: 'left', columnLabel: '物料名称', columnWidth: 150, fixed: '', columnHidden: false, columnSortable: false },
  231. { columnProp: 'umid', headerAlign: 'center', align: 'center', columnLabel: '计量单位', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
  232. { columnProp: 'qty', headerAlign: 'center', align: 'right', columnLabel: '询价数量', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  233. { columnProp: 'remark1', headerAlign: 'center', align: 'center', columnLabel: '状态', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  234. { columnProp: 'materialCost', headerAlign: 'center', align: 'right', columnLabel: '材料费用', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  235. { columnProp: 'produceFee', headerAlign: 'center', align: 'right', columnLabel: '加工费', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  236. { columnProp: 'surfaceFee', headerAlign: 'center', align: 'right', columnLabel: '表面处理费', columnWidth: 110, fixed: '', columnHidden: false, columnSortable: false },
  237. { columnProp: 'profit', headerAlign: 'center', align: 'right', columnLabel: '利润', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
  238. { columnProp: 'price', headerAlign: 'center', align: 'right', columnLabel: '未税单价', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  239. { columnProp: 'taxRate', headerAlign: 'center', align: 'right', columnLabel: '税率', columnWidth: 80, fixed: '', columnHidden: false, columnSortable: false },
  240. { columnProp: 'tax', headerAlign: 'center', align: 'right', columnLabel: '含税单价', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  241. { columnProp: 'duty', headerAlign: 'center', align: 'right', columnLabel: '关税', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
  242. { columnProp: 'purchaseCycle', headerAlign: 'center', align: 'center', columnLabel: '采购周期', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  243. { columnProp: 'mouldFee', headerAlign: 'center', align: 'right', columnLabel: '模具费', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  244. { columnProp: 'additionalCost', headerAlign: 'center', align: 'right', columnLabel: '附加费用', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
  245. { columnProp: 'freight', headerAlign: 'center', align: 'right', columnLabel: '运费', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
  246. { columnProp: 'createdDate', headerAlign: 'center', align: 'center', columnLabel: '报价日期', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: true },
  247. { columnProp: 'remark', headerAlign: 'center', align: 'left', columnLabel: '备注', columnWidth: 180, fixed: '', columnHidden: false, columnSortable: false },
  248. { columnProp: 'createdBy', headerAlign: 'center', align: 'center', columnLabel: '最近更改人', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: false }
  249. ]
  250. }
  251. },
  252. methods: {
  253. // 初始化方法,供父组件调用
  254. init(inData) {
  255. if (inData) {
  256. this.searchData = { ...this.searchData, ...inData }
  257. }
  258. this.searchTable()
  259. },
  260. // 查询列表
  261. searchTable() {
  262. this.dataListLoading = true
  263. // TODO: 请替换为实际接口调用
  264. // searchQuotationList(this.searchData).then(({ data }) => {
  265. // if (data && data.code === 0) {
  266. // this.dataList = data.rows
  267. // } else {
  268. // this.dataList = []
  269. // }
  270. // this.dataListLoading = false
  271. // })
  272. // 模拟数据示例,实际使用时请删除
  273. setTimeout(() => {
  274. this.dataList = []
  275. this.dataListLoading = false
  276. }, 500)
  277. },
  278. // 新增
  279. addModal() {
  280. this.dialogTitle = '新增报价记录'
  281. this.formData = {
  282. id: '',
  283. partNo: '',
  284. partDesc: '',
  285. umid: '',
  286. qty: '',
  287. remark1: '',
  288. materialCost: '',
  289. produceFee: '',
  290. surfaceFee: '',
  291. profit: '',
  292. price: '',
  293. taxRate: '',
  294. tax: '',
  295. duty: '',
  296. purchaseCycle: '',
  297. mouldFee: '',
  298. additionalCost: '',
  299. freight: '',
  300. createdDate: '',
  301. remark: '',
  302. createdBy: (this.$store && this.$store.state && this.$store.state.user && this.$store.state.user.name) || ''
  303. }
  304. this.dialogVisible = true
  305. this.$nextTick(() => {
  306. if (this.$refs.formRef) {
  307. this.$refs.formRef.clearValidate()
  308. }
  309. })
  310. },
  311. // 编辑
  312. editModel(row) {
  313. this.dialogTitle = '编辑报价记录'
  314. this.formData = JSON.parse(JSON.stringify(row))
  315. this.dialogVisible = true
  316. this.$nextTick(() => {
  317. if (this.$refs.formRef) {
  318. this.$refs.formRef.clearValidate()
  319. }
  320. })
  321. },
  322. // 提交保存
  323. submitData() {
  324. this.$refs.formRef.validate((valid) => {
  325. if (!valid) return
  326. // TODO: 请替换为实际接口调用
  327. // const api = this.formData.id ? updateQuotation : createQuotation
  328. // api(this.formData).then(({ data }) => {
  329. // if (data && data.code === 0) {
  330. // this.$message.success(data.msg)
  331. // this.dialogVisible = false
  332. // this.searchTable()
  333. // } else {
  334. // this.$message.warning(data.msg)
  335. // }
  336. // })
  337. // 模拟保存,实际使用时请删除
  338. this.$message.success('保存成功')
  339. this.dialogVisible = false
  340. this.searchTable()
  341. })
  342. },
  343. // 删除
  344. deleteData(row) {
  345. this.$confirm('确认删除该条报价记录吗?', '提示', {
  346. confirmButtonText: '确认',
  347. cancelButtonText: '取消',
  348. type: 'warning'
  349. }).then(() => {
  350. // TODO: 请替换为实际接口调用
  351. // deleteQuotation(row.id).then(({ data }) => {
  352. // if (data.code === 0) {
  353. // this.$message.success('删除成功')
  354. // this.searchTable()
  355. // }
  356. // })
  357. // 模拟删除,实际使用时请删除
  358. this.$message.success('删除成功')
  359. this.searchTable()
  360. }).catch(() => {})
  361. }
  362. }
  363. }
  364. </script>
  365. <style scoped lang="scss">
  366. .dialog-content {
  367. width: 100%;
  368. max-height: 60vh;
  369. overflow-y: auto;
  370. padding-right: 10px;
  371. }
  372. .customer-css {
  373. padding: 10px;
  374. }
  375. </style>