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.

428 lines
14 KiB

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