Commit 13639926764b2998e191873c46c803ddd4ee6233

Authored by gesilong
2 parents 8c1172c2 b67d3ac9

Merge branch 'cjerp-2.0-fix' into test_cjerp

... ... @@ -56,3 +56,12 @@ export function supplierQuotationProjectUpdateStatusApi(params) {
56 56 params
57 57 })
58 58 }
  59 +
  60 +// 获取供应商部门列表
  61 +export function getSupplierDeptApi() {
  62 + return request({
  63 + url: '/system/dept/getChildDeptsByCode',
  64 + method: 'get',
  65 + params: { code: 'GYSBM' }
  66 + })
  67 +}
... ...
... ... @@ -12,6 +12,14 @@
12 12 </template>
13 13 </uni-list-item>
14 14
  15 + <!-- 供应商部门 -->
  16 + <uni-list-item class="select-item" :class="form.supplierDepartmentId ? 'is-filled' : 'is-empty'" clickable
  17 + @click="openSupplierDeptSheet" :rightText="form.supplierDepartmentName || '请选择供应商部门'" showArrow>
  18 + <template v-slot:body>
  19 + <view class="item-title"><text>供应商部门</text></view>
  20 + </template>
  21 + </uni-list-item>
  22 +
15 23 <!-- 品种 -->
16 24 <uni-list-item class="select-item" :class="form.productId ? 'is-filled' : 'is-empty'" clickable
17 25 @click="openProductSheet" :rightText="form.productName || '请选择品种'" showArrow>
... ... @@ -92,7 +100,7 @@
92 100
93 101 <script>
94 102 import SingleSelectSheet from '@/components/single-select/index.vue'
95   -import { supplierQuotationProjectSaveApi } from '@/api/procure-manage/supplierQuotationProject.js'
  103 +import { supplierQuotationProjectSaveApi, getSupplierDeptApi } from '@/api/procure-manage/supplierQuotationProject.js'
96 104 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
97 105 import { getDicByCodes } from '@/utils/dic.js'
98 106
... ... @@ -103,6 +111,8 @@ export default {
103 111 return {
104 112 form: {
105 113 name: '',
  114 + supplierDepartmentId: '',
  115 + supplierDepartmentName: '',
106 116 productId: '',
107 117 productName: '',
108 118 quantity: '',
... ... @@ -113,6 +123,7 @@ export default {
113 123 purchaseRule: ''
114 124 },
115 125 productList: [],
  126 + supplierDeptOptions: [],
116 127 dictData: {},
117 128 sheet: {
118 129 visible: false,
... ... @@ -136,6 +147,7 @@ export default {
136 147 onLoad() {
137 148 this.loadDictData()
138 149 this.loadProducts()
  150 + this.loadSupplierDeptList()
139 151 },
140 152 methods: {
141 153 async loadDictData() {
... ... @@ -150,6 +162,19 @@ export default {
150 162 const data = this.dictData[dictCode]
151 163 return (data && data.data) ? data.data : (Array.isArray(data) ? data : [])
152 164 },
  165 + async loadSupplierDeptList() {
  166 + try {
  167 + const res = await getSupplierDeptApi()
  168 + const raw = res && res.data != null ? res.data : []
  169 + const list = Array.isArray(raw) ? raw : []
  170 + this.supplierDeptOptions = list.map(it => ({
  171 + label: it.deptName || it.name || '',
  172 + value: it.deptId || it.id || ''
  173 + }))
  174 + } catch (e) {
  175 + this.supplierDeptOptions = []
  176 + }
  177 + },
153 178 async loadProducts() {
154 179 try {
155 180 const res = await breedRelationshipQueryApi({ pageIndex: 1, pageSize: 9999 })
... ... @@ -181,6 +206,19 @@ export default {
181 206 isDict: false
182 207 }
183 208 },
  209 + openSupplierDeptSheet() {
  210 + const opts = (this.supplierDeptOptions || []).map(p => ({ label: p.label, value: p.value }))
  211 + const cur = this.form.supplierDepartmentId
  212 + const match = opts.find(o => String(o.value) === String(cur))
  213 + this.sheet = {
  214 + visible: true,
  215 + title: '请选择供应商部门',
  216 + options: opts,
  217 + value: match ? match.value : '',
  218 + field: 'supplierDepartmentId',
  219 + isDict: false
  220 + }
  221 + },
184 222 openDictSheet(field, dictCode, title) {
185 223 const raw = this.getDictOptions(dictCode) || []
186 224 const opts = raw.map(o => ({ label: o.name || o.label || '', value: o.code != null ? o.code : (o.value != null ? o.value : '') }))
... ... @@ -203,6 +241,10 @@ export default {
203 241 const m = (this.productList || []).find(p => String(p.value) === String(value))
204 242 this.form.productName = m ? m.label : ''
205 243 }
  244 + if (field === 'supplierDepartmentId') {
  245 + const m = (this.supplierDeptOptions || []).find(p => String(p.value) === String(value))
  246 + this.form.supplierDepartmentName = m ? m.label : ''
  247 + }
206 248 // 切换项目类型时,若不再是集中开标则清空开标时间
207 249 if (field === 'projectType' && !this.isConcentratedBid) {
208 250 this.form.bidTime = ''
... ... @@ -281,6 +323,8 @@ export default {
281 323 }
282 324 const payload = clean({
283 325 name: this.form.name,
  326 + supplierDepartmentId: this.form.supplierDepartmentId,
  327 + supplierDepartmentName: this.form.supplierDepartmentName,
284 328 productId: this.form.productId,
285 329 productName: this.form.productName,
286 330 quantity: this.form.quantity,
... ...
... ... @@ -5,6 +5,7 @@
5 5 <view class="section">
6 6 <text class="row company">{{ safeText(form.name) }}</text>
7 7 <view class="row"><text class="label">编号</text><text class="value">{{ safeText(form.code) }}</text></view>
  8 + <view class="row"><text class="label">供应商部门</text><text class="value">{{ safeText(form.supplierDepartmentName) }}</text></view>
8 9 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(form.productName) }}</text></view>
9 10 <view class="row"><text class="label">数量(吨)</text><text class="value">{{ safeText(form.quantity) }}</text></view>
10 11 <view class="row"><text class="label">开始时间</text><text class="value">{{ formatDateTimeMinute(form.startTime) }}</text></view>
... ...
... ... @@ -12,6 +12,14 @@
12 12 </template>
13 13 </uni-list-item>
14 14
  15 + <!-- 供应商部门 -->
  16 + <uni-list-item class="select-item" :class="form.supplierDepartmentId ? 'is-filled' : 'is-empty'" clickable
  17 + @click="openSupplierDeptSheet" :rightText="form.supplierDepartmentName || '请选择供应商部门'" showArrow>
  18 + <template v-slot:body>
  19 + <view class="item-title"><text>供应商部门</text></view>
  20 + </template>
  21 + </uni-list-item>
  22 +
15 23 <!-- 品种 -->
16 24 <uni-list-item class="select-item" :class="form.productId ? 'is-filled' : 'is-empty'" clickable
17 25 @click="openProductSheet" :rightText="form.productName || '请选择品种'" showArrow>
... ... @@ -92,7 +100,7 @@
92 100
93 101 <script>
94 102 import SingleSelectSheet from '@/components/single-select/index.vue'
95   -import { supplierQuotationProjectDetailApi, supplierQuotationProjectUpdateApi } from '@/api/procure-manage/supplierQuotationProject.js'
  103 +import { supplierQuotationProjectDetailApi, supplierQuotationProjectUpdateApi, getSupplierDeptApi } from '@/api/procure-manage/supplierQuotationProject.js'
96 104 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
97 105 import { getDicByCodes } from '@/utils/dic.js'
98 106
... ... @@ -106,6 +114,8 @@ export default {
106 114 id: '',
107 115 name: '',
108 116 code: '',
  117 + supplierDepartmentId: '',
  118 + supplierDepartmentName: '',
109 119 productId: '',
110 120 productName: '',
111 121 quantity: '',
... ... @@ -116,6 +126,7 @@ export default {
116 126 purchaseRule: ''
117 127 },
118 128 productList: [],
  129 + supplierDeptOptions: [],
119 130 dictData: {},
120 131 sheet: {
121 132 visible: false,
... ... @@ -139,7 +150,9 @@ export default {
139 150 this.id = (options && options.id) ? options.id : ''
140 151 this.loadDictData().then(() => {
141 152 this.loadProducts().then(() => {
142   - if (this.id) this.loadDetail()
  153 + this.loadSupplierDeptList().then(() => {
  154 + if (this.id) this.loadDetail()
  155 + })
143 156 })
144 157 })
145 158 },
... ... @@ -156,6 +169,19 @@ export default {
156 169 const data = this.dictData[dictCode]
157 170 return (data && data.data) ? data.data : (Array.isArray(data) ? data : [])
158 171 },
  172 + async loadSupplierDeptList() {
  173 + try {
  174 + const res = await getSupplierDeptApi()
  175 + const raw = res && res.data != null ? res.data : []
  176 + const list = Array.isArray(raw) ? raw : []
  177 + this.supplierDeptOptions = list.map(it => ({
  178 + label: it.deptName || it.name || '',
  179 + value: it.deptId || it.id || ''
  180 + }))
  181 + } catch (e) {
  182 + this.supplierDeptOptions = []
  183 + }
  184 + },
159 185 async loadProducts() {
160 186 try {
161 187 const res = await breedRelationshipQueryApi({ pageIndex: 1, pageSize: 9999 })
... ... @@ -187,6 +213,19 @@ export default {
187 213 isDict: false
188 214 }
189 215 },
  216 + openSupplierDeptSheet() {
  217 + const opts = (this.supplierDeptOptions || []).map(p => ({ label: p.label, value: p.value }))
  218 + const cur = this.form.supplierDepartmentId
  219 + const match = opts.find(o => String(o.value) === String(cur))
  220 + this.sheet = {
  221 + visible: true,
  222 + title: '请选择供应商部门',
  223 + options: opts,
  224 + value: match ? match.value : '',
  225 + field: 'supplierDepartmentId',
  226 + isDict: false
  227 + }
  228 + },
190 229 openDictSheet(field, dictCode, title) {
191 230 const raw = this.getDictOptions(dictCode) || []
192 231 const opts = raw.map(o => ({ label: o.name || o.label || '', value: o.code != null ? o.code : (o.value != null ? o.value : '') }))
... ... @@ -209,6 +248,10 @@ export default {
209 248 const m = (this.productList || []).find(p => String(p.value) === String(value))
210 249 this.form.productName = m ? m.label : ''
211 250 }
  251 + if (field === 'supplierDepartmentId') {
  252 + const m = (this.supplierDeptOptions || []).find(p => String(p.value) === String(value))
  253 + this.form.supplierDepartmentName = m ? m.label : ''
  254 + }
212 255 if (field === 'projectType' && !this.isConcentratedBid) {
213 256 this.form.bidTime = ''
214 257 }
... ... @@ -297,6 +340,8 @@ export default {
297 340 const payload = clean({
298 341 id: this.form.id,
299 342 name: this.form.name,
  343 + supplierDepartmentId: this.form.supplierDepartmentId,
  344 + supplierDepartmentName: this.form.supplierDepartmentName,
300 345 productId: this.form.productId,
301 346 productName: this.form.productName,
302 347 quantity: this.form.quantity,
... ...