plm前端
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.

409 lines
13 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <script>
  2. import {
  3. getPriceCheckPropertiesList,
  4. removePriceCheckPropertiesItem,
  5. savePriceCheckPropertiesItem,
  6. searchPriceCheckPropertiesItemList,
  7. searchPriceCheckPropertiesList,
  8. updatePriceCheckPropertiesList,
  9. } from "../../../api/quotation/priceCheckProperties";
  10. import TransferTable from "../common/transferTable.vue";
  11. export default {
  12. name: "priceCheckProperties",
  13. components: {TransferTable},
  14. props:{
  15. dataList:{
  16. type: Array,
  17. default: ()=>[],
  18. },
  19. quotationNo:{
  20. type:String,
  21. },
  22. columnList:{
  23. type: Array,
  24. default: ()=>[],
  25. },
  26. height:{
  27. type:[Number,String],
  28. default:300
  29. },
  30. disabled:{
  31. type:Boolean,
  32. default:false
  33. }
  34. },
  35. model:{
  36. prop:"dataList",
  37. event:"change"
  38. },
  39. data(){
  40. return{
  41. attributeSaveDialog:false,
  42. loading:false,
  43. attributeDialog:true,
  44. copyAttributeList:[],
  45. productColumnList: [
  46. {
  47. userId: this.$store.state.user.name,
  48. functionId: 100002001,
  49. serialNumber: '100002001TableItemNo',
  50. tableId: "100002001Table",
  51. tableName: "属性表",
  52. columnProp: 'itemNo',
  53. headerAlign: "center",
  54. align: "left",
  55. columnLabel: '属性编码',
  56. columnHidden: false,
  57. columnImage: false,
  58. columnSortable: false,
  59. sortLv: 0,
  60. status: true,
  61. fixed: '',
  62. },{
  63. userId: this.$store.state.user.name,
  64. functionId: 100002001,
  65. serialNumber: '100002001TableItemDesc',
  66. tableId: "100002001Table",
  67. tableName: "属性表",
  68. columnProp: 'itemDesc',
  69. headerAlign: "center",
  70. align: "left",
  71. columnLabel: '属性名称',
  72. columnHidden: false,
  73. columnImage: false,
  74. columnSortable: false,
  75. sortLv: 0,
  76. status: true,
  77. fixed: '',
  78. },
  79. {
  80. userId: this.$store.state.user.name,
  81. functionId: 100002001,
  82. serialNumber: '100002001TableValueType',
  83. tableId: "100002001Table",
  84. tableName: "属性表",
  85. columnProp: 'valueType',
  86. headerAlign: "center",
  87. align: "center",
  88. columnLabel: '值类型',
  89. columnHidden: false,
  90. columnImage: false,
  91. columnSortable: false,
  92. sortLv: 0,
  93. status: true,
  94. fixed: '',
  95. columnWidth:80,
  96. },
  97. // {
  98. // userId: this.$store.state.user.name,
  99. // functionId: 100002001,
  100. // serialNumber: '100002001TableMinValue',
  101. // tableId: "100002001Table",
  102. // tableName: "属性表",
  103. // columnProp: 'minValue',
  104. // headerAlign: "center",
  105. // align: "center",
  106. // columnLabel: '最小值',
  107. // columnHidden: false,
  108. // columnImage: false,
  109. // columnSortable: false,
  110. // sortLv: 0,
  111. // status: true,
  112. // fixed: '',
  113. // columnWidth:80,
  114. // },{
  115. // userId: this.$store.state.user.name,
  116. // functionId: 100002001,
  117. // serialNumber: '100002001TableMaxValue',
  118. // tableId: "100002001Table",
  119. // tableName: "属性表",
  120. // columnProp: 'maxValue',
  121. // headerAlign: "center",
  122. // align: "center",
  123. // columnLabel: '最大值',
  124. // columnHidden: false,
  125. // columnImage: false,
  126. // columnSortable: false,
  127. // sortLv: 0,
  128. // status: true,
  129. // fixed: '',
  130. // columnWidth:80,
  131. // },
  132. {
  133. userId: this.$store.state.user.name,
  134. functionId: 100002001,
  135. serialNumber: '100002001TableMaxValue',
  136. tableId: "100002001Table",
  137. tableName: "属性表",
  138. columnProp: 'textValue',
  139. headerAlign: "center",
  140. align: "left",
  141. columnLabel: '属性值',
  142. columnHidden: false,
  143. columnImage: false,
  144. columnSortable: false,
  145. sortLv: 0,
  146. status: true,
  147. fixed: '',
  148. columnWidth:120,
  149. },
  150. // {
  151. // userId: this.$store.state.user.name,
  152. // functionId: 100002001,
  153. // serialNumber: '100002001TableMinValue',
  154. // tableId: "100002001Table",
  155. // tableName: "属性表",
  156. // columnProp: 'numValue',
  157. // headerAlign: "center",
  158. // align: "right",
  159. // columnLabel: '数字值',
  160. // columnHidden: false,
  161. // columnImage: false,
  162. // columnSortable: false,
  163. // sortLv: 0,
  164. // status: true,
  165. // fixed: '',
  166. // columnWidth:120,
  167. // },
  168. // {
  169. // userId: this.$store.state.user.name,
  170. // functionId: 100002001,
  171. // serialNumber: '100002001TableDefaultValue',
  172. // tableId: "100002001Table",
  173. // tableName: "属性表",
  174. // columnProp: 'defaultValue',
  175. // headerAlign: "center",
  176. // align: "right",
  177. // columnLabel: '参照值',
  178. // columnHidden: false,
  179. // columnImage: false,
  180. // columnSortable: false,
  181. // sortLv: 0,
  182. // status: true,
  183. // fixed: '',
  184. // },
  185. ],
  186. searchDataList:[],
  187. }
  188. },
  189. methods:{
  190. savePriceCheckPropertiesItem(params){
  191. let i = 0;
  192. let arr = params.searchTableList.map(item=>{
  193. item.quotationNo = this.quotationNo;
  194. item.seqNo = i++;
  195. return item
  196. })
  197. savePriceCheckPropertiesItem(arr).then(({data})=>{
  198. if (data && data.code === 0){
  199. this.$message.success(data.msg);
  200. this.getPriceCheckProperties(params);
  201. }else {
  202. this.$message.warning(data.msg);
  203. }
  204. }).catch((error)=>{
  205. this.$message.error(error)
  206. })
  207. },
  208. removePriceCheckPropertiesItem(params){
  209. removePriceCheckPropertiesItem(params.dataTableList).then(({data})=>{
  210. if (data && data.code === 0){
  211. this.$message.success(data.msg);
  212. this.getPriceCheckProperties(params);
  213. }else {
  214. this.$message.warning(data.msg);
  215. }
  216. }).catch((error)=>{
  217. this.$message.error(error)
  218. })
  219. },
  220. searchPriceCheckPropertiesItemList(value){
  221. let params= JSON.parse(JSON.stringify(value))
  222. params.site=this.$store.state.user.site;
  223. params.list = this.dataList;
  224. if (!this.attributeSaveDialog){
  225. this.searchDataList = [];
  226. }
  227. searchPriceCheckPropertiesItemList(params).then(({data})=>{
  228. if (data && data.code === 0){
  229. this.searchDataList = data.rows;
  230. this.attributeSaveDialog = true;
  231. }else {
  232. this.$message.warning(data.msg)
  233. }
  234. }).catch((error)=>{
  235. this.$message.error(error)
  236. })
  237. },
  238. getPriceCheckProperties(searchData){
  239. let params = {
  240. site:this.$store.state.user.site,
  241. quotationNo: this.quotationNo
  242. }
  243. getPriceCheckPropertiesList(params).then(({data})=>{
  244. if (data && data.code === 0){
  245. this.$emit("change",data.rows)
  246. if (searchData){
  247. this.$nextTick(()=>{
  248. this.searchPriceCheckPropertiesItemList(searchData);
  249. })
  250. }
  251. }else {
  252. this.$message.warning(data.msg)
  253. }
  254. }).catch((error)=>{
  255. this.$message.error(error)
  256. })
  257. },
  258. updatePriceCheckPropertiesList(){
  259. updatePriceCheckPropertiesList(this.copyAttributeList).then(({data})=>{
  260. if (data && data.code === 0){
  261. this.$message.success(data.msg);
  262. this.$emit("change",this.copyAttributeList)
  263. this.getPriceCheckProperties();
  264. this.attributeDialog = true;
  265. }else {
  266. this.$message.warning(data.msg);
  267. }
  268. }).catch((error)=>{
  269. this.$message.error(error)
  270. })
  271. },
  272. searchPriceCheckPropertiesList(){
  273. let params = {
  274. site:this.$store.state.user.site,
  275. quotationNo: this.quotationNo
  276. }
  277. this.loading = true
  278. searchPriceCheckPropertiesList(params).then(({data})=>{
  279. if (data && data.code === 0){
  280. this.getPriceCheckProperties();
  281. }else {
  282. this.$message.warning(data.msg)
  283. }
  284. this.loading = false
  285. }).catch((error)=>{
  286. this.loading = false
  287. this.$message.error(error)
  288. })
  289. },
  290. saveClick(){
  291. if (this.attributeDialog){
  292. this.copyAttributeList = JSON.parse(JSON.stringify(this.dataList))
  293. this.attributeDialog = false;
  294. }else {
  295. this.updatePriceCheckPropertiesList();
  296. }
  297. },
  298. saveBtnClick(){
  299. if (!this.attributeDialog) {
  300. this.$message.warning('请保存更改!')
  301. return
  302. }
  303. this.searchPriceCheckPropertiesItemList({})
  304. },
  305. },
  306. }
  307. </script>
  308. <template>
  309. <div>
  310. <div style="margin-top: 5px">
  311. <el-button type="primary" :loading="loading" v-if="quotationNo && !disabled" @click="saveBtnClick">新增</el-button>
  312. <el-button type="primary" @click="saveClick" v-if="quotationNo && !disabled">{{ attributeDialog?'编辑':'保存' }}</el-button>
  313. </div>
  314. <div class="rq" v-if="attributeDialog">
  315. <el-table
  316. :height="height"
  317. :data="dataList"
  318. border
  319. style="width: 100%;margin-top: 5px">
  320. <el-table-column
  321. v-for="(item,index) in productColumnList" :key="index"
  322. :sortable="item.columnSortable"
  323. :prop="item.columnProp"
  324. :header-align="item.headerAlign"
  325. :show-overflow-tooltip="item.showOverflowTooltip"
  326. :align="item.align"
  327. :fixed="item.fixed===''?false:item.fixed"
  328. :min-width="item.columnWidth"
  329. :label="item.columnLabel">
  330. <template slot-scope="scope">
  331. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  332. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  333. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  334. </div>
  335. <div v-else>
  336. {{scope.row.textValue?scope.row.textValue:scope.row.numValue}}
  337. </div>
  338. </template>
  339. </el-table-column>
  340. </el-table>
  341. </div>
  342. <div class="rq" v-else>
  343. <el-table
  344. :height="height"
  345. :data="copyAttributeList"
  346. border
  347. style="width: 100%;margin-top: 5px">
  348. <el-table-column
  349. v-for="(item,index) in productColumnList" :key="index"
  350. :sortable="item.columnSortable"
  351. :prop="item.columnProp"
  352. :header-align="item.headerAlign"
  353. :show-overflow-tooltip="item.showOverflowTooltip"
  354. :align="item.align"
  355. :fixed="item.fixed===''?false:item.fixed"
  356. :min-width="item.columnWidth"
  357. :label="item.columnLabel">
  358. <template slot-scope="scope">
  359. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  360. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  361. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  362. </div>
  363. <div v-else>
  364. <div v-if="scope.row.valueChooseFlag !== 'Y'">
  365. <el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueType === '数字'" :controls="false"></el-input-number>
  366. <el-input v-model="scope.row.textValue" v-else></el-input>
  367. </div>
  368. <div v-else>
  369. <el-select style="width: 100%;" v-if="scope.row.valueType === '文本'" v-model="scope.row.textValue">
  370. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.list" :key="key"></el-option>
  371. </el-select>
  372. <el-select style="width: 100%;" v-else v-model="scope.row.numValue">
  373. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.list" :key="key"></el-option>
  374. </el-select>
  375. </div>
  376. </div>
  377. </template>
  378. </el-table-column>
  379. </el-table>
  380. </div>
  381. <el-dialog title="属性项目" v-drag :visible.sync="attributeSaveDialog" append-to-body>
  382. <transfer-table v-if="attributeSaveDialog"
  383. v-model="dataList"
  384. :data-list="searchDataList"
  385. @add="savePriceCheckPropertiesItem"
  386. @delete="removePriceCheckPropertiesItem"
  387. @search="searchPriceCheckPropertiesItemList"></transfer-table>
  388. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  389. <el-button type="primary" @click="attributeSaveDialog = false">关闭</el-button>
  390. </el-footer>
  391. </el-dialog>
  392. </div>
  393. </template>
  394. <style scoped>
  395. .el-input-number /deep/ .el-input__inner {
  396. text-align: right;
  397. padding-right: 5px !important;
  398. }
  399. /deep/ .el-input .el-input--medium{
  400. line-height: 20px;
  401. }
  402. /deep/ .el-input-number .el-input--medium{
  403. line-height: 20px;
  404. }
  405. </style>