CostModelXmxqClList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <!-- <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="物料编码">
  9. <a-input placeholder="请输入物料编码" v-model="queryParam.wlbm"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="规格型号">
  14. <a-input placeholder="请输入规格型号" v-model="queryParam.ggxh"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <template v-if="toggleSearchStatus">
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="质量等级">
  20. <a-input placeholder="请输入质量等级" v-model="queryParam.zlLevel"></a-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <a-form-item label="批次">
  25. <a-input placeholder="请输入批次" v-model="queryParam.pici"></a-input>
  26. </a-form-item>
  27. </a-col>
  28. </template>
  29. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  30. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  31. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  32. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  33. <a @click="handleToggleSearch" style="margin-left: 8px">
  34. {{ toggleSearchStatus ? '收起' : '展开' }}
  35. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  36. </a>
  37. </span>
  38. </a-col>
  39. </a-row>
  40. </a-form>
  41. </div> -->
  42. <!-- 查询区域-END -->
  43. <!-- 操作按钮区域 -->
  44. <!-- <div class="table-operator">
  45. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  46. <a-button type="primary" icon="download" @click="handleExportXls('项目材料导入详情')">导出</a-button>
  47. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  48. <a-button type="primary" icon="import">导入</a-button>
  49. </a-upload> -->
  50. <!-- 高级查询区域 -->
  51. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  52. <a-dropdown v-if="selectedRowKeys.length > 0">
  53. <a-menu slot="overlay">
  54. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  55. </a-menu>
  56. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  57. </a-dropdown>
  58. </div> -->
  59. <!-- table区域-begin -->
  60. <div>
  61. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  62. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  63. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  64. </div> -->
  65. <a-table
  66. ref="table"
  67. size="middle"
  68. :scroll="{x:true}"
  69. bordered
  70. rowKey="id"
  71. :columns="columns"
  72. :dataSource="dataSource"
  73. :pagination="ipagination"
  74. :loading="loading"
  75. class="j-table-force-nowrap"
  76. @change="handleTableChange">
  77. <template slot="htmlSlot" slot-scope="text">
  78. <div v-html="text"></div>
  79. </template>
  80. <template slot="imgSlot" slot-scope="text,record">
  81. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  82. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  83. </template>
  84. <template slot="fileSlot" slot-scope="text">
  85. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  86. <a-button
  87. v-else
  88. :ghost="true"
  89. type="primary"
  90. icon="download"
  91. size="small"
  92. @click="downloadFile(text)">
  93. 下载
  94. </a-button>
  95. </template>
  96. <!-- <span slot="action" slot-scope="text, record">
  97. <a @click="handleEdit(record)">编辑</a>
  98. <a-divider type="vertical" />
  99. <a-dropdown>
  100. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  101. <a-menu slot="overlay">
  102. <a-menu-item>
  103. <a @click="handleDetail(record)">详情</a>
  104. </a-menu-item>
  105. <a-menu-item>
  106. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  107. <a>删除</a>
  108. </a-popconfirm>
  109. </a-menu-item>
  110. </a-menu>
  111. </a-dropdown>
  112. </span> -->
  113. </a-table>
  114. </div>
  115. <!-- <cost-model-xmxq-cl-modal ref="modalForm" @ok="modalFormOk"></cost-model-xmxq-cl-modal> -->
  116. </a-card>
  117. </template>
  118. <script>
  119. import '@/assets/less/TableExpand.less'
  120. import { mixinDevice } from '@/utils/mixin'
  121. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  122. // import CostModelXmxqClModal from './modules/CostModelXmxqClModal'
  123. import { getAction } from '@/api/manage'
  124. export default {
  125. name: 'CostModelXmxqClList',
  126. mixins:[JeecgListMixin, mixinDevice],
  127. components: {
  128. // CostModelXmxqClModal
  129. },
  130. props: ['id', 'type'],
  131. data () {
  132. return {
  133. description: '项目材料导入详情管理页面',
  134. // 表头
  135. columns: [
  136. {
  137. title: '#',
  138. dataIndex: '',
  139. key:'rowIndex',
  140. width:60,
  141. align:"center",
  142. customRender:function (t,r,index) {
  143. return parseInt(index)+1;
  144. }
  145. },
  146. {
  147. title:'项目ID',
  148. align:"center",
  149. dataIndex: 'xiangmuId'
  150. },
  151. {
  152. title:'项目名称',
  153. align:"center",
  154. dataIndex: 'xiangmuName'
  155. },
  156. {
  157. title:'物料编码',
  158. align:"center",
  159. dataIndex: 'wlbm'
  160. },
  161. {
  162. title:'规格型号',
  163. align:"center",
  164. dataIndex: 'ggxh'
  165. },
  166. {
  167. title:'质量等级',
  168. align:"center",
  169. dataIndex: 'zlLevel'
  170. },
  171. {
  172. title:'批次',
  173. align:"center",
  174. dataIndex: 'pici'
  175. },
  176. {
  177. title:'采购日期',
  178. align:"center",
  179. dataIndex: 'caigouTime',
  180. customRender:function (text) {
  181. return !text?"":(text.length>10?text.substr(0,10):text)
  182. }
  183. },
  184. {
  185. title:'数量',
  186. align:"center",
  187. dataIndex: 'number'
  188. },
  189. // {
  190. // title:'单价(最大值)',
  191. // align:"center",
  192. // dataIndex: 'maxDanjia'
  193. // },
  194. // {
  195. // title:'单价(最小值)',
  196. // align:"center",
  197. // dataIndex: 'minDanjia'
  198. // },
  199. // {
  200. // title:'单价(平均值)',
  201. // align:"center",
  202. // dataIndex: 'aveDanjia'
  203. // },
  204. // {
  205. // title:'单价(近期值)',
  206. // align:"center",
  207. // dataIndex: 'recentDanjia'
  208. // },
  209. // {
  210. // title:'价格(最大值)',
  211. // align:"center",
  212. // dataIndex: 'maxPrice'
  213. // },
  214. // {
  215. // title:'价格(最小值)',
  216. // align:"center",
  217. // dataIndex: 'minPrice'
  218. // },
  219. // {
  220. // title:'价格(平均值)',
  221. // align:"center",
  222. // dataIndex: 'avePrice'
  223. // },
  224. // {
  225. // title:'价格(近期值)',
  226. // align:"center",
  227. // dataIndex: 'recentPrice'
  228. // },
  229. // {
  230. // title:'单价',
  231. // align:"center",
  232. // dataIndex: 'danjia'
  233. // },
  234. // {
  235. // title:'数量',
  236. // align:"center",
  237. // dataIndex: 'number'
  238. // },
  239. // {
  240. // title:'价格(单价*数量)',
  241. // align:"center",
  242. // dataIndex: 'price'
  243. // },
  244. // {
  245. // title:'材料费类型',
  246. // align:"center",
  247. // dataIndex: 'clfType'
  248. // },
  249. // {
  250. // title: '操作',
  251. // dataIndex: 'action',
  252. // align:"center",
  253. // fixed:"right",
  254. // width:147,
  255. // scopedSlots: { customRender: 'action' }
  256. // }
  257. ],
  258. url: {
  259. list: "/costModelXmxqCl/costModelXmxqCl/list",
  260. delete: "/costModelXmxqCl/costModelXmxqCl/delete",
  261. deleteBatch: "/costModelXmxqCl/costModelXmxqCl/deleteBatch",
  262. exportXlsUrl: "/costModelXmxqCl/costModelXmxqCl/exportXls",
  263. importExcelUrl: "costModelXmxqCl/costModelXmxqCl/importExcel",
  264. },
  265. dictOptions:{},
  266. superFieldList:[],
  267. }
  268. },
  269. created() {
  270. this.getSuperFieldList();
  271. this.setColumn()
  272. },
  273. computed: {
  274. importExcelUrl: function(){
  275. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  276. },
  277. },
  278. methods: {
  279. // 获取页面列表
  280. loadData(arg) {
  281. this.queryParam.xiangmuId = this.id
  282. if(!this.url.list){
  283. this.$message.error("请设置url.list属性!")
  284. return
  285. }
  286. //加载数据 若传入参数1则加载第一页的内容
  287. if (arg === 1) {
  288. this.ipagination.current = 1;
  289. }
  290. var params = this.getQueryParams();//查询条件
  291. this.loading = true;
  292. getAction(this.url.list, params).then((res) => {
  293. if (res.success) {
  294. //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  295. this.dataSource = res.result.records||res.result;
  296. if(res.result.total)
  297. {
  298. this.ipagination.total = res.result.total;
  299. }else{
  300. this.ipagination.total = 0;
  301. }
  302. //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
  303. }else{
  304. this.$message.warning(res.message)
  305. }
  306. }).finally(() => {
  307. this.loading = false
  308. })
  309. },
  310. setColumn(){
  311. if (this.type == 'max') {
  312. this.columns.push(
  313. { title:'单价(最大值)', align:"center", dataIndex: 'maxDanjia', fixed: 'right', width: 120 },
  314. { title:'价格(最大值)', align:"center", dataIndex: 'maxPrice', fixed: 'right', width: 120 }
  315. )
  316. }
  317. if (this.type == 'min') {
  318. this.columns.push(
  319. { title:'单价(最小值)', align:"center", dataIndex: 'minDanjia', fixed: 'right', width: 120 },
  320. { title:'价格(最小值)', align:"center", dataIndex: 'minPrice', fixed: 'right', width: 120 }
  321. )
  322. }
  323. if (this.type == 'ave') {
  324. this.columns.push(
  325. { title:'单价(平均值)', align:"center", dataIndex: 'aveDanjia', fixed: 'right', width: 120 },
  326. { title:'价格(平均值)', align:"center", dataIndex: 'avePrice', fixed: 'right', width: 120 }
  327. )
  328. }
  329. if (this.type == 'recent') {
  330. this.columns.push(
  331. { title:'单价(近期值)', align:"center", dataIndex: 'recentDanjia', fixed: 'right', width: 120 },
  332. { title:'价格(近期值)', align:"center", dataIndex: 'recentPrice', fixed: 'right', width: 120 }
  333. )
  334. }
  335. },
  336. initDictConfig(){
  337. },
  338. getSuperFieldList(){
  339. let fieldList=[];
  340. fieldList.push({type:'string',value:'xiangmuId',text:'项目ID',dictCode:''})
  341. fieldList.push({type:'string',value:'xiangmuName',text:'项目名称',dictCode:''})
  342. fieldList.push({type:'string',value:'wlbm',text:'物料编码',dictCode:''})
  343. fieldList.push({type:'string',value:'ggxh',text:'规格型号',dictCode:''})
  344. fieldList.push({type:'string',value:'zlLevel',text:'质量等级',dictCode:''})
  345. fieldList.push({type:'string',value:'pici',text:'批次',dictCode:''})
  346. fieldList.push({type:'date',value:'caigouTime',text:'采购日期'})
  347. fieldList.push({type:'string',value:'danjia',text:'单价',dictCode:''})
  348. fieldList.push({type:'string',value:'number',text:'数量',dictCode:''})
  349. fieldList.push({type:'string',value:'price',text:'价格(单价*数量)',dictCode:''})
  350. fieldList.push({type:'string',value:'clfType',text:'材料费类型',dictCode:''})
  351. this.superFieldList = fieldList
  352. },
  353. }
  354. }
  355. </script>
  356. <style scoped>
  357. @import '~@assets/less/common.less';
  358. </style>